Browse Source

qcacld-3.0: Start SAP on 80Mhz in STA+SAP when acs_policy enabled

When acs_policy is enabled and STA is already up on some 5Ghz channel,
SAP is coming up on the same 5Ghz channel as expected but in 20Mhz even
when bandwidth given by hostapd is 80Mhz.

Start SAP on same channel as STA but in 80Mhz instead of 20Mhz.

Change-Id: Ie5dc06844f867d32796706cdcc190d1cb1b1d2fe
CRs-Fixed: 2196229
Himanshu Agarwal 7 năm trước cách đây
mục cha
commit
331639871a

+ 32 - 0
core/hdd/src/wlan_hdd_cfg80211.c

@@ -2353,6 +2353,7 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 	uint8_t ch_width;
 	enum qca_wlan_vendor_acs_hw_mode hw_mode;
 	QDF_STATUS qdf_status;
+	uint8_t conc_channel;
 
 	/* ***Note*** Donot set SME config related to ACS operation here because
 	 * ACS operation is not synchronouse and ACS for Second AP may come when
@@ -2607,6 +2608,37 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 		for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++)
 			hdd_debug("%d ", sap_config->acs_cfg.ch_list[i]);
 	}
+
+	conc_channel = policy_mgr_mode_specific_get_channel(hdd_ctx->hdd_psoc,
+							    PM_STA_MODE);
+	if (hdd_ctx->config->external_acs_policy ==
+	    HDD_EXTERNAL_ACS_PCL_MANDATORY) {
+		if ((conc_channel >= WLAN_REG_CH_NUM(CHAN_ENUM_36) &&
+		     sap_config->acs_cfg.band == QCA_ACS_MODE_IEEE80211A) ||
+		     (conc_channel <= WLAN_REG_CH_NUM(CHAN_ENUM_14) &&
+		      (sap_config->acs_cfg.band == QCA_ACS_MODE_IEEE80211B ||
+		       sap_config->acs_cfg.band == QCA_ACS_MODE_IEEE80211A))) {
+			sap_config->acs_cfg.pri_ch = conc_channel;
+			wlan_sap_set_sap_ctx_acs_cfg(
+				WLAN_HDD_GET_SAP_CTX_PTR(adapter), sap_config);
+			sap_config_acs_result(hdd_ctx->hHal,
+					      WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+					      sap_config->acs_cfg.ht_sec_ch);
+			sap_config->ch_params.ch_width =
+					sap_config->acs_cfg.ch_width;
+			sap_config->ch_params.sec_ch_offset =
+					sap_config->acs_cfg.ht_sec_ch;
+			sap_config->ch_params.center_freq_seg0 =
+					sap_config->acs_cfg.vht_seg0_center_ch;
+			sap_config->ch_params.center_freq_seg1 =
+					sap_config->acs_cfg.vht_seg1_center_ch;
+			/*notify hostapd about channel override */
+			wlan_hdd_cfg80211_acs_ch_select_evt(adapter);
+			ret = 0;
+			goto out;
+		}
+	}
+
 	sap_config->acs_cfg.acs_mode = true;
 	if (test_bit(ACS_IN_PROGRESS, &hdd_ctx->g_event_flags)) {
 		/* ***Note*** Completion variable usage is not allowed

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

@@ -1296,6 +1296,21 @@ uint32_t wlan_sap_get_vht_ch_width(struct sap_context *sap_ctx);
 void wlan_sap_set_vht_ch_width(struct sap_context *sap_ctx,
 			       uint32_t vht_channel_width);
 
+/**
+ * wlan_sap_set_sap_ctx_acs_cfg() - Sets acs cfg
+ * @sap_ctx:  Pointer to Sap Context
+ * @sap_config:  Pointer to sap config
+ *
+ * This function sets the acs cfg in sap context.
+ *
+ * Return: None
+ */
+void wlan_sap_set_sap_ctx_acs_cfg(struct sap_context *sap_ctx,
+				  tsap_config_t *sap_config);
+
+void sap_config_acs_result(tHalHandle hal, struct sap_context *sap_ctx,
+			   uint32_t sec_ch);
+
 QDF_STATUS wlansap_update_sap_config_add_ie(tsap_config_t *pConfig,
 		const uint8_t *
 		pAdditionIEBuffer,

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

@@ -389,8 +389,6 @@ QDF_STATUS sap_goto_channel_sel(
 	bool sap_do_acs_pre_start_bss,
 	bool check_for_connection_update);
 
-void sap_config_acs_result(tHalHandle hal, struct sap_context *sap_ctx,
-							uint32_t sec_ch);
 /**
  * sap_check_in_avoid_ch_list() - checks if given channel present is channel
  * avoidance list

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

@@ -620,6 +620,20 @@ static inline bool wlan_sap_validate_channel_switch(tHalHandle hal,
 	return true;
 }
 #endif
+
+void wlan_sap_set_sap_ctx_acs_cfg(struct sap_context *sap_ctx,
+				  tsap_config_t *sap_config)
+{
+	if (!sap_ctx) {
+		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
+			  "%s: Invalid SAP pointer",
+			  __func__);
+		return;
+	}
+
+	sap_ctx->acs_cfg = &sap_config->acs_cfg;
+}
+
 QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx,
 			     tpWLAN_SAPEventCB pSapEventCallback,
 			     tsap_config_t *pConfig, void *pUsrContext)