diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 2792996e027f..f840b0559bd3 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -57,31 +57,6 @@ ieee80211_iface_combination mwifiex_iface_comb_ap_sta_drcs = {
 	.beacon_int_infra_match = true,
 };
 
-struct mwifiex_ieee80211_mgmt {
-	__le16 frame_control;
-	__le16 duration;
-	u8 da[ETH_ALEN];
-	u8 sa[ETH_ALEN];
-	u8 bssid[ETH_ALEN];
-	__le16 seq_ctrl;
-	u8 addr4[ETH_ALEN];
-	union {
-		struct {
-			__le16 auth_alg;
-			__le16 auth_transaction;
-			__le16 status_code;
-			/* possibly followed by Challenge text */
-			u8 variable[];
-		} __packed auth;
-		struct {
-			__le16 capab_info;
-			__le16 listen_interval;
-			/* followed by SSID and Supported rates */
-			u8 variable[];
-		} __packed assoc_req;
-	} u;
-} __pack;
-
 /*
  * This function maps the nl802.11 channel type into driver channel type.
  *
@@ -551,7 +526,7 @@ mwifiex_cfg80211_set_default_mgmt_key(struct wiphy *wiphy,
 
 	wiphy_dbg(wiphy, "set default mgmt key, key index=%d\n", key_index);
 
-	if (priv->adapter->host_mlme)
+	if (priv->adapter->host_mlme_enabled)
 		return 0;
 
 	memset(&encrypt_key, 0, sizeof(struct mwifiex_ds_encrypt_key));
@@ -3683,7 +3658,7 @@ static int mwifiex_set_rekey_data(struct wiphy *wiphy, struct net_device *dev,
 	if (!ISSUPP_FIRMWARE_SUPPLICANT(priv->adapter->fw_cap_info))
 		return -EOPNOTSUPP;
 
-	if (priv->adapter->host_mlme)
+	if (priv->adapter->host_mlme_enabled)
 		return 0;
 
 	return mwifiex_send_cmd(priv, HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG,
@@ -4033,7 +4008,7 @@ mwifiex_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev,
 {
 	struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
 
-	if (priv->adapter->host_mlme &&
+	if (priv->adapter->host_mlme_enabled &&
 	    (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP))
 		return mwifiex_cfg80211_uap_add_station(priv, mac, params);
 
@@ -4274,7 +4249,7 @@ mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev,
 	int ret;
 	struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
 
-	if (priv->adapter->host_mlme &&
+	if (priv->adapter->host_mlme_enabled &&
 	    (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP))
 		return 0;
 
@@ -4426,8 +4401,8 @@ mwifiex_cfg80211_authenticate(struct wiphy *wiphy,
 	}
 
 	mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg);
-	mgmt->u.auth.auth_transaction = trans;
-	mgmt->u.auth.status_code = status_code;
+	mgmt->u.auth.auth_transaction = cpu_to_le16(trans);
+	mgmt->u.auth.status_code = cpu_to_le16(status_code);
 
 	if (req->ie && req->ie_len) {
 		if (!varptr)
@@ -4545,7 +4520,7 @@ mwifiex_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev,
 
 	if (ret) {
 		priv->auth_flag = 0;
-		priv->auth_alg = 0xFFFF;
+		priv->auth_alg = WLAN_AUTH_NONE;
 		eth_zero_addr(priv->cfg_bssid);
 	}
 
@@ -4735,7 +4710,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 			    "%s: creating new wiphy\n", __func__);
 		return -ENOMEM;
 	}
-	if (adapter->host_mlme) {
+	if (adapter->host_mlme_enabled) {
 		mwifiex_cfg80211_ops.auth = mwifiex_cfg80211_authenticate;
 		mwifiex_cfg80211_ops.assoc = mwifiex_cfg80211_associate;
 		mwifiex_cfg80211_ops.deauth = mwifiex_cfg80211_deauthenticate;
@@ -4747,7 +4722,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 	}
 	wiphy->max_scan_ssids = MWIFIEX_MAX_SSID_LIST_LENGTH;
 	wiphy->max_scan_ie_len = MWIFIEX_MAX_VSIE_LEN;
-	if (adapter->host_mlme) {
+	if (adapter->host_mlme_enabled) {
 		mwifiex_mgmt_stypes[NL80211_IFTYPE_AP].tx = 0xffff;
 		mwifiex_mgmt_stypes[NL80211_IFTYPE_AP].rx =
 			BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
@@ -4807,7 +4782,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 			WIPHY_FLAG_NETNS_OK |
 			WIPHY_FLAG_PS_ON_BY_DEFAULT;
 
-	if (adapter->host_mlme)
+	if (adapter->host_mlme_enabled)
 		wiphy->flags |= WIPHY_FLAG_REPORTS_OBSS;
 	else
 		wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME;
@@ -4841,7 +4816,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 			   NL80211_FEATURE_LOW_PRIORITY_SCAN |
 			   NL80211_FEATURE_NEED_OBSS_SCAN;
 
-	if (adapter->host_mlme)
+	if (adapter->host_mlme_enabled)
 		wiphy->features |= NL80211_FEATURE_SAE;
 
 	if (ISSUPP_ADHOC_ENABLED(adapter->fw_cap_info))
diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
index c8d94cc6706f..85429c51c407 100644
--- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
@@ -1499,11 +1499,11 @@ int mwifiex_cmd_get_hw_spec(struct mwifiex_private *priv,
 
 static void mwifiex_check_key_api_ver(struct mwifiex_adapter *adapter)
 {
-	if (adapter->host_mlme) {
+	if (adapter->host_mlme_enabled) {
 		if (adapter->key_api_major_ver != KEY_API_VER_MAJOR_V2)
-			adapter->host_mlme = false;
+			adapter->host_mlme_enabled = false;
 		mwifiex_dbg(adapter, MSG, "host_mlme: %s, key_api: %d\n",
-			    adapter->host_mlme ? "enable" : "disable",
+			    adapter->host_mlme_enabled ? "enable" : "disable",
 			    adapter->key_api_major_ver);
 	}
 }
@@ -1617,7 +1617,6 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
 						    "key_api v%d.%d\n",
 						    adapter->key_api_major_ver,
 						    adapter->key_api_minor_ver);
-					mwifiex_check_key_api_ver(adapter);
 					break;
 				case FW_API_VER_ID:
 					adapter->fw_api_ver =
@@ -1712,6 +1711,8 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,
 	if (adapter->fw_api_ver == MWIFIEX_FW_V15)
 		adapter->scan_chan_gap_enabled = true;
 
+	mwifiex_check_key_api_ver(adapter);
+
 	return 0;
 }
 
diff --git a/drivers/net/wireless/marvell/mwifiex/decl.h b/drivers/net/wireless/marvell/mwifiex/decl.h
index f9b21b13d6c3..be42040822b2 100644
--- a/drivers/net/wireless/marvell/mwifiex/decl.h
+++ b/drivers/net/wireless/marvell/mwifiex/decl.h
@@ -24,10 +24,24 @@
 #define MWIFIEX_RX_HEADROOM	    64
 #define MAX_TXPD_SZ		    32
 #define INTF_HDR_ALIGN		     4
-/* frmctl + durationid + addr1 + addr2 + addr3 + seqctl + addr4 */
-#define MWIFIEX_MGMT_HEADER_LEN   (2 + 2 + 6 + 6 + 6 + 2 + 6)
-/* 6   = auth_alg + auth_transaction + auth_status */
-#define MWIFIEX_AUTH_BODY_LEN     6
+#define MWIFIEX_MIN_DATA_HEADER_LEN (MWIFIEX_DMA_ALIGN_SZ + INTF_HDR_ALIGN + \
+				     MAX_TXPD_SZ)
+
+#define MWIFIEX_MGMT_FRAME_HEADER_SIZE	8	/* sizeof(pkt_type)
+						 *   + sizeof(tx_control)
+						 */
+
+#define FRMCTL_LEN                2
+#define DURATION_LEN              2
+#define SEQCTL_LEN                2
+#define MWIFIEX_MGMT_HEADER_LEN   (FRMCTL_LEN + FRMCTL_LEN + ETH_ALEN + \
+				   ETH_ALEN + ETH_ALEN + SEQCTL_LEN + ETH_ALEN)
+
+#define AUTH_ALG_LEN              2
+#define AUTH_TRANSACTION_LEN      2
+#define AUTH_STATUS_LEN           2
+#define MWIFIEX_AUTH_BODY_LEN     (AUTH_ALG_LEN + AUTH_TRANSACTION_LEN + \
+				   AUTH_STATUS_LEN)
 
 #define HOST_MLME_AUTH_PENDING    BIT(0)
 #define HOST_MLME_AUTH_DONE       BIT(1)
