Browse Source

qcacld-3.0: remove duplicate code logic and race condition

Currently, there is duplicate logic in function
wlansap_roam_process_ch_change_success to invoke
function wlansap_start_beacon_req.
  a\ wlansap_roam_process_ch_change_success ->
	wlansap_start_beacon_req(sap_ctx)
  b\ wlansap_roam_process_ch_change_success ->
	sap_fsm -> sap_fsm_state_starting ->
	wlansap_start_beacon_req(sap_ctx)
This causes fw crash since it sends vdev up twice.

Also in SAP + SAP scenario, there is a race in updating global
variable mac_ctx->sap.SapDfsInfo.sap_radar_found_status. Move the
variable to sap_ctx per vdev to avoid such race.

Change-Id: Iaac9e5a649ea5fd6a8378f6da47c51112fbe8d18
CRs-Fixed: 3310317
Paul Zhang 2 years ago
parent
commit
bc894a28b6

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

@@ -578,7 +578,6 @@ typedef struct sSapDfsNolInfo {
 
 typedef struct sSapDfsInfo {
 	qdf_mc_timer_t sap_dfs_cac_timer;
-	uint8_t sap_radar_found_status;
 	/*
 	 * New channel frequency to move to when a  Radar is
 	 * detected on current Channel

+ 4 - 8
core/sap/src/sap_api_link_cntl.c

@@ -492,10 +492,8 @@ wlansap_roam_process_ch_change_success(struct mac_context *mac_ctx,
 	sap_ctx->chan_freq = target_chan_freq;
 	/* check if currently selected channel is a DFS channel */
 	if (is_ch_dfs && wlan_pre_cac_complete_get(sap_ctx->vdev)) {
-		/* Start beaconing on the new pre cac channel */
-		wlansap_start_beacon_req(sap_ctx);
 		sap_ctx->fsm_state = SAP_STARTING;
-		mac_ctx->sap.SapDfsInfo.sap_radar_found_status = false;
+		sap_ctx->sap_radar_found_status = false;
 		sap_event.event = eSAP_MAC_START_BSS_SUCCESS;
 		sap_event.params = csr_roam_info;
 		sap_event.u1 = eCSR_ROAM_INFRA_IND;
@@ -514,10 +512,8 @@ wlansap_roam_process_ch_change_success(struct mac_context *mac_ctx,
 			sap_event.u1 = 0;
 			sap_event.u2 = 0;
 		} else {
-			/* Start beaconing on the new channel */
-			wlansap_start_beacon_req(sap_ctx);
 			sap_ctx->fsm_state = SAP_STARTING;
-			mac_ctx->sap.SapDfsInfo.sap_radar_found_status = false;
+			sap_ctx->sap_radar_found_status = false;
 			sap_event.event = eSAP_MAC_START_BSS_SUCCESS;
 			sap_event.params = csr_roam_info;
 			sap_event.u1 = eCSR_ROAM_INFRA_IND;
@@ -526,7 +522,7 @@ wlansap_roam_process_ch_change_success(struct mac_context *mac_ctx,
 	} else {
 		/* non-DFS channel */
 		sap_ctx->fsm_state = SAP_STARTING;
-		mac_ctx->sap.SapDfsInfo.sap_radar_found_status = false;
+		sap_ctx->sap_radar_found_status = false;
 		sap_event.event = eSAP_MAC_START_BSS_SUCCESS;
 		sap_event.params = csr_roam_info;
 		sap_event.u1 = eCSR_ROAM_INFRA_IND;
@@ -721,7 +717,7 @@ wlansap_roam_process_dfs_radar_found(struct mac_context *mac_ctx,
 			sap_err("sapdfs: DFS channel switch disabled");
 			return;
 		}
-		if (false == mac_ctx->sap.SapDfsInfo.sap_radar_found_status) {
+		if (!sap_ctx->sap_radar_found_status) {
 			sap_err("sapdfs: sap_radar_found_status is false");
 			return;
 		}

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

@@ -2838,7 +2838,7 @@ static void wlansap_pre_cac_end_notify(struct sap_context *sap_context,
 				       uint8_t intf)
 {
 	sap_context->isCacEndNotified = true;
-	mac->sap.SapDfsInfo.sap_radar_found_status = false;
+	sap_context->sap_radar_found_status = false;
 	sap_context->fsm_state = SAP_STARTED;
 
 	sap_warn("pre cac end notify on %d: move to state SAP_STARTED", intf);
@@ -2899,7 +2899,7 @@ QDF_STATUS sap_cac_end_notify(mac_handle_t mac_handle,
 				return qdf_status;
 			}
 			sap_context->isCacEndNotified = true;
-			mac->sap.SapDfsInfo.sap_radar_found_status = false;
+			sap_context->sap_radar_found_status = false;
 			sap_debug("sapdfs: Start beacon request on sapctx[%pK]",
 				  sap_context);
 
@@ -3272,7 +3272,7 @@ static QDF_STATUS sap_goto_starting(struct sap_context *sap_ctx,
 	/* Reset radar found flag before start sap, the flag will
 	 * be set when radar found in CAC wait.
 	 */
-	mac_ctx->sap.SapDfsInfo.sap_radar_found_status = false;
+	sap_ctx->sap_radar_found_status = false;
 
 	sap_debug("session: %d", sap_ctx->sessionId);
 
@@ -3641,7 +3641,7 @@ static QDF_STATUS sap_fsm_state_starting(struct sap_context *sap_ctx,
 							       mac_handle);
 			} else {
 				sap_debug("skip cac timer");
-				mac_ctx->sap.SapDfsInfo.sap_radar_found_status = false;
+				sap_ctx->sap_radar_found_status = false;
 				/*
 				 * If hostapd starts AP on dfs channel,
 				 * hostapd will wait for CAC START/CAC END
@@ -4420,7 +4420,7 @@ qdf_freq_t sap_indicate_radar(struct sap_context *sap_ctx)
 		return sap_ctx->chan_freq;
 
 	/* set the Radar Found flag in SapDfsInfo */
-	mac->sap.SapDfsInfo.sap_radar_found_status = true;
+	sap_ctx->sap_radar_found_status = true;
 
 	chan_freq = wlan_pre_cac_get_freq_before_pre_cac(sap_ctx->vdev);
 	if (chan_freq) {

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

@@ -133,6 +133,7 @@ struct sap_context {
 
 	/* Include the SME(CSR) sessionId here */
 	uint8_t sessionId;
+	uint8_t sap_radar_found_status;
 
 	/* vdev object corresponding to sessionId */
 	struct wlan_objmgr_vdev *vdev;

+ 2 - 2
core/sap/src/sap_module.c

@@ -1690,7 +1690,7 @@ QDF_STATUS wlansap_set_channel_change_with_csa(struct sap_context *sap_ctx,
 			 * that were suspended in HDD before the channel
 			 * request was issued.
 			 */
-			mac->sap.SapDfsInfo.sap_radar_found_status = true;
+			sap_ctx->sap_radar_found_status = true;
 			mac->sap.SapDfsInfo.cac_state =
 					eSAP_DFS_DO_NOT_SKIP_CAC;
 			sap_cac_reset_notify(mac_handle);
@@ -1988,7 +1988,7 @@ QDF_STATUS wlansap_start_beacon_req(struct sap_context *sap_ctx)
 	}
 
 	/* No Radar was found during CAC WAIT, So start Beaconing */
-	if (mac->sap.SapDfsInfo.sap_radar_found_status == false) {
+	if (!sap_ctx->sap_radar_found_status) {
 		/* CAC Wait done without any Radar Detection */
 		dfs_cac_wait_status = true;
 		wlan_pre_cac_complete_set(sap_ctx->vdev, false);