Parcourir la source

qcacld-3.0: Remove SAP FSM dependency from CSA

CSA req changes the SAP FSM state to STOPPING.

Remove this state manipulation by CSA.

Change-Id: I76e78824cdc7acad87e60310d53225596630ea94
CRs-Fixed: 2309229
Abhishek Singh il y a 6 ans
Parent
commit
5cd19f35d2

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

@@ -5317,10 +5317,6 @@ 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)) {
@@ -5336,10 +5332,6 @@ 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,

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

@@ -1413,6 +1413,21 @@ QDF_STATUS wlansap_set_tx_leakage_threshold(tHalHandle hal,
  */
 QDF_STATUS wlansap_set_invalid_session(struct sap_context *sap_ctx);
 
+/**
+ * sap_get_cac_dur_dfs_region() - get cac duration and dfs region.
+ * @sap_ctxt: sap context
+ * @cac_duration_ms: pointer to cac duration
+ * @dfs_region: pointer to dfs region
+ *
+ * Get cac duration and dfs region.
+ *
+ * Return: None
+ */
+void sap_get_cac_dur_dfs_region(struct sap_context *sap_ctx,
+				uint32_t *cac_duration_ms,
+				uint32_t *dfs_region);
+
+
 /**
  * sap_dfs_set_current_channel() - Set current channel params in dfs component
  * @sap_ctx: sap context
@@ -1435,20 +1450,6 @@ 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

+ 30 - 44
core/sap/src/sap_api_link_cntl.c

@@ -306,21 +306,16 @@ wlansap_roam_process_ch_change_success(tpAniSirGlobal mac_ctx,
 	 * then we will to perform channel availability check for 60 seconds
 	 */
 	QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_MED,
-		  FL("sapdfs: changing target channel to [%d]"),
-		  mac_ctx->sap.SapDfsInfo.target_channel);
+		  FL("sapdfs: changing target channel to [%d] state %d"),
+		  mac_ctx->sap.SapDfsInfo.target_channel, sap_ctx->fsm_state);
 	sap_ctx->channel = mac_ctx->sap.SapDfsInfo.target_channel;
 
-	/*
-	 * 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 ((sap_ctx->fsm_state != SAP_STOPPING) ||
-	    sap_ctx->stop_bss_in_progress) {
+	/* If SAP is not in starting or started state don't proceed further */
+	if (sap_ctx->fsm_state == SAP_INIT ||
+	    sap_ctx->fsm_state == SAP_STOPPING) {
 		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->fsm_state,
-			  sap_ctx->stop_bss_in_progress);
+			  FL("sapdfs: state [%d] not starting SAP after channel change"),
+			  sap_ctx->fsm_state);
 		return;
 	}
 
@@ -345,7 +340,7 @@ wlansap_roam_process_ch_change_success(tpAniSirGlobal mac_ctx,
 	/* check if currently selected channel is a DFS channel */
 	if (is_ch_dfs && sap_ctx->pre_cac_complete) {
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_MED, FL(
-		    "sapdfs: SAP_STOPPING => SAP_STARTING, on pre cac"));
+		    "sapdfs: => SAP_STARTING, on pre cac"));
 		/* Start beaconing on the new pre cac channel */
 		wlansap_start_beacon_req(sap_ctx);
 		sap_ctx->fsm_state = SAP_STARTING;
@@ -360,7 +355,7 @@ wlansap_roam_process_ch_change_success(tpAniSirGlobal mac_ctx,
 			mac_ctx->sap.SapDfsInfo.cac_state)) {
 			sap_ctx->fsm_state = SAP_INIT;
 			QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_MED,
-				  "%s: %d: sapdfs: from state SAP_STOPPING => DISCONNECTED with ignore cac false on sapctx[%pK]",
+				  "%s: %d: sapdfs: => SAP_INIT with ignore cac false on sapctx[%pK]",
 				  __func__, __LINE__, sap_ctx);
 			/* DFS Channel */
 			sap_event.event = eSAP_DFS_CHANNEL_CAC_START;
@@ -370,7 +365,7 @@ wlansap_roam_process_ch_change_success(tpAniSirGlobal mac_ctx,
 		} else {
 			QDF_TRACE(QDF_MODULE_ID_SAP,
 				  QDF_TRACE_LEVEL_INFO_MED,
-				  "%s: %d: sapdfs: from state SAP_STOPPING => SAP_STARTING with ignore cac true on sapctx[%pK]",
+				  "%s: %d: sapdfs: SAP_STARTING with ignore cac true on sapctx[%pK]",
 				  __func__, __LINE__, sap_ctx);
 
 			/* Start beaconing on the new channel */
@@ -384,7 +379,7 @@ wlansap_roam_process_ch_change_success(tpAniSirGlobal mac_ctx,
 		}
 	} else {
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_MED,
-			  "%s: %d: sapdfs: from state SAP_STOPPING => SAP_STARTING on sapctx[%pK]",
+			  "%s: %d: sapdfs: => SAP_STARTING on sapctx[%pK]",
 			  __func__, __LINE__, sap_ctx);
 		/* non-DFS channel */
 		sap_ctx->fsm_state = SAP_STARTING;
