Browse Source

qcacld-3.0: Fix compile errors when WLAN_FEATURE_11W is disabled

Fix compilation errors when WLAN_FEATURE_11W is disabled.

Change-Id: I5bed89f0077a51117c57e176568f849293d40ee5
CRs-Fixed: 2019223
Abhishek Singh 8 years ago
parent
commit
cfb4448302

+ 8 - 0
core/dp/txrx/ol_txrx.c

@@ -2497,6 +2497,7 @@ ol_txrx_peer_get_peer_mac_addr(void *ppeer)
 	return peer->mac_addr.raw;
 }
 
+#ifdef WLAN_FEATURE_11W
 /**
  * ol_txrx_get_pn_info() - Returns pn info from peer
  * @peer: handle to peer
@@ -2515,6 +2516,13 @@ ol_txrx_get_pn_info(void *ppeer, uint8_t **last_pn_valid,
 	*last_pn = &peer->last_rmf_pn;
 	*rmf_pn_replays = &peer->rmf_pn_replays;
 }
+#else
+void
+ol_txrx_get_pn_info(void *ppeer, uint8_t **last_pn_valid,
+		uint64_t **last_pn, uint32_t **rmf_pn_replays)
+{
+}
+#endif
 
 /**
  * ol_txrx_get_opmode() - Return operation mode of vdev

+ 34 - 12
core/hdd/src/wlan_hdd_cfg80211.c

@@ -12872,6 +12872,38 @@ static bool wlan_hdd_handle_sap_sta_dfs_conc(hdd_adapter_t *adapter,
 	return true;
 }
 
+#ifdef WLAN_FEATURE_11W
+/**
+ * wlan_hdd_cfg80211_check_pmf_valid() - check if pmf status is ok
+ * @roam_profile: pointer to roam profile
+ *
+ * if MFPEnabled is set but the peer AP is non-PMF i.e 80211w=2
+ * or pmf=2 is an explicit configuration in the supplicant
+ * configuration, drop the connection request.
+ *
+ * Return: 0 if check result is valid, otherwise return error code
+ */
+static int wlan_hdd_cfg80211_check_pmf_valid(tCsrRoamProfile *roam_profile)
+{
+	if (roam_profile->MFPEnabled &&
+	    !(roam_profile->MFPRequired ||
+	    roam_profile->MFPCapable)) {
+		hdd_err("Drop connect req as supplicant has indicated PMF required for the non-PMF peer. MFPEnabled %d MFPRequired %d MFPCapable %d",
+				roam_profile->MFPEnabled,
+				roam_profile->MFPRequired,
+				roam_profile->MFPCapable);
+		return -EINVAL;
+	}
+	return 0;
+}
+#else
+static inline
+int wlan_hdd_cfg80211_check_pmf_valid(tCsrRoamProfile *roam_profile)
+{
+	return 0;
+}
+#endif
+
 /**
  * wlan_hdd_cfg80211_connect_start() - to start the association process
  * @pAdapter: Pointer to adapter
@@ -13088,19 +13120,9 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter,
 			hdd_select_cbmode(pAdapter, operatingChannel,
 					  &pRoamProfile->ch_params);
 		}
-		/*
-		 * if MFPEnabled is set but the peer AP is non-PMF i.e 80211w=2
-		 * or pmf=2 is an explicit configuration in the supplicant
-		 * configuration, drop the connection request.
-		 */
-		if (pWextState->roamProfile.MFPEnabled &&
-		    !(pWextState->roamProfile.MFPRequired ||
-		    pWextState->roamProfile.MFPCapable)) {
-			hdd_err("Drop connect req as supplicant has indicated PMF req for a non-PMF peer. MFPEnabled %d MFPRequired %d MFPCapable %d",
-					pWextState->roamProfile.MFPEnabled,
-					pWextState->roamProfile.MFPRequired,
-					pWextState->roamProfile.MFPCapable);
 
+		if (wlan_hdd_cfg80211_check_pmf_valid(
+		   &pWextState->roamProfile)) {
 			status = -EINVAL;
 			goto conn_failure;
 		}

+ 47 - 35
core/mac/src/pe/lim/lim_p2p.c

@@ -511,6 +511,52 @@ static void lim_tx_action_frame(tpAniSirGlobal mac_ctx,
 	return;
 }
 
+#ifdef WLAN_FEATURE_11W
+static void lim_check_rmf_and_set_protected(tpAniSirGlobal mac_ctx,
+	tSirMbMsgP2p *mb_msg, uint8_t *frame)
+{
+	uint8_t session_id = 0;
+	tpPESession session_entry;
+	tpSirMacMgmtHdr mac_hdr;
+	tpSirMacActionFrameHdr action_hdr;
+	tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data;
+
+	action_hdr = (tpSirMacActionFrameHdr)
+		(frame + sizeof(tSirMacMgmtHdr));
+	mac_hdr = (tpSirMacMgmtHdr) frame;
+	session_entry = pe_find_session_by_bssid(mac_ctx,
+		(uint8_t *) mb_msg->data + BSSID_OFFSET,
+		&session_id);
+
+	/*
+	 * Check for session corresponding to ADDR2 as supplicant
+	 * is filling ADDR2  with BSSID
+	 */
+	if (!session_entry) {
+		session_entry = pe_find_session_by_bssid(mac_ctx,
+			(uint8_t *) mb_msg->data + ADDR2_OFFSET,
+			 &session_id);
+	}
+	/*
+	 * Setting Protected bit only for Robust Action Frames
+	 * This has to be based on the current Connection with the
+	 * station. lim_set_protected_bit API will set the protected
+	 * bit if connection is PMF
+	 */
+	if (session_entry && (SIR_MAC_MGMT_ACTION == fc->subType) &&
+		session_entry->limRmfEnabled &&
+		(!lim_is_group_addr(mac_hdr->da)) &&
+		lim_is_robust_mgmt_action_frame(action_hdr->category))
+		lim_set_protected_bit(mac_ctx, session_entry,
+					mac_hdr->da, mac_hdr);
+}
+#else
+static inline void lim_check_rmf_and_set_protected(tpAniSirGlobal mac_ctx,
+	tSirMbMsgP2p *mb_msg, uint8_t *frame)
+{
+}
+#endif
+
 /**
  * lim_send_p2p_action_frame() - Process action frame request
  * @mac_ctx:  Pointer to mac context
@@ -533,17 +579,12 @@ void lim_send_p2p_action_frame(tpAniSirGlobal mac_ctx,
 	uint8_t noa_len = 0;
 	uint8_t noa_stream[SIR_MAX_NOA_ATTR_LEN + (2 * SIR_P2P_IE_HEADER_LEN)];
 	uint8_t orig_len = 0;
-	uint8_t session_id = 0;
 	uint8_t *p2p_ie = NULL;
 	tpPESession session_entry = NULL;
 	uint8_t *presence_noa_attr = NULL;
 	uint8_t *tmp_p2p_ie = NULL;
 	uint16_t remain_len = 0;
 	uint8_t sme_session_id = 0;
-#ifdef WLAN_FEATURE_11W
-	tpSirMacMgmtHdr mac_hdr;
-	tpSirMacActionFrameHdr action_hdr;
-#endif
 
 	msg_len = mb_msg->msgLen - sizeof(tSirMbMsgP2p);
 	lim_log(mac_ctx, LOG1, FL("sending fc->type=%d fc->subType=%d"),
@@ -698,36 +739,7 @@ void lim_send_p2p_action_frame(tpAniSirGlobal mac_ctx,
 		qdf_mem_copy(frame, mb_msg->data, msg_len);
 	}
 
-#ifdef WLAN_FEATURE_11W
-	action_hdr = (tpSirMacActionFrameHdr)
-		(frame + sizeof(tSirMacMgmtHdr));
-	mac_hdr = (tpSirMacMgmtHdr) frame;
-	session_entry = pe_find_session_by_bssid(mac_ctx,
-		(uint8_t *) mb_msg->data + BSSID_OFFSET,
-		&session_id);
-
-	/*
-	 * Check for session corresponding to ADDR2 as supplicant
-	 * is filling ADDR2  with BSSID
-	 */
-	if (NULL == session_entry) {
-		session_entry = pe_find_session_by_bssid(mac_ctx,
-			(uint8_t *) mb_msg->data + ADDR2_OFFSET,
-			 &session_id);
-	}
-	/*
-	 * Setting Protected bit only for Robust Action Frames
-	 * This has to be based on the current Connection with the
-	 * station. lim_set_protected_bit API will set the protected
-	 * bit if connection is PMF
-	 */
-	if (session_entry && (SIR_MAC_MGMT_ACTION == fc->subType) &&
-		session_entry->limRmfEnabled &&
-		(!lim_is_group_addr(mac_hdr->da)) &&
-		lim_is_robust_mgmt_action_frame(action_hdr->category))
-		lim_set_protected_bit(mac_ctx, session_entry,
-					mac_hdr->da, mac_hdr);
-#endif
+	lim_check_rmf_and_set_protected(mac_ctx, mb_msg, frame);
 
 	lim_tx_action_frame(mac_ctx, mb_msg, msg_len, packet, frame);
 	return;

+ 32 - 9
core/mac/src/pe/lim/lim_session.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -248,6 +248,36 @@ static void pe_reset_protection_callback(void *ptr)
 	}
 }
 