@@ -35,13 +49,10 @@
 #define HOST_MLME_MGMT_MASK       (BIT(IEEE80211_STYPE_AUTH >> 4) | \
 				   BIT(IEEE80211_STYPE_DEAUTH >> 4) | \
 				   BIT(IEEE80211_STYPE_DISASSOC >> 4))
+
 #define AUTH_TX_DEFAULT_WAIT_TIME 2400
 
-#define MWIFIEX_MIN_DATA_HEADER_LEN (MWIFIEX_DMA_ALIGN_SZ + INTF_HDR_ALIGN + \
-				     MAX_TXPD_SZ)
-#define MWIFIEX_MGMT_FRAME_HEADER_SIZE	8	/* sizeof(pkt_type)
-						 *   + sizeof(tx_control)
-						 */
+#define WLAN_AUTH_NONE            0xFFFF
 
 #define MWIFIEX_MAX_TX_BASTREAM_SUPPORTED	2
 #define MWIFIEX_MAX_RX_BASTREAM_SUPPORTED	16
diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h
index 699c7ffcd0e5..0f9d860b5d59 100644
--- a/drivers/net/wireless/marvell/mwifiex/fw.h
+++ b/drivers/net/wireless/marvell/mwifiex/fw.h
@@ -752,6 +752,31 @@ struct uap_rxpd {
 	u8 flags;
 } __packed;
 
