Преглед на файлове

qcacld-3.0: Add 6GHz support for VENDOR_SUBCMD_ACS_POLICY

As a part of 6GHz support, add support to parse channel frequency
attribute: QCA_WLAN_VENDOR_ATTR_ACS_FREQUENCY_HINT (in MHz)
in QCA_NL80211_VENDOR_SUBCMD_ACS_POLICY command data.

Change-Id: Ic7bee5fe1123b82607e375c71a21b9744d67ea17
CRs-Fixed: 2533998
Rajeev Kumar Sirasanagandla преди 5 години
родител
ревизия
e83ac29a70
променени са 4 файла, в които са добавени 32 реда и са изтрити 23 реда
  1. 2 2
      core/hdd/inc/wlan_hdd_main.h
  2. 21 11
      core/hdd/src/wlan_hdd_cfg80211.c
  3. 6 8
      core/hdd/src/wlan_hdd_hostapd.c
  4. 3 2
      core/hdd/src/wlan_hdd_main.c

+ 2 - 2
core/hdd/inc/wlan_hdd_main.h

@@ -1427,11 +1427,11 @@ enum driver_modules_status {
 /**
  * struct acs_dfs_policy - Define ACS policies
  * @acs_dfs_mode: Dfs mode enabled/disabled.
- * @acs_channel: pre defined channel to avoid ACS.
+ * @acs_chan_freq: pre defined channel frequency to avoid ACS.
  */
 struct acs_dfs_policy {
 	enum dfs_mode acs_dfs_mode;
-	uint8_t acs_channel;
+	uint32_t acs_chan_freq;
 };
 
 /**

+ 21 - 11
core/hdd/src/wlan_hdd_cfg80211.c

@@ -1900,9 +1900,8 @@ int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter)
 		hdd_err("SAP config is NULL");
 		return -EINVAL;
 	}
-	if (hdd_ctx->acs_policy.acs_channel)
-		sap_config->chan_freq = wlan_reg_chan_to_freq(hdd_ctx->pdev,
-					hdd_ctx->acs_policy.acs_channel);
+	if (hdd_ctx->acs_policy.acs_chan_freq)
+		sap_config->chan_freq = hdd_ctx->acs_policy.acs_chan_freq;
 	else
 		sap_config->chan_freq = AUTO_CHANNEL_SELECT;
 	ucfg_policy_mgr_get_mcc_scc_switch(hdd_ctx->psoc,
@@ -10254,8 +10253,9 @@ wlan_hdd_sap_config_policy[QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_MAX + 1] = {
 
 static const struct nla_policy
 wlan_hdd_set_acs_dfs_config_policy[QCA_WLAN_VENDOR_ATTR_ACS_DFS_MAX + 1] = {
-	[QCA_WLAN_VENDOR_ATTR_ACS_DFS_MODE] = {.type = NLA_U8 },
-	[QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_HINT] = {.type = NLA_U8 },
+	[QCA_WLAN_VENDOR_ATTR_ACS_DFS_MODE] = {.type = NLA_U8},
+	[QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_HINT] = {.type = NLA_U8},
+	[QCA_WLAN_VENDOR_ATTR_ACS_FREQUENCY_HINT] = {.type = NLA_U32},
 };
 
 /**
@@ -10285,7 +10285,7 @@ __wlan_hdd_cfg80211_acs_dfs_mode(struct wiphy *wiphy,
 	int ret;
 	struct acs_dfs_policy *acs_policy;
 	int mode = DFS_MODE_NONE;
-	int channel_hint = 0;
+	uint32_t freq_hint = 0;
 
 	hdd_enter_dev(wdev->netdev);
 
@@ -10323,15 +10323,25 @@ __wlan_hdd_cfg80211_acs_dfs_mode(struct wiphy *wiphy,
 	 * SCM sends this attribute to provide an active channel,
 	 * to skip redundant ACS between drivers, and save driver start up time
 	 */
-	if (tb[QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_HINT])
-		channel_hint = nla_get_u8(
+	if (tb[QCA_WLAN_VENDOR_ATTR_ACS_FREQUENCY_HINT]) {
+		freq_hint = nla_get_u32(
+				tb[QCA_WLAN_VENDOR_ATTR_ACS_FREQUENCY_HINT]);
+	} else if (tb[QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_HINT]) {
+		uint32_t channel_hint = nla_get_u8(
 				tb[QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_HINT]);
 
-	if (!IS_CHANNEL_VALID(channel_hint)) {
-		hdd_err("acs channel is not valid");
+		freq_hint = wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev,
+							 channel_hint);
+	}
+
+	if (freq_hint && !WLAN_REG_IS_24GHZ_CH_FREQ(freq_hint) &&
+	    !WLAN_REG_IS_5GHZ_CH_FREQ(freq_hint) &&
+	    !WLAN_REG_IS_6GHZ_CHAN_FREQ(freq_hint)) {
+		hdd_err("acs channel frequency is not valid");
 		return -EINVAL;
 	}
-	acs_policy->acs_channel = channel_hint;
+
+	acs_policy->acs_chan_freq = freq_hint;
 
 	return 0;
 }

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

@@ -3325,8 +3325,7 @@ QDF_STATUS hdd_init_ap_mode(struct hdd_adapter *adapter, bool reinit)
 
 	if (!reinit) {
 		adapter->session.ap.sap_config.chan_freq =
-			wlan_reg_chan_to_freq(hdd_ctx->pdev,
-					      hdd_ctx->acs_policy.acs_channel);
+					      hdd_ctx->acs_policy.acs_chan_freq;
 		acs_dfs_mode = hdd_ctx->acs_policy.acs_dfs_mode;
 		adapter->session.ap.sap_config.acs_dfs_mode =
 			wlan_hdd_get_dfs_mode(acs_dfs_mode);
@@ -5054,13 +5053,12 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 	hdd_debug("acs_mode %d", config->acs_cfg.acs_mode);
 
 	if (config->acs_cfg.acs_mode == true) {
-		hdd_debug("acs_channel %d, acs_dfs_mode %d",
-			hdd_ctx->acs_policy.acs_channel,
-			hdd_ctx->acs_policy.acs_dfs_mode);
+		hdd_debug("acs_chan_freq %u, acs_dfs_mode %u",
+			  hdd_ctx->acs_policy.acs_chan_freq,
+			  hdd_ctx->acs_policy.acs_dfs_mode);
 
-		if (hdd_ctx->acs_policy.acs_channel)
-			config->chan_freq = wlan_reg_chan_to_freq(hdd_ctx->pdev,
-					    hdd_ctx->acs_policy.acs_channel);
+		if (hdd_ctx->acs_policy.acs_chan_freq)
+			config->chan_freq = hdd_ctx->acs_policy.acs_chan_freq;
 		mode = hdd_ctx->acs_policy.acs_dfs_mode;
 		config->acs_dfs_mode = wlan_hdd_get_dfs_mode(mode);
 	}

+ 3 - 2
core/hdd/src/wlan_hdd_main.c

@@ -9346,7 +9346,8 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
 			 * 0. Otherwise these settings will override
 			 * the ACS while restart.
 			 */
-			hdd_ctxt->acs_policy.acs_channel = AUTO_CHANNEL_SELECT;
+			hdd_ctxt->acs_policy.acs_chan_freq =
+						AUTO_CHANNEL_SELECT;
 			ucfg_mlme_get_sap_internal_restart(hdd_ctxt->psoc,
 							   &value);
 			if (value) {
@@ -9425,7 +9426,7 @@ static void hdd_lte_coex_restart_sap(struct hdd_adapter *adapter,
 	 * reset to 0. Otherwise these settings will override
 	 * the ACS while restart.
 	 */
-	hdd_ctx->acs_policy.acs_channel = AUTO_CHANNEL_SELECT;
+	hdd_ctx->acs_policy.acs_chan_freq = AUTO_CHANNEL_SELECT;
 
 	hdd_debug("sending coex indication");