+#ifdef WLAN_FEATURE_11W
+/**
+ * pe_init_pmf_comeback_timer: init PMF comeback timer
+ * @mac_ctx: pointer to global adapter context
+ * @session: pe session
+ * @session_id: session ID
+ *
+ * Return: void
+ */
+static void pe_init_pmf_comeback_timer(tpAniSirGlobal mac_ctx,
+tpPESession session, uint8_t session_id)
+{
+	QDF_STATUS status;
+
+	session->pmfComebackTimerInfo.pMac = mac_ctx;
+	session->pmfComebackTimerInfo.sessionID = session_id;
+	status = qdf_mc_timer_init(&session->pmfComebackTimer,
+			QDF_TIMER_TYPE_SW, lim_pmf_comeback_timer_callback,
+			(void *)&session->pmfComebackTimerInfo);
+	if (!QDF_IS_STATUS_SUCCESS(status))
+		lim_log(mac_ctx, LOGE, FL("cannot init pmf comeback timer."));
+}
+#else
+static inline void
+pe_init_pmf_comeback_timer(tpAniSirGlobal mac_ctx,
+	tpPESession session, uint8_t session_id)
+{
+}
+#endif
+
 /**
  * pe_create_session() creates a new PE session given the BSSID
  * @param pMac:        pointer to global adapter context
@@ -401,14 +431,7 @@ pe_create_session(tpAniSirGlobal pMac, uint8_t *bssid, uint8_t *sessionId,
 			QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
 				FL("cannot create or start protectionFieldsResetTimer"));
 	}
-
-	session_ptr->pmfComebackTimerInfo.pMac = pMac;
-	session_ptr->pmfComebackTimerInfo.sessionID = *sessionId;
-	status = qdf_mc_timer_init(&session_ptr->pmfComebackTimer,
-			QDF_TIMER_TYPE_SW, lim_pmf_comeback_timer_callback,
-			(void *)&session_ptr->pmfComebackTimerInfo);
-	if (!QDF_IS_STATUS_SUCCESS(status))
-		lim_log(pMac, LOGE, FL("cannot init pmf comeback timer."));
+	pe_init_pmf_comeback_timer(pMac, session_ptr, *sessionId);
 
 	return &pMac->lim.gpSession[i];
 }

+ 2 - 0
core/mac/src/pe/lim/lim_utils.c

@@ -546,6 +546,7 @@ tSirRetStatus lim_init_mlm(tpAniSirGlobal pMac)
 	return eSIR_SUCCESS;
 } /*** end lim_init_mlm() ***/
 