+struct mwifiex_ieee80211_mgmt {
+	__le16 frame_control;
+	__le16 duration;
+	u8 da[ETH_ALEN];
+	u8 sa[ETH_ALEN];
+	u8 bssid[ETH_ALEN];
+	__le16 seq_ctrl;
+	u8 addr4[ETH_ALEN];
+	union {
+		struct {
+			__le16 auth_alg;
+			__le16 auth_transaction;
+			__le16 status_code;
+			/* possibly followed by Challenge text */
+			u8 variable[];
+		} __packed auth;
+		struct {
+			__le16 capab_info;
+			__le16 listen_interval;
+			/* followed by SSID and Supported rates */
+			u8 variable[];
+		} __packed assoc_req;
+	} u;
+} __packed;
+
 struct mwifiex_fw_chan_stats {
 	u8 chan_num;
 	u8 bandcfg;
diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c
index 87121018abc6..a336d45b9677 100644
--- a/drivers/net/wireless/marvell/mwifiex/init.c
+++ b/drivers/net/wireless/marvell/mwifiex/init.c
@@ -82,7 +82,7 @@ int mwifiex_init_priv(struct mwifiex_private *priv)
 	priv->data_avg_factor = DEFAULT_DATA_AVG_FACTOR;
 
 	priv->auth_flag = 0;
-	priv->auth_alg = 0xFFFF;
+	priv->auth_alg = WLAN_AUTH_NONE;
 
 	priv->sec_info.wep_enabled = 0;
 	priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM;
diff --git a/drivers/net/wireless/marvell/mwifiex/join.c b/drivers/net/wireless/marvell/mwifiex/join.c
index 00720c6840ef..06db8e358c01 100644
--- a/drivers/net/wireless/marvell/mwifiex/join.c
+++ b/drivers/net/wireless/marvell/mwifiex/join.c
@@ -511,7 +511,7 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
 			sizeof(struct mwifiex_chan_scan_param_set);
 	}
 
