Forráskód Böngészése

qcacld-3.0: Fix set band cases failed

Recent changes to hdd_regulatory_dyn_cbk broke WWAN n79 and
WIFI 5 GHz co-existence, failure:
1. AGO won't switch channel to 2G even 5G channel disabled.
2. SAP can switch to 2G if 5G disabled, but won't restore back
to 5G when 5G re-enable.

Update callback to call the proper function so that band for
SAP or P2P GO is updated accordingly.

Change-Id: I4087466c9a05250921159d5daff077a8ea7ea495
CRs-fixed: 2718339
Lincoln Tran 4 éve
szülő
commit
d8a2fcc25d

+ 11 - 1
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -2582,13 +2582,23 @@ int8_t policy_mgr_get_num_dbs_hw_modes(struct wlan_objmgr_psoc *psoc);
 QDF_STATUS policy_mgr_get_dbs_hw_modes(struct wlan_objmgr_psoc *psoc,
 		bool *one_by_one_dbs, bool *two_by_two_dbs);
 
+/**
+ * policy_mgr_check_sap_restart() - Restart SAP when band/channel change
+ * @psoc: Pointer to soc
+ * @vdev_id: Vdev id
+ *
+ * Return: None
+ */
+void
+policy_mgr_check_sap_restart(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id);
+
 /**
  * policy_mgr_check_sta_ap_concurrent_ch_intf() - Restart SAP in STA-AP case
  * @data: Pointer to STA adapter
  *
  * Restarts the SAP interface in STA-AP concurrency scenario
  *
- * Restart: None
+ * Return: None
  */
 void policy_mgr_check_sta_ap_concurrent_ch_intf(void *data);
 

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

@@ -1779,6 +1779,49 @@ void policy_mgr_nan_sap_post_disable_conc_check(struct wlan_objmgr_psoc *psoc)
 					       sap_info->bw), true);
 }
 
