Browse Source

qcacld-3.0: Prevent CSA in middle of CAC

If precac interface is in the middle of CAC, do not
entertain any CSA request coming as part of userspace/
country change/unsafe channel handling. Processing the
Channel change request in middle of CAC leads to teardown
of the SAP as SAP is in SAP_STOPPED state.
This leads to pre-cac failure.

To fix this, prevent CSA while CAC and once CAC is finished,
check the sanity of the operating channel based on
unsafe/disable channel list and move it to a valid channel.

Change-Id: I2757753a2a13bdaef60f9b9a46fcd569ddb7306c
CRs-Fixed: 3505593
Surya Prakash Sivaraj 1 year ago
parent
commit
5e69b2f7f7

+ 10 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -2223,6 +2223,16 @@ void policy_mgr_check_sap_restart(struct wlan_objmgr_psoc *psoc,
 		return;
 	}
 
+	/*
+	 * Restart should be handled by sap_fsm_validate_and_change_channel(),
+	 * after SAP starts.
+	 */
+	if (pm_ctx->hdd_cbacks.hdd_is_cac_in_progress &&
+	    pm_ctx->hdd_cbacks.hdd_is_cac_in_progress()) {
+		policy_mgr_debug("DFS CAC in progress, do not restart SAP");
+		return;
+	}
+
 	if (!pm_ctx->hdd_cbacks.wlan_hdd_get_channel_for_sap_restart) {
 		policy_mgr_err("SAP restart get channel callback in NULL");
 		goto end;

+ 2 - 2
core/hdd/src/wlan_hdd_regulatory.c

@@ -1838,8 +1838,8 @@ static void hdd_country_change_update_sap(struct hdd_context *hdd_ctx)
 					policy_mgr_check_sap_restart(
 							hdd_ctx->psoc,
 							link_info->vdev_id);
-					hdd_debug("Update tx power due to ctry change");
-					wlan_reg_update_tx_power_on_ctry_change(
+				hdd_debug("Update tx power due to ctry change");
+				wlan_reg_update_tx_power_on_ctry_change(
 						    pdev, link_info->vdev_id);
 				break;
 			default:

+ 8 - 6
core/sap/src/sap_fsm.c

@@ -3705,14 +3705,14 @@ sap_fsm_send_csa_restart_req(struct mac_context *mac_ctx,
 }
 
 /**
- * sap_fsm_handle_check_safe_channel() - handle channel Avoid event event during
- *                                       cac
+ * sap_fsm_validate_and_change_channel() - handle channel Avoid event event
+ *                                         or channel list update during cac
  * @mac_ctx: global MAC context
  *
  * Return: QDF_STATUS
  */
-static void sap_fsm_handle_check_safe_channel(struct mac_context *mac_ctx,
-					      struct sap_context *sap_ctx)
+static void sap_fsm_validate_and_change_channel(struct mac_context *mac_ctx,
+						struct sap_context *sap_ctx)
 {
 	qdf_freq_t target_chan_freq;
 	struct ch_params ch_params = {0};
@@ -3722,7 +3722,9 @@ static void sap_fsm_handle_check_safe_channel(struct mac_context *mac_ctx,
 	if (((!sap_ctx->acs_cfg || !sap_ctx->acs_cfg->acs_mode) &&
 	     target_psoc_get_sap_coex_fixed_chan_cap(
 				wlan_psoc_get_tgt_if_handle(mac_ctx->psoc))) ||
-	    policy_mgr_is_sap_freq_allowed(mac_ctx->psoc, sap_ctx->chan_freq))
+	    (policy_mgr_is_sap_freq_allowed(mac_ctx->psoc, sap_ctx->chan_freq) &&
+	     !wlan_reg_is_disable_for_pwrmode(mac_ctx->pdev, sap_ctx->chan_freq,
+					      REG_CURRENT_PWR_MODE)))
 		return;
 
 	/*
@@ -3889,7 +3891,7 @@ static QDF_STATUS sap_fsm_state_starting(struct sap_context *sap_ctx,
 		 * whether sap frequency is safe if not restart sap to a safe
 		 * channel.
 		 */
-		sap_fsm_handle_check_safe_channel(mac_ctx, sap_ctx);
+		sap_fsm_validate_and_change_channel(mac_ctx, sap_ctx);
 	} else if (msg == eSAP_MAC_START_FAILS ||
 		 msg == eSAP_HDD_STOP_INFRA_BSS) {
 			qdf_status = sap_fsm_handle_start_failure(sap_ctx, msg,