@@ -416,7 +411,6 @@ wlansap_roam_process_dfs_chansw_update(tHalHandle hHal,
 					    struct sap_context *sap_ctx,
 					    QDF_STATUS *ret_status)
 {
-	tWLAN_SAPEvent sap_event;
 	uint8_t intf;
 	QDF_STATUS qdf_status;
 	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hHal);
@@ -453,8 +447,6 @@ wlansap_roam_process_dfs_chansw_update(tHalHandle hHal,
 
 	QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_MED,
 		  FL("sapdfs: from state SAP_STARTED => SAP_STOPPING"));
-	/* SAP to be moved to DISCONNECTING state */
-	sap_ctx->fsm_state = SAP_STOPPING;
 	sap_ctx->is_chan_change_inprogress = true;
 	/*
 	 * The associated stations have been informed to move to a different
@@ -497,16 +489,15 @@ wlansap_roam_process_dfs_chansw_update(tHalHandle hHal,
 	if (sap_get_total_number_sap_intf(hHal) <= 1 ||
 	    policy_mgr_is_current_hwmode_dbs(mac_ctx->psoc) ||
 	    !sap_scc_dfs) {
-		/* Send channel switch request */
-		sap_event.event = eWNI_SME_CHANNEL_CHANGE_REQ;
-		sap_event.params = 0;
-		sap_event.u1 = 0;
-		sap_event.u2 = 0;
-		QDF_TRACE(QDF_MODULE_ID_SAP,
-			  QDF_TRACE_LEVEL_INFO_MED,
-			  FL("sapdfs: Posting event eWNI_SME_CHANNEL_CHANGE_REQ to sapFSM"));
-		/* Handle event */
-		qdf_status = sap_fsm(sap_ctx, &sap_event);
+		sap_get_cac_dur_dfs_region(sap_ctx,
+			&sap_ctx->csr_roamProfile.cac_duration_ms,
+			&sap_ctx->csr_roamProfile.dfs_regdomain);
+		/*
+		 * Most likely, radar has been detected and SAP wants to
+		 * change the channel
+		 */
+		qdf_status = wlansap_channel_change_request(sap_ctx,
+			mac_ctx->sap.SapDfsInfo.target_channel);
 		if (!QDF_IS_STATUS_SUCCESS(qdf_status))
 			*ret_status = QDF_STATUS_E_FAILURE;
 		return;
@@ -548,13 +539,15 @@ wlansap_roam_process_dfs_chansw_update(tHalHandle hHal,
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_MED,
 			  FL("sapdfs:issue chnl change for sapctx[%pK]"),
 			  sap_context);
-		/* Send channel switch request */
-		sap_event.event = eWNI_SME_CHANNEL_CHANGE_REQ;
-		sap_event.params = 0;
-		sap_event.u1 = 0;
-		sap_event.u2 = 0;
-		/* Handle event */
-		qdf_status = sap_fsm(sap_context, &sap_event);
+		sap_get_cac_dur_dfs_region(sap_context,
+			&sap_context->csr_roamProfile.cac_duration_ms,
+			&sap_context->csr_roamProfile.dfs_regdomain);
+		/*
+		 * Most likely, radar has been detected and SAP wants to
+		 * change the channel
+		 */
+		qdf_status = wlansap_channel_change_request(sap_context,
+				mac_ctx->sap.SapDfsInfo.target_channel);
 		if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
 			QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
 				  FL("post chnl chng req failed, sap[%pK]"),