+#ifdef WLAN_FEATURE_11W
 /**
  * lim_deactivate_del_sta() - This function deactivate/delete associates STA
  * @mac_ctx: pointer to Global Mac Structure
@@ -577,6 +578,7 @@ static void lim_deactivate_del_sta(tpAniSirGlobal mac_ctx, uint32_t bss_entry,
 		tx_timer_delete(&sta_ds->pmfSaQueryTimer);
 	}
 }
+#endif
 
 /**
  * lim_cleanup_mlm() - This function is called to cleanup

+ 7 - 7
core/mac/src/pe/lim/lim_utils.h

@@ -572,14 +572,14 @@ bool lim_check_disassoc_deauth_ack_pending(tpAniSirGlobal pMac,
 
 #ifdef WLAN_FEATURE_11W
 void lim_pmf_sa_query_timer_handler(void *pMacGlobal, uint32_t param);
-#endif
-
-void lim_set_protected_bit(tpAniSirGlobal pMac,
-		tpPESession psessionEntry,
-		tSirMacAddr peer, tpSirMacMgmtHdr pMacHdr);
-
-#ifdef WLAN_FEATURE_11W
 void lim_pmf_comeback_timer_callback(void *context);
+void lim_set_protected_bit(tpAniSirGlobal pMac,
+	tpPESession psessionEntry,
+	tSirMacAddr peer, tpSirMacMgmtHdr pMacHdr);
+#else
+static inline void lim_set_protected_bit(tpAniSirGlobal pMac,
+	tpPESession psessionEntry,
+	tSirMacAddr peer, tpSirMacMgmtHdr pMacHdr) {}
 #endif /* WLAN_FEATURE_11W */
 
 void lim_set_ht_caps(tpAniSirGlobal p_mac,

+ 0 - 2
core/sme/inc/csr_api.h

@@ -63,10 +63,8 @@ typedef enum {
 #endif /* FEATURE_WLAN_WAPI */
 	eCSR_AUTH_TYPE_CCKM_WPA,
 	eCSR_AUTH_TYPE_CCKM_RSN,
-#ifdef WLAN_FEATURE_11W
 	eCSR_AUTH_TYPE_RSN_PSK_SHA256,
 	eCSR_AUTH_TYPE_RSN_8021X_SHA256,
-#endif
 	eCSR_NUM_OF_SUPPORT_AUTH_TYPE,
 	eCSR_AUTH_TYPE_FAILED = 0xff,
 	eCSR_AUTH_TYPE_UNKNOWN = eCSR_AUTH_TYPE_FAILED,

+ 31 - 11
core/sme/src/csr/csr_api_roam.c

@@ -13863,6 +13863,36 @@ static QDF_STATUS csr_set_ldpc_exception(tpAniSirGlobal mac_ctx,
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef WLAN_FEATURE_11W
+/**
+ * csr_set_mgmt_enc_type() - set mgmt enc type for PMF
+ * @profile: roam profile
+ * @ies: AP ie
+ * @csr_join_req: csr join req
+ *
+ * Return: void
+ */
+static void csr_set_mgmt_enc_type(tCsrRoamProfile *profile,
+	tDot11fBeaconIEs *ies, tSirSmeJoinReq *csr_join_req)
+{
+	if (profile->MFPEnabled)
+		csr_join_req->MgmtEncryptionType = eSIR_ED_AES_128_CMAC;
+	else
+		csr_join_req->MgmtEncryptionType = eSIR_ED_NONE;
+	if (profile->MFPEnabled &&
+	   !(profile->MFPRequired) &&
+	   ((ies->RSN.present) &&
+	   (!(ies->RSN.RSN_Cap[0] >> 7) & 0x1)))
+		csr_join_req->MgmtEncryptionType = eSIR_ED_NONE;
+}
+#else
+static inline void csr_set_mgmt_enc_type(tCsrRoamProfile *profile,
+	tDot11fBeaconIEs *pIes, tSirSmeJoinReq *csr_join_req)
+{
+}
+#endif
+
+
 /**
  * The communication between HDD and LIM is thru mailbox (MB).
  * Both sides will access the data structure "tSirSmeJoinReq".
@@ -14249,17 +14279,7 @@ QDF_STATUS csr_send_join_req_msg(tpAniSirGlobal pMac, uint32_t sessionId,
 		csr_join_req->MCEncryptionType =
 				csr_translate_encrypt_type_to_ed_type
 					(pProfile->negotiatedMCEncryptionType);
-#ifdef WLAN_FEATURE_11W
-		if (pProfile->MFPEnabled)
-			csr_join_req->MgmtEncryptionType = eSIR_ED_AES_128_CMAC;
-		else
-			csr_join_req->MgmtEncryptionType = eSIR_ED_NONE;
-#endif
-		if (pProfile->MFPEnabled &&
-			 !(pProfile->MFPRequired) &&
-			 ((pIes->RSN.present) &&
-			 (!(pIes->RSN.RSN_Cap[0] >> 7) & 0x1)))
-			csr_join_req->MgmtEncryptionType = eSIR_ED_NONE;
+	csr_set_mgmt_enc_type(pProfile, pIes, csr_join_req);
 #ifdef FEATURE_WLAN_ESE
 		ese_config =  pMac->roam.configParam.isEseIniFeatureEnabled;
 #endif

+ 39 - 85
core/wma/src/wma_dev_if.c

@@ -2832,6 +2832,33 @@ wma_vdev_set_bss_params(tp_wma_handle wma, int vdev_id,
 	wma_update_protection_mode(wma, vdev_id, llbCoexist);
 }
 
+#ifdef WLAN_FEATURE_11W
+static void wma_set_mgmt_frame_protection(tp_wma_handle wma)
+{
+	struct pdev_params param = {0};
+	QDF_STATUS ret;
+
+	/*
+	 * when 802.11w PMF is enabled for hw encr/decr
+	 * use hw MFP Qos bits 0x10
+	 */
+	param.param_id = WMI_PDEV_PARAM_PMF_QOS;
+	param.param_value = true;
+	ret = wmi_unified_pdev_param_send(wma->wmi_handle,
+					 &param, WMA_WILDCARD_PDEV_ID);
+	if (QDF_IS_STATUS_ERROR(ret)) {
+		WMA_LOGE("%s: Failed to set QOS MFP/PMF (%d)",
+			 __func__, ret);
+	} else {
+		WMA_LOGD("%s: QOS MFP/PMF set", __func__);
+	}
+}
+#else
+static inline void wma_set_mgmt_frame_protection(tp_wma_handle wma)
+{
+}
+#endif /* WLAN_FEATURE_11W */
+
 /**
  * wma_add_bss_ap_mode() - process add bss request in ap mode
  * @wma: wma handle
@@ -2849,10 +2876,6 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, tpAddBssParams add_bss)
 	uint8_t vdev_id, peer_id;
 	QDF_STATUS status;
 	int8_t maxTxPower;
-	struct pdev_params param = {0};
-#ifdef WLAN_FEATURE_11W
-	QDF_STATUS ret;
-#endif /* WLAN_FEATURE_11W */
 	struct sir_hw_mode_params hw_mode = {0};
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
@@ -2914,24 +2937,9 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, tpAddBssParams add_bss)
 	req.vht_capable = add_bss->vhtCapable;
 	req.max_txpow = add_bss->maxTxPower;
 	maxTxPower = add_bss->maxTxPower;
-#ifdef WLAN_FEATURE_11W
-	if (add_bss->rmfEnabled) {
-		/*
-		 * when 802.11w PMF is enabled for hw encr/decr
-		 * use hw MFP Qos bits 0x10
-		 */
-		param.param_id = WMI_PDEV_PARAM_PMF_QOS;
-		param.param_value = true;
-		ret = wmi_unified_pdev_param_send(wma->wmi_handle,
-						 &param, WMA_WILDCARD_PDEV_ID);
-		if (QDF_IS_STATUS_ERROR(ret)) {
-			WMA_LOGE("%s: Failed to set QOS MFP/PMF (%d)",
-				 __func__, ret);
-		} else {
-			WMA_LOGI("%s: QOS MFP/PMF set to %d", __func__, true);
-		}
-	}
-#endif /* WLAN_FEATURE_11W */
+
+	if (add_bss->rmfEnabled)
+		wma_set_mgmt_frame_protection(wma);
 
 	req.beacon_intval = add_bss->beaconInterval;
 	req.dtim_period = add_bss->dtimPeriod;
@@ -3153,7 +3161,6 @@ static void wma_add_bss_sta_mode(tp_wma_handle wma, tpAddBssParams add_bss)
 	tpAniSirGlobal pMac = cds_get_context(QDF_MODULE_ID_PE);
 	struct sir_hw_mode_params hw_mode = {0};
 	bool peer_assoc_sent = false;
-	struct pdev_params param = {0};
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
 	if (NULL == pMac) {
@@ -3359,24 +3366,9 @@ static void wma_add_bss_sta_mode(tp_wma_handle wma, tpAddBssParams add_bss)
 		wma_send_peer_assoc(wma, add_bss->nwType,
 					    &add_bss->staContext);
 		peer_assoc_sent = true;
-#ifdef WLAN_FEATURE_11W
-		if (add_bss->rmfEnabled) {
-			/* when 802.11w PMF is enabled for hw encr/decr
-			   use hw MFP Qos bits 0x10 */
-			param.param_id = WMI_PDEV_PARAM_PMF_QOS;
-			param.param_value = true;
-			status = wmi_unified_pdev_param_send(wma->wmi_handle,
-							 &param,
-							 WMA_WILDCARD_PDEV_ID);
-			if (QDF_IS_STATUS_ERROR(status)) {
-				WMA_LOGE("%s: Failed to set QOS MFP/PMF (%d)",
-					 __func__, status);
-			} else {
-				WMA_LOGI("%s: QOS MFP/PMF set to %d",
-					 __func__, true);
-			}
-		}
-#endif /* WLAN_FEATURE_11W */
+
+		if (add_bss->rmfEnabled)
+			wma_set_mgmt_frame_protection(wma);
 
 		wma_vdev_set_bss_params(wma, add_bss->staContext.smesessionId,
 					add_bss->beaconInterval,
@@ -3501,7 +3493,6 @@ static void wma_add_sta_req_ap_mode(tp_wma_handle wma, tpAddStaParams add_sta)
 	struct wma_txrx_node *iface = NULL;
 	struct wma_target_req *msg;
 	bool peer_assoc_cnf = false;
-	struct pdev_params param;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
 	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
@@ -3637,30 +3628,8 @@ static void wma_add_sta_req_ap_mode(tp_wma_handle wma, tpAddStaParams add_sta)
 	}
 #endif
 
-#ifdef WLAN_FEATURE_11W
-	if (add_sta->rmfEnabled) {
-		/*
-		 * We have to store the state of PMF connection
-		 * per STA for SAP case
-		 * We will isolate the ifaces based on vdevid
-		 */
-		iface->rmfEnabled = add_sta->rmfEnabled;
-		/*
-		 * when 802.11w PMF is enabled for hw encr/decr
-		 * use hw MFP Qos bits 0x10
-		 */
-		param.param_id = WMI_PDEV_PARAM_PMF_QOS;
-		param.param_value = true;
-		status = wmi_unified_pdev_param_send(wma->wmi_handle,
-						 &param, WMA_WILDCARD_PDEV_ID);
-		if (QDF_IS_STATUS_ERROR(status)) {
-			WMA_LOGE("%s: Failed to set QOS MFP/PMF (%d)",
-				 __func__, status);
-		} else {
-			WMA_LOGI("%s: QOS MFP/PMF set to %d", __func__, true);
-		}
-	}
-#endif /* WLAN_FEATURE_11W */
+	if (add_sta->rmfEnabled)
+		wma_set_mgmt_frame_protection(wma);
 
 	if (add_sta->uAPSD) {
 		status = wma_set_ap_peer_uapsd(wma, add_sta->smesessionId,
@@ -3876,7 +3845,6 @@ static void wma_add_sta_req_sta_mode(tp_wma_handle wma, tpAddStaParams params)
 	struct wma_target_req *msg;
 	bool peer_assoc_cnf = false;
 	struct vdev_up_params param = {0};
-	struct pdev_params pdev_param = {0};
 	int smps_param;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
@@ -3994,24 +3962,10 @@ static void wma_add_sta_req_sta_mode(tp_wma_handle wma, tpAddStaParams params)
 					params->smesessionId, peer, false);
 			goto out;
 		}
-#ifdef WLAN_FEATURE_11W
-		if (params->rmfEnabled) {
-			/* when 802.11w PMF is enabled for hw encr/decr
-			   use hw MFP Qos bits 0x10 */
-			pdev_param.param_id = WMI_PDEV_PARAM_PMF_QOS;
-			pdev_param.param_value = true;
-			status = wmi_unified_pdev_param_send(wma->wmi_handle,
-							 &pdev_param,
-							 WMA_WILDCARD_PDEV_ID);
-			if (QDF_IS_STATUS_ERROR(status)) {
-				WMA_LOGE("%s: Failed to set QOS MFP/PMF (%d)",
-					 __func__, status);
-			} else {
-				WMA_LOGI("%s: QOS MFP/PMF set to %d",
-					 __func__, true);
-			}
-		}
-#endif /* WLAN_FEATURE_11W */
+
+		if (params->rmfEnabled)
+			wma_set_mgmt_frame_protection(wma);
+
 		/*
 		 * Set the PTK in 11r mode because we already have it.
 		 */

+ 10 - 2
core/wma/src/wma_mgmt.c

@@ -3180,6 +3180,16 @@ int wma_process_rmf_frame(tp_wma_handle wma_handle,
 	}
     return 0;
 }
+#else
+static inline int wma_process_rmf_frame(tp_wma_handle wma_handle,
+	struct wma_txrx_node *iface,
+	struct ieee80211_frame *wh,
+	cds_pkt_t *rx_pkt,
+	qdf_nbuf_t wbuf)
+{
+	return 0;
+}
+
 #endif
 
 /**
@@ -3385,7 +3395,6 @@ int wma_form_rx_packet(qdf_nbuf_t buf,
 	mgt_type = (wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
 	mgt_subtype = (wh)->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
 
-#ifdef WLAN_FEATURE_11W
 	if (mgt_type == IEEE80211_FC0_TYPE_MGT &&
 	    (mgt_subtype == IEEE80211_FC0_SUBTYPE_DISASSOC ||
 	     mgt_subtype == IEEE80211_FC0_SUBTYPE_DEAUTH ||
@@ -3407,7 +3416,6 @@ int wma_form_rx_packet(qdf_nbuf_t buf,
 			}
 		}
 	}
-#endif /* WLAN_FEATURE_11W */
 
 	rx_pkt->pkt_meta.sessionId =
 		(vdev_id == WMA_INVALID_VDEV_ID ? 0 : vdev_id);