-	if (priv->adapter->host_mlme) {
+	if (priv->adapter->host_mlme_enabled) {
 		host_mlme_tlv = (struct mwifiex_ie_types_host_mlme *)pos;
 		host_mlme_tlv->header.type = cpu_to_le16(TLV_TYPE_HOST_MLME);
 		host_mlme_tlv->header.len =
@@ -672,7 +672,7 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
 		goto done;
 	}
 
-	if (adapter->host_mlme) {
+	if (adapter->host_mlme_enabled) {
 		hdr = (struct ieee80211_mgmt *)&resp->params;
 		if (!memcmp(hdr->bssid,
 			    priv->attempted_bss_desc->mac_address,
@@ -724,7 +724,7 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
 					    "ASSOC_RESP: UNSPECIFIED failure\n");
 			}
 
-			if (priv->adapter->host_mlme)
+			if (priv->adapter->host_mlme_enabled)
 				priv->assoc_rsp_size = 0;
 		} else {
 			ret = status_code;
@@ -1538,9 +1538,9 @@ int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac)
 	if (!priv->media_connected)
 		return 0;
 
-	if (priv->adapter->host_mlme) {
+	if (priv->adapter->host_mlme_enabled) {
 		priv->auth_flag = 0;
-		priv->auth_alg = 0xFFFF;
+		priv->auth_alg = WLAN_AUTH_NONE;
 		priv->host_mlme_reg = false;
 		priv->mgmt_frame_mask = 0;
 		if (mwifiex_send_cmd(priv, HostCmd_CMD_MGMT_FRAME_REG,
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index f0158d217bb8..b5aef4c92b98 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -1010,7 +1010,7 @@ struct mwifiex_adapter {
 	bool is_up;
 
 	bool ext_scan;
-	bool host_mlme;
+	bool host_mlme_enabled;
 	u8 fw_api_ver;
 	u8 key_api_major_ver, key_api_minor_ver;
 	u8 max_p2p_conn, max_sta_conn;
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
index f5039d158f46..e7b488fca52f 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -2504,7 +2504,7 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter)
 		adapter->num_mem_types = ARRAY_SIZE(mem_type_mapping_tbl);
 	}
 
-	adapter->host_mlme = card->host_mlme;
+	adapter->host_mlme_enabled = card->host_mlme;
 
 	return 0;
 }
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c
index 9c6fac91204c..b5f3821a6a8f 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_event.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c
@@ -136,7 +136,7 @@ void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code,
 	priv->media_connected = false;
 
 	priv->auth_flag = 0;
-	priv->auth_alg = 0xFFFF;
+	priv->auth_alg = WLAN_AUTH_NONE;
 
 	priv->scan_block = false;
 	priv->port_open = false;
@@ -225,7 +225,7 @@ void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code,
 		    priv->cfg_bssid, reason_code);
 	if (priv->bss_mode == NL80211_IFTYPE_STATION ||
 	    priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) {
-		if (adapter->host_mlme && adapter->host_mlme_link_lost)
+		if (adapter->host_mlme_enabled && adapter->host_mlme_link_lost)
 			mwifiex_host_mlme_disconnect(adapter->priv_link_lost,
 						     reason_code, NULL);
 		else
@@ -753,7 +753,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
 		if (priv->media_connected) {
 			reason_code =
 				get_unaligned_le16(adapter->event_body);
-			if (adapter->host_mlme) {
+			if (adapter->host_mlme_enabled) {
 				adapter->priv_link_lost = priv;
 				adapter->host_mlme_link_lost = true;
 				queue_work(adapter->host_mlme_workqueue,
@@ -1015,10 +1015,10 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
 		mwifiex_dbg(adapter, EVENT,
 			    "event: Remain on channel expired\n");
 
-		if (adapter->host_mlme &&
+		if (adapter->host_mlme_enabled &&
 		    (priv->auth_flag & HOST_MLME_AUTH_PENDING)) {
 			priv->auth_flag = 0;
-			priv->auth_alg = 0xFFFF;
+			priv->auth_alg = WLAN_AUTH_NONE;
 		} else {
 			cfg80211_remain_on_channel_expired(&priv->wdev,
 							   priv->roc_cfg.cookie,
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
index 046541713318..23639aacf092 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -340,7 +340,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
 			ret = mwifiex_associate(priv, bss_desc);
 		}
 
-		if (bss && !priv->adapter->host_mlme)
+		if (bss && !priv->adapter->host_mlme_enabled)
 			cfg80211_put_bss(priv->adapter->wiphy, bss);
 	} else {
 		/* Adhoc mode */
diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
index eb7e39146b8a..e393cc78bb98 100644
--- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
@@ -765,7 +765,7 @@ static int mwifiex_cmd_uap_bss_start(struct mwifiex_private *priv,
 	cmd->command = cpu_to_le16(HostCmd_CMD_UAP_BSS_START);
 	cmd->size = S_DS_GEN;
 
-	if (priv->adapter->host_mlme) {
+	if (priv->adapter->host_mlme_enabled) {
 		tlv = (struct mwifiex_ie_types_host_mlme *)((u8 *)cmd + cmd->size);
 		tlv->header.type = cpu_to_le16(TLV_TYPE_HOST_MLME);
 		tlv->header.len = cpu_to_le16(sizeof(tlv->host_mlme));
diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c
index 9e36bb4a8d67..c0614c246b5f 100644
--- a/drivers/net/wireless/marvell/mwifiex/util.c
+++ b/drivers/net/wireless/marvell/mwifiex/util.c
@@ -392,7 +392,7 @@ void mwifiex_host_mlme_disconnect(struct mwifiex_private *priv,
 		       ETH_ALEN);
 		memcpy(mgmt->bssid, priv->cfg_bssid, ETH_ALEN);
 		priv->auth_flag = 0;
-		priv->auth_alg = 0xFFFF;
+		priv->auth_alg = WLAN_AUTH_NONE;
 	} else {
 		memcpy(mgmt->da, priv->curr_addr, ETH_ALEN);
 		memcpy(mgmt->sa, sa, ETH_ALEN);
@@ -486,7 +486,7 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
 					    "auth: receive deauth from %pM\n",
 					    ieee_hdr->addr3);
 				priv->auth_flag = 0;
-				priv->auth_alg = 0xFFFF;
+				priv->auth_alg = WLAN_AUTH_NONE;
 			} else {
 				mwifiex_dbg(priv->adapter, MSG,
 					    "assoc: receive disasso from %pM\n",
@@ -497,7 +497,7 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
 		cfg80211_rx_mlme_mgmt(priv->netdev, skb->data, pkt_len);
 	}
 
-	if (priv->adapter->host_mlme &&
+	if (priv->adapter->host_mlme_enabled &&
 	    (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP)) {
 		if (ieee80211_is_auth(ieee_hdr->frame_control))
 			mwifiex_dbg(priv->adapter, MSG,
