Browse Source

qcacld-3.0: Fix Mlme info updating in connected BSS in scan

Mlme info is not updated for the new AP to which driver roamed and
also not updated for the old AP after driver roamed to new AP.
Also in some case when deauth is from peer the Mlme info is not reset
by driver for the disconnected AP.
As mlme info of the AP is not updated and it remain in associated state
The AGE out logic skip the AP and thus it never ageout.

Fix this by properly updating the MLME info of the AP during roaming
And disconnection.

Change-Id: Ib17499c8ab0c4725d146d7c09077c92661adbdd5
CRs-Fixed: 2419853
Abhishek Singh 6 years ago
parent
commit
d7302318ca
1 changed files with 51 additions and 26 deletions
  1. 51 26
      core/sme/src/csr/csr_api_roam.c

+ 51 - 26
core/sme/src/csr/csr_api_roam.c

@@ -6059,16 +6059,37 @@ bool csr_roam_is_fast_roam_enabled(struct mac_context *mac, uint32_t sessionId)
 	}
 }
 
-static void csr_update_scan_entry_associnfo(struct mac_context *mac_ctx,
-			struct bss_info *bss, enum scan_entry_connection_state state)
+static
+void csr_update_scan_entry_associnfo(struct mac_context *mac_ctx,
+				     struct csr_roam_session *session,
+				     enum scan_entry_connection_state state)
 {
 	QDF_STATUS status;
 	struct mlme_info mlme;
+	struct bss_info bss;
+	tCsrRoamConnectedProfile *conn_profile;
 
-	sme_debug("Update MLME info in scan database. bssid %pM state: %d",
-				bss->bssid.bytes, state);
+	if (!session) {
+		sme_debug("session is NULL");
+		return;
+	}
+	conn_profile = &session->connectedProfile;
+	if (!CSR_IS_INFRASTRUCTURE(conn_profile)) {
+		sme_debug("not infra return");
+		return;
+	}
+
+	qdf_copy_macaddr(&bss.bssid, &conn_profile->bssid);
+	bss.chan = conn_profile->operationChannel;
+	bss.ssid.length = conn_profile->SSID.length;
+	qdf_mem_copy(&bss.ssid.ssid, &conn_profile->SSID.ssId,
+		     bss.ssid.length);
+
+	sme_debug("Update MLME info in scan database. bssid %pM ssid:%.*s chan %d state: %d",
+		  bss.bssid.bytes, bss.ssid.length, bss.ssid.ssid, bss.chan,
+		  state);
 	mlme.assoc_state = state;
-	status = ucfg_scan_update_mlme_by_bssinfo(mac_ctx->pdev, bss, &mlme);
+	status = ucfg_scan_update_mlme_by_bssinfo(mac_ctx->pdev, &bss, &mlme);
 	if (QDF_IS_STATUS_ERROR(status))
 		sme_debug("Failed to update the MLME info in scan entry");
 }
