Эх сурвалжийг харах

qcacld-3.0: Skip starting SAP after channel change if stop BSS in progress

When stop_bss from HDD is received when a SAP channel change request
is currently in progress and channel change response is not yet
received from the FW, the stop_bss would clear the SAP session and
when channel change response is received, we try to start BSS again.
The CSR roam state is also set to JOINING in this case.

As part of start BSS, we queue set key command to SME active command
list. Since the session has been cleared, eWNI_SME_SETCONTEXT_RSP
sent to lim would not be processed in CSR state JOINING leading to set
key command stuck in the active command list.

Do not restart BSS after channel change response if stop BSS is in
progress. Also handle eWNI_SME_SETCONTEXT_RSP and clear the command
queue in CSR Joining state.

Change-Id: I8dbab054746d26cc92fc2274d35ce76a694035fe
CRs-Fixed: 2193505
Vignesh Viswanathan 7 жил өмнө
parent
commit
200f5c19b0

+ 9 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -8431,6 +8431,10 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 		struct hdd_hostapd_state *hostapd_state =
 			WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
 
+		/* Set the stop_bss_in_progress flag */
+		wlansap_set_stop_bss_inprogress(
+			WLAN_HDD_GET_SAP_CTX_PTR(adapter), true);
+
 		qdf_event_reset(&hostapd_state->qdf_stop_bss_event);
 		status = wlansap_stop_bss(WLAN_HDD_GET_SAP_CTX_PTR(adapter));
 		if (QDF_IS_STATUS_SUCCESS(status)) {
@@ -8445,6 +8449,11 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 			}
 		}
 		clear_bit(SOFTAP_BSS_STARTED, &adapter->event_flags);
+
+		/* Clear the stop_bss_in_progress flag */
+		wlansap_set_stop_bss_inprogress(
+			WLAN_HDD_GET_SAP_CTX_PTR(adapter), false);
+
 		/*BSS stopped, clear the active sessions for this device mode*/
 		policy_mgr_decr_session_set_pcl(hdd_ctx->hdd_psoc,
 						adapter->device_mode,

+ 14 - 0
core/sap/inc/sap_api.h

@@ -1425,6 +1425,20 @@ void sap_dfs_set_current_channel(void *sap_ctx);
  */
 void wlansap_cleanup_cac_timer(struct sap_context *sap_ctx);
 
+/**
+ * wlansap_set_stop_bss_inprogress - sets the stop_bss_in_progress flag
+ *
+ * @sap_ctx: Pointer to the global SAP ctx
+ * @in_progress: the value to be set to the stop_bss_in_progress_flag
+ *
+ * This function sets the value in in_progress parameter to the
+ * stop_bss_in_progress flag in sap_context.
+ *
+ * Return: None
+ */
+void wlansap_set_stop_bss_inprogress(struct sap_context *sap_ctx,
+					bool in_progress);
+
 #ifdef __cplusplus
 }
 #endif

+ 13 - 2
core/sap/src/sap_api_link_cntl.c

@@ -439,9 +439,20 @@ wlansap_roam_process_ch_change_success(tpAniSirGlobal mac_ctx,
 		  FL("sapdfs: changing target channel to [%d]"),
 		  mac_ctx->sap.SapDfsInfo.target_channel);
 	sap_ctx->channel = mac_ctx->sap.SapDfsInfo.target_channel;
-	/* Identify if this is channel change in radar detected state */
-	if (eSAP_DISCONNECTING != sap_ctx->sapsMachine)
+
+	/*
+	 * Identify if this is channel change in radar detected state
+	 * Also if we are waiting for sap to stop, don't proceed further
+	 * to restart SAP again.
+	 */
+	if ((eSAP_DISCONNECTING != sap_ctx->sapsMachine) ||
+	    sap_ctx->stop_bss_in_progress) {
+		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
+			  FL("sapdfs: state [%d] Stop BSS in progress [%d], not starting SAP after channel change"),
+			  sap_ctx->sapsMachine,
+			  sap_ctx->stop_bss_in_progress);
 		return;
+	}
 
 	if (sap_ctx->ch_params.ch_width == CH_WIDTH_160MHZ) {
 		is_ch_dfs = true;

+ 1 - 1
core/sap/src/sap_fsm.c

@@ -2704,7 +2704,7 @@ static QDF_STATUS sap_fsm_state_disconnecting(struct sap_context *sap_ctx,
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
 			  FL("in state %s, event msg %d result %d"),
 			  "eSAP_DISCONNECTING ", msg, sap_event->u2);
-		sap_goto_disconnecting(sap_ctx);
+		qdf_status = sap_goto_disconnecting(sap_ctx);
 	} else {
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
 			  FL("in state %s, invalid event msg %d"),

+ 1 - 0
core/sap/src/sap_internal.h

@@ -257,6 +257,7 @@ struct sap_context {
 	uint8_t sap_sta_id;
 	bool dfs_cac_offload;
 	bool is_chan_change_inprogress;
+	bool stop_bss_in_progress;
 };
 
 /*----------------------------------------------------------------------------

+ 16 - 0
core/sap/src/sap_module.c

@@ -671,6 +671,7 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx,
 	sap_ctx->dfs_cac_offload = pConfig->dfs_cac_offload;
 	sap_ctx->isCacEndNotified = false;
 	sap_ctx->is_chan_change_inprogress = false;
+	sap_ctx->stop_bss_in_progress = false;
 	/* Set the BSSID to your "self MAC Addr" read the mac address
 		from Configuation ITEM received from HDD */
 	sap_ctx->csr_roamProfile.BSSIDs.numOfBSSIDs = 1;
@@ -798,6 +799,21 @@ QDF_STATUS wlansap_set_mac_acl(struct sap_context *sap_ctx,
 	return qdf_status;
 } /* wlansap_set_mac_acl */
 
+void wlansap_set_stop_bss_inprogress(struct sap_context *sap_ctx,
+					bool in_progress)
+{
+	if (!sap_ctx) {
+		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
+			  "%s: Invalid SAP pointer from ctx", __func__);
+		return;
+	}
+
+	QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG,
+		  "%s: Set stop_bss_in_progress to %d",
+		  __func__, in_progress);
+	sap_ctx->stop_bss_in_progress = in_progress;
+}
+
 QDF_STATUS wlansap_stop_bss(struct sap_context *sap_ctx)
 {
 	tWLAN_SAPEvent sapEvent;        /* State machine event */

+ 4 - 0
core/sme/src/csr/csr_api_roam.c

@@ -10359,6 +10359,10 @@ void csr_roaming_state_msg_processor(tpAniSirGlobal pMac, void *pMsgBuf)
 		csr_sae_callback(pMac, pSmeRsp);
 		break;
 
+	case eWNI_SME_SETCONTEXT_RSP:
+		csr_roam_check_for_link_status_change(pMac, pSmeRsp);
+		break;
+
 	default:
 		sme_debug("Unexpected message type: %d[0x%X] received in substate %s",
 			pSmeRsp->messageType, pSmeRsp->messageType,