Browse Source

qcacld-3.0: Add RSO state check for disconnect event

Firmware sends final bmiss indication as part of roam scan
stats event. Disconn log is sent as part of the final bmiss
indication from roam scan stats event with specific reason.
But if RSO stop or RSO deinit happens after first bmiss due
to concurrent interface connection, then firmware doesn't
send the final bmiss indication to driver since roam scan
will be disabled. This will lead HOST to unable to send
disconnect log to userspace.

In api lim_tear_down_link_with_ap(), add rso state check
to send discon connectivity event in case when RSO state
change to STOPPED or DEINIT after initial BMISS.

Change-Id: I318590ea5758b19a2542b4b581a07221f5195b24
CRs-Fixed: 3530673
Vijay Raj 1 year ago
parent
commit
ab389ecd74
1 changed files with 85 additions and 52 deletions
  1. 85 52
      core/mac/src/pe/lim/lim_link_monitoring_algo.c

+ 85 - 52
core/mac/src/pe/lim/lim_link_monitoring_algo.c

@@ -340,12 +340,42 @@ lim_trigger_sta_deletion(struct mac_context *mac_ctx, tpDphHashNode sta_ds,
 	lim_send_sme_disassoc_ind(mac_ctx, sta_ds, session_entry);
 } /*** end lim_trigger_st_adeletion() ***/
 