+void policy_mgr_check_sap_restart(struct wlan_objmgr_psoc *psoc,
+				  uint8_t vdev_id)
+{
+	QDF_STATUS status;
+	uint32_t ch_freq;
+	struct policy_mgr_psoc_priv_obj *pm_ctx = NULL;
+
+	if (!psoc) {
+		policy_mgr_err("Invalid psoc");
+		return;
+	}
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid context");
+		return;
+	}
+
+	if (pm_ctx->hdd_cbacks.hdd_is_chan_switch_in_progress &&
+	    pm_ctx->hdd_cbacks.hdd_is_chan_switch_in_progress()) {
+		policy_mgr_debug("wait as channel switch is already in progress");
+		status =
+			qdf_wait_single_event(&pm_ctx->channel_switch_complete_evt,
+					      CHANNEL_SWITCH_COMPLETE_TIMEOUT);
+		if (QDF_IS_STATUS_ERROR(status))
+			policy_mgr_err("wait for event failed, still continue with channel switch");
+	}
+
+	if (!pm_ctx->hdd_cbacks.wlan_hdd_get_channel_for_sap_restart) {
+		policy_mgr_err("SAP restart get channel callback in NULL");
+		goto end;
+	}
+	status =
+		pm_ctx->hdd_cbacks.wlan_hdd_get_channel_for_sap_restart(psoc,
+								      vdev_id,
+								      &ch_freq);
+	if (status == QDF_STATUS_SUCCESS)
+		policy_mgr_debug("SAP vdev id %d switch to new ch freq: %d",
+				 vdev_id, ch_freq);
+
+end:
+	pm_ctx->do_sap_unsafe_ch_check = false;
+}
+
 static void __policy_mgr_check_sta_ap_concurrent_ch_intf(void *data)
 {
 	struct wlan_objmgr_psoc *psoc;

+ 9 - 24
core/hdd/src/wlan_hdd_regulatory.c

@@ -1469,7 +1469,6 @@ static void hdd_country_change_update_sta(struct hdd_context *hdd_ctx)
  * @adapter: HDD vdev context
  * @sap_config: sap configuration pointer
  * @csr_phy_mode: phymode to restart SAP with
- * @freq_changed: flag to set freq update on restart
  *
  * This function handles the stop/start/restart of SAP/P2P_GO adapters when the
  * country code changes
@@ -1479,8 +1478,7 @@ static void hdd_country_change_update_sta(struct hdd_context *hdd_ctx)
 static void hdd_restart_sap_with_new_phymode(struct hdd_context *hdd_ctx,
 					     struct hdd_adapter *adapter,
 					     struct sap_config *sap_config,
-					     eCsrPhyMode csr_phy_mode,
-					     bool freq_changed)
+					     eCsrPhyMode csr_phy_mode)
 {
 	struct hdd_hostapd_state *hostapd_state = NULL;
 	struct sap_context *sap_ctx = NULL;
@@ -1503,10 +1501,8 @@ static void hdd_restart_sap_with_new_phymode(struct hdd_context *hdd_ctx,
 		return;
 	}
 
-	if (freq_changed) {
-		sap_config->chan_freq =
+	sap_config->chan_freq =
 		wlansap_get_safe_channel_from_pcl_and_acs_range(sap_ctx);
-	}
 
 	sap_config->sap_orig_hw_mode = sap_config->SapHw_mode;
 	sap_config->SapHw_mode = csr_phy_mode;
@@ -1543,29 +1539,21 @@ static void hdd_country_change_update_sap(struct hdd_context *hdd_ctx)
 {
 	struct hdd_adapter *adapter = NULL;
 	struct sap_config *sap_config = NULL;
-	struct sap_context *sap_ctx = NULL;
 	struct wlan_objmgr_pdev *pdev = NULL;
 	uint32_t reg_phy_mode, new_phy_mode;
-	bool freq_changed, phy_changed;
+	bool phy_changed;
 	qdf_freq_t oper_freq;
 	eCsrPhyMode csr_phy_mode;
-	struct sta_ap_intf_check_work_ctx intf_work;
-	QDF_STATUS status;
 
 	pdev = hdd_ctx->pdev;
 
 	hdd_for_each_adapter_dev_held(hdd_ctx, adapter) {
 		oper_freq = hdd_get_adapter_home_channel(adapter);
-		freq_changed = wlan_reg_is_disable_for_freq(pdev, oper_freq);
 
 		switch (adapter->device_mode) {
 		case QDF_P2P_GO_MODE:
-			sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
-			if (freq_changed) {
-				status = wlansap_stop_bss(sap_ctx);
-				if (QDF_IS_STATUS_SUCCESS(status))
-					hdd_debug("Deleting SAP/P2P link!!");
-			}
+			policy_mgr_check_sap_restart(hdd_ctx->psoc,
+						     adapter->vdev_id);
 			break;
 		case QDF_SAP_MODE:
 			sap_config = &adapter->session.ap.sap_config;
@@ -1578,18 +1566,15 @@ static void hdd_country_change_update_sap(struct hdd_context *hdd_ctx)
 			csr_phy_mode =
 				csr_convert_from_reg_phy_mode(new_phy_mode);
 			phy_changed = (csr_phy_mode != sap_config->SapHw_mode);
-			if (freq_changed) {
-				intf_work.psoc = wlan_pdev_get_psoc(pdev);
-				policy_mgr_check_sta_ap_concurrent_ch_intf(
-								&intf_work);
-			}
 
 			if (phy_changed)
 				hdd_restart_sap_with_new_phymode(hdd_ctx,
 								 adapter,
 								 sap_config,
-								 csr_phy_mode,
-								 freq_changed);
+								 csr_phy_mode);
+			else
+				policy_mgr_check_sap_restart(hdd_ctx->psoc,
+							     adapter->vdev_id);
 			break;
 		default:
 			break;