@@ -1213,14 +1206,7 @@ wlansap_roam_callback(void *ctx, struct csr_roam_info *csr_roam_info,
 		 * channel due to the presence of radar but our channel change
 		 * failed, stop the BSS operation completely and inform hostapd
 		 */
-		sap_event.event = eWNI_SME_CHANNEL_CHANGE_RSP;
-		sap_event.params = 0;
-		sap_event.u1 = eCSR_ROAM_INFRA_IND;
-		sap_event.u2 = eCSR_ROAM_RESULT_CHANNEL_CHANGE_FAILURE;
-
-		qdf_status = sap_fsm(sap_ctx, &sap_event);
-		if (!QDF_IS_STATUS_SUCCESS(qdf_status))
-			qdf_ret_status = QDF_STATUS_E_FAILURE;
+		qdf_ret_status = wlansap_stop_bss(sap_ctx);
 		break;
 	case eCSR_ROAM_EXT_CHG_CHNL_UPDATE_IND:
 		qdf_status = sap_signal_hdd_event(sap_ctx, csr_roam_info,

+ 2 - 49
core/sap/src/sap_fsm.c

@@ -419,17 +419,7 @@ static uint8_t sap_ch_params_to_bonding_channels(
 	return nchannels;
 }
 
-/**
- * sap_get_cac_dur_dfs_region() - get cac duration and dfs region.
- * @sap_ctxt: sap context
- * @cac_duration_ms: pointer to cac duration
- * @dfs_region: pointer to dfs region
- *
- * Get cac duration and dfs region.
- *
- * Return: None
- */
-static void sap_get_cac_dur_dfs_region(struct sap_context *sap_ctx,
+void sap_get_cac_dur_dfs_region(struct sap_context *sap_ctx,
 		uint32_t *cac_duration_ms,
 		uint32_t *dfs_region)
 {
@@ -2323,12 +2313,7 @@ static QDF_STATUS sap_fsm_state_dfs_cac_wait(struct sap_context *sap_ctx,
 		qdf_status = sap_cac_start_notify(hal);
 	} else if (msg == eSAP_DFS_CHANNEL_CAC_RADAR_FOUND) {
 		uint8_t intf;
-		/*
-		 * Radar found while performing channel availability
-		 * check, need to switch the channel again
-		 */
-		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
-			  "ENTERTRED CAC WAIT STATE-->SAP_STOPPING\n");
+
 		if (mac_ctx->sap.SapDfsInfo.target_channel) {
 			wlan_reg_set_channel_params(mac_ctx->pdev,
 				mac_ctx->sap.SapDfsInfo.target_channel, 0,
@@ -2356,8 +2341,6 @@ static QDF_STATUS sap_fsm_state_dfs_cac_wait(struct sap_context *sap_ctx,
 						mac_ctx->pdev,
 						profile->operationChannel))
 					continue;
-				/* SAP to be moved to STOPPING state */
-				t_sap_ctx->fsm_state = SAP_STOPPING;
 				t_sap_ctx->is_chan_change_inprogress = true;
 				/*
 				 * eSAP_DFS_CHANNEL_CAC_RADAR_FOUND:
@@ -2673,36 +2656,6 @@ sap_fsm_state_stopping(struct sap_context *sap_ctx,
 		qdf_status = sap_signal_hdd_event(sap_ctx, NULL,
 					eSAP_STOP_BSS_EVENT,
 					(void *)eSAP_STATUS_SUCCESS);
-	} else if (msg == eWNI_SME_CHANNEL_CHANGE_REQ) {
-		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_MED,
-			  FL("sapdfs: Send channel change request on sapctx[%pK]"),
-			  sap_ctx);
-
-		sap_get_cac_dur_dfs_region(sap_ctx,
-				&sap_ctx->csr_roamProfile.cac_duration_ms,
-				&sap_ctx->csr_roamProfile.dfs_regdomain);
-		/*
-		 * Most likely, radar has been detected and SAP wants to
-		 * change the channel
-		 */
-		qdf_status = wlansap_channel_change_request(sap_ctx,
-				mac_ctx->sap.SapDfsInfo.target_channel);
-
-		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
-			  FL("Sending DFS eWNI_SME_CHANNEL_CHANGE_REQ"));
-	} else if (msg == eWNI_SME_CHANNEL_CHANGE_RSP) {
-		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
-			  FL("in state %s, event msg %d result %d"),
-			  "SAP_STOPPING ", msg, sap_event->u2);
-		if (sap_event->u2 == eCSR_ROAM_RESULT_CHANNEL_CHANGE_FAILURE)
-			qdf_status = sap_goto_stopping(sap_ctx);
-	} else if ((msg == eSAP_HDD_STOP_INFRA_BSS) &&
-			(sap_ctx->is_chan_change_inprogress)) {
-		/* stop bss is received while processing channel change */
-		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
-			  FL("in state %s, event msg %d result %d"),
-			  "SAP_STOPPING ", msg, sap_event->u2);
-		qdf_status = sap_goto_stopping(sap_ctx);
 	} else {
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
 			  FL("in state %s, invalid event msg %d"),

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

@@ -688,7 +688,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;
@@ -809,21 +809,6 @@ 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 */