Parcourir la source

qcacld-3.0: Cleanup crypto params from roam profile struct

Cleanup crypto params from roam profile struct.

Change-Id: Ib3acb7f2ee669ba05da7011a56a54487d5100033
CRs-Fixed: 2988892
Abhishek Singh il y a 3 ans
Parent
commit
bac97712b7

+ 26 - 0
components/mlme/core/inc/wlan_mlme_main.h

@@ -758,6 +758,32 @@ enum QDF_OPMODE wlan_get_opmode_vdev_id(struct wlan_objmgr_pdev *pdev,
  */
 bool wlan_is_open_wep_cipher(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id);
 
+/**
+ * wlan_vdev_id_is_open_cipher() - check if cipher is open
+ * @pdev: Pointer to pdev
+ * @vdev_id: vdev id
+ *
+ * Return: if cipher is open
+ */
+bool wlan_vdev_id_is_open_cipher(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id);
+
+/**
+ * wlan_vdev_is_open_mode() - check if cipher is open
+ * @vdev: Pointer to vdev
+ *
+ * Return: if cipher is open
+ */
+bool wlan_vdev_is_open_mode(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * wlan_vdev_id_is_11n_allowed() - check if 11n allowed
+ * @pdev: Pointer to pdev
+ * @vdev_id: vdev id
+ *
+ * Return: false if cipher is TKIP or WEP
+ */
+bool wlan_vdev_id_is_11n_allowed(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id);
+
 /**
  * wlan_is_vdev_id_up() - check if vdev id is in UP state
  * @pdev: Pointer to pdev

+ 62 - 0
components/mlme/core/src/wlan_mlme_main.c

@@ -2906,6 +2906,68 @@ bool wlan_is_open_wep_cipher(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id)
 	return is_open_wep;
 }
 
+bool wlan_vdev_is_open_mode(struct wlan_objmgr_vdev *vdev)
+{
+	int32_t ucast_cipher;
+
+	ucast_cipher = wlan_crypto_get_param(vdev,
+					     WLAN_CRYPTO_PARAM_UCAST_CIPHER);
+	if (!ucast_cipher ||
+	    ((QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_NONE) ==
+	      ucast_cipher)))
+		return true;
+
+	return false;
+}
+
+bool wlan_vdev_id_is_open_cipher(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id)
+{
+	struct wlan_objmgr_vdev *vdev;
+	bool is_open = false;
+
+	if (!pdev)
+		return is_open;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev, vdev_id,
+						    WLAN_LEGACY_MAC_ID);
+	if (!vdev)
+		return is_open;
+	is_open = wlan_vdev_is_open_mode(vdev);
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
+
+	return is_open;
+}
+
+bool wlan_vdev_id_is_11n_allowed(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id)
+{
+	struct wlan_objmgr_vdev *vdev;
+	bool is_11n_allowed = true;
+	int32_t ucast_cipher;
+
+	if (!pdev)
+		return is_11n_allowed;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev, vdev_id,
+						    WLAN_LEGACY_MAC_ID);
+	if (!vdev)
+		return is_11n_allowed;
+	ucast_cipher = wlan_crypto_get_param(vdev,
+					     WLAN_CRYPTO_PARAM_UCAST_CIPHER);
+
+	if (ucast_cipher == -1)
+		return is_11n_allowed;
+	if (QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_TKIP) ||
+	    QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP) ||
+	    QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP_40) ||
+	    QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP_104))
+		is_11n_allowed = false;
+
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
+
+	return is_11n_allowed;
+}
+
+
 bool wlan_is_vdev_id_up(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id)
 {
 	struct wlan_objmgr_vdev *vdev;

+ 0 - 14
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload.c

@@ -4199,20 +4199,6 @@ bool cm_is_auth_type_11r(struct wlan_mlme_psoc_ext_obj *mlme_obj,
 	return false;
 }
 
-bool cm_is_open_mode(struct wlan_objmgr_vdev *vdev)
-{
-	int32_t ucast_cipher;
-
-	ucast_cipher = wlan_crypto_get_param(vdev,
-					     WLAN_CRYPTO_PARAM_UCAST_CIPHER);
-	if (!ucast_cipher ||
-	    ((QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_NONE) ==
-	      ucast_cipher)))
-		return true;
-
-	return false;
-}
-
 #ifdef FEATURE_WLAN_ESE
 bool
 cm_ese_open_present(struct wlan_objmgr_vdev *vdev,

+ 4 - 1
components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h

@@ -543,7 +543,10 @@ bool wlan_cm_is_auth_type_11r(struct wlan_mlme_psoc_ext_obj *mlme_obj,
 	return cm_is_auth_type_11r(mlme_obj, vdev, mdie_present);
 }
 
-bool cm_is_open_mode(struct wlan_objmgr_vdev *vdev);
+static inline bool cm_is_open_mode(struct wlan_objmgr_vdev *vdev)
+{
+	return wlan_vdev_is_open_mode(vdev);
+}
 
 #ifdef FEATURE_WLAN_ESE
 bool

+ 6 - 25
core/hdd/src/wlan_hdd_cfg80211.c

@@ -18532,10 +18532,9 @@ static int __wlan_hdd_cfg80211_get_key(struct wiphy *wiphy,
 				       )
 {
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(ndev);
-	struct csr_roam_profile *roam_profile;
 	struct key_params params;
 	eCsrEncryptionType enc_type;
-	struct hdd_station_ctx *sta_ctx;
+	int32_t ucast_cipher = 0;
 
 	hdd_enter();
 
@@ -18556,30 +18555,11 @@ static int __wlan_hdd_cfg80211_get_key(struct wiphy *wiphy,
 		hdd_err("Invalid key index: %d", key_index);
 		return -EINVAL;
 	}
+	if (adapter->vdev)
+		ucast_cipher = wlan_crypto_get_param(adapter->vdev,
+						WLAN_CRYPTO_PARAM_UCAST_CIPHER);
 
-	if ((adapter->device_mode == QDF_SAP_MODE) ||
-	    (adapter->device_mode == QDF_P2P_GO_MODE)) {
-		struct hdd_ap_ctx *ap_ctx =
-			WLAN_HDD_GET_AP_CTX_PTR(adapter);
-
-		roam_profile =
-			wlan_sap_get_roam_profile(ap_ctx->sap_context);
-		if (!roam_profile) {
-			hdd_err("Get roam profile failed!");
-			return -EINVAL;
-		}
-		enc_type = roam_profile->EncryptionType.encryptionType[0];
-	} else if (adapter->device_mode == QDF_NDI_MODE) {
-		roam_profile = hdd_roam_profile(adapter);
-		if (!roam_profile) {
-			hdd_err("Get roam profile failed!");
-			return -EINVAL;
-		}
-		enc_type = roam_profile->EncryptionType.encryptionType[0];
-	} else {
-		sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-		enc_type = sta_ctx->conn_info.uc_encrypt_type;
-	}
+	sme_fill_enc_type(&enc_type, ucast_cipher);
 
 	switch (enc_type) {
 	case eCSR_ENCRYPT_TYPE_NONE:
@@ -21168,6 +21148,7 @@ static int __wlan_hdd_cfg80211_set_mon_ch(struct wiphy *wiphy,
 	adapter->monitor_mode_vdev_up_in_progress = true;
 
 	status = sme_roam_channel_change_req(mac_handle, bssid,
+					     adapter->vdev_id,
 					     &roam_profile.ch_params,
 					     &roam_profile);
 	if (status) {

+ 2 - 1
core/hdd/src/wlan_hdd_main.c

@@ -8030,7 +8030,8 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, qdf_freq_t freq,
 	adapter->monitor_mode_vdev_up_in_progress = true;
 
 	status = sme_roam_channel_change_req(hdd_ctx->mac_handle,
-					     bssid, &roam_profile.ch_params,
+					     bssid, adapter->vdev_id,
+					     &roam_profile.ch_params,
 					     &roam_profile);
 	if (status) {
 		hdd_err("Status: %d Failed to set sme_roam Channel for monitor mode",

+ 0 - 5
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -260,11 +260,6 @@ static int hdd_ndi_start_bss(struct hdd_adapter *adapter,
 		&adapter->mac_addr.bytes[0],
 		QDF_MAC_ADDR_SIZE);
 
-	roam_profile->AuthType.numEntries = 1;
-	roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
-	roam_profile->EncryptionType.numEntries = 1;
-	roam_profile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
-
 	mac_handle = hdd_adapter_get_mac_handle(adapter);
 	status = sme_bss_start(mac_handle, adapter->vdev_id,
 			       roam_profile, &roam_id);

+ 0 - 3
core/mac/inc/sir_api.h

@@ -744,9 +744,6 @@ struct start_bss_req {
 	tSirNwType nwType;      /* Indicates 11a/b/g */
 	tSirMacRateSet operationalRateSet;      /* Has 11a or 11b rates */
 	tSirMacRateSet extendedRateSet; /* Has 11g rates */
-	bool pmfCapable;
-	bool pmfRequired;
-
 	struct add_ie_params add_ie_params;
 
 	bool obssEnabled;

+ 1 - 1
core/mac/src/pe/lim/lim_process_assoc_req_frame.c

@@ -970,7 +970,7 @@ static enum wlan_status_code lim_check_sae_pmf_cap(struct pe_session *session,
 {
 	enum wlan_status_code status = STATUS_SUCCESS;
 
-	if (session->pLimStartBssReq->pmfCapable &&
+	if (session->limRmfEnabled &&
 	    (rsn->RSN_Cap[0] & WLAN_CRYPTO_RSN_CAP_MFP_ENABLED) == 0 &&
 	    akm_type == ANI_AKM_TYPE_SAE)
 		status = STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION;

+ 7 - 2
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -708,6 +708,7 @@ __lim_handle_sme_start_bss_request(struct mac_context *mac_ctx, uint32_t *msg_bu
 	int32_t ucast_cipher;
 	int32_t auth_mode;
 	int32_t akm;
+	int32_t rsn_caps;
 
 /* FEATURE_WLAN_DIAG_SUPPORT */
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
@@ -859,8 +860,12 @@ __lim_handle_sme_start_bss_request(struct mac_context *mac_ctx, uint32_t *msg_bu
 
 		session->txLdpcIniFeatureEnabled =
 			sme_start_bss_req->txLdpcIniFeatureEnabled;
-		session->limRmfEnabled = sme_start_bss_req->pmfCapable ? 1 : 0;
-		pe_debug("RMF enabled: %d", session->limRmfEnabled);
+		rsn_caps = wlan_crypto_get_param(session->vdev,
+						 WLAN_CRYPTO_PARAM_RSN_CAP);
+		session->limRmfEnabled =
+			rsn_caps & WLAN_CRYPTO_RSN_CAP_MFP_ENABLED ? 1 : 0;
+		pe_debug("RMF enabled: %d rsn_caps 0x%x",
+			 session->limRmfEnabled, rsn_caps);
 
 		qdf_mem_copy((void *)&session->rateSet,
 			     (void *)&sme_start_bss_req->operationalRateSet,

+ 0 - 31
core/sap/src/sap_fsm.c

@@ -3207,32 +3207,6 @@ sapconvert_to_csr_profile(struct sap_config *config, eCsrRoamBssType bssType,
 		     config->SSIDinfo.ssid.ssId,
 		     sizeof(config->SSIDinfo.ssid.ssId));
 
-	profile->negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
-
-	if (config->authType == eSAP_OPEN_SYSTEM) {
-		profile->negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
-	} else if (config->authType == eSAP_SHARED_KEY) {
-		profile->negotiatedAuthType = eCSR_AUTH_TYPE_SHARED_KEY;
-	} else {
-		profile->negotiatedAuthType = eCSR_AUTH_TYPE_AUTOSWITCH;
-	}
-
-	profile->AuthType.numEntries = 1;
-	profile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
-
-	/* Always set the Encryption Type */
-	profile->EncryptionType.numEntries = 1;
-	profile->EncryptionType.encryptionType[0] =
-		config->RSNEncryptType;
-
-	profile->mcEncryptionType.numEntries = 1;
-	profile->mcEncryptionType.encryptionType[0] =
-		config->mcRSNEncryptType;
-
-	if (config->privacy & eSAP_SHARED_KEY) {
-		profile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY;
-	}
-
 	profile->privacy = config->privacy;
 	profile->fwdWPSPBCProbeReq = config->fwdWPSPBCProbeReq;
 
@@ -3294,14 +3268,9 @@ sapconvert_to_csr_profile(struct sap_config *config, eCsrRoamBssType bssType,
 	if (QDF_IS_STATUS_ERROR(qdf_status))
 		sap_err("Get ap protection mode failed using default value");
 	profile->cfg_protection = ap_prot;
-	profile->ieee80211d = config->ieee80211d;
 	/* wps config info */
 	profile->wps_state = config->wps_state;
 
-	/* MFP capable/required */
-	profile->MFPCapable = config->mfpCapable ? 1 : 0;
-	profile->MFPRequired = config->mfpRequired ? 1 : 0;
-
 	if (config->probeRespIEsBufferLen > 0 &&
 	    config->pProbeRespIEsBuffer) {
 		profile->add_ie_params.probeRespDataLen =

+ 1 - 3
core/sap/src/sap_module.c

@@ -319,9 +319,6 @@ QDF_STATUS sap_init_ctx(struct sap_context *sap_ctx,
 	sap_ctx->csr_roamProfile.csrPersona = mode;
 	qdf_mem_copy(sap_ctx->self_mac_addr, addr, QDF_MAC_ADDR_SIZE);
 
-	/* Now configure the auth type in the roaming profile. To open. */
-	sap_ctx->csr_roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;        /* open is the default */
-
 	mac = sap_get_mac_context();
 	if (!mac) {
 		sap_err("Invalid MAC context");
@@ -1881,6 +1878,7 @@ QDF_STATUS wlansap_channel_change_request(struct sap_context *sap_ctx,
 
 	status = sme_roam_channel_change_req(MAC_HANDLE(mac_ctx),
 					     sap_ctx->bssid,
+					     sap_ctx->sessionId,
 					     ch_params,
 					     &sap_ctx->csr_roamProfile);
 

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

@@ -531,19 +531,6 @@ struct csr_roam_profile {
 	/* this is bit mask of all the needed phy mode defined in eCsrPhyMode */
 	uint32_t phyMode;
 	eCsrRoamBssType BSSType;
-	tCsrAuthList AuthType;
-	enum csr_akm_type negotiatedAuthType;
-	tCsrEncryptionList EncryptionType;
-	/* This field is for output only, not for input */
-	eCsrEncryptionType negotiatedUCEncryptionType;
-	/*
-	 * eCSR_ENCRYPT_TYPE_ANY cannot be set in multicast encryption type.
-	 * If caller doesn't case, put all supported encryption types in here
-	 */
-	tCsrEncryptionList mcEncryptionType;
-	/* Management Frame Protection */
-	uint8_t MFPRequired;
-	uint8_t MFPCapable;
 	tCsrChannelInfo ChannelInfo;
 	uint32_t op_freq;
 	struct ch_params ch_params;
@@ -557,7 +544,6 @@ struct csr_roam_profile {
 	uint8_t uapsd_mask;
 	uint32_t nRSNReqIELength; /* The byte count in the pRSNReqIE */
 	uint8_t *pRSNReqIE;       /* If not null,it's IE byte stream for RSN */
-	uint8_t ieee80211d;
 	uint8_t privacy;
 	bool fwdWPSPBCProbeReq;
 	tAniAuthType csr80211AuthType;

+ 15 - 6
core/sme/inc/csr_internal.h

@@ -134,7 +134,6 @@ struct bss_config_param {
 	eCsrMediaAccessType qosType;
 	tSirMacSSid SSID;
 	enum csr_cfgdot11mode uCfgDot11Mode;
-	tAniAuthType authType;
 	tSirMacCapabilityInfo BssCap;
 	ePhyChanBondState cbMode;
 };
@@ -170,8 +169,6 @@ struct csr_roamstart_bssparams {
 	uint8_t *pRSNIE;        /* If not null, it has IE byte stream for RSN */
 	/* Flag used to indicate update beaconInterval */
 	bool updatebeaconInterval;
-	bool mfpCapable;
-	bool mfpRequired;
 	struct add_ie_params add_ie_params;
 	uint8_t sap_dot11mc;
 	uint16_t beacon_tx_rate;
@@ -611,10 +608,22 @@ bool csr_roam_is_fast_roam_enabled(struct mac_context *mac,  uint8_t vdev_id);
 bool csr_roam_is_roam_offload_scan_enabled(
 	struct mac_context *mac);
 
-/* Post Channel Change Indication */
+/**
+ * csr_roam_channel_change_req() - Post channel change request to LIM
+ * @mac: mac context
+ * @bssid: SAP bssid
+ * @vdev_id: vdev_id
+ * @ch_params: channel information
+ * @profile: CSR profile
+ *
+ * This API is primarily used to post Channel Change Req for SAP
+ *
+ * Return: QDF_STATUS
+ */
 QDF_STATUS csr_roam_channel_change_req(struct mac_context *mac,
-					struct qdf_mac_addr
-				       bssid, struct ch_params *ch_params,
+				       struct qdf_mac_addr bssid,
+				       uint8_t vdev_id,
+				       struct ch_params *ch_params,
 				       struct csr_roam_profile *profile);
 
 /* Post Beacon Tx Start Indication */

+ 0 - 10
core/sme/inc/csr_support.h

@@ -176,11 +176,6 @@ struct csr_timer_info {
 	 ((pIes)->WMMParams.qosInfo & SME_QOS_AP_SUPPORTS_APSD)) || \
 	 ((pIes)->WMMInfoAp.present && (pIes)->WMMInfoAp.uapsd))
 
-bool csr_get_bss_id_bss_desc(struct bss_description *pSirBssDesc,
-			     struct qdf_mac_addr *pBssId);
-bool csr_is_bss_id_equal(struct bss_description *pSirBssDesc1,
-			 struct bss_description *pSirBssDesc2);
-
 eCsrMediaAccessType
 csr_get_qos_from_bss_desc(struct mac_context *mac_ctx,
 			  struct bss_description *pSirBssDesc,
@@ -193,7 +188,6 @@ tSirResultCodes csr_get_de_auth_rsp_status_code(struct deauth_rsp *pSmeRsp);
 uint32_t csr_get_frag_thresh(struct mac_context *mac_ctx);
 uint32_t csr_get_rts_thresh(struct mac_context *mac_ctx);
 
-bool csr_rates_is_dot11_rate11b_supported_rate(uint8_t dot11Rate);
 bool csr_rates_is_dot11_rate11a_supported_rate(uint8_t dot11Rate);
 tAniEdType csr_translate_encrypt_type_to_ed_type(
 		eCsrEncryptionType EncryptType);
@@ -214,10 +208,6 @@ QDF_STATUS csr_get_parsed_bss_description_ies(struct mac_context *mac_ctx,
 					      struct bss_description *bss_desc,
 					      tDot11fBeaconIEs **ppIEStruct);
 
-QDF_STATUS csr_get_phy_mode_from_bss(struct mac_context *mac,
-		struct bss_description *pBSSDescription,
-		eCsrPhyMode *pPhyMode, tDot11fBeaconIEs *pIes);
-
 /**
  * csr_is_auth_type_ese() - Checks whether Auth type is ESE or not
  * @AuthType: Authentication type

+ 14 - 0
core/sme/inc/sme_api.h

@@ -1210,8 +1210,22 @@ QDF_STATUS sme_set_auto_shutdown_cb(mac_handle_t mac_handle,
 QDF_STATUS sme_set_auto_shutdown_timer(mac_handle_t mac_handle,
 				       uint32_t timer_value);
 #endif
+
+/**
+ * sme_roam_channel_change_req() - Channel change to new target channel
+ * @mac_handle: handle returned by mac_open
+ * @bssid: mac address of BSS
+ * @vdev_id: vdev_id
+ * @ch_params: target channel information
+ * @profile: CSR profile
+ *
+ * API to Indicate Channel change to new target channel
+ *
+ * Return: QDF_STATUS
+ */
 QDF_STATUS sme_roam_channel_change_req(mac_handle_t mac_handle,
 				       struct qdf_mac_addr bssid,
+				       uint8_t vdev_id,
 				       struct ch_params *ch_params,
 				       struct csr_roam_profile *profile);
 

+ 3 - 13
core/sme/src/common/sme_api.c

@@ -8370,19 +8370,9 @@ QDF_STATUS sme_set_mas(uint32_t val)
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * sme_roam_channel_change_req() - Channel change to new target channel
- * @mac_handle: handle returned by mac_open
- * @bssid: mac address of BSS
- * @ch_params: target channel information
- * @profile: CSR profile
- *
- * API to Indicate Channel change to new target channel
- *
- * Return: QDF_STATUS
- */
 QDF_STATUS sme_roam_channel_change_req(mac_handle_t mac_handle,
 				       struct qdf_mac_addr bssid,
+				       uint8_t vdev_id,
 				       struct ch_params *ch_params,
 				       struct csr_roam_profile *profile)
 {
@@ -8392,8 +8382,8 @@ QDF_STATUS sme_roam_channel_change_req(mac_handle_t mac_handle,
 	status = sme_acquire_global_lock(&mac->sme);
 	if (QDF_IS_STATUS_SUCCESS(status)) {
 
-		status = csr_roam_channel_change_req(mac, bssid, ch_params,
-				profile);
+		status = csr_roam_channel_change_req(mac, bssid, vdev_id,
+						     ch_params, profile);
 		sme_release_global_lock(&mac->sme);
 	}
 	return status;

+ 58 - 137
core/sme/src/csr/csr_api_roam.c

@@ -183,6 +183,7 @@ static QDF_STATUS csr_roam_free_connected_info(struct mac_context *mac,
 					       pConnectedInfo);
 static enum csr_cfgdot11mode
 csr_roam_get_phy_mode_band_for_bss(struct mac_context *mac,
+				   uint8_t vdev_id,
 				   struct csr_roam_profile *pProfile,
 				   uint32_t bss_op_ch_freq,
 				   enum reg_wifi_band *pBand);
@@ -2308,6 +2309,7 @@ QDF_STATUS csr_roam_issue_deauth_sta_cmd(struct mac_context *mac,
 
 QDF_STATUS csr_roam_prepare_bss_config_from_profile(struct mac_context *mac,
 					struct csr_roam_profile *pProfile,
+					uint8_t vdev_id,
 					struct bss_config_param *pBssConfig)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
@@ -2329,15 +2331,16 @@ QDF_STATUS csr_roam_prepare_bss_config_from_profile(struct mac_context *mac,
 	/* Settomg up the capabilities */
 	pBssConfig->BssCap.ess = 1;
 
-	if (eCSR_ENCRYPT_TYPE_NONE !=
-	    pProfile->EncryptionType.encryptionType[0])
+	/* set priv if not open mode */
+	if (!wlan_vdev_id_is_open_cipher(mac->pdev, vdev_id))
 		pBssConfig->BssCap.privacy = 1;
 
 	/* phymode */
 	if (pProfile->ChannelInfo.freq_list)
 		bss_op_ch_freq = pProfile->ChannelInfo.freq_list[0];
 	pBssConfig->uCfgDot11Mode = csr_roam_get_phy_mode_band_for_bss(
-						mac, pProfile, bss_op_ch_freq,
+						mac, vdev_id, pProfile,
+						bss_op_ch_freq,
 						&band);
 	/* QOS */
 	/* Is this correct to always set to this // *** */
@@ -2362,27 +2365,6 @@ QDF_STATUS csr_roam_prepare_bss_config_from_profile(struct mac_context *mac,
 		pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF;
 	}
 
-	/* auth type */
-	/* Take the preferred Auth type. */
-	switch (pProfile->AuthType.authType[0]) {
-	default:
-	case eCSR_AUTH_TYPE_WPA:
-	case eCSR_AUTH_TYPE_WPA_PSK:
-	case eCSR_AUTH_TYPE_WPA_NONE:
-	case eCSR_AUTH_TYPE_OPEN_SYSTEM:
-		pBssConfig->authType = eSIR_OPEN_SYSTEM;
-		break;
-	case eCSR_AUTH_TYPE_SHARED_KEY:
-		pBssConfig->authType = eSIR_SHARED_KEY;
-		break;
-	case eCSR_AUTH_TYPE_AUTOSWITCH:
-		pBssConfig->authType = eSIR_AUTO_SWITCH;
-		break;
-	case eCSR_AUTH_TYPE_SAE:
-	case eCSR_AUTH_TYPE_FT_SAE:
-		pBssConfig->authType = eSIR_AUTH_TYPE_SAE;
-		break;
-	}
 	/* short slot time */
 	if (WNI_CFG_PHY_MODE_11B != pBssConfig->uCfgDot11Mode) {
 		mac->mlme_cfg->feature_flags.enable_short_slot_time_11g =
@@ -2438,7 +2420,8 @@ static QDF_STATUS csr_set_qos_to_cfg(struct mac_context *mac, uint32_t sessionId
 
 static void csr_set_cfg_rate_set_from_profile(struct mac_context *mac,
 					      struct csr_roam_profile *pProfile,
-					      uint32_t session_id)
+					      uint32_t session_id,
+					      enum csr_cfgdot11mode cfgDot11Mode)
 {
 	tSirMacRateSetIE DefaultSupportedRates11a = { WLAN_ELEMID_RATES,
 						      {8,
@@ -2456,8 +2439,6 @@ static void csr_set_cfg_rate_set_from_profile(struct mac_context *mac,
 							SIR_MAC_RATE_2,
 							SIR_MAC_RATE_5_5,
 							SIR_MAC_RATE_11} } };
-	enum csr_cfgdot11mode cfgDot11Mode;
-	enum reg_wifi_band band;
 	/* leave enough room for the max number of rates */
 	uint8_t OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX];
 	qdf_size_t OperationalRatesLength = 0;
@@ -2470,16 +2451,14 @@ static void csr_set_cfg_rate_set_from_profile(struct mac_context *mac,
 
 	if (pProfile->ChannelInfo.freq_list)
 		bss_op_ch_freq = pProfile->ChannelInfo.freq_list[0];
-	cfgDot11Mode = csr_roam_get_phy_mode_band_for_bss(mac, pProfile,
-							  bss_op_ch_freq,
-							  &band);
+
 	/* For 11a networks, the 11a rates go into the Operational Rate set.
 	 * For 11b and 11g networks, the 11b rates appear in the Operational
 	 * Rate set. In either case, we can blindly put the rates we support
 	 * into our Operational Rate set (including the basic rates, which we
 	 * have already verified are supported earlier in the roaming decision).
 	 */
-	if (REG_BAND_5G == band) {
+	if (wlan_reg_is_5ghz_ch_freq(bss_op_ch_freq)) {
 		/* 11a rates into the Operational Rate Set. */
 		OperationalRatesLength =
 			DefaultSupportedRates11a.supportedRateSet.numRates *
@@ -2585,53 +2564,17 @@ QDF_STATUS csr_roam_set_bss_config_cfg(struct mac_context *mac, uint32_t session
 	}
 	/* Rate */
 	/* Fixed Rate */
-	csr_set_cfg_rate_set_from_profile(mac, pProfile, sessionId);
+	csr_set_cfg_rate_set_from_profile(mac, pProfile, sessionId,
+					  pBssConfig->uCfgDot11Mode);
 
 	csr_roam_substate_change(mac, eCSR_ROAM_SUBSTATE_CONFIG, sessionId);
+	pSession->bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode;
 
 	csr_roam_ccm_cfg_set_callback(mac, sessionId);
 
 	return QDF_STATUS_SUCCESS;
 }
 
-/* In case no matching BSS is found, use whatever default we can find */
-static void csr_roam_assign_default_param(struct mac_context *mac,
-					tSmeCmd *pCommand)
-{
-	/* Need to get all negotiated types in place first */
-	/* auth type */
-	/* Take the preferred Auth type. */
-	switch (pCommand->u.roamCmd.roamProfile.AuthType.authType[0]) {
-	default:
-	case eCSR_AUTH_TYPE_WPA:
-	case eCSR_AUTH_TYPE_WPA_PSK:
-	case eCSR_AUTH_TYPE_WPA_NONE:
-	case eCSR_AUTH_TYPE_OPEN_SYSTEM:
-		pCommand->u.roamCmd.roamProfile.negotiatedAuthType =
-			eCSR_AUTH_TYPE_OPEN_SYSTEM;
-		break;
-
-	case eCSR_AUTH_TYPE_SHARED_KEY:
-		pCommand->u.roamCmd.roamProfile.negotiatedAuthType =
-			eCSR_AUTH_TYPE_SHARED_KEY;
-		break;
-
-	case eCSR_AUTH_TYPE_AUTOSWITCH:
-		pCommand->u.roamCmd.roamProfile.negotiatedAuthType =
-			eCSR_AUTH_TYPE_AUTOSWITCH;
-		break;
-
-	case eCSR_AUTH_TYPE_SAE:
-	case eCSR_AUTH_TYPE_FT_SAE:
-		pCommand->u.roamCmd.roamProfile.negotiatedAuthType =
-			eCSR_AUTH_TYPE_SAE;
-		break;
-	}
-	pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType =
-		pCommand->u.roamCmd.roamProfile.EncryptionType.
-		encryptionType[0];
-}
-
 /**
  * csr_roam_start_bss() - Handle start bss scenario based on profile
  * @mac_ctx:             Global MAC Context
@@ -2651,33 +2594,26 @@ static void csr_roam_start_bss(struct mac_context *mac_ctx,
 
 	if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) {
 		sme_err("Invalid session id %d", session_id);
+		*roam_state = eCsrStopRoaming;
 		return;
 	}
 	session = CSR_GET_SESSION(mac_ctx, session_id);
 
 	if (CSR_IS_INFRA_AP(profile)) {
-		/* Attempt to start this WDS... */
-		csr_roam_assign_default_param(mac_ctx, cmd);
-		/* For AP WDS, we dont have any BSSDescription */
 		status = csr_roam_start_wds(mac_ctx, session_id, profile);
-		if (QDF_IS_STATUS_SUCCESS(status))
-			*roam_state = eCsrContinueRoaming;
-		else
-			*roam_state = eCsrStopRoaming;
 	} else if (CSR_IS_NDI(profile)) {
-		csr_roam_assign_default_param(mac_ctx, cmd);
 		status = csr_roam_start_ndi(mac_ctx, session_id, profile);
-		if (QDF_IS_STATUS_SUCCESS(status))
-			*roam_state = eCsrContinueRoaming;
-		else
-			*roam_state = eCsrStopRoaming;
 	} else {
 		/* Nothing we can do */
 		sme_warn("cannot continue without BSS list");
-		*roam_state = eCsrStopRoaming;
-		return;
+		status = QDF_STATUS_E_INVAL;
 	}
 
+	if (QDF_IS_STATUS_SUCCESS(status))
+		*roam_state = eCsrContinueRoaming;
+	else
+		*roam_state = eCsrStopRoaming;
+
 }
 
 static QDF_STATUS csr_start_bss(struct mac_context *mac, tSmeCmd *pCommand)
@@ -3205,14 +3141,6 @@ QDF_STATUS csr_roam_copy_profile(struct mac_context *mac,
 			     sizeof(uint32_t) *
 			     pSrcProfile->ChannelInfo.numOfChannels);
 	}
-	pDstProfile->AuthType = pSrcProfile->AuthType;
-	pDstProfile->EncryptionType = pSrcProfile->EncryptionType;
-	pDstProfile->negotiatedUCEncryptionType =
-		pSrcProfile->negotiatedUCEncryptionType;
-	pDstProfile->mcEncryptionType = pSrcProfile->mcEncryptionType;
-	pDstProfile->negotiatedAuthType = pSrcProfile->negotiatedAuthType;
-	pDstProfile->MFPRequired = pSrcProfile->MFPRequired;
-	pDstProfile->MFPCapable = pSrcProfile->MFPCapable;
 	pDstProfile->BSSType = pSrcProfile->BSSType;
 	pDstProfile->phyMode = pSrcProfile->phyMode;
 	pDstProfile->csrPersona = pSrcProfile->csrPersona;
@@ -3237,9 +3165,6 @@ QDF_STATUS csr_roam_copy_profile(struct mac_context *mac,
 	pDstProfile->obssProtEnabled = pSrcProfile->obssProtEnabled;
 	pDstProfile->cfg_protection = pSrcProfile->cfg_protection;
 	pDstProfile->wps_state = pSrcProfile->wps_state;
-	pDstProfile->ieee80211d = pSrcProfile->ieee80211d;
-	pDstProfile->MFPRequired = pSrcProfile->MFPRequired;
-	pDstProfile->MFPCapable = pSrcProfile->MFPCapable;
 	pDstProfile->add_ie_params = pSrcProfile->add_ie_params;
 
 	pDstProfile->beacon_tx_rate = pSrcProfile->beacon_tx_rate;
@@ -3334,6 +3259,8 @@ QDF_STATUS csr_bss_start(struct mac_context *mac, uint32_t vdev_id,
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	uint32_t id = 0;
 	struct csr_roam_session *session = CSR_GET_SESSION(mac, vdev_id);
+	struct wlan_objmgr_vdev *vdev;
+	int32_t cipher, mc_cipher, akm;
 
 	if (!session) {
 		sme_err("session does not exist for given sessionId: %d",
@@ -3345,11 +3272,19 @@ QDF_STATUS csr_bss_start(struct mac_context *mac, uint32_t vdev_id,
 		sme_err("No profile specified");
 		return QDF_STATUS_E_FAILURE;
 	}
+	vdev = wlan_objmgr_get_vdev_by_id_from_pdev(mac->pdev, vdev_id,
+						    WLAN_LEGACY_MAC_ID);
+	if (!vdev) {
+		sme_err("No vdev for vdev id %d", vdev_id);
+		return QDF_STATUS_E_FAILURE;
+	}
+	cipher = wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_UCAST_CIPHER);
+	mc_cipher = wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_MCAST_CIPHER);
+	akm = wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_KEY_MGMT);
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
 
-	sme_debug("Persona %d authtype %d  encryType %d mc_encType %d",
-		  profile->csrPersona, profile->AuthType.authType[0],
-		  profile->EncryptionType.encryptionType[0],
-		  profile->mcEncryptionType.encryptionType[0]);
+	sme_debug("vdev_id %d Persona %d akm 0x%x uc cipher 0x%x mc cipher 0x%x",
+		  vdev_id, profile->csrPersona, akm, cipher, mc_cipher);
 
 	csr_flush_pending_start_bss_cmd(mac, vdev_id);
 	id = GET_NEXT_ROAM_ID(&mac->roam);
@@ -5253,12 +5188,14 @@ csr_compute_mode_and_band(struct mac_context *mac_ctx,
  */
 static enum csr_cfgdot11mode
 csr_roam_get_phy_mode_band_for_bss(struct mac_context *mac_ctx,
+				   uint8_t vdev_id,
 				   struct csr_roam_profile *profile,
 				   uint32_t bss_op_ch_freq,
 				   enum reg_wifi_band *p_band)
 {
 	enum reg_wifi_band band = REG_BAND_2G;
-	uint8_t opr_freq = 0;
+	qdf_freq_t opr_freq = 0;
+	bool is_11n_allowed;
 	enum csr_cfgdot11mode curr_mode =
 		mac_ctx->roam.configParam.uCfgDot11Mode;
 	enum csr_cfgdot11mode cfg_dot11_mode =
@@ -5310,22 +5247,23 @@ csr_roam_get_phy_mode_band_for_bss(struct mac_context *mac_ctx,
 	 * Incase of WEP Security encryption type is coming as part of add key.
 	 * So while STart BSS dont have information
 	 */
-	if ((!CSR_IS_11n_ALLOWED(profile->EncryptionType.encryptionType[0])
-	    || ((profile->privacy == 1)
-		&& (profile->EncryptionType.encryptionType[0] ==
-		eCSR_ENCRYPT_TYPE_NONE)))
-		&& ((eCSR_CFG_DOT11_MODE_11N == cfg_dot11_mode) ||
-		    (eCSR_CFG_DOT11_MODE_11AC == cfg_dot11_mode) ||
-		    (eCSR_CFG_DOT11_MODE_11AX == cfg_dot11_mode) ||
-		    CSR_IS_CFG_DOT11_PHY_MODE_11BE(cfg_dot11_mode))) {
+	is_11n_allowed = wlan_vdev_id_is_11n_allowed(mac_ctx->pdev, vdev_id);
+	if ((!is_11n_allowed || (profile->privacy &&
+	       wlan_vdev_id_is_open_cipher(mac_ctx->pdev, vdev_id))) &&
+	      ((eCSR_CFG_DOT11_MODE_11N == cfg_dot11_mode) ||
+		(eCSR_CFG_DOT11_MODE_11AC == cfg_dot11_mode) ||
+		(eCSR_CFG_DOT11_MODE_11AX == cfg_dot11_mode) ||
+		CSR_IS_CFG_DOT11_PHY_MODE_11BE(cfg_dot11_mode))) {
 		/* We cannot do 11n here */
 		if (wlan_reg_is_24ghz_ch_freq(bss_op_ch_freq))
 			cfg_dot11_mode = eCSR_CFG_DOT11_MODE_11G;
 		else
 			cfg_dot11_mode = eCSR_CFG_DOT11_MODE_11A;
 	}
-	sme_debug("dot11mode: %d phyMode %d fw sup AX %d", cfg_dot11_mode,
-		  profile->phyMode, IS_FEATURE_SUPPORTED_BY_FW(DOT11AX));
+	sme_debug("dot11mode: %d phyMode %d is_11n_allowed %d privacy %d chan freq %d fw sup AX %d",
+		  cfg_dot11_mode, profile->phyMode, is_11n_allowed,
+		  profile->privacy, bss_op_ch_freq,
+		  IS_FEATURE_SUPPORTED_BY_FW(DOT11AX));
 #ifdef WLAN_FEATURE_11BE
 	sme_debug("BE :%d", IS_FEATURE_SUPPORTED_BY_FW(DOT11BE));
 #endif
@@ -5485,6 +5423,7 @@ static void csr_populate_supported_rates_from_hostapd(tSirMacRateSet *opr_rates,
 /**
  * csr_roam_get_bss_start_parms() - get bss start param from profile
  * @mac:          mac global context
+ * @vdev_id: vdev id
  * @pProfile:      roam profile
  * @pParam:        out param, start bss params
  * @skip_hostapd_rate: to skip given hostapd's rate
@@ -5495,6 +5434,7 @@ static void csr_populate_supported_rates_from_hostapd(tSirMacRateSet *opr_rates,
  */
 static QDF_STATUS
 csr_roam_get_bss_start_parms(struct mac_context *mac,
+			     uint8_t vdev_id,
 			     struct csr_roam_profile *pProfile,
 			     struct csr_roamstart_bssparams *pParam,
 			     bool skip_hostapd_rate)
@@ -5511,7 +5451,7 @@ csr_roam_get_bss_start_parms(struct mac_context *mac,
 		tmp_opr_ch_freq = pProfile->ChannelInfo.freq_list[0];
 
 	pParam->uCfgDot11Mode =
-		csr_roam_get_phy_mode_band_for_bss(mac, pProfile,
+		csr_roam_get_phy_mode_band_for_bss(mac, vdev_id, pProfile,
 						   tmp_opr_ch_freq,
 						   &band);
 
@@ -5628,7 +5568,6 @@ QDF_STATUS csr_roam_issue_start_bss(struct mac_context *mac, uint32_t sessionId,
 				    uint32_t roamId)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	enum reg_wifi_band band;
 	/* Set the roaming substate to 'Start BSS attempt'... */
 	csr_roam_substate_change(mac, eCSR_ROAM_SUBSTATE_START_BSS_REQ,
 				 sessionId);
@@ -5654,16 +5593,8 @@ QDF_STATUS csr_roam_issue_start_bss(struct mac_context *mac, uint32_t sessionId,
 	pParam->obssProtEnabled = pProfile->obssProtEnabled;
 	pParam->ht_protection = pProfile->cfg_protection;
 	pParam->wps_state = pProfile->wps_state;
-
-	pParam->uCfgDot11Mode =
-		csr_roam_get_phy_mode_band_for_bss(mac, pProfile,
-						   pParam->operation_chan_freq,
-						   &band);
 	pParam->bssPersona = pProfile->csrPersona;
 
-	pParam->mfpCapable = (0 != pProfile->MFPCapable);
-	pParam->mfpRequired = (0 != pProfile->MFPRequired);
-
 	pParam->add_ie_params.probeRespDataLen =
 		pProfile->add_ie_params.probeRespDataLen;
 	pParam->add_ie_params.probeRespData_buff =
@@ -5684,7 +5615,8 @@ QDF_STATUS csr_roam_issue_start_bss(struct mac_context *mac, uint32_t sessionId,
 	else
 		pParam->sap_dot11mc = 1;
 
-	sme_debug("11MC Support Enabled : %d", pParam->sap_dot11mc);
+	sme_debug("11MC Support Enabled : %d uCfgDot11Mode %d",
+		  pParam->sap_dot11mc, pParam->uCfgDot11Mode);
 
 	pParam->cac_duration_ms = pProfile->cac_duration_ms;
 	pParam->dfs_regdomain = pProfile->dfs_regdomain;
@@ -5708,7 +5640,8 @@ void csr_roam_prepare_bss_params(struct mac_context *mac, uint32_t sessionId,
 		return;
 	}
 
-	csr_roam_get_bss_start_parms(mac, pProfile, &pSession->bssParams,
+	csr_roam_get_bss_start_parms(mac, sessionId, pProfile, 
+				     &pSession->bssParams,
 				     skip_hostapd_rate);
 	/* Use the first SSID */
 	if (pProfile->SSIDs.numOfSSIDs)
@@ -5859,6 +5792,7 @@ static QDF_STATUS csr_roam_start_wds(struct mac_context *mac, uint32_t sessionId
 	 * Profile.
 	 */
 	status = csr_roam_prepare_bss_config_from_profile(mac, pProfile,
+							  sessionId,
 							  &bssConfig);
 	if (QDF_IS_STATUS_SUCCESS(status)) {
 		/* Prepare some more parameters for this WDS */
@@ -6925,9 +6859,6 @@ QDF_STATUS csr_send_mb_start_bss_req_msg(struct mac_context *mac, uint32_t
 	pMsg->bssPersona = pParam->bssPersona;
 	pMsg->txLdpcIniFeatureEnabled = mac->mlme_cfg->ht_caps.tx_ldpc_enable;
 
-	pMsg->pmfCapable = pParam->mfpCapable;
-	pMsg->pmfRequired = pParam->mfpRequired;
-
 	if (pParam->nRSNIELength > sizeof(pMsg->rsnIE.rsnIEdata)) {
 		qdf_mem_free(pMsg);
 		return QDF_STATUS_E_INVAL;
@@ -7765,19 +7696,9 @@ QDF_STATUS csr_roam_update_config(struct mac_context *mac_ctx, uint8_t session_i
 	return status;
 }
 
-/**
- * csr_roam_channel_change_req() - Post channel change request to LIM
- * @mac: mac context
- * @bssid: SAP bssid
- * @ch_params: channel information
- * @profile: CSR profile
- *
- * This API is primarily used to post Channel Change Req for SAP
- *
- * Return: QDF_STATUS
- */
 QDF_STATUS csr_roam_channel_change_req(struct mac_context *mac,
 				       struct qdf_mac_addr bssid,
+				       uint8_t vdev_id,
 				       struct ch_params *ch_params,
 				       struct csr_roam_profile *profile)
 {
@@ -7794,7 +7715,7 @@ QDF_STATUS csr_roam_channel_change_req(struct mac_context *mac,
 	 */
 	qdf_mem_zero(&param, sizeof(struct csr_roamstart_bssparams));
 
-	status = csr_roam_get_bss_start_parms(mac, profile, &param,
+	status = csr_roam_get_bss_start_parms(mac, vdev_id, profile, &param,
 					      skip_hostapd_rate);
 
 	if (status != QDF_STATUS_SUCCESS) {

+ 1 - 20
core/sme/src/csr/csr_inside_api.h

@@ -79,14 +79,6 @@ struct scan_result_list {
 #define CSR_IS_WAIT_FOR_KEY(mac, sessionId) \
 		 (CSR_IS_ROAM_JOINED(mac, sessionId) && \
 		  CSR_IS_ROAM_SUBSTATE_WAITFORKEY(mac, sessionId))
-/* WIFI has a test case for not using HT rates with TKIP as encryption */
-/* We may need to add WEP but for now, TKIP only. */
-
-#define CSR_IS_11n_ALLOWED(encType) ((eCSR_ENCRYPT_TYPE_TKIP != (encType)) && \
-			(eCSR_ENCRYPT_TYPE_WEP40_STATICKEY != (encType)) && \
-			(eCSR_ENCRYPT_TYPE_WEP104_STATICKEY != (encType)) && \
-				     (eCSR_ENCRYPT_TYPE_WEP40 != (encType)) && \
-				       (eCSR_ENCRYPT_TYPE_WEP104 != (encType)))
 
 enum csr_roam_state csr_roam_state_change(struct mac_context *mac,
 					  enum csr_roam_state NewRoamState,
@@ -169,18 +161,6 @@ QDF_STATUS csr_send_mb_start_bss_req_msg(struct mac_context *mac,
 QDF_STATUS csr_send_mb_stop_bss_req_msg(struct mac_context *mac,
 					uint32_t sessionId);
 
-/* Caller should put the BSS' ssid to fiedl bssSsid when
- * comparing SSID for a BSS.
- */
-bool csr_is_ssid_match(struct mac_context *mac, uint8_t *ssid1, uint8_t ssid1Len,
-		       uint8_t *bssSsid, uint8_t bssSsidLen,
-			bool fSsidRequired);
-bool csr_is_phy_mode_match(struct mac_context *mac, uint32_t phyMode,
-			   struct bss_description *pSirBssDesc,
-			   struct csr_roam_profile *pProfile,
-			   enum csr_cfgdot11mode *pReturnCfgDot11Mode,
-			   tDot11fBeaconIEs *pIes);
-
 /**
  * csr_get_cfg_valid_channels() - Get valid channel frequency list
  * @mac: mac context
@@ -577,6 +557,7 @@ QDF_STATUS csr_set_ht2040_mode(struct mac_context *mac, uint32_t sessionId,
 QDF_STATUS
 csr_roam_prepare_bss_config_from_profile(struct mac_context *mac_ctx,
 					 struct csr_roam_profile *profile,
+					 uint8_t vdev_id,
 					 struct bss_config_param *bss_cfg);
 
 void

+ 0 - 658
core/sme/src/csr/csr_util.c

@@ -392,38 +392,6 @@ tListElem *csr_nonscan_pending_ll_next(struct mac_context *mac_ctx,
 	return NULL;
 }
 
-bool csr_get_bss_id_bss_desc(struct bss_description *pSirBssDesc,
-			     struct qdf_mac_addr *pBssId)
-{
-	qdf_mem_copy(pBssId, &pSirBssDesc->bssId[0],
-			sizeof(struct qdf_mac_addr));
-	return true;
-}
-
-bool csr_is_bss_id_equal(struct bss_description *pSirBssDesc1,
-			 struct bss_description *pSirBssDesc2)
-{
-	bool fEqual = false;
-	struct qdf_mac_addr bssId1;
-	struct qdf_mac_addr bssId2;
-
-	do {
-		if (!pSirBssDesc1)
-			break;
-		if (!pSirBssDesc2)
-			break;
-
-		if (!csr_get_bss_id_bss_desc(pSirBssDesc1, &bssId1))
-			break;
-		if (!csr_get_bss_id_bss_desc(pSirBssDesc2, &bssId2))
-			break;
-
-		fEqual = qdf_is_macaddr_equal(&bssId1, &bssId2);
-	} while (0);
-
-	return fEqual;
-}
-
 static bool csr_is_conn_state(struct mac_context *mac_ctx, uint32_t session_id,
 			      eCsrConnectState state)
 {
@@ -1173,60 +1141,6 @@ uint32_t csr_get_rts_thresh(struct mac_context *mac_ctx)
 	return mac_ctx->mlme_cfg->threshold.rts_threshold;
 }
 
-static eCsrPhyMode
-csr_translate_to_phy_mode_from_bss_desc(struct mac_context *mac_ctx,
-					struct bss_description *pSirBssDesc,
-					tDot11fBeaconIEs *ies)
-{
-	eCsrPhyMode phyMode;
-	uint8_t i;
-
-	switch (pSirBssDesc->nwType) {
-	case eSIR_11A_NW_TYPE:
-		phyMode = eCSR_DOT11_MODE_11a;
-		break;
-
-	case eSIR_11B_NW_TYPE:
-		phyMode = eCSR_DOT11_MODE_11b;
-		break;
-
-	case eSIR_11G_NW_TYPE:
-		phyMode = eCSR_DOT11_MODE_11g_ONLY;
-
-		/* Check if the BSS is in b/g mixed mode or g_only mode */
-		if (!ies || !ies->SuppRates.present) {
-			sme_debug("Unable to get rates, assume G only mode");
-			break;
-		}
-
-		for (i = 0; i < ies->SuppRates.num_rates; i++) {
-			if (csr_rates_is_dot11_rate11b_supported_rate(
-			    ies->SuppRates.rates[i])) {
-				sme_debug("One B rate is supported");
-				phyMode = eCSR_DOT11_MODE_11g;
-				break;
-			}
-		}
-		break;
-	case eSIR_11N_NW_TYPE:
-		phyMode = eCSR_DOT11_MODE_11n;
-		break;
-	case eSIR_11AX_NW_TYPE:
-		phyMode = eCSR_DOT11_MODE_11ax;
-		break;
-#ifdef WLAN_FEATURE_11BE
-	case eSIR_11BE_NW_TYPE:
-		phyMode = eCSR_DOT11_MODE_11be;
-		break;
-#endif
-	case eSIR_11AC_NW_TYPE:
-	default:
-		phyMode = eCSR_DOT11_MODE_11ac;
-		break;
-	}
-	return phyMode;
-}
-
 uint32_t csr_translate_to_wni_cfg_dot11_mode(struct mac_context *mac,
 					     enum csr_cfgdot11mode csrDot11Mode)
 {
@@ -1326,514 +1240,6 @@ uint32_t csr_translate_to_wni_cfg_dot11_mode(struct mac_context *mac,
 	return ret;
 }
 
-/**
- * csr_get_phy_mode_from_bss() - Get Phy Mode
- * @mac:           Global MAC context
- * @pBSSDescription: BSS Descriptor
- * @pPhyMode:        Physical Mode
- * @pIes:            Pointer to the IE fields
- *
- * This function should only return the super set of supported modes
- * 11n implies 11b/g/a/n.
- *
- * Return: success
- **/
-QDF_STATUS csr_get_phy_mode_from_bss(struct mac_context *mac,
-		struct bss_description *pBSSDescription,
-		eCsrPhyMode *pPhyMode, tDot11fBeaconIEs *pIes)
-{
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	eCsrPhyMode phyMode =
-		csr_translate_to_phy_mode_from_bss_desc(mac, pBSSDescription,
-							pIes);
-
-	if (pIes) {
-		if (pIes->HTCaps.present) {
-			phyMode = eCSR_DOT11_MODE_11n;
-			if (IS_BSS_VHT_CAPABLE(pIes->VHTCaps) ||
-				IS_BSS_VHT_CAPABLE(pIes->vendor_vht_ie.VHTCaps))
-				phyMode = eCSR_DOT11_MODE_11ac;
-			if (pIes->he_cap.present)
-				phyMode = eCSR_DOT11_MODE_11ax;
-			if (pIes->eht_cap.present)
-				phyMode = eCSR_DOT11_MODE_11be;
-		} else if (WLAN_REG_IS_6GHZ_CHAN_FREQ(
-					pBSSDescription->chan_freq)) {
-			if (pIes->eht_cap.present)
-				phyMode = eCSR_DOT11_MODE_11be;
-			else if (pIes->he_cap.present)
-				phyMode = eCSR_DOT11_MODE_11ax;
-			else
-				sme_debug("Warning - 6Ghz AP no he cap");
-		} else {
-			if (pIes->he_cap.present)
-				phyMode = eCSR_DOT11_MODE_11ax;
-			if (pIes->eht_cap.present)
-				phyMode = eCSR_DOT11_MODE_11be;
-		}
-
-		*pPhyMode = phyMode;
-	}
-
-	return status;
-}
-
-/**
- * csr_get_phy_mode_in_use() - to get phymode
- * @phyModeIn: physical mode
- * @bssPhyMode: physical mode in bss
- * @f5GhzBand: 5Ghz band
- * @pCfgDot11ModeToUse: dot11 mode in use
- *
- * This function returns the correct eCSR_CFG_DOT11_MODE is the two phyModes
- * matches. bssPhyMode is the mode derived from the BSS description
- * f5GhzBand is derived from the channel id of BSS description
- *
- * Return: true or false
- */
-static bool csr_get_phy_mode_in_use(struct mac_context *mac_ctx,
-				    eCsrPhyMode phyModeIn,
-				    eCsrPhyMode bssPhyMode,
-				    bool f5GhzBand,
-				    enum csr_cfgdot11mode *pCfgDot11ModeToUse)
-{
-	bool fMatch = false;
-	enum csr_cfgdot11mode cfgDot11Mode;
-
-	cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
-	switch (phyModeIn) {
-	/* 11a or 11b or 11g */
-	case eCSR_DOT11_MODE_abg:
-		fMatch = true;
-		if (f5GhzBand)
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
-		else if (eCSR_DOT11_MODE_11b == bssPhyMode)
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
-		else
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
-		break;
-
-	case eCSR_DOT11_MODE_11a:
-		if (f5GhzBand) {
-			fMatch = true;
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
-		}
-		break;
-
-	case eCSR_DOT11_MODE_11g:
-		if (!f5GhzBand) {
-			fMatch = true;
-			if (eCSR_DOT11_MODE_11b == bssPhyMode)
-				cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
-			else
-				cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
-		}
-		break;
-
-	case eCSR_DOT11_MODE_11g_ONLY:
-		if ((bssPhyMode == eCSR_DOT11_MODE_11g) ||
-		    (bssPhyMode == eCSR_DOT11_MODE_11g_ONLY)) {
-			fMatch = true;
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
-		}
-		break;
-
-	case eCSR_DOT11_MODE_11b:
-	case eCSR_DOT11_MODE_11b_ONLY:
-		if (!f5GhzBand && (bssPhyMode != eCSR_DOT11_MODE_11g_ONLY)) {
-			fMatch = true;
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
-		}
-		break;
-
-	case eCSR_DOT11_MODE_11n:
-		fMatch = true;
-		switch (bssPhyMode) {
-		case eCSR_DOT11_MODE_11g:
-		case eCSR_DOT11_MODE_11g_ONLY:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
-			break;
-		case eCSR_DOT11_MODE_11b:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
-			break;
-		case eCSR_DOT11_MODE_11a:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
-			break;
-		case eCSR_DOT11_MODE_11n:
-		case eCSR_DOT11_MODE_11ac:
-		case eCSR_DOT11_MODE_11ax:
-		case eCSR_DOT11_MODE_11be:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
-			break;
-
-		default:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
-			break;
-		}
-		break;
-
-	case eCSR_DOT11_MODE_11n_ONLY:
-		if (eCSR_DOT11_MODE_11n == bssPhyMode ||
-			bssPhyMode >= eCSR_DOT11_MODE_11ac) {
-			fMatch = true;
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
-
-		}
-
-		break;
-	case eCSR_DOT11_MODE_11ac:
-		fMatch = true;
-		switch (bssPhyMode) {
-		case eCSR_DOT11_MODE_11g:
-		case eCSR_DOT11_MODE_11g_ONLY:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
-			break;
-		case eCSR_DOT11_MODE_11b:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
-			break;
-		case eCSR_DOT11_MODE_11a:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
-			break;
-		case eCSR_DOT11_MODE_11n:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
-			break;
-		case eCSR_DOT11_MODE_11ac:
-		case eCSR_DOT11_MODE_11ax:
-		case eCSR_DOT11_MODE_11be:
-		default:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
-			break;
-		}
-		break;
-
-	case eCSR_DOT11_MODE_11ac_ONLY:
-		if (eCSR_DOT11_MODE_11ac == bssPhyMode) {
-			fMatch = true;
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
-		}
-		break;
-	case eCSR_DOT11_MODE_11ax:
-		fMatch = true;
-		switch (bssPhyMode) {
-		case eCSR_DOT11_MODE_11g:
-		case eCSR_DOT11_MODE_11g_ONLY:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
-			break;
-		case eCSR_DOT11_MODE_11b:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
-			break;
-		case eCSR_DOT11_MODE_11a:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
-			break;
-		case eCSR_DOT11_MODE_11n:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
-			break;
-		case eCSR_DOT11_MODE_11ac:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
-			break;
-		case eCSR_DOT11_MODE_11ax:
-		case eCSR_DOT11_MODE_11be:
-		default:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AX;
-			break;
-		}
-		break;
-
-	case eCSR_DOT11_MODE_11ax_ONLY:
-		if (eCSR_DOT11_MODE_11ax == bssPhyMode) {
-			fMatch = true;
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AX;
-		}
-		break;
-
-	case eCSR_DOT11_MODE_11be:
-		fMatch = true;
-		switch (bssPhyMode) {
-		case eCSR_DOT11_MODE_11g:
-		case eCSR_DOT11_MODE_11g_ONLY:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
-			break;
-		case eCSR_DOT11_MODE_11b:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
-			break;
-		case eCSR_DOT11_MODE_11a:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
-			break;
-		case eCSR_DOT11_MODE_11n:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
-			break;
-		case eCSR_DOT11_MODE_11ac:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
-			break;
-		case eCSR_DOT11_MODE_11ax:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AX;
-			break;
-		case eCSR_DOT11_MODE_11be:
-		default:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11BE;
-			break;
-		}
-		break;
-
-	case eCSR_DOT11_MODE_11be_ONLY:
-		if (CSR_IS_DOT11_PHY_MODE_11BE(bssPhyMode)) {
-			fMatch = true;
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11BE;
-		}
-		break;
-
-	default:
-		fMatch = true;
-		switch (bssPhyMode) {
-		case eCSR_DOT11_MODE_11g:
-		case eCSR_DOT11_MODE_11g_ONLY:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
-			break;
-		case eCSR_DOT11_MODE_11b:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
-			break;
-		case eCSR_DOT11_MODE_11a:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
-			break;
-		case eCSR_DOT11_MODE_11n:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
-			break;
-		case eCSR_DOT11_MODE_11ac:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
-			break;
-		case eCSR_DOT11_MODE_11ax:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AX;
-			break;
-		case eCSR_DOT11_MODE_11be:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_11BE;
-			break;
-		default:
-			cfgDot11Mode = eCSR_CFG_DOT11_MODE_AUTO;
-			break;
-		}
-		break;
-	}
-
-	if (fMatch && pCfgDot11ModeToUse) {
-		if (CSR_IS_CFG_DOT11_PHY_MODE_11BE(cfgDot11Mode)) {
-#ifdef WLAN_FEATURE_11BE
-			if (IS_FEATURE_SUPPORTED_BY_FW(DOT11BE))
-				*pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11BE;
-			else
-#endif
-			if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX))
-				*pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AX;
-			else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
-				*pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AC;
-			else
-				*pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
-		} else if (cfgDot11Mode == eCSR_CFG_DOT11_MODE_11AX) {
-			if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX))
-				*pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AX;
-			else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
-				*pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AC;
-			else
-				*pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
-		} else {
-			if (cfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC
-			    && (!IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)))
-				*pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
-			else
-				*pCfgDot11ModeToUse = cfgDot11Mode;
-		}
-	}
-	return fMatch;
-}
-
-/**
- * csr_is_phy_mode_match() - to find if phy mode matches
- * @mac: pointer to mac context
- * @phyMode: physical mode
- * @pSirBssDesc: bss description
- * @pProfile: pointer to roam profile
- * @pReturnCfgDot11Mode: dot1 mode to return
- * @pIes: pointer to IEs
- *
- * This function decides whether the one of the bit of phyMode is matching the
- * mode in the BSS and allowed by the user setting
- *
- * Return: true or false based on mode that fits the criteria
- */
-bool csr_is_phy_mode_match(struct mac_context *mac, uint32_t phyMode,
-			   struct bss_description *pSirBssDesc,
-			   struct csr_roam_profile *pProfile,
-			   enum csr_cfgdot11mode *pReturnCfgDot11Mode,
-			   tDot11fBeaconIEs *pIes)
-{
-	bool fMatch = false;
-	eCsrPhyMode phyModeInBssDesc = eCSR_DOT11_MODE_AUTO;
-	eCsrPhyMode phyMode2 = eCSR_DOT11_MODE_AUTO;
-	enum csr_cfgdot11mode cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_AUTO;
-	uint32_t bitMask, loopCount;
-	uint32_t bss_chan_freq;
-
-	if (!pProfile) {
-		sme_err("profile not found");
-		return fMatch;
-	}
-
-	if (!QDF_IS_STATUS_SUCCESS(csr_get_phy_mode_from_bss(mac, pSirBssDesc,
-					&phyModeInBssDesc, pIes)))
-		return fMatch;
-
-	bss_chan_freq = pSirBssDesc->chan_freq;
-
-	if ((0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode)) {
-		if (eCSR_CFG_DOT11_MODE_ABG ==
-				mac->roam.configParam.uCfgDot11Mode) {
-			phyMode = eCSR_DOT11_MODE_abg;
-		} else if (eCSR_CFG_DOT11_MODE_AUTO ==
-				mac->roam.configParam.uCfgDot11Mode) {
-#ifdef WLAN_FEATURE_11BE
-			if (IS_FEATURE_SUPPORTED_BY_FW(DOT11BE))
-				phyMode = eCSR_DOT11_MODE_11be;
-			else
-#endif
-			if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX))
-				phyMode = eCSR_DOT11_MODE_11ax;
-			else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
-				phyMode = eCSR_DOT11_MODE_11ac;
-			else
-				phyMode = eCSR_DOT11_MODE_11n;
-		} else {
-			/* user's pick */
-			phyMode = mac->roam.configParam.phyMode;
-		}
-	}
-
-	if ((0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode)) {
-		if (0 != phyMode) {
-			if (eCSR_DOT11_MODE_AUTO & phyMode) {
-				phyMode2 =
-					eCSR_DOT11_MODE_AUTO & phyMode;
-			}
-		} else {
-			phyMode2 = phyMode;
-		}
-		fMatch = csr_get_phy_mode_in_use(mac, phyMode2,
-						 phyModeInBssDesc,
-						 !WLAN_REG_IS_24GHZ_CH_FREQ
-							(bss_chan_freq),
-						 &cfgDot11ModeToUse);
-	} else {
-		bitMask = 1;
-		loopCount = 0;
-		while (loopCount < eCSR_NUM_PHY_MODE) {
-			phyMode2 = (phyMode & (bitMask << loopCount++));
-			if (0 != phyMode2 &&
-			    csr_get_phy_mode_in_use(mac, phyMode2,
-			    phyModeInBssDesc,
-			    !WLAN_REG_IS_24GHZ_CH_FREQ(bss_chan_freq),
-			    &cfgDot11ModeToUse)) {
-				fMatch = true;
-				break;
-			}
-		}
-	}
-
-	cfgDot11ModeToUse = csr_get_vdev_dot11_mode(mac, pProfile->csrPersona,
-						    cfgDot11ModeToUse);
-	if (fMatch && pReturnCfgDot11Mode) {
-		/*
-		 * IEEE 11n spec (8.4.3): HT STA shall
-		 * eliminate TKIP as a choice for the pairwise
-		 * cipher suite if CCMP is advertised by the AP
-		 * or if the AP included an HT capabilities
-		 * element in its Beacons and Probe Response.
-		 */
-		if ((!CSR_IS_11n_ALLOWED(
-				pProfile->negotiatedUCEncryptionType))
-				&& ((eCSR_CFG_DOT11_MODE_11N ==
-					cfgDot11ModeToUse) ||
-				(eCSR_CFG_DOT11_MODE_11AC ==
-					cfgDot11ModeToUse) ||
-				(eCSR_CFG_DOT11_MODE_11AX ==
-					cfgDot11ModeToUse) ||
-				CSR_IS_CFG_DOT11_PHY_MODE_11BE(
-					cfgDot11ModeToUse))) {
-			/* We cannot do 11n here */
-			if (WLAN_REG_IS_24GHZ_CH_FREQ(bss_chan_freq)) {
-				cfgDot11ModeToUse =
-					eCSR_CFG_DOT11_MODE_11G;
-			} else {
-				cfgDot11ModeToUse =
-					eCSR_CFG_DOT11_MODE_11A;
-			}
-		}
-		*pReturnCfgDot11Mode = cfgDot11ModeToUse;
-	}
-
-	return fMatch;
-}
-
-enum csr_cfgdot11mode csr_find_best_phy_mode(struct mac_context *mac,
-			uint32_t phyMode)
-{
-	enum csr_cfgdot11mode cfgDot11ModeToUse;
-	enum band_info band = mac->mlme_cfg->gen.band;
-
-	if ((0 == phyMode) ||
-	    (eCSR_DOT11_MODE_AUTO & phyMode) ||
-	    (eCSR_DOT11_MODE_11be & phyMode)) {
-#ifdef WLAN_FEATURE_11BE
-		if (IS_FEATURE_SUPPORTED_BY_FW(DOT11BE)) {
-			cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11BE;
-		} else
-#endif
-		if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX)) {
-			cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AX;
-		} else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) {
-			cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AC;
-		} else {
-			/* Default to 11N mode if user has configured 11ac mode
-			 * and FW doesn't supports 11ac mode .
-			 */
-			cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
-		}
-	} else if (eCSR_DOT11_MODE_11ax & phyMode) {
-		if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX)) {
-			cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AX;
-		} else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) {
-			cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AC;
-		} else {
-			/* Default to 11N mode if user has configured 11ac mode
-			 * and FW doesn't supports 11ac mode .
-			 */
-			cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
-		}
-	} else if (eCSR_DOT11_MODE_11ac & phyMode) {
-		if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) {
-			cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AC;
-		} else {
-			/* Default to 11N mode if user has configured 11ac mode
-			 * and FW doesn't supports 11ac mode .
-			 */
-		}	cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
-	} else {
-		if ((eCSR_DOT11_MODE_11n | eCSR_DOT11_MODE_11n_ONLY) & phyMode)
-			cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
-		else if (eCSR_DOT11_MODE_abg & phyMode) {
-			if (BAND_2G != band)
-				cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A;
-			else
-				cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G;
-		} else if (eCSR_DOT11_MODE_11a & phyMode)
-			cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A;
-		else if ((eCSR_DOT11_MODE_11g | eCSR_DOT11_MODE_11g_ONLY) &
-			   phyMode)
-			cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G;
-		else
-			cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11B;
-	}
-
-	return cfgDot11ModeToUse;
-}
-
 enum reg_phymode csr_convert_to_reg_phy_mode(eCsrPhyMode csr_phy_mode,
 				       qdf_freq_t freq)
 {
@@ -1950,27 +1356,6 @@ bool csr_is_pmkid_found_for_peer(struct mac_context *mac,
 	return false;
 }
 
-bool csr_rates_is_dot11_rate11b_supported_rate(uint8_t dot11Rate)
-{
-	bool fSupported = false;
-	uint16_t nonBasicRate =
-		(uint16_t) (BITS_OFF(dot11Rate, CSR_DOT11_BASIC_RATE_MASK));
-
-	switch (nonBasicRate) {
-	case SUPP_RATE_1_MBPS:
-	case SUPP_RATE_2_MBPS:
-	case SUPP_RATE_5_MBPS:
-	case SUPP_RATE_11_MBPS:
-		fSupported = true;
-		break;
-
-	default:
-		break;
-	}
-
-	return fSupported;
-}
-
 bool csr_rates_is_dot11_rate11a_supported_rate(uint8_t dot11Rate)
 {
 	bool fSupported = false;
@@ -2049,49 +1434,6 @@ tAniEdType csr_translate_encrypt_type_to_ed_type(eCsrEncryptionType EncryptType)
 	return edType;
 }
 
-bool csr_is_ssid_match(struct mac_context *mac, uint8_t *ssid1, uint8_t ssid1Len,
-		       uint8_t *bssSsid, uint8_t bssSsidLen, bool fSsidRequired)
-{
-	bool fMatch = false;
-
-	do {
-		/*
-		 * Check for the specification of the Broadcast SSID at the
-		 * beginning of the list. If specified, then all SSIDs are
-		 * matches (broadcast SSID means accept all SSIDs).
-		 */
-		if (ssid1Len == 0) {
-			fMatch = true;
-			break;
-		}
-
-		/* There are a few special cases.  If the Bss description has
-		 * a Broadcast SSID, then our Profile must have a single SSID
-		 * without Wildcards so we can program the SSID.
-		 *
-		 * SSID could be suppressed in beacons. In that case SSID IE
-		 * has valid length but the SSID value is all NULL characters.
-		 * That condition is trated same as NULL SSID
-		 */
-		if (csr_is_nullssid(bssSsid, bssSsidLen)) {
-			if (false == fSsidRequired) {
-				fMatch = true;
-				break;
-			}
-		}
-
-		if (ssid1Len != bssSsidLen)
-			break;
-		if (!qdf_mem_cmp(bssSsid, ssid1, bssSsidLen)) {
-			fMatch = true;
-			break;
-		}
-
-	} while (0);
-
-	return fMatch;
-}
-
 bool csr_is_bssid_match(struct qdf_mac_addr *pProfBssid,
 			struct qdf_mac_addr *BssBssid)
 {

+ 1 - 0
core/sme/src/nan/nan_datapath_api.c

@@ -44,6 +44,7 @@ QDF_STATUS csr_roam_start_ndi(struct mac_context *mac_ctx, uint32_t session,
 
 	/* Build BSS configuration from profile */
 	status = csr_roam_prepare_bss_config_from_profile(mac_ctx, profile,
+							  session,
 							  &bss_cfg);
 	if (QDF_IS_STATUS_SUCCESS(status)) {
 		mac_ctx->roam.roamSession[session].bssParams.uCfgDot11Mode