+static void
+lim_connectivity_bmiss_disconn_event(tpDphHashNode sta,
+				     struct wlan_objmgr_psoc *psoc,
+				     enum wlan_reason_code reason_code,
+				     uint32_t vdev_id)
+{
+	if (!(reason_code == REASON_BEACON_MISSED))
+		return;
+
+	/*
+	 * Firmware sends final bmiss indication as part of roam scan stats
+	 * event. Disconn log is sent as part of the final bmiss indication
+	 * from  roam scan stats event with specific reason. But if RSO stop
+	 * or RSO deinit happens after first bmiss due to concurrent interface
+	 * connection, then firmware doesn't send the final bmiss indication
+	 * to driver since roam scan will be disabled. But final bmiss
+	 * heartbeat failure will be indicated as part of WMI_ROAM_EVENTID with
+	 * reason as BMISS. So generate DISCONN log in this case from host based
+	 * on RSO state and final bmiss HB failure teardown.
+	 */
+	if (!(MLME_IS_ROAM_STATE_STOPPED(psoc, vdev_id) ||
+	      MLME_IS_ROAM_STATE_DEINIT(psoc, vdev_id)))
+		return;
+
+	cm_roam_beacon_loss_disconnect_event(psoc,
+					     *(struct qdf_mac_addr *)sta->staAddr,
+					     vdev_id);
+}
+
 void
 lim_tear_down_link_with_ap(struct mac_context *mac, uint8_t sessionId,
 			   enum wlan_reason_code reasonCode,
 			   enum eLimDisassocTrigger trigger)
 {
 	tpDphHashNode sta = NULL;
+	tLimMlmDeauthInd mlmDeauthInd;
 
 	/* tear down the following pe_session */
 	struct pe_session *pe_session;
@@ -374,72 +404,75 @@ lim_tear_down_link_with_ap(struct mac_context *mac, uint8_t sessionId,
 	/* Announce loss of link to Roaming algorithm */
 	/* and cleanup by sending SME_DISASSOC_REQ to SME */
 
-	sta =
-		dph_get_hash_entry(mac, DPH_STA_HASH_INDEX_PEER,
-				   &pe_session->dph.dphHashTable);
+	sta = dph_get_hash_entry(mac, DPH_STA_HASH_INDEX_PEER,
+				 &pe_session->dph.dphHashTable);
 
-	if (sta) {
-		tLimMlmDeauthInd mlmDeauthInd;
+	if (!sta)
+		return;
 
-		if ((sta->mlmStaContext.disassocReason ==
-		    REASON_DEAUTH_NETWORK_LEAVING) ||
-		    (sta->mlmStaContext.cleanupTrigger ==
-		    eLIM_HOST_DEAUTH)) {
-			pe_err("Host already issued deauth, do nothing");
-			return;
-		}
+	if ((sta->mlmStaContext.disassocReason ==
+	    REASON_DEAUTH_NETWORK_LEAVING) ||
+	    (sta->mlmStaContext.cleanupTrigger ==
+	    eLIM_HOST_DEAUTH)) {
+		pe_err("Host already issued deauth, do nothing");
+		return;
+	}
 
 #ifdef FEATURE_WLAN_TDLS
-		/* Delete all TDLS peers connected before leaving BSS */
-		lim_delete_tdls_peers(mac, pe_session);
+	/* Delete all TDLS peers connected before leaving BSS */
+	lim_delete_tdls_peers(mac, pe_session);
 #endif
 
-		sta->mlmStaContext.disassocReason = reasonCode;
-		sta->mlmStaContext.cleanupTrigger = trigger;
-		/* / Issue Deauth Indication to SME. */
-		qdf_mem_copy((uint8_t *) &mlmDeauthInd.peerMacAddr,
-			     sta->staAddr, sizeof(tSirMacAddr));
+	sta->mlmStaContext.disassocReason = reasonCode;
+	sta->mlmStaContext.cleanupTrigger = trigger;
+	/* / Issue Deauth Indication to SME. */
+	qdf_mem_copy((uint8_t *) &mlmDeauthInd.peerMacAddr,
+		     sta->staAddr, sizeof(tSirMacAddr));
+
+	/*
+	 * if deauth_before_connection is enabled and reasoncode is
+	 * Beacon Missed Store the MAC of AP in the flip flop
+	 * buffer. This MAC will be used to send Deauth before
+	 * connection, if we connect to same AP after HB failure.
+	 */
+	if (mac->mlme_cfg->sta.deauth_before_connection &&
+	    reasonCode == REASON_BEACON_MISSED) {
+		int apCount = mac->lim.gLimHeartBeatApMacIndex;
 
-		/*
-		 * if deauth_before_connection is enabled and reasoncode is
-		 * Beacon Missed Store the MAC of AP in the flip flop
-		 * buffer. This MAC will be used to send Deauth before
-		 * connection, if we connect to same AP after HB failure.
-		 */
-		if (mac->mlme_cfg->sta.deauth_before_connection &&
-		    reasonCode == REASON_BEACON_MISSED) {
-			int apCount = mac->lim.gLimHeartBeatApMacIndex;
+		if (mac->lim.gLimHeartBeatApMacIndex)
+			mac->lim.gLimHeartBeatApMacIndex = 0;
+		else
+			mac->lim.gLimHeartBeatApMacIndex = 1;
 
-			if (mac->lim.gLimHeartBeatApMacIndex)
-				mac->lim.gLimHeartBeatApMacIndex = 0;
-			else
-				mac->lim.gLimHeartBeatApMacIndex = 1;
+		pe_debug("HB Failure on MAC "
+			 QDF_MAC_ADDR_FMT" Store it on Index %d",
+			 QDF_MAC_ADDR_REF(sta->staAddr), apCount);
 
-			pe_debug("HB Failure on MAC "
-				 QDF_MAC_ADDR_FMT" Store it on Index %d",
-				 QDF_MAC_ADDR_REF(sta->staAddr), apCount);
+		sir_copy_mac_addr(mac->lim.gLimHeartBeatApMac[apCount],
+				  sta->staAddr);
+	}
 
-			sir_copy_mac_addr(mac->lim.gLimHeartBeatApMac[apCount],
-					  sta->staAddr);
-		}
+	mlmDeauthInd.reasonCode =
+		(uint8_t) sta->mlmStaContext.disassocReason;
+	mlmDeauthInd.deauthTrigger =
+		sta->mlmStaContext.cleanupTrigger;
 
-		mlmDeauthInd.reasonCode =
-			(uint8_t) sta->mlmStaContext.disassocReason;
-		mlmDeauthInd.deauthTrigger =
-			sta->mlmStaContext.cleanupTrigger;
+	if (LIM_IS_STA_ROLE(pe_session)) {
+		lim_connectivity_bmiss_disconn_event(sta, mac->psoc, reasonCode,
+						     pe_session->vdev_id);
 
-		if (LIM_IS_STA_ROLE(pe_session))
-			lim_post_sme_message(mac, LIM_MLM_DEAUTH_IND,
-					     (uint32_t *)&mlmDeauthInd);
+		lim_post_sme_message(mac, LIM_MLM_DEAUTH_IND,
+				     (uint32_t *)&mlmDeauthInd);
+	}
 
-		if (mac->mlme_cfg->gen.fatal_event_trigger)
-			cds_flush_logs(WLAN_LOG_TYPE_FATAL,
-					WLAN_LOG_INDICATOR_HOST_DRIVER,
-					WLAN_LOG_REASON_HB_FAILURE,
-					false, false);
+	if (mac->mlme_cfg->gen.fatal_event_trigger)
+		cds_flush_logs(WLAN_LOG_TYPE_FATAL,
+				WLAN_LOG_INDICATOR_HOST_DRIVER,
+				WLAN_LOG_REASON_HB_FAILURE,
+				false, false);
+
+	lim_send_sme_deauth_ind(mac, sta, pe_session);
 
-		lim_send_sme_deauth_ind(mac, sta, pe_session);
-	}
 } /*** lim_tear_down_link_with_ap() ***/
 
 /**