@@ -6218,7 +6239,6 @@ static void csr_roam_process_results_default(struct mac_context *mac_ctx,
 	struct csr_roam_session *session;
 	struct csr_roam_info *roam_info;
 	QDF_STATUS status;
-	struct bss_info bss_info;
 
 	if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) {
 		sme_err("Invalid session id %d", session_id);
@@ -6233,14 +6253,17 @@ static void csr_roam_process_results_default(struct mac_context *mac_ctx,
 		  session->is_fils_connection);
 	sme_debug("Assoc ref count: %d", session->bRefAssocStartCnt);
 
-	if (CSR_IS_INFRASTRUCTURE(&session->connectedProfile)) {
-		qdf_copy_macaddr(&bss_info.bssid,
-				&session->connectedProfile.bssid);
-		bss_info.chan = session->connectedProfile.operationChannel;
-		bss_info.ssid.length = session->connectedProfile.SSID.length;
-		qdf_mem_copy(&bss_info.ssid.ssid,
-				&session->connectedProfile.SSID.ssId,
-				bss_info.ssid.length);
+	/* Update AP's assoc info in scan before removing connectedProfile */
+	switch (cmd->u.roamCmd.roamReason) {
+	case eCsrSmeIssuedDisassocForHandoff:
+	case eCsrForcedDisassoc:
+	case eCsrForcedDeauth:
+	case eCsrForcedDisassocMICFailure:
+		csr_update_scan_entry_associnfo(mac_ctx, session,
+						SCAN_ENTRY_CON_STATE_NONE);
+		break;
+	default:
+		break;
 	}
 	if (CSR_IS_INFRASTRUCTURE(&session->connectedProfile)
 		|| CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ(mac_ctx, session_id)) {
@@ -6350,8 +6373,6 @@ static void csr_roam_process_results_default(struct mac_context *mac_ctx,
 				SME_QOS_CSR_DISCONNECT_IND,
 				NULL);
 #endif
-		csr_update_scan_entry_associnfo(mac_ctx, &bss_info,
-						SCAN_ENTRY_CON_STATE_NONE);
 		csr_roam_link_down(mac_ctx, session_id);
 
 		if (mac_ctx->roam.deauthRspStatus == eSIR_SME_DEAUTH_STATUS) {
@@ -6816,7 +6837,6 @@ static void csr_roam_process_join_res(struct mac_context *mac_ctx,
 	struct ps_global_info *ps_global_info = &mac_ctx->sme.ps_global_info;
 	struct join_rsp *join_rsp = context;
 	uint32_t len;
-	struct bss_info bss_info;
 
 	if (!join_rsp) {
 		sme_err("join_rsp is NULL");
@@ -7165,15 +7185,8 @@ static void csr_roam_process_join_res(struct mac_context *mac_ctx,
 					       eCSR_ROAM_RESULT_ASSOCIATED);
 		}
 
-		qdf_copy_macaddr(&bss_info.bssid, &conn_profile->bssid);
-		bss_info.chan = conn_profile->operationChannel;
-		bss_info.ssid.length =
-			conn_profile->SSID.length;
-		qdf_mem_copy(&bss_info.ssid.ssid,
-			&conn_profile->SSID.ssId,
-			bss_info.ssid.length);
-		csr_update_scan_entry_associnfo(mac_ctx,
-					&bss_info, SCAN_ENTRY_CON_STATE_ASSOC);
+		csr_update_scan_entry_associnfo(mac_ctx, session,
+						SCAN_ENTRY_CON_STATE_ASSOC);
 		csr_roam_completion(mac_ctx, session_id, NULL, cmd,
 				eCSR_ROAM_RESULT_NONE, true);
 		csr_reset_pmkid_candidate_list(mac_ctx, session_id);
@@ -11131,6 +11144,9 @@ csr_roam_chk_lnk_disassoc_ind(struct mac_context *mac_ctx, tSirSmeRsp *msg_ptr)
 		return;
 	}
 
+	csr_update_scan_entry_associnfo(mac_ctx,
+					session, SCAN_ENTRY_CON_STATE_NONE);
+
 	/* Update the disconnect stats */
 	session->disconnect_stats.disconnection_cnt++;
 	session->disconnect_stats.disassoc_by_peer++;
@@ -11264,6 +11280,8 @@ csr_roam_chk_lnk_deauth_ind(struct mac_context *mac_ctx, tSirSmeRsp *msg_ptr)
 		return;
 	}
 
+	csr_update_scan_entry_associnfo(mac_ctx,
+					session, SCAN_ENTRY_CON_STATE_NONE);
 	/* Update the disconnect stats */
 	switch (pDeauthInd->reasonCode) {
 	case eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON:
@@ -21114,6 +21132,10 @@ static QDF_STATUS csr_process_roam_sync_callback(struct mac_context *mac_ctx,
 			      bss_desc, ies_local);
 	ps_global_info->remain_in_power_active_till_dhcp = false;
 	session->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED;
+
+	/* Remove old BSSID mlme info from scan cache */
+	csr_update_scan_entry_associnfo(mac_ctx, session,
+					SCAN_ENTRY_CON_STATE_NONE);
 	roam_info = qdf_mem_malloc(sizeof(struct csr_roam_info));
 	if (!roam_info) {
 		session->roam_synch_in_progress = false;
@@ -21129,6 +21151,9 @@ static QDF_STATUS csr_process_roam_sync_callback(struct mac_context *mac_ctx,
 			session->pCurRoamProfile,
 			bss_desc,
 			ies_local);
+	/* Add new mlme info to new BSSID after upting connectedProfile */
+	csr_update_scan_entry_associnfo(mac_ctx, session,
+					SCAN_ENTRY_CON_STATE_ASSOC);
 	csr_roam_save_security_rsp_ie(mac_ctx, session_id,
 			session->pCurRoamProfile->negotiatedAuthType,
 			bss_desc, ies_local);