qcacld-3.0: ACS changes for 6ghz support

Driver ACS changes for 6Ghz channel support.

Change-Id: I94cc834a9fdd5cfe54e4dcc09aba0253de6b2a39
CRs-Fixed: 2555187
This commit is contained in:
gaurank kathpalia
2019-10-29 17:36:45 +05:30
committed by nshrivas
parent 4fa476c979
commit 924b2a764a
8 changed files with 137 additions and 193 deletions

View File

@@ -1871,15 +1871,11 @@ struct hdd_context {
/** /**
* struct hdd_vendor_acs_chan_params - vendor acs channel parameters * struct hdd_vendor_acs_chan_params - vendor acs channel parameters
* @channel_count: channel count
* @channel_list: pointer to channel list
* @pcl_count: pcl list count * @pcl_count: pcl list count
* @vendor_pcl_list: pointer to pcl list * @vendor_pcl_list: pointer to pcl list
* @vendor_weight_list: pointer to pcl weight list * @vendor_weight_list: pointer to pcl weight list
*/ */
struct hdd_vendor_acs_chan_params { struct hdd_vendor_acs_chan_params {
uint32_t channel_count;
uint8_t *channel_list;
uint32_t pcl_count; uint32_t pcl_count;
uint8_t *vendor_pcl_list; uint8_t *vendor_pcl_list;
uint8_t *vendor_weight_list; uint8_t *vendor_weight_list;

View File

@@ -1734,22 +1734,23 @@ int wlan_hdd_sap_cfg_dfs_override(struct hdd_adapter *adapter)
* MCC restriction. So free ch list allocated in do_acs * MCC restriction. So free ch list allocated in do_acs
* func for Sec AP and realloc for Pri AP ch list size * func for Sec AP and realloc for Pri AP ch list size
*/ */
if (sap_config->acs_cfg.ch_list) if (sap_config->acs_cfg.freq_list)
qdf_mem_free(sap_config->acs_cfg.ch_list); qdf_mem_free(sap_config->acs_cfg.freq_list);
qdf_mem_copy(&sap_config->acs_cfg, qdf_mem_copy(&sap_config->acs_cfg,
&con_sap_config->acs_cfg, &con_sap_config->acs_cfg,
sizeof(struct sap_acs_cfg)); sizeof(struct sap_acs_cfg));
sap_config->acs_cfg.ch_list = qdf_mem_malloc( sap_config->acs_cfg.freq_list = qdf_mem_malloc(
sizeof(uint8_t) * sizeof(uint32_t) *
con_sap_config->acs_cfg.ch_list_count); con_sap_config->acs_cfg.ch_list_count);
if (!sap_config->acs_cfg.ch_list) { if (!sap_config->acs_cfg.freq_list) {
sap_config->acs_cfg.ch_list_count = 0; sap_config->acs_cfg.ch_list_count = 0;
return -ENOMEM; return -ENOMEM;
} }
qdf_mem_copy(sap_config->acs_cfg.ch_list, qdf_mem_copy(sap_config->acs_cfg.freq_list,
con_sap_config->acs_cfg.ch_list, con_sap_config->acs_cfg.freq_list,
con_sap_config->acs_cfg.ch_list_count); con_sap_config->acs_cfg.ch_list_count *
sizeof(uint32_t));
sap_config->acs_cfg.ch_list_count = sap_config->acs_cfg.ch_list_count =
con_sap_config->acs_cfg.ch_list_count; con_sap_config->acs_cfg.ch_list_count;
@@ -1808,19 +1809,24 @@ static int wlan_hdd_set_acs_ch_range(
sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11ac; sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11ac;
/* Parse ACS Chan list from hostapd */ /* Parse ACS Chan list from hostapd */
if (!sap_cfg->acs_cfg.ch_list) if (!sap_cfg->acs_cfg.freq_list)
return -EINVAL; return -EINVAL;
sap_cfg->acs_cfg.start_ch = sap_cfg->acs_cfg.ch_list[0]; sap_cfg->acs_cfg.start_ch =
sap_cfg->acs_cfg.end_ch = wlan_freq_to_chan(sap_cfg->acs_cfg.freq_list[0]);
sap_cfg->acs_cfg.ch_list[sap_cfg->acs_cfg.ch_list_count - 1]; sap_cfg->acs_cfg.end_ch = wlan_freq_to_chan(
sap_cfg->acs_cfg.freq_list[sap_cfg->acs_cfg.ch_list_count - 1]);
for (i = 0; i < sap_cfg->acs_cfg.ch_list_count; i++) { for (i = 0; i < sap_cfg->acs_cfg.ch_list_count; i++) {
/* avoid channel as start channel */ /* avoid channel as start channel */
if (sap_cfg->acs_cfg.start_ch > sap_cfg->acs_cfg.ch_list[i] && if (sap_cfg->acs_cfg.start_ch >
sap_cfg->acs_cfg.ch_list[i] != 0) wlan_freq_to_chan(sap_cfg->acs_cfg.freq_list[i]) &&
sap_cfg->acs_cfg.start_ch = sap_cfg->acs_cfg.ch_list[i]; sap_cfg->acs_cfg.freq_list[i] != 0)
if (sap_cfg->acs_cfg.end_ch < sap_cfg->acs_cfg.ch_list[i]) sap_cfg->acs_cfg.start_ch =
sap_cfg->acs_cfg.end_ch = sap_cfg->acs_cfg.ch_list[i]; wlan_freq_to_chan(sap_cfg->acs_cfg.freq_list[i]);
if (sap_cfg->acs_cfg.end_ch <
wlan_freq_to_chan(sap_cfg->acs_cfg.freq_list[i]))
sap_cfg->acs_cfg.end_ch =
wlan_freq_to_chan(sap_cfg->acs_cfg.freq_list[i]);
} }
return 0; return 0;
@@ -1838,17 +1844,19 @@ static void hdd_update_acs_channel_list(struct sap_config *sap_config,
for (i = 0; i < acs_list_count; i++) { for (i = 0; i < acs_list_count; i++) {
if (BAND_2G == band) { if (BAND_2G == band) {
if (WLAN_REG_IS_24GHZ_CH( if (WLAN_REG_IS_24GHZ_CH_FREQ(
sap_config->acs_cfg.ch_list[i])) { sap_config->acs_cfg.freq_list[i])) {
sap_config->acs_cfg.ch_list[temp_count] = sap_config->acs_cfg.freq_list[temp_count] =
sap_config->acs_cfg.ch_list[i]; sap_config->acs_cfg.freq_list[i];
temp_count++; temp_count++;
} }
} else if (BAND_5G == band) { } else if (BAND_5G == band) {
if (WLAN_REG_IS_5GHZ_CH( if (WLAN_REG_IS_5GHZ_CH_FREQ(
sap_config->acs_cfg.ch_list[i])) { sap_config->acs_cfg.freq_list[i]) ||
sap_config->acs_cfg.ch_list[temp_count] = WLAN_REG_IS_6GHZ_CHAN_FREQ(
sap_config->acs_cfg.ch_list[i]; sap_config->acs_cfg.freq_list[i])) {
sap_config->acs_cfg.freq_list[temp_count] =
sap_config->acs_cfg.freq_list[i];
temp_count++; temp_count++;
} }
} }
@@ -1927,8 +1935,8 @@ int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter)
conc_connection_info = policy_mgr_get_conn_info(&i); conc_connection_info = policy_mgr_get_conn_info(&i);
if (conc_connection_info[0].mac == if (conc_connection_info[0].mac ==
conc_connection_info[1].mac) { conc_connection_info[1].mac) {
if (WLAN_REG_IS_5GHZ_CH(sap_config->acs_cfg. if (WLAN_REG_IS_5GHZ_CH_FREQ(
pcl_channels[0])) { sap_config->acs_cfg.pcl_chan_freq[0])) {
sap_config->acs_cfg.band = sap_config->acs_cfg.band =
QCA_ACS_MODE_IEEE80211A; QCA_ACS_MODE_IEEE80211A;
hdd_update_acs_channel_list(sap_config, hdd_update_acs_channel_list(sap_config,
@@ -1992,14 +2000,14 @@ static void hdd_update_vendor_pcl_list(struct hdd_context *hdd_ctx,
*/ */
for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++) { for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++) {
acs_chan_params->vendor_pcl_list[i] = acs_chan_params->vendor_pcl_list[i] =
sap_config->acs_cfg.ch_list[i]; wlan_reg_freq_to_chan(hdd_ctx->pdev,
sap_config->acs_cfg.freq_list[i]);
acs_chan_params->vendor_weight_list[i] = 0; acs_chan_params->vendor_weight_list[i] = 0;
for (j = 0; j < sap_config->acs_cfg.pcl_ch_count; j++) { for (j = 0; j < sap_config->acs_cfg.pcl_ch_count; j++) {
if (sap_config->acs_cfg.ch_list[i] == if (sap_config->acs_cfg.freq_list[i] ==
sap_config->acs_cfg.pcl_channels[j]) { sap_config->acs_cfg.pcl_chan_freq[j]) {
acs_chan_params->vendor_weight_list[i] = acs_chan_params->vendor_weight_list[i] =
sap_config-> sap_config->acs_cfg.pcl_channels_weight_list[j];
acs_cfg.pcl_channels_weight_list[j];
break; break;
} }
} }
@@ -2241,24 +2249,6 @@ static void hdd_get_scan_band(struct hdd_context *hdd_ctx,
} }
} }
/**
* hdd_get_freq_list: API to get Frequency list based on channel list
* @channel_list: channel list
* @freq_list: frequency list
* @channel_count: channel count
*
* Return: None
*/
static void hdd_get_freq_list(uint8_t *channel_list, uint32_t *freq_list,
uint32_t channel_count)
{
int count;
for (count = 0; count < channel_count ; count++)
freq_list[count] = cds_chan_to_freq(channel_list[count]);
}
/** /**
* wlan_hdd_sap_get_valid_channellist() - Get SAPs valid channel list * wlan_hdd_sap_get_valid_channellist() - Get SAPs valid channel list
* @ap_adapter: adapter * @ap_adapter: adapter
@@ -2363,8 +2353,8 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
if (conc_connection_info[0].mac == if (conc_connection_info[0].mac ==
conc_connection_info[1].mac) { conc_connection_info[1].mac) {
if (WLAN_REG_IS_5GHZ_CH(sap_config->acs_cfg. if (WLAN_REG_IS_5GHZ_CH_FREQ(
pcl_channels[0])) { sap_config->acs_cfg.pcl_chan_freq[0])) {
sap_config->acs_cfg.band = sap_config->acs_cfg.band =
QCA_ACS_MODE_IEEE80211A; QCA_ACS_MODE_IEEE80211A;
hdd_update_acs_channel_list(sap_config, hdd_update_acs_channel_list(sap_config,
@@ -2380,10 +2370,11 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
hdd_get_scan_band(hdd_ctx, &adapter->session.ap.sap_config, &band); hdd_get_scan_band(hdd_ctx, &adapter->session.ap.sap_config, &band);
if (sap_config->acs_cfg.ch_list) { if (sap_config->acs_cfg.freq_list) {
/* Copy INI or hostapd provided ACS channel range*/ /* Copy INI or hostapd provided ACS channel range*/
qdf_mem_copy(channel_list, sap_config->acs_cfg.ch_list, for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++)
sap_config->acs_cfg.ch_list_count); channel_list[i] = wlan_reg_freq_to_chan(hdd_ctx->pdev,
sap_config->acs_cfg.freq_list[i]);
channel_count = sap_config->acs_cfg.ch_list_count; channel_count = sap_config->acs_cfg.ch_list_count;
} else { } else {
/* No channel list provided, copy all valid channels */ /* No channel list provided, copy all valid channels */
@@ -2400,7 +2391,9 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
return -ENOMEM; return -ENOMEM;
hdd_update_reg_chan_info(adapter, channel_count, channel_list); hdd_update_reg_chan_info(adapter, channel_count, channel_list);
hdd_get_freq_list(channel_list, freq_list, channel_count);
qdf_mem_copy(freq_list, sap_config->acs_cfg.freq_list,
sizeof(uint32_t) * sap_config->acs_cfg.ch_list_count);
/* Get phymode */ /* Get phymode */
phy_mode = adapter->session.ap.sap_config.acs_cfg.hw_mode; phy_mode = adapter->session.ap.sap_config.acs_cfg.hw_mode;
@@ -2420,21 +2413,12 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
* Remove all channels which are not in channel list from pcl * Remove all channels which are not in channel list from pcl
* and add weight as zero * and add weight as zero
*/ */
acs_chan_params.channel_count = channel_count;
acs_chan_params.channel_list = channel_list;
acs_chan_params.vendor_pcl_list = vendor_pcl_list; acs_chan_params.vendor_pcl_list = vendor_pcl_list;
acs_chan_params.vendor_weight_list = vendor_weight_list; acs_chan_params.vendor_weight_list = vendor_weight_list;
hdd_update_vendor_pcl_list(hdd_ctx, &acs_chan_params, hdd_update_vendor_pcl_list(hdd_ctx, &acs_chan_params,
sap_config); sap_config);
if (acs_chan_params.channel_count) {
hdd_debug("ACS channel list: len: %d",
acs_chan_params.channel_count);
for (i = 0; i < acs_chan_params.channel_count; i++)
hdd_debug("%d ", acs_chan_params.channel_list[i]);
}
if (acs_chan_params.pcl_count) { if (acs_chan_params.pcl_count) {
hdd_debug("ACS PCL list: len: %d", hdd_debug("ACS PCL list: len: %d",
acs_chan_params.pcl_count); acs_chan_params.pcl_count);
@@ -2479,8 +2463,7 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
} }
status = status =
hdd_cfg80211_update_pcl(skb, hdd_cfg80211_update_pcl(skb,
acs_chan_params. acs_chan_params.pcl_count,
pcl_count,
QCA_WLAN_VENDOR_ATTR_EXTERNAL_ACS_EVENT_PCL, QCA_WLAN_VENDOR_ATTR_EXTERNAL_ACS_EVENT_PCL,
vendor_pcl_list, vendor_pcl_list,
vendor_weight_list); vendor_weight_list);
@@ -2621,18 +2604,16 @@ static void hdd_avoid_acs_channels(struct hdd_context *hdd_ctx,
for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++) { for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++) {
for (j = 0; j < avoid_acs_freq_list_num; j++) { for (j = 0; j < avoid_acs_freq_list_num; j++) {
if (sap_config->acs_cfg.ch_list[i] == if (sap_config->acs_cfg.freq_list[i] ==
wlan_reg_freq_to_chan( avoid_acs_freq_list[j]) {
hdd_ctx->pdev, hdd_debug("skip freq %d",
avoid_acs_freq_list[j])) { sap_config->acs_cfg.freq_list[i]);
hdd_debug("skip channel %d",
sap_config->acs_cfg.ch_list[i]);
break; break;
} }
} }
if (j == avoid_acs_freq_list_num) if (j == avoid_acs_freq_list_num)
sap_config->acs_cfg.ch_list[ch_cnt++] = sap_config->acs_cfg.freq_list[ch_cnt++] =
sap_config->acs_cfg.ch_list[i]; sap_config->acs_cfg.freq_list[i];
} }
sap_config->acs_cfg.ch_list_count = ch_cnt; sap_config->acs_cfg.ch_list_count = ch_cnt;
} }
@@ -2653,8 +2634,8 @@ static void hdd_avoid_acs_channels(struct hdd_context *hdd_ctx,
* *
* Return: None * Return: None
*/ */
static void wlan_hdd_trim_acs_channel_list(uint8_t *pcl, uint8_t pcl_count, static void wlan_hdd_trim_acs_channel_list(uint32_t *pcl, uint8_t pcl_count,
uint8_t *org_ch_list, uint32_t *org_freq_list,
uint8_t *org_ch_list_count) uint8_t *org_ch_list_count)
{ {
uint16_t i, j, ch_list_count = 0; uint16_t i, j, ch_list_count = 0;
@@ -2670,11 +2651,11 @@ static void wlan_hdd_trim_acs_channel_list(uint8_t *pcl, uint8_t pcl_count,
return; return;
} }
hdd_debug("Update ACS channels with PCL"); hdd_debug("Update ACS chan freq with PCL");
for (j = 0; j < *org_ch_list_count; j++) for (j = 0; j < *org_ch_list_count; j++)
for (i = 0; i < pcl_count; i++) for (i = 0; i < pcl_count; i++)
if (pcl[i] == org_ch_list[j]) { if (pcl[i] == org_freq_list[j]) {
org_ch_list[ch_list_count++] = pcl[i]; org_freq_list[ch_list_count++] = pcl[i];
break; break;
} }
@@ -2702,24 +2683,21 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
struct hdd_context *hdd_ctx = wiphy_priv(wiphy); struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
struct sap_config *sap_config; struct sap_config *sap_config;
struct sk_buff *temp_skbuff; struct sk_buff *temp_skbuff;
int ret, i, ch_cnt = 0; int ret, i;
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_ACS_MAX + 1]; struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_ACS_MAX + 1];
bool ht_enabled, ht40_enabled, vht_enabled; bool ht_enabled, ht40_enabled, vht_enabled;
uint8_t ch_width; uint8_t ch_width;
enum qca_wlan_vendor_acs_hw_mode hw_mode; enum qca_wlan_vendor_acs_hw_mode hw_mode;
enum policy_mgr_con_mode pm_mode; enum policy_mgr_con_mode pm_mode;
QDF_STATUS qdf_status; QDF_STATUS qdf_status;
bool skip_etsi13_srd_chan = false;
bool is_vendor_acs_support = bool is_vendor_acs_support =
cfg_default(CFG_USER_AUTO_CHANNEL_SELECTION); cfg_default(CFG_USER_AUTO_CHANNEL_SELECTION);
bool is_external_acs_policy = bool is_external_acs_policy =
cfg_default(CFG_EXTERNAL_ACS_POLICY); cfg_default(CFG_EXTERNAL_ACS_POLICY);
bool sap_force_11n_for_11ac = 0; bool sap_force_11n_for_11ac = 0;
bool go_force_11n_for_11ac = 0; bool go_force_11n_for_11ac = 0;
bool etsi13_srd_chan;
bool go_11ac_override = 0; bool go_11ac_override = 0;
bool sap_11ac_override = 0; bool sap_11ac_override = 0;
uint32_t pcl_freq_list[QDF_MAX_NUM_CHAN] = {0};
/* ***Note*** Donot set SME config related to ACS operation here because /* ***Note*** Donot set SME config related to ACS operation here because
* ACS operation is not synchronouse and ACS for Second AP may come when * ACS operation is not synchronouse and ACS for Second AP may come when
@@ -2855,23 +2833,27 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
*/ */
if (tb[QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST]) { if (tb[QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST]) {
char *tmp = nla_data(tb[QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST]); uint8_t *tmp = nla_data(tb[QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST]);
sap_config->acs_cfg.ch_list_count = nla_len( sap_config->acs_cfg.ch_list_count = nla_len(
tb[QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST]); tb[QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST]);
if (sap_config->acs_cfg.ch_list_count) { if (sap_config->acs_cfg.ch_list_count) {
sap_config->acs_cfg.ch_list = qdf_mem_malloc( sap_config->acs_cfg.freq_list = qdf_mem_malloc(
sap_config->acs_cfg.ch_list_count); sap_config->acs_cfg.ch_list_count *
sizeof(uint32_t));
sap_config->acs_cfg.master_ch_list = qdf_mem_malloc( sap_config->acs_cfg.master_ch_list = qdf_mem_malloc(
sap_config->acs_cfg.ch_list_count); sap_config->acs_cfg.ch_list_count);
if (!sap_config->acs_cfg.ch_list || if (!sap_config->acs_cfg.freq_list ||
!sap_config->acs_cfg.master_ch_list) { !sap_config->acs_cfg.master_ch_list) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
qdf_mem_copy(sap_config->acs_cfg.ch_list, tmp, /* convert frequency to channel */
sap_config->acs_cfg.ch_list_count); for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++)
sap_config->acs_cfg.freq_list[i] =
wlan_reg_chan_to_freq(hdd_ctx->pdev, tmp[i]);
qdf_mem_copy(sap_config->acs_cfg.master_ch_list, tmp, qdf_mem_copy(sap_config->acs_cfg.master_ch_list, tmp,
sap_config->acs_cfg.ch_list_count); sap_config->acs_cfg.ch_list_count);
sap_config->acs_cfg.master_ch_list_count = sap_config->acs_cfg.master_ch_list_count =
@@ -2884,23 +2866,24 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
tb[QCA_WLAN_VENDOR_ATTR_ACS_FREQ_LIST]) / tb[QCA_WLAN_VENDOR_ATTR_ACS_FREQ_LIST]) /
sizeof(uint32_t); sizeof(uint32_t);
if (sap_config->acs_cfg.ch_list_count) { if (sap_config->acs_cfg.ch_list_count) {
sap_config->acs_cfg.ch_list = qdf_mem_malloc( sap_config->acs_cfg.freq_list = qdf_mem_malloc(
sap_config->acs_cfg.ch_list_count); sap_config->acs_cfg.ch_list_count *
sizeof(uint32_t));
sap_config->acs_cfg.master_ch_list = qdf_mem_malloc( sap_config->acs_cfg.master_ch_list = qdf_mem_malloc(
sap_config->acs_cfg.ch_list_count); sap_config->acs_cfg.ch_list_count);
if (!sap_config->acs_cfg.ch_list || if (!sap_config->acs_cfg.freq_list ||
!sap_config->acs_cfg.master_ch_list) { !sap_config->acs_cfg.master_ch_list) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
/* convert frequency to channel */ /* convert frequency to channel */
for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++) for (i = 0; i < sap_config->acs_cfg.ch_list_count;
sap_config->acs_cfg.ch_list[i] = i++) {
sap_config->acs_cfg.master_ch_list[i] =
ieee80211_frequency_to_channel(freq[i]); ieee80211_frequency_to_channel(freq[i]);
qdf_mem_copy(sap_config->acs_cfg.master_ch_list, sap_config->acs_cfg.freq_list[i] = freq[i];
sap_config->acs_cfg.ch_list, }
sap_config->acs_cfg.ch_list_count);
sap_config->acs_cfg.master_ch_list_count = sap_config->acs_cfg.master_ch_list_count =
sap_config->acs_cfg.ch_list_count; sap_config->acs_cfg.ch_list_count;
} }
@@ -2912,25 +2895,6 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
goto out; goto out;
} }
ucfg_mlme_get_etsi13_srd_chan_in_master_mode(hdd_ctx->psoc,
&etsi13_srd_chan);
skip_etsi13_srd_chan =
!etsi13_srd_chan &&
wlan_reg_is_etsi13_regdmn(hdd_ctx->pdev);
if (skip_etsi13_srd_chan) {
for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++) {
if (wlan_reg_is_etsi13_srd_chan(hdd_ctx->pdev,
sap_config->acs_cfg.
ch_list[i]))
sap_config->acs_cfg.ch_list[i] = 0;
else
sap_config->acs_cfg.ch_list[ch_cnt++] =
sap_config->acs_cfg.ch_list[i];
}
sap_config->acs_cfg.ch_list_count = ch_cnt;
}
hdd_avoid_acs_channels(hdd_ctx, sap_config); hdd_avoid_acs_channels(hdd_ctx, sap_config);
hdd_debug("get pcl for DO_ACS vendor command"); hdd_debug("get pcl for DO_ACS vendor command");
@@ -2939,25 +2903,18 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
policy_mgr_convert_device_mode_to_qdf_type(adapter->device_mode); policy_mgr_convert_device_mode_to_qdf_type(adapter->device_mode);
/* consult policy manager to get PCL */ /* consult policy manager to get PCL */
qdf_status = policy_mgr_get_pcl(hdd_ctx->psoc, pm_mode, qdf_status = policy_mgr_get_pcl(hdd_ctx->psoc, pm_mode,
pcl_freq_list, sap_config->acs_cfg.pcl_chan_freq,
&sap_config->acs_cfg.pcl_ch_count, &sap_config->acs_cfg.pcl_ch_count,
sap_config->acs_cfg. sap_config->acs_cfg.
pcl_channels_weight_list, pcl_channels_weight_list,
QDF_MAX_NUM_CHAN); QDF_MAX_NUM_CHAN);
if (qdf_status != QDF_STATUS_SUCCESS) {
hdd_err("Get PCL failed");
} else {
for (i = 0; i < sap_config->acs_cfg.pcl_ch_count; i++)
sap_config->acs_cfg.pcl_channels[i] =
wlan_freq_to_chan(pcl_freq_list[i]);
}
if (sap_config->acs_cfg.pcl_ch_count) { if (sap_config->acs_cfg.pcl_ch_count) {
hdd_debug("ACS config PCL: len: %d", hdd_debug("ACS config PCL: len: %d",
sap_config->acs_cfg.pcl_ch_count); sap_config->acs_cfg.pcl_ch_count);
for (i = 0; i < sap_config->acs_cfg.pcl_ch_count; i++) for (i = 0; i < sap_config->acs_cfg.pcl_ch_count; i++)
hdd_debug("channel:%d, weight:%d ", hdd_debug("freq:%d, weight:%d ",
sap_config->acs_cfg. sap_config->acs_cfg.pcl_chan_freq[i],
pcl_channels[i],
sap_config->acs_cfg. sap_config->acs_cfg.
pcl_channels_weight_list[i]); pcl_channels_weight_list[i]);
} }
@@ -2974,15 +2931,16 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
policy_mgr_is_force_scc(hdd_ctx->psoc) && policy_mgr_is_force_scc(hdd_ctx->psoc) &&
policy_mgr_get_connection_count(hdd_ctx->psoc)) { policy_mgr_get_connection_count(hdd_ctx->psoc)) {
wlan_hdd_trim_acs_channel_list( wlan_hdd_trim_acs_channel_list(
sap_config->acs_cfg.pcl_channels, sap_config->acs_cfg.pcl_chan_freq,
sap_config->acs_cfg.pcl_ch_count, sap_config->acs_cfg.pcl_ch_count,
sap_config->acs_cfg.ch_list, sap_config->acs_cfg.freq_list,
&sap_config->acs_cfg.ch_list_count); &sap_config->acs_cfg.ch_list_count);
/* if it is only one channel, send ACS event to upper layer */ /* if it is only one channel, send ACS event to upper layer */
if (sap_config->acs_cfg.ch_list_count == 1) { if (sap_config->acs_cfg.ch_list_count == 1) {
sap_config->acs_cfg.pri_ch = sap_config->acs_cfg.pri_ch =
sap_config->acs_cfg.ch_list[0]; wlan_reg_freq_to_chan(hdd_ctx->pdev,
sap_config->acs_cfg.freq_list[0]);
wlan_sap_set_sap_ctx_acs_cfg( wlan_sap_set_sap_ctx_acs_cfg(
WLAN_HDD_GET_SAP_CTX_PTR(adapter), sap_config); WLAN_HDD_GET_SAP_CTX_PTR(adapter), sap_config);
sap_config_acs_result(hdd_ctx->mac_handle, sap_config_acs_result(hdd_ctx->mac_handle,
@@ -3051,10 +3009,10 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
sap_config->acs_cfg.is_vht_enabled = vht_enabled; sap_config->acs_cfg.is_vht_enabled = vht_enabled;
if (sap_config->acs_cfg.ch_list_count) { if (sap_config->acs_cfg.ch_list_count) {
hdd_debug("ACS channel list: len: %d", hdd_debug("ACS freq list: len: %d",
sap_config->acs_cfg.ch_list_count); sap_config->acs_cfg.ch_list_count);
for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++) for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++)
hdd_debug("%d ", sap_config->acs_cfg.ch_list[i]); hdd_debug("%d ", sap_config->acs_cfg.freq_list[i]);
} }
if (test_bit(ACS_IN_PROGRESS, &hdd_ctx->g_event_flags)) { if (test_bit(ACS_IN_PROGRESS, &hdd_ctx->g_event_flags)) {

View File

@@ -431,7 +431,7 @@ struct sap_acs_cfg {
eCsrPhyMode hw_mode; eCsrPhyMode hw_mode;
uint8_t start_ch; uint8_t start_ch;
uint8_t end_ch; uint8_t end_ch;
uint8_t *ch_list; uint32_t *freq_list;
uint8_t ch_list_count; uint8_t ch_list_count;
uint8_t *master_ch_list; uint8_t *master_ch_list;
uint8_t master_ch_list_count; uint8_t master_ch_list_count;
@@ -444,7 +444,7 @@ struct sap_acs_cfg {
#endif #endif
uint16_t ch_width; uint16_t ch_width;
uint8_t pcl_channels[QDF_MAX_NUM_CHAN]; uint32_t pcl_chan_freq[QDF_MAX_NUM_CHAN];
uint8_t pcl_channels_weight_list[QDF_MAX_NUM_CHAN]; uint8_t pcl_channels_weight_list[QDF_MAX_NUM_CHAN];
uint32_t pcl_ch_count; uint32_t pcl_ch_count;
uint8_t is_ht_enabled; uint8_t is_ht_enabled;

View File

@@ -199,7 +199,7 @@ static inline void wlansap_send_acs_success_event(struct sap_context *sap_ctx,
} }
#endif #endif
static uint8_t static uint32_t
wlansap_calculate_chan_from_scan_result(mac_handle_t mac_handle, wlansap_calculate_chan_from_scan_result(mac_handle_t mac_handle,
struct sap_context *sap_ctx, struct sap_context *sap_ctx,
uint32_t scan_id) uint32_t scan_id)
@@ -207,7 +207,7 @@ wlansap_calculate_chan_from_scan_result(mac_handle_t mac_handle,
struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle); struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
qdf_list_t *list = NULL; qdf_list_t *list = NULL;
struct scan_filter *filter; struct scan_filter *filter;
uint8_t oper_channel = SAP_CHANNEL_NOT_SELECTED; uint32_t oper_channel = SAP_CHANNEL_NOT_SELECTED;
filter = qdf_mem_malloc(sizeof(*filter)); filter = qdf_mem_malloc(sizeof(*filter));
@@ -254,22 +254,21 @@ wlansap_filter_unsafe_ch(struct wlan_objmgr_psoc *psoc,
*/ */
for (i = 0; i < sap_ctx->acs_cfg->ch_list_count; i++) { for (i = 0; i < sap_ctx->acs_cfg->ch_list_count; i++) {
if (!policy_mgr_is_safe_channel( if (!policy_mgr_is_safe_channel(
psoc, wlan_chan_to_freq( psoc, sap_ctx->acs_cfg->freq_list[i])) {
sap_ctx->acs_cfg->ch_list[i]))) { sap_debug("unsafe freq %d removed from acs list",
sap_debug("unsafe ch %d removed from acs list", sap_ctx->acs_cfg->freq_list[i]);
sap_ctx->acs_cfg->ch_list[i]);
continue; continue;
} }
/* Add only safe channels to the acs cfg ch list */ /* Add only safe channels to the acs cfg ch list */
sap_ctx->acs_cfg->ch_list[num_safe_ch++] = sap_ctx->acs_cfg->freq_list[num_safe_ch++] =
sap_ctx->acs_cfg->ch_list[i]; sap_ctx->acs_cfg->freq_list[i];
} }
sap_debug("Updated ACS ch list len %d", num_safe_ch); sap_debug("Updated ACS ch list len %d", num_safe_ch);
sap_ctx->acs_cfg->ch_list_count = num_safe_ch; sap_ctx->acs_cfg->ch_list_count = num_safe_ch;
for (i = 0; i < num_safe_ch; i++) for (i = 0; i < num_safe_ch; i++)
sap_debug("Ch %d", sap_ctx->acs_cfg->ch_list[i]); sap_debug("Safe freq %d", sap_ctx->acs_cfg->freq_list[i]);
} }
QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle, QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle,
@@ -278,7 +277,7 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle,
uint32_t scanid, uint32_t scanid,
eCsrScanStatus scan_status) eCsrScanStatus scan_status)
{ {
uint8_t oper_channel = SAP_CHANNEL_NOT_SELECTED; uint32_t oper_channel = SAP_CHANNEL_NOT_SELECTED;
struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle); struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
host_log_acs_scan_done(acs_scan_done_status_str(scan_status), host_log_acs_scan_done(acs_scan_done_status_str(scan_status),
@@ -303,9 +302,9 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle,
scan_status); scan_status);
oper_channel = oper_channel =
sap_select_default_oper_chan(sap_ctx->acs_cfg); sap_select_default_oper_chan(sap_ctx->acs_cfg);
sap_ctx->chan_freq = wlan_reg_chan_to_freq(mac_ctx->pdev, sap_ctx->chan_freq = oper_channel;
oper_channel); sap_ctx->acs_cfg->pri_ch =
sap_ctx->acs_cfg->pri_ch = oper_channel; wlan_reg_freq_to_chan(mac_ctx->pdev, oper_channel);
sap_config_acs_result(mac_handle, sap_ctx, sap_config_acs_result(mac_handle, sap_ctx,
sap_ctx->acs_cfg->ht_sec_ch); sap_ctx->acs_cfg->ht_sec_ch);
sap_ctx->sap_state = eSAP_ACS_CHANNEL_SELECTED; sap_ctx->sap_state = eSAP_ACS_CHANNEL_SELECTED;
@@ -324,10 +323,10 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle,
oper_channel = sap_select_default_oper_chan(sap_ctx->acs_cfg); oper_channel = sap_select_default_oper_chan(sap_ctx->acs_cfg);
} }
sap_ctx->chan_freq = wlan_reg_chan_to_freq(mac_ctx->pdev, oper_channel); sap_ctx->chan_freq = oper_channel;
sap_ctx->acs_cfg->pri_ch = oper_channel; sap_ctx->acs_cfg->pri_ch = wlan_reg_freq_to_chan(mac_ctx->pdev,
sap_config_acs_result(mac_handle, sap_ctx, oper_channel);
sap_ctx->acs_cfg->ht_sec_ch); sap_config_acs_result(mac_handle, sap_ctx, sap_ctx->acs_cfg->ht_sec_ch);
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("Channel freq selected = %d"), sap_ctx->chan_freq); FL("Channel freq selected = %d"), sap_ctx->chan_freq);

View File

@@ -416,7 +416,7 @@ uint8_t sap_select_preferred_channel_from_channel_list(uint8_t best_chnl,
* If Channel List is not Configured don't do anything * If Channel List is not Configured don't do anything
* Else return the Best Channel from the Channel List * Else return the Best Channel from the Channel List
*/ */
if ((!sap_ctx->acs_cfg->ch_list) || if ((!sap_ctx->acs_cfg->freq_list) ||
(!spectinfo_param) || (!spectinfo_param) ||
(0 == sap_ctx->acs_cfg->ch_list_count)) (0 == sap_ctx->acs_cfg->ch_list_count))
return best_chnl; return best_chnl;
@@ -426,7 +426,8 @@ uint8_t sap_select_preferred_channel_from_channel_list(uint8_t best_chnl,
/* Select the best channel from allowed list */ /* Select the best channel from allowed list */
for (i = 0; i < sap_ctx->acs_cfg->ch_list_count; i++) { for (i = 0; i < sap_ctx->acs_cfg->ch_list_count; i++) {
if ((sap_ctx->acs_cfg->ch_list[i] == best_chnl) && if ((sap_ctx->acs_cfg->freq_list[i] ==
wlan_reg_chan_to_freq(mac_ctx->pdev, best_chnl)) &&
!(wlan_reg_is_dfs_ch(mac_ctx->pdev, best_chnl) && !(wlan_reg_is_dfs_ch(mac_ctx->pdev, best_chnl) &&
policy_mgr_disallow_mcc( policy_mgr_disallow_mcc(
mac_ctx->psoc, wlan_chan_to_freq(best_chnl)))) { mac_ctx->psoc, wlan_chan_to_freq(best_chnl)))) {
@@ -1354,12 +1355,12 @@ static void sap_interference_rssi_count(tSapSpectChInfo *spect_ch,
* true: channel is in PCL, * true: channel is in PCL,
* false: channel is not in PCL * false: channel is not in PCL
*/ */
static bool ch_in_pcl(struct sap_context *sap_ctx, uint8_t channel) static bool ch_in_pcl(struct sap_context *sap_ctx, uint32_t ch_freq)
{ {
uint32_t i; uint32_t i;
for (i = 0; i < sap_ctx->acs_cfg->pcl_ch_count; i++) { for (i = 0; i < sap_ctx->acs_cfg->pcl_ch_count; i++) {
if (channel == sap_ctx->acs_cfg->pcl_channels[i]) if (ch_freq == sap_ctx->acs_cfg->pcl_chan_freq[i])
return true; return true;
} }
@@ -1546,7 +1547,8 @@ static void sap_compute_spect_weight(tSapChSelSpectInfo *pSpectInfoParams,
*/ */
rssi = (int8_t) pSpectCh->rssiAgr; rssi = (int8_t) pSpectCh->rssiAgr;
if (ch_in_pcl(sap_ctx, pSpectCh->chNum)) if (ch_in_pcl(sap_ctx, wlan_reg_chan_to_freq(mac->pdev,
pSpectCh->chNum)))
rssi -= PCL_RSSI_DISCOUNT; rssi -= PCL_RSSI_DISCOUNT;
if (rssi < SOFTAP_MIN_RSSI) if (rssi < SOFTAP_MIN_RSSI)
@@ -2442,7 +2444,7 @@ static bool sap_is_ch_non_overlap(struct sap_context *sap_ctx, uint16_t ch)
return false; return false;
} }
uint8_t sap_select_channel(mac_handle_t mac_handle, uint32_t sap_select_channel(mac_handle_t mac_handle,
struct sap_context *sap_ctx, struct sap_context *sap_ctx,
qdf_list_t *scan_list) qdf_list_t *scan_list)
{ {
@@ -2473,11 +2475,7 @@ uint8_t sap_select_channel(mac_handle_t mac_handle,
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("No external AP present")); FL("No external AP present"));
#ifndef SOFTAP_CHANNEL_RANGE
return SAP_CHANNEL_NOT_SELECTED;
#else
return sap_select_default_oper_chan(sap_ctx->acs_cfg); return sap_select_default_oper_chan(sap_ctx->acs_cfg);
#endif
} }
/* Initialize the structure pointed by spect_info */ /* Initialize the structure pointed by spect_info */
@@ -2662,8 +2660,5 @@ sap_ch_sel_end:
FL("Running SAP Ch select Completed, Ch=%d"), best_ch_num); FL("Running SAP Ch select Completed, Ch=%d"), best_ch_num);
host_log_acs_best_chan(best_ch_num, best_ch_weight); host_log_acs_best_chan(best_ch_num, best_ch_weight);
if (best_ch_num > 0 && best_ch_num <= 252) return wlan_reg_chan_to_freq(mac_ctx->pdev, best_ch_num);
return best_ch_num;
else
return SAP_CHANNEL_NOT_SELECTED;
} }

View File

@@ -670,11 +670,11 @@ sap_chan_bond_dfs_sub_chan(struct sap_context *sap_context,
return false; return false;
} }
uint8_t sap_select_default_oper_chan(struct sap_acs_cfg *acs_cfg) uint32_t sap_select_default_oper_chan(struct sap_acs_cfg *acs_cfg)
{ {
uint16_t i; uint16_t i;
if (!acs_cfg || !acs_cfg->ch_list || !acs_cfg->ch_list_count) if (!acs_cfg || !acs_cfg->freq_list || !acs_cfg->ch_list_count)
return 0; return 0;
/* /*
@@ -688,16 +688,16 @@ uint8_t sap_select_default_oper_chan(struct sap_acs_cfg *acs_cfg)
*/ */
for (i = 0; i < acs_cfg->ch_list_count; i++) { for (i = 0; i < acs_cfg->ch_list_count; i++) {
if (WLAN_CHAN_IS_5GHZ(acs_cfg->ch_list[i])) { if (WLAN_REG_IS_5GHZ_CH_FREQ(acs_cfg->freq_list[i])) {
sap_debug("default channel chosen as %d", sap_debug("default freq chosen as %d",
acs_cfg->ch_list[i]); acs_cfg->freq_list[i]);
return acs_cfg->ch_list[i]; return acs_cfg->freq_list[i];
} }
} }
sap_debug("default channel chosen as %d", acs_cfg->ch_list[0]); sap_debug("default frequency chosen as %d", acs_cfg->freq_list[0]);
return acs_cfg->ch_list[0]; return acs_cfg->freq_list[0];
} }
QDF_STATUS QDF_STATUS
@@ -967,9 +967,6 @@ QDF_STATUS sap_channel_sel(struct sap_context *sap_context)
sap_context->chan_freq); sap_context->chan_freq);
sap_context->chan_freq = sap_select_default_oper_chan( sap_context->chan_freq = sap_select_default_oper_chan(
sap_context->acs_cfg); sap_context->acs_cfg);
sap_context->chan_freq = wlan_reg_chan_to_freq(
mac_ctx->pdev,
sap_context->chan_freq);
if (sap_context->freq_list) { if (sap_context->freq_list) {
sap_context->chan_freq = sap_context->chan_freq =
@@ -3486,8 +3483,7 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
for (loop_count = 0; loop_count < ch_count; loop_count++) { for (loop_count = 0; loop_count < ch_count; loop_count++) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG,
FL("channel frequency: %d"), list[loop_count]); FL("channel frequency: %d"), list[loop_count]);
sap_ctx->acs_cfg->ch_list[loop_count] = sap_ctx->acs_cfg->freq_list[loop_count] = list[loop_count];
wlan_reg_freq_to_chan(mac_ctx->pdev, list[loop_count]);
} }
sap_ctx->acs_cfg->ch_list_count = ch_count; sap_ctx->acs_cfg->ch_list_count = ch_count;

View File

@@ -290,9 +290,9 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle,
* Runs a algorithm to select the best channel to operate in based on BSS * Runs a algorithm to select the best channel to operate in based on BSS
* rssi and bss count on each channel * rssi and bss count on each channel
* *
* Returns: channel number if success, 0 otherwise * Returns: channel frequency if success, 0 otherwise
*/ */
uint8_t sap_select_channel(mac_handle_t mac_handle, struct sap_context *sap_ctx, uint32_t sap_select_channel(mac_handle_t mac_handle, struct sap_context *sap_ctx,
qdf_list_t *scan_list); qdf_list_t *scan_list);
QDF_STATUS QDF_STATUS
@@ -452,9 +452,9 @@ static inline uint8_t sap_indicate_radar(struct sap_context *sap_ctx)
* range configuration when ACS scan fails due to some reasons, such as scan * range configuration when ACS scan fails due to some reasons, such as scan
* timeout, etc. * timeout, etc.
* *
* Return: Selected operating channel number * Return: Selected operating channel frequency
*/ */
uint8_t sap_select_default_oper_chan(struct sap_acs_cfg *acs_cfg); uint32_t sap_select_default_oper_chan(struct sap_acs_cfg *acs_cfg);
/* /*
* sap_is_dfs_cac_wait_state() - check if sap is in cac wait state * sap_is_dfs_cac_wait_state() - check if sap is in cac wait state

View File

@@ -2483,10 +2483,10 @@ void sap_undo_acs(struct sap_context *sap_ctx, struct sap_config *sap_cfg)
if (!acs_cfg) if (!acs_cfg)
return; return;
if (acs_cfg->ch_list) { if (acs_cfg->freq_list) {
sap_debug("Clearing ACS cfg channel list"); sap_debug("Clearing ACS cfg ch freq list");
qdf_mem_free(acs_cfg->ch_list); qdf_mem_free(acs_cfg->freq_list);
acs_cfg->ch_list = NULL; acs_cfg->freq_list = NULL;
} }
if (acs_cfg->master_ch_list) { if (acs_cfg->master_ch_list) {
sap_debug("Clearing master ACS cfg channel list"); sap_debug("Clearing master ACS cfg channel list");