Browse Source

qcacld-3.0: Move prev ap info under connection manager macro

Move prev ap info and connected bss in connection manager
macro in csr session.

Change-Id: Ie2b8ecdbcf7134f93f908ba596c0398712da7ac8
CRs-Fixed: 2895259
Utkarsh Bhatnagar 4 years ago
parent
commit
9131f1bc48

+ 2 - 0
components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_api.h

@@ -237,6 +237,8 @@ void cm_stop_wait_for_key_timer(struct wlan_objmgr_psoc *psoc,
 void cm_update_wait_for_key_timer(struct wlan_objmgr_vdev *vdev,
 				  uint8_t vdev_id, uint32_t interval);
 
+void cm_update_prev_ap_ie(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
+			  uint32_t len, uint8_t *bcn_ptr);
 bool cm_csr_is_ss_wait_for_key(uint8_t vdev_id);
 void cm_csr_set_ss_wait_for_key(uint8_t vdev_id);
 void cm_csr_set_ss_none(uint8_t vdev_id);

+ 47 - 1
components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_connect.c

@@ -217,6 +217,43 @@ void cm_update_wait_for_key_timer(struct wlan_objmgr_vdev *vdev,
 	}
 }
 
+void cm_update_prev_ap_ie(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
+			  uint32_t len, uint8_t *bcn_ptr)
+{
+	struct wlan_objmgr_vdev *vdev;
+	struct rso_config *rso_cfg;
+	struct element_info *bcn_ie;
+
+	if (!len || !bcn_ptr)
+		return;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_MLME_CM_ID);
+	if (!vdev) {
+		mlme_err("vdev is NULL for vdev id %d", vdev_id);
+		return;
+	}
+	rso_cfg = wlan_cm_get_rso_config(vdev);
+	if (!rso_cfg)
+		goto end;
+
+	bcn_ie = &rso_cfg->prev_ap_bcn_ie;
+	if (bcn_ie->ptr) {
+		qdf_mem_free(bcn_ie->ptr);
+		bcn_ie->ptr = NULL;
+		bcn_ie->len = 0;
+	}
+	bcn_ie->ptr = qdf_mem_malloc(len);
+	if (!bcn_ie->ptr) {
+		bcn_ie->len = 0;
+		goto end;
+	}
+
+	qdf_mem_copy(bcn_ie->ptr, bcn_ptr, len);
+end:
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID);
+}
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
 static const char *cm_diag_get_ch_width_str(uint8_t ch_width)
 {
@@ -1182,7 +1219,16 @@ static void cm_process_connect_complete(struct wlan_objmgr_psoc *psoc,
 	uint8_t vdev_id = wlan_vdev_get_id(vdev);
 	int32_t ucast_cipher, akm;
 	uint32_t key_interval;
-
+	struct element_info *bcn_probe_rsp = &rsp->connect_ies.bcn_probe_rsp;
+
+	if (bcn_probe_rsp->ptr &&
+	    bcn_probe_rsp->len > sizeof(struct wlan_frame_hdr)) {
+		cm_update_prev_ap_ie(psoc, vdev_id,
+				     bcn_probe_rsp->len -
+				     sizeof(struct wlan_frame_hdr),
+				     bcn_probe_rsp->ptr +
+				     sizeof(struct wlan_frame_hdr));
+	}
 	akm = wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_KEY_MGMT);
 	if (QDF_HAS_PARAM(akm, WLAN_CRYPTO_KEY_MGMT_FT_SAE)) {
 		mlme_debug("Update the MDID in PMK cache for FT-SAE case");

+ 2 - 0
components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_public_struct.h

@@ -267,6 +267,7 @@ enum roam_fail_params {
  * ROAM_TRIGGER_REASON_PER, ROAM_TRIGGER_REASON_BMISS
  * @cfg_param: per vdev config params
  * @assoc_ie: assoc IE
+ * @prev_ap_bcn_ie: last connetced AP ie
  * @occupied_chan_lst: occupied channel list
  * @roam_candidate_count: candidate count
  * @is_ese_assoc: is ese assoc
@@ -295,6 +296,7 @@ struct rso_config {
 	uint32_t roam_scan_scheme_bitmap;
 	struct rso_cfg_params cfg_param;
 	struct element_info assoc_ie;
+	struct element_info prev_ap_bcn_ie;
 	struct wlan_chan_list occupied_chan_lst;
 	int8_t roam_candidate_count;
 	uint8_t uapsd_mask;

+ 5 - 0
components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c

@@ -1256,6 +1256,11 @@ void wlan_cm_rso_config_deinit(struct wlan_objmgr_vdev *vdev,
 		rso_cfg->assoc_ie.ptr = NULL;
 		rso_cfg->assoc_ie.len = 0;
 	}
+	if (rso_cfg->prev_ap_bcn_ie.ptr) {
+		qdf_mem_free(rso_cfg->prev_ap_bcn_ie.ptr);
+		rso_cfg->prev_ap_bcn_ie.ptr = NULL;
+		rso_cfg->prev_ap_bcn_ie.len = 0;
+	}
 	if (rso_cfg->roam_scan_freq_lst.freq_list)
 		qdf_mem_free(rso_cfg->roam_scan_freq_lst.freq_list);
 	rso_cfg->roam_scan_freq_lst.freq_list = NULL;

+ 3 - 3
core/sme/inc/csr_internal.h

@@ -472,15 +472,15 @@ struct csr_roam_session {
 	eCsrConnectState connectState;
 	tCsrRoamConnectedProfile connectedProfile;
 	struct csr_roam_connectedinfo connectedInfo;
-	struct csr_roam_connectedinfo prev_assoc_ap_info;
 	struct csr_roam_profile *pCurRoamProfile;
-	struct bss_description *pConnectBssDesc;
 	/*
 	 * to remember some parameters needed for START_BSS.
 	 * All member must be set every time we try to join
 	 */
 	struct csr_roamstart_bssparams bssParams;
 #ifndef FEATURE_CM_ENABLE
+	struct csr_roam_connectedinfo prev_assoc_ap_info;
+	struct bss_description *pConnectBssDesc;
 	/* the byte count of pWpaRsnIE; */
 	uint32_t nWpaRsnReqIeLength;
 	/* contain the WPA/RSN IE in assoc req */
@@ -506,6 +506,7 @@ struct csr_roam_session {
 	qdf_mc_timer_t hTimerRoaming;
 	enum csr_roaming_reason roamingReason;
 	bool fCancelRoaming;
+	uint8_t bRefAssocStartCnt;      /* Tracking assoc start indication */
 #endif /* ndef FEATURE_CM_ENABLE */
 #ifdef WLAN_BCN_RECV_FEATURE
 	bool is_bcn_recv_start;
@@ -525,7 +526,6 @@ struct csr_roam_session {
 	tSirMacSSid prevApSSID;
 	uint32_t roamTS1;
 #endif
-	uint8_t bRefAssocStartCnt;      /* Tracking assoc start indication */
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 	struct roam_offload_synch_ind *roam_synch_data;
 #endif

+ 19 - 19
core/sme/src/common/sme_api.c

@@ -15754,46 +15754,46 @@ QDF_STATUS sme_get_prev_connected_bss_ies(mac_handle_t mac_handle,
 					  uint8_t vdev_id,
 					  uint8_t **ies, uint32_t *ie_len)
 {
-	struct csr_roam_session *session;
-	struct mac_context *mac;
+	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	uint32_t len;
 	uint8_t *beacon_ie;
+	struct rso_config *rso_cfg;
+	struct wlan_objmgr_vdev *vdev;
+	struct element_info *bcn_ie;
 
-	if (!mac_handle) {
-		sme_err("mac_handle is not valid");
-		return QDF_STATUS_E_INVAL;
-	}
-	mac = MAC_CONTEXT(mac_handle);
-	session = CSR_GET_SESSION(mac, vdev_id);
-	if (!session) {
-		sme_err("session not found");
+	vdev = wlan_objmgr_get_vdev_by_id_from_pdev(mac->pdev, vdev_id,
+						    WLAN_LEGACY_SME_ID);
+	if (!vdev)
 		return QDF_STATUS_E_INVAL;
-	}
 
-	status = sme_acquire_global_lock(&mac->sme);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		sme_err("Failed to acquire sme lock; status: %d", status);
-		return status;
+	rso_cfg = wlan_cm_get_rso_config(vdev);
+	if (!rso_cfg) {
+		status = QDF_STATUS_E_INVAL;
+		goto end;
 	}
 
-	len = session->prev_assoc_ap_info.nBeaconLength;
-	if (!len) {
+	bcn_ie = &rso_cfg->prev_ap_bcn_ie;
+
+	if (!bcn_ie->len) {
 		sme_debug("No IEs to return");
 		status = QDF_STATUS_E_INVAL;
 		goto end;
 	}
+
+	len = bcn_ie->len;
 	beacon_ie = qdf_mem_malloc(len);
 	if (!beacon_ie) {
 		status = QDF_STATUS_E_NOMEM;
 		goto end;
 	}
-	qdf_mem_copy(beacon_ie, session->prev_assoc_ap_info.pbFrames, len);
+	qdf_mem_copy(beacon_ie, bcn_ie->ptr, len);
 
 	*ie_len = len;
 	*ies = beacon_ie;
 end:
-	sme_release_global_lock(&mac->sme);
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_SME_ID);
+
 	return status;
 }
 

+ 20 - 49
core/sme/src/csr/csr_api_roam.c

@@ -2863,7 +2863,6 @@ QDF_STATUS csr_roam_issue_deauth(struct mac_context *mac, uint32_t sessionId,
 
 	return status;
 }
-#endif
 
 QDF_STATUS csr_roam_save_connected_bss_desc(struct mac_context *mac,
 					    uint32_t sessionId,
@@ -2906,7 +2905,6 @@ QDF_STATUS csr_roam_save_connected_bss_desc(struct mac_context *mac,
 	return status;
 }
 
-#ifndef FEATURE_CM_ENABLE
 static
 QDF_STATUS csr_roam_prepare_bss_config(struct mac_context *mac,
 				       struct csr_roam_profile *pProfile,
@@ -4978,7 +4976,10 @@ static void csr_roam_process_results_default(struct mac_context *mac_ctx,
 		 * do not free for the other profiles as we need
 		 * to send down stop BSS later
 		 */
+		/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 		csr_free_connect_bss_desc(mac_ctx, session_id);
+#endif
 		csr_roam_free_connect_profile(&session->connectedProfile);
 		csr_roam_free_connected_info(mac_ctx, &session->connectedInfo);
 		csr_set_default_dot11_mode(mac_ctx);
@@ -5211,7 +5212,6 @@ static void csr_roam_process_start_bss_success(struct mac_context *mac_ctx,
 				session_id);
 	}
 
-	csr_roam_save_connected_bss_desc(mac_ctx, session_id, bss_desc);
 	csr_roam_free_connect_profile(&session->connectedProfile);
 	csr_roam_free_connected_info(mac_ctx, &session->connectedInfo);
 	csr_roam_save_connected_information(mac_ctx, session_id,
@@ -7387,11 +7387,12 @@ csr_roam_save_connected_information(struct mac_context *mac,
 				     pProfile->SSIDs.SSIDList[0].SSID.ssId,
 				     pConnectProfile->SSID.length);
 		}
-		/* Save the bss desc */
-		status = csr_roam_save_connected_bss_desc(mac, sessionId,
-								pSirBssDesc);
+
 #ifndef FEATURE_CM_ENABLE
 		if (CSR_IS_INFRASTRUCTURE(pConnectProfile)) {
+					/* Save the bss desc */
+			status = csr_roam_save_connected_bss_desc(mac, sessionId,
+								  pSirBssDesc);
 			src_cfg.uint_value = pSirBssDesc->mbo_oce_enabled_ap;
 			wlan_cm_roam_cfg_set_value(mac->psoc, sessionId,
 						   MBO_OCE_ENABLED_AP, &src_cfg);
@@ -7431,8 +7432,10 @@ csr_roam_save_connected_information(struct mac_context *mac,
 	pConnectProfile->qosConnection =
 		mac->roam.roamSession[sessionId].fWMMConnection;
 
+#ifndef FEATURE_CM_ENABLE
 	if (!QDF_IS_STATUS_SUCCESS(status))
 		csr_free_connect_bss_desc(mac, sessionId);
+#endif
 
 	return status;
 }
@@ -7561,6 +7564,8 @@ static void csr_roam_join_rsp_processor(struct mac_context *mac,
 		return;
 	}
 
+	cm_update_prev_ap_ie(mac->psoc, pSmeJoinRsp->vdev_id,
+			     pSmeJoinRsp->beaconLength, pSmeJoinRsp->frames);
 	prev_connect_info = &session_ptr->prev_assoc_ap_info;
 	/* The head of the active list is the request we sent */
 	pEntry = csr_nonscan_active_ll_peek_head(mac, LL_ACCESS_LOCK);
@@ -10307,12 +10312,9 @@ csr_roam_chk_lnk_swt_ch_ind(struct mac_context *mac_ctx, tSirSmeRsp *msg_ptr)
 {
 	struct csr_roam_session *session;
 	uint32_t sessionId = WLAN_UMAC_VDEV_ID_MAX;
-	uint16_t ie_len;
 	QDF_STATUS status;
 	struct switch_channel_ind *pSwitchChnInd;
 	struct csr_roam_info *roam_info;
-	tSirMacDsParamSetIE *ds_params_ie;
-	tDot11fIEHTInfo *ht_info_ie;
 
 	/* in case of STA, the SWITCH_CHANNEL originates from its AP */
 	sme_debug("eWNI_SME_SWITCH_CHL_IND from SME");
@@ -10340,34 +10342,6 @@ csr_roam_chk_lnk_swt_ch_ind(struct mac_context *mac_ctx, tSirSmeRsp *msg_ptr)
 	/* Update the occupied channel list with the new switched channel */
 	wlan_cm_init_occupied_ch_freq_list(mac_ctx->pdev, mac_ctx->psoc,
 					   sessionId);
-
-	if (session->pConnectBssDesc) {
-		session->pConnectBssDesc->chan_freq = pSwitchChnInd->freq;
-
-		ie_len = wlan_get_ielen_from_bss_description(
-						session->pConnectBssDesc);
-		ds_params_ie = (tSirMacDsParamSetIE *)wlan_get_ie_ptr_from_eid(
-				DOT11F_EID_DSPARAMS,
-				(uint8_t *)session->pConnectBssDesc->ieFields,
-				ie_len);
-		if (ds_params_ie)
-			ds_params_ie->channelNumber =
-				wlan_reg_freq_to_chan(mac_ctx->pdev,
-						      pSwitchChnInd->freq);
-
-		ht_info_ie = (tDot11fIEHTInfo *)wlan_get_ie_ptr_from_eid(
-				DOT11F_EID_HTINFO,
-				(uint8_t *)session->pConnectBssDesc->ieFields,
-				ie_len);
-		if (ht_info_ie) {
-			ht_info_ie->primaryChannel =
-				wlan_reg_freq_to_chan(mac_ctx->pdev,
-						      pSwitchChnInd->freq);
-			ht_info_ie->secondaryChannelOffset =
-				pSwitchChnInd->chan_params.sec_ch_offset;
-		}
-	}
-
 	roam_info = qdf_mem_malloc(sizeof(*roam_info));
 	if (!roam_info)
 		return;
@@ -12443,7 +12417,7 @@ static void csr_fill_connected_profile(struct mac_context *mac_ctx,
 	qdf_list_node_t *cur_lst = NULL;
 	struct scan_cache_node *cur_node = NULL;
 	uint32_t bss_len, ie_len;
-	struct bss_description *bss_desc;
+	struct bss_description *bss_desc = NULL;
 	tDot11fBeaconIEs *bcn_ies;
 	sme_QosAssocInfo assoc_info;
 	struct cm_roam_values_copy src_cfg;
@@ -12491,7 +12465,6 @@ static void csr_fill_connected_profile(struct mac_context *mac_ctx,
 		goto purge_list;
 
 	wlan_fill_bss_desc_from_scan_entry(mac_ctx, bss_desc, cur_node->entry);
-	csr_free_connect_bss_desc(mac_ctx, vdev_id);
 
 	src_cfg.uint_value = bss_desc->mbo_oce_enabled_ap;
 	wlan_cm_roam_cfg_set_value(mac_ctx->psoc, vdev_id, MBO_OCE_ENABLED_AP,
@@ -12499,12 +12472,9 @@ static void csr_fill_connected_profile(struct mac_context *mac_ctx,
 	csr_fill_single_pmk(mac_ctx->psoc, vdev_id, bss_desc);
 	status = wlan_get_parsed_bss_description_ies(mac_ctx, bss_desc,
 						     &bcn_ies);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		qdf_mem_free(bss_desc);
+	if (QDF_IS_STATUS_ERROR(status))
 		goto purge_list;
-	}
-	/* update bss desc */
-	session->pConnectBssDesc = bss_desc;
+
 	ucast_cipher = wlan_crypto_get_param(vdev,
 					     WLAN_CRYPTO_PARAM_UCAST_CIPHER);
 	auth_mode = wlan_crypto_get_param(vdev,
@@ -12550,6 +12520,8 @@ static void csr_fill_connected_profile(struct mac_context *mac_ctx,
 	qdf_mem_free(bcn_ies);
 
 purge_list:
+	if (bss_desc)
+		qdf_mem_free(bss_desc);
 	if (list)
 		wlan_scan_purge_results(list);
 
@@ -12720,7 +12692,6 @@ cm_csr_diconnect_done_ind(struct wlan_objmgr_vdev *vdev,
 	if (cm_is_vdev_roaming(vdev))
 		sme_qos_update_hand_off(vdev_id, false);
 	csr_set_default_dot11_mode(mac_ctx);
-	csr_free_connect_bss_desc(mac_ctx, vdev_id);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -14057,17 +14028,17 @@ void csr_cleanup_vdev_session(struct mac_context *mac, uint8_t vdev_id)
 
 #ifndef FEATURE_CM_ENABLE
 		csr_roam_stop_roaming_timer(mac, vdev_id);
+		csr_free_connect_bss_desc(mac, vdev_id);
 #endif
 		/* Clean up FT related data structures */
 		sme_ft_close(MAC_HANDLE(mac), vdev_id);
-		csr_free_connect_bss_desc(mac, vdev_id);
 		sme_reset_key(MAC_HANDLE(mac), vdev_id);
 		csr_flush_roam_scan_chan_lists(mac, vdev_id);
 		csr_roam_free_connect_profile(&pSession->connectedProfile);
 		csr_roam_free_connected_info(mac, &pSession->connectedInfo);
+#ifndef FEATURE_CM_ENABLE
 		csr_roam_free_connected_info(mac,
 					     &pSession->prev_assoc_ap_info);
-#ifndef FEATURE_CM_ENABLE
 		qdf_mc_timer_destroy(&pSession->hTimerRoaming);
 		qdf_mc_timer_destroy(&pSession->roaming_offload_timer);
 #endif
@@ -14131,11 +14102,11 @@ static void csr_init_session(struct mac_context *mac, uint32_t sessionId)
 	csr_free_roam_profile(mac, sessionId);
 	csr_roam_free_connect_profile(&pSession->connectedProfile);
 	csr_roam_free_connected_info(mac, &pSession->connectedInfo);
+	qdf_mem_zero(&pSession->self_mac_addr, sizeof(struct qdf_mac_addr));
+#ifndef FEATURE_CM_ENABLE
 	csr_roam_free_connected_info(mac,
 				     &pSession->prev_assoc_ap_info);
 	csr_free_connect_bss_desc(mac, sessionId);
-	qdf_mem_zero(&pSession->self_mac_addr, sizeof(struct qdf_mac_addr));
-#ifndef FEATURE_CM_ENABLE
 	if (pSession->pWpaRsnReqIE) {
 		qdf_mem_free(pSession->pWpaRsnReqIE);
 		pSession->pWpaRsnReqIE = NULL;

+ 5 - 4
core/sme/src/csr/csr_inside_api.h

@@ -139,15 +139,14 @@ void csr_roam_joined_state_msg_processor(struct mac_context *mac,
 #ifndef FEATURE_CM_ENABLE
 void csr_scan_callback(struct wlan_objmgr_vdev *vdev,
 				struct scan_event *event, void *arg);
+QDF_STATUS csr_roam_save_connected_bss_desc(struct mac_context *mac,
+					    uint32_t sessionId,
+					    struct bss_description *bss_desc);
 #endif
 void csr_release_command_roam(struct mac_context *mac, tSmeCmd *pCommand);
 void csr_release_command_wm_status_change(struct mac_context *mac,
 					  tSmeCmd *pCommand);
 
-QDF_STATUS csr_roam_save_connected_bss_desc(struct mac_context *mac,
-					    uint32_t sessionId,
-					    struct bss_description *bss_desc);
-
 QDF_STATUS csr_roam_copy_profile(struct mac_context *mac,
 				 struct csr_roam_profile *pDstProfile,
 				 struct csr_roam_profile *pSrcProfile,
@@ -321,7 +320,9 @@ int8_t csr_get_cfg_max_tx_power(struct mac_context *mac, uint32_t ch_freq);
 
 /* To free the last roaming profile */
 void csr_free_roam_profile(struct mac_context *mac, uint32_t sessionId);
+#ifndef FEATURE_CM_ENABLE
 void csr_free_connect_bss_desc(struct mac_context *mac, uint32_t sessionId);
+#endif
 
 /* to free memory allocated inside the profile structure */
 void csr_release_profile(struct mac_context *mac,

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

@@ -2692,6 +2692,7 @@ void csr_free_roam_profile(struct mac_context *mac, uint32_t sessionId)
 	}
 }
 
+#ifndef FEATURE_CM_ENABLE
 void csr_free_connect_bss_desc(struct mac_context *mac, uint32_t sessionId)
 {
 	struct csr_roam_session *pSession = &mac->roam.roamSession[sessionId];
@@ -2701,6 +2702,7 @@ void csr_free_connect_bss_desc(struct mac_context *mac, uint32_t sessionId)
 		pSession->pConnectBssDesc = NULL;
 	}
 }
+#endif
 
 tSirResultCodes csr_get_de_auth_rsp_status_code(struct deauth_rsp *pSmeRsp)
 {

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

@@ -105,7 +105,6 @@ void csr_roam_save_ndi_connected_info(struct mac_context *mac_ctx,
 		     sizeof(roam_profile->Keys));
 	csr_get_bss_id_bss_desc(bssdesc, &connect_profile->bssid);
 	connect_profile->SSID.length = 0;
-	csr_free_connect_bss_desc(mac_ctx, session_id);
 	connect_profile->qap = false;
 	connect_profile->qosConnection = false;
 }

+ 12 - 9
core/sme/src/rrm/sme_rrm.c

@@ -452,7 +452,7 @@ static QDF_STATUS sme_rrm_send_scan_result(struct mac_context *mac_ctx,
 		&mac_ctx->rrm.rrmSmeContext[measurement_index];
 	uint32_t session_id;
 	tSirScanType scan_type;
-	struct csr_roam_session *session;
+	struct qdf_mac_addr bss_peer_mac;
 
 	filter = qdf_mem_malloc(sizeof(*filter));
 	if (!filter)
@@ -572,20 +572,23 @@ static QDF_STATUS sme_rrm_send_scan_result(struct mac_context *mac_ctx,
 		goto rrm_send_scan_results_done;
 	}
 
-	session = CSR_GET_SESSION(mac_ctx, session_id);
+	status = wlan_mlme_get_bssid_vdev_id(mac_ctx->pdev, session_id,
+					     &bss_peer_mac);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		sme_err("Invaild session %d", session_id);
+		status = QDF_STATUS_E_FAILURE;
+		goto rrm_send_scan_results_done;
+	}
 
 	/* This is temp ifdef will be removed in near future */
 #ifdef FEATURE_CM_ENABLE
-	if (!session || !cm_is_vdevid_connected(mac_ctx->pdev, session_id) ||
-	    !session->pConnectBssDesc) {
+	if (!cm_is_vdevid_connected(mac_ctx->pdev, session_id)) {
 		sme_err("Invaild session");
 		status = QDF_STATUS_E_FAILURE;
 		goto rrm_send_scan_results_done;
 	}
 #else
-	if (!session ||
-	    !csr_is_conn_state_connected_infra(mac_ctx, session_id) ||
-	    !session->pConnectBssDesc) {
+	if (!csr_is_conn_state_connected_infra(mac_ctx, session_id)) {
 		sme_err("Invaild session");
 		status = QDF_STATUS_E_FAILURE;
 		goto rrm_send_scan_results_done;
@@ -605,7 +608,7 @@ static QDF_STATUS sme_rrm_send_scan_result(struct mac_context *mac_ctx,
 		uint8_t is_nontx_of_conn_bss = false;
 
 		if (!qdf_mem_cmp(scan_results->BssDescriptor.bssId,
-				 session->pConnectBssDesc->bssId,
+				 bss_peer_mac.bytes,
 		    sizeof(struct qdf_mac_addr))) {
 			is_conn_bss_found = true;
 			sme_debug("Connected BSS in scan results");
@@ -613,7 +616,7 @@ static QDF_STATUS sme_rrm_send_scan_result(struct mac_context *mac_ctx,
 		if (scan_results->BssDescriptor.mbssid_info.profile_num) {
 			if (!qdf_mem_cmp(scan_results->BssDescriptor.
 					 mbssid_info.trans_bssid,
-					 session->pConnectBssDesc->bssId,
+					 bss_peer_mac.bytes,
 					 QDF_MAC_ADDR_SIZE)) {
 				is_nontx_of_conn_bss = true;
 				sme_debug("Non Tx BSS of Conn AP in results");