qcacld-3.0: Convert to freq for acs->start_ch

Change acs->start_ch and acs->end_ch to acs->start_ch_freq
and acs->end_ch_freq respectively.

Change-Id: I105cd618970c739340df29d58f635d01a68754d2
CRs-Fixed: 2564018
This commit is contained in:
Liangwei Dong 2019-11-06 14:19:46 +08:00 committed by nshrivas
parent 0eddedfcc4
commit 50d12dc273
6 changed files with 264 additions and 178 deletions

View File

@ -1685,7 +1685,6 @@ int wlan_hdd_sap_cfg_dfs_override(struct hdd_adapter *adapter)
{
struct hdd_adapter *con_sap_adapter;
struct sap_config *sap_config, *con_sap_config;
int con_ch;
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
uint32_t con_ch_freq;
@ -1709,11 +1708,8 @@ int wlan_hdd_sap_cfg_dfs_override(struct hdd_adapter *adapter)
sap_config = &adapter->session.ap.sap_config;
con_sap_config = &con_sap_adapter->session.ap.sap_config;
con_ch_freq = con_sap_adapter->session.ap.operating_chan_freq;
con_ch = wlan_reg_freq_to_chan(
hdd_ctx->pdev,
con_sap_adapter->session.ap.operating_chan_freq);
if (!wlan_reg_is_dfs_ch(hdd_ctx->pdev, con_ch))
if (!wlan_reg_is_dfs_for_freq(hdd_ctx->pdev, con_ch_freq))
return 0;
hdd_debug("Only SCC AP-AP DFS Permitted (ch_freq=%d, con_ch_freq=%d)",
@ -1726,7 +1722,8 @@ int wlan_hdd_sap_cfg_dfs_override(struct hdd_adapter *adapter)
con_ch_freq != con_sap_config->acs_cfg.ht_sec_ch_freq) {
hdd_err("Primary AP channel config error");
hdd_err("Operating ch: %d ACS ch freq: %d Sec Freq %d",
con_ch, con_sap_config->acs_cfg.pri_ch_freq,
con_ch_freq,
con_sap_config->acs_cfg.pri_ch_freq,
con_sap_config->acs_cfg.ht_sec_ch_freq);
return -EINVAL;
}
@ -1761,7 +1758,7 @@ int wlan_hdd_sap_cfg_dfs_override(struct hdd_adapter *adapter)
con_sap_config->sec_ch_freq;
}
return con_ch;
return con_ch_freq;
}
/**
@ -1785,20 +1782,28 @@ static int wlan_hdd_set_acs_ch_range(
if (hw_mode == QCA_ACS_MODE_IEEE80211B) {
sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11b;
sap_cfg->acs_cfg.start_ch = WLAN_REG_CH_NUM(CHAN_ENUM_2412);
sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_2484);
sap_cfg->acs_cfg.start_ch_freq =
wlan_reg_ch_to_freq(CHAN_ENUM_2412);
sap_cfg->acs_cfg.end_ch_freq =
wlan_reg_ch_to_freq(CHAN_ENUM_2484);
} else if (hw_mode == QCA_ACS_MODE_IEEE80211G) {
sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11g;
sap_cfg->acs_cfg.start_ch = WLAN_REG_CH_NUM(CHAN_ENUM_2412);
sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_2472);
sap_cfg->acs_cfg.start_ch_freq =
wlan_reg_ch_to_freq(CHAN_ENUM_2412);
sap_cfg->acs_cfg.end_ch_freq =
wlan_reg_ch_to_freq(CHAN_ENUM_2472);
} else if (hw_mode == QCA_ACS_MODE_IEEE80211A) {
sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11a;
sap_cfg->acs_cfg.start_ch = WLAN_REG_CH_NUM(CHAN_ENUM_5180);
sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_5865);
sap_cfg->acs_cfg.start_ch_freq =
wlan_reg_ch_to_freq(CHAN_ENUM_5180);
sap_cfg->acs_cfg.end_ch_freq =
wlan_reg_ch_to_freq(CHAN_ENUM_5865);
} else if (hw_mode == QCA_ACS_MODE_IEEE80211ANY) {
sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_abg;
sap_cfg->acs_cfg.start_ch = WLAN_REG_CH_NUM(CHAN_ENUM_2412);
sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_5865);
sap_cfg->acs_cfg.start_ch_freq =
wlan_reg_ch_to_freq(CHAN_ENUM_2412);
sap_cfg->acs_cfg.end_ch_freq =
wlan_reg_ch_to_freq(CHAN_ENUM_5865);
}
if (ht_enabled)
@ -1811,21 +1816,20 @@ static int wlan_hdd_set_acs_ch_range(
if (!sap_cfg->acs_cfg.freq_list)
return -EINVAL;
sap_cfg->acs_cfg.start_ch =
wlan_freq_to_chan(sap_cfg->acs_cfg.freq_list[0]);
sap_cfg->acs_cfg.end_ch = wlan_freq_to_chan(
sap_cfg->acs_cfg.freq_list[sap_cfg->acs_cfg.ch_list_count - 1]);
sap_cfg->acs_cfg.start_ch_freq = sap_cfg->acs_cfg.freq_list[0];
sap_cfg->acs_cfg.end_ch_freq =
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++) {
/* avoid channel as start channel */
if (sap_cfg->acs_cfg.start_ch >
wlan_freq_to_chan(sap_cfg->acs_cfg.freq_list[i]) &&
if (sap_cfg->acs_cfg.start_ch_freq >
sap_cfg->acs_cfg.freq_list[i] &&
sap_cfg->acs_cfg.freq_list[i] != 0)
sap_cfg->acs_cfg.start_ch =
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]);
sap_cfg->acs_cfg.start_ch_freq =
sap_cfg->acs_cfg.freq_list[i];
if (sap_cfg->acs_cfg.end_ch_freq <
sap_cfg->acs_cfg.freq_list[i])
sap_cfg->acs_cfg.end_ch_freq =
sap_cfg->acs_cfg.freq_list[i];
}
return 0;
@ -1910,7 +1914,7 @@ int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter)
if (QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION !=
mcc_to_scc_switch &&
!(policy_mgr_is_hw_dbs_capable(hdd_ctx->psoc) &&
IS_24G_CH(sap_config->acs_cfg.end_ch))) {
WLAN_REG_IS_24GHZ_CH_FREQ(sap_config->acs_cfg.end_ch_freq))) {
status = wlan_hdd_sap_cfg_dfs_override(adapter);
if (status < 0)
return status;
@ -2974,7 +2978,8 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
ucfg_mlme_is_sap_11ac_override(hdd_ctx->psoc, &sap_11ac_override);
/* ACS override for android */
if (ht_enabled &&
sap_config->acs_cfg.end_ch >= WLAN_REG_CH_NUM(CHAN_ENUM_5180) &&
sap_config->acs_cfg.end_ch_freq >=
WLAN_REG_CH_TO_FREQ(CHAN_ENUM_5180) &&
((adapter->device_mode == QDF_SAP_MODE &&
!sap_force_11n_for_11ac &&
sap_11ac_override) ||
@ -2990,7 +2995,8 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
}
/* No VHT80 in 2.4G so perform ACS accordingly */
if (sap_config->acs_cfg.end_ch <= 14 &&
if (sap_config->acs_cfg.end_ch_freq <=
WLAN_REG_CH_TO_FREQ(CHAN_ENUM_2484) &&
sap_config->acs_cfg.ch_width == eHT_CHANNEL_WIDTH_80MHZ) {
sap_config->acs_cfg.ch_width = eHT_CHANNEL_WIDTH_40MHZ;
hdd_debug("resetting to 40Mhz in 2.4Ghz");
@ -2999,13 +3005,14 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
hdd_debug("ACS Config for %s: HW_MODE: %d ACS_BW: %d HT: %d VHT: %d START_CH: %d END_CH: %d band %d",
adapter->dev->name, sap_config->acs_cfg.hw_mode,
sap_config->acs_cfg.ch_width, ht_enabled, vht_enabled,
sap_config->acs_cfg.start_ch, sap_config->acs_cfg.end_ch,
sap_config->acs_cfg.start_ch_freq,
sap_config->acs_cfg.end_ch_freq,
sap_config->acs_cfg.band);
host_log_acs_req_event(adapter->dev->name,
csr_phy_mode_str(sap_config->acs_cfg.hw_mode),
ch_width, ht_enabled, vht_enabled,
sap_config->acs_cfg.start_ch,
sap_config->acs_cfg.end_ch);
sap_config->acs_cfg.start_ch_freq,
sap_config->acs_cfg.end_ch_freq);
sap_config->acs_cfg.is_ht_enabled = ht_enabled;
sap_config->acs_cfg.is_vht_enabled = vht_enabled;

View File

@ -4334,71 +4334,78 @@ QDF_STATUS wlan_hdd_config_acs(struct hdd_context *hdd_ctx,
hdd_ctx->skip_acs_scan_status == eSAP_SKIP_ACS_SCAN &&
con_sap_config->acs_cfg.hw_mode ==
sap_config->acs_cfg.hw_mode) {
uint8_t con_sap_st_ch, con_sap_end_ch;
uint8_t cur_sap_st_ch, cur_sap_end_ch;
uint8_t bandStartChannel, bandEndChannel;
uint32_t con_sap_st_ch_freq, con_sap_end_ch_freq;
uint32_t cur_sap_st_ch_freq, cur_sap_end_ch_freq;
uint32_t bandStartChannel, bandEndChannel;
con_sap_st_ch =
con_sap_config->acs_cfg.start_ch;
con_sap_end_ch =
con_sap_config->acs_cfg.end_ch;
cur_sap_st_ch = sap_config->acs_cfg.start_ch;
cur_sap_end_ch = sap_config->acs_cfg.end_ch;
con_sap_st_ch_freq =
con_sap_config->acs_cfg.start_ch_freq;
con_sap_end_ch_freq =
con_sap_config->acs_cfg.end_ch_freq;
cur_sap_st_ch_freq =
sap_config->acs_cfg.start_ch_freq;
cur_sap_end_ch_freq =
sap_config->acs_cfg.end_ch_freq;
wlansap_extend_to_acs_range(mac_handle, &cur_sap_st_ch,
&cur_sap_end_ch, &bandStartChannel,
&bandEndChannel);
wlansap_extend_to_acs_range(mac_handle,
&con_sap_st_ch, &con_sap_end_ch,
wlansap_extend_to_acs_range(
mac_handle, &cur_sap_st_ch_freq,
&cur_sap_end_ch_freq,
&bandStartChannel, &bandEndChannel);
if (con_sap_st_ch <= cur_sap_st_ch &&
con_sap_end_ch >= cur_sap_end_ch) {
wlansap_extend_to_acs_range(
mac_handle, &con_sap_st_ch_freq,
&con_sap_end_ch_freq,
&bandStartChannel, &bandEndChannel);
if (con_sap_st_ch_freq <= cur_sap_st_ch_freq &&
con_sap_end_ch_freq >= cur_sap_end_ch_freq) {
sap_config->acs_cfg.skip_scan_status =
eSAP_SKIP_ACS_SCAN;
} else if (con_sap_st_ch >= cur_sap_st_ch &&
con_sap_end_ch >= cur_sap_end_ch) {
} else if (con_sap_st_ch_freq >= cur_sap_st_ch_freq &&
con_sap_end_ch_freq >=
cur_sap_end_ch_freq) {
sap_config->acs_cfg.skip_scan_status =
eSAP_DO_PAR_ACS_SCAN;
sap_config->acs_cfg.skip_scan_range1_stch =
cur_sap_st_ch;
cur_sap_st_ch_freq;
sap_config->acs_cfg.skip_scan_range1_endch =
con_sap_st_ch - 1;
con_sap_st_ch_freq - 5;
sap_config->acs_cfg.skip_scan_range2_stch =
0;
sap_config->acs_cfg.skip_scan_range2_endch =
0;
} else if (con_sap_st_ch <= cur_sap_st_ch &&
con_sap_end_ch <= cur_sap_end_ch) {
} else if (con_sap_st_ch_freq <= cur_sap_st_ch_freq &&
con_sap_end_ch_freq <=
cur_sap_end_ch_freq) {
sap_config->acs_cfg.skip_scan_status =
eSAP_DO_PAR_ACS_SCAN;
sap_config->acs_cfg.skip_scan_range1_stch =
con_sap_end_ch + 1;
con_sap_end_ch_freq + 5;
sap_config->acs_cfg.skip_scan_range1_endch =
cur_sap_end_ch;
cur_sap_end_ch_freq;
sap_config->acs_cfg.skip_scan_range2_stch =
0;
sap_config->acs_cfg.skip_scan_range2_endch =
0;
} else if (con_sap_st_ch >= cur_sap_st_ch &&
con_sap_end_ch <= cur_sap_end_ch) {
} else if (con_sap_st_ch_freq >= cur_sap_st_ch_freq &&
con_sap_end_ch_freq <=
cur_sap_end_ch_freq) {
sap_config->acs_cfg.skip_scan_status =
eSAP_DO_PAR_ACS_SCAN;
sap_config->acs_cfg.skip_scan_range1_stch =
cur_sap_st_ch;
cur_sap_st_ch_freq;
sap_config->acs_cfg.skip_scan_range1_endch =
con_sap_st_ch - 1;
con_sap_st_ch_freq - 5;
sap_config->acs_cfg.skip_scan_range2_stch =
con_sap_end_ch;
con_sap_end_ch_freq;
sap_config->acs_cfg.skip_scan_range2_endch =
cur_sap_end_ch + 1;
cur_sap_end_ch_freq + 5;
} else
sap_config->acs_cfg.skip_scan_status =

View File

@ -429,18 +429,18 @@ struct sap_acs_cfg {
/* ACS Algo Input */
uint8_t acs_mode;
eCsrPhyMode hw_mode;
uint8_t start_ch;
uint8_t end_ch;
uint32_t start_ch_freq;
uint32_t end_ch_freq;
uint32_t *freq_list;
uint8_t ch_list_count;
uint32_t *master_freq_list;
uint8_t master_ch_list_count;
#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
uint8_t skip_scan_status;
uint8_t skip_scan_range1_stch;
uint8_t skip_scan_range1_endch;
uint8_t skip_scan_range2_stch;
uint8_t skip_scan_range2_endch;
uint32_t skip_scan_range1_stch;
uint32_t skip_scan_range1_endch;
uint32_t skip_scan_range2_stch;
uint32_t skip_scan_range2_endch;
#endif
uint16_t ch_width;
@ -1260,10 +1260,10 @@ QDF_STATUS wlansap_reset_sap_config_add_ie(struct sap_config *config,
eUpdateIEsType updateType);
void wlansap_extend_to_acs_range(mac_handle_t mac_handle,
uint8_t *startChannelNum,
uint8_t *endChannelNum,
uint8_t *bandStartChannel,
uint8_t *bandEndChannel);
uint32_t *start_ch_freq,
uint32_t *end_ch_freq,
uint32_t *bandStartChannel,
uint32_t *bandEndChannel);
/**
* wlansap_set_dfs_nol() - Set dfs nol

View File

@ -66,10 +66,13 @@
#define SET_ACS_BAND(acs_band, sap_ctx) \
{ \
if (sap_ctx->acs_cfg->start_ch <= 14 && \
sap_ctx->acs_cfg->end_ch <= 14) \
if (sap_ctx->acs_cfg->start_ch_freq <= \
WLAN_REG_CH_TO_FREQ(CHAN_ENUM_2484) && \
sap_ctx->acs_cfg->end_ch_freq <= \
WLAN_REG_CH_TO_FREQ(CHAN_ENUM_2484)) \
acs_band = eCSR_DOT11_MODE_11g; \
else if (sap_ctx->acs_cfg->start_ch >= 14)\
else if (sap_ctx->acs_cfg->start_ch_freq >= \
WLAN_REG_CH_TO_FREQ(CHAN_ENUM_2484))\
acs_band = eCSR_DOT11_MODE_11a; \
else \
acs_band = eCSR_DOT11_MODE_abg; \

View File

@ -3250,8 +3250,8 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
uint32_t *list;
uint8_t ch_count;
uint8_t dfs_master_enable;
uint8_t start_ch_num, band_start_ch;
uint8_t end_ch_num, band_end_ch;
uint32_t start_ch_freq, band_start_ch;
uint32_t end_ch_freq, band_end_ch;
uint32_t en_lte_coex;
struct mac_context *mac_ctx;
uint16_t ch_width;
@ -3277,21 +3277,21 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
if (sap_ctx->dfs_mode == ACS_DFS_MODE_DISABLE)
dfs_master_enable = false;
start_ch_num = sap_ctx->acs_cfg->start_ch;
end_ch_num = sap_ctx->acs_cfg->end_ch;
start_ch_freq = sap_ctx->acs_cfg->start_ch_freq;
end_ch_freq = sap_ctx->acs_cfg->end_ch_freq;
ch_width = sap_ctx->acs_cfg->ch_width;
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
FL("startChannel %d, EndChannel %d, ch_width %d, HW:%d"),
start_ch_num, end_ch_num, ch_width,
start_ch_freq, end_ch_freq, ch_width,
sap_ctx->acs_cfg->hw_mode);
wlansap_extend_to_acs_range(MAC_HANDLE(mac_ctx),
&start_ch_num, &end_ch_num,
&start_ch_freq, &end_ch_freq,
&band_start_ch, &band_end_ch);
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
FL("expanded startChannel %d,EndChannel %d"),
start_ch_num, end_ch_num);
start_ch_freq, end_ch_freq);
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
FL("band_start_ch %d, band_end_ch %d"),
@ -3318,16 +3318,15 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
ch_count = 0;
for (loop_count = band_start_ch; loop_count <= band_end_ch;
loop_count++) {
chan_freq = wlan_reg_chan_to_freq(mac_ctx->pdev,
WLAN_REG_CH_NUM(loop_count));
chan_freq = WLAN_REG_CH_TO_FREQ(loop_count);
/* go to next channel if rf_channel is out of range */
if ((start_ch_num > WLAN_REG_CH_NUM(loop_count)) ||
(end_ch_num < WLAN_REG_CH_NUM(loop_count)))
if (start_ch_freq > WLAN_REG_CH_TO_FREQ(loop_count) ||
end_ch_freq < WLAN_REG_CH_TO_FREQ(loop_count))
continue;
/* Skip channel 12, and 13 for IOT issues for now */
if (WLAN_REG_CH_NUM(loop_count) == 12 ||
WLAN_REG_CH_NUM(loop_count) == 13)
if (loop_count == CHAN_ENUM_2467 ||
loop_count == CHAN_ENUM_2472)
continue;
/*
* go to next channel if none of these condition pass
@ -3335,35 +3334,38 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
* - DFS scan disable but chan in CHANNEL_STATE_ENABLE
*/
if (!(((true == mac_ctx->scan.fEnableDFSChnlScan) &&
wlan_reg_get_channel_state(mac_ctx->pdev,
WLAN_REG_CH_NUM(loop_count)))
wlan_reg_get_channel_state_for_freq(
mac_ctx->pdev, WLAN_REG_CH_TO_FREQ(loop_count)))
||
((false == mac_ctx->scan.fEnableDFSChnlScan) &&
(CHANNEL_STATE_ENABLE ==
wlan_reg_get_channel_state(mac_ctx->pdev,
WLAN_REG_CH_NUM(loop_count)))
wlan_reg_get_channel_state_for_freq(
mac_ctx->pdev, WLAN_REG_CH_TO_FREQ(loop_count)))
)))
continue;
/* check if the channel is in NOL blacklist */
if (sap_dfs_is_channel_in_nol_list(sap_ctx,
WLAN_REG_CH_NUM(loop_count),
PHY_SINGLE_CHANNEL_CENTERED)) {
sap_debug("Ch %d in NOL list",
WLAN_REG_CH_NUM(loop_count));
continue;
if (!WLAN_REG_IS_6GHZ_CHAN_FREQ(WLAN_REG_CH_TO_FREQ(
loop_count))) {
if (sap_dfs_is_channel_in_nol_list(
sap_ctx,
WLAN_REG_CH_NUM(loop_count),
PHY_SINGLE_CHANNEL_CENTERED)) {
sap_debug("Ch %d in NOL list",
WLAN_REG_CH_NUM(loop_count));
continue;
}
}
/* Skip DSRC channels */
if (wlan_reg_is_dsrc_chan(mac_ctx->pdev,
WLAN_REG_CH_NUM(loop_count)))
if (wlan_reg_is_dsrc_freq(WLAN_REG_CH_TO_FREQ(loop_count)))
continue;
/*
* Skip the channels which are not in ACS config from user
* space
*/
if (!wlansap_is_channel_present_in_acs_list(chan_freq,
if (!wlansap_is_channel_present_in_acs_list(
chan_freq,
sap_ctx->acs_cfg->freq_list,
sap_ctx->acs_cfg->ch_list_count))
continue;
@ -3371,10 +3373,11 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
* As it can result in SAP starting on DFS channel
* resulting MCC on DFS channel
*/
if (wlan_reg_is_dfs_ch(mac_ctx->pdev,
WLAN_REG_CH_NUM(loop_count)) &&
if (wlan_reg_is_dfs_for_freq(
mac_ctx->pdev,
WLAN_REG_CH_TO_FREQ(loop_count)) &&
(policy_mgr_disallow_mcc(mac_ctx->psoc,
WLAN_REG_CH_TO_FREQ(loop_count)) ||
WLAN_REG_CH_TO_FREQ(loop_count)) ||
!dfs_master_enable))
continue;
@ -3383,8 +3386,9 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
*/
if (!wlan_reg_is_etsi13_srd_chan_allowed_master_mode(mac_ctx->
pdev) &&
wlan_reg_is_etsi13_srd_chan(mac_ctx->pdev,
WLAN_REG_CH_NUM(loop_count)))
wlan_reg_is_etsi13_srd_chan_for_freq(
mac_ctx->pdev,
WLAN_REG_CH_TO_FREQ(loop_count)))
continue;
/* Check if the freq is present in range list */
@ -3420,29 +3424,32 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
if ((sap_ctx->acs_cfg->skip_scan_status ==
eSAP_DO_PAR_ACS_SCAN)) {
uint8_t ch;
uint32_t ch_freq;
ch = WLAN_REG_CH_NUM(loop_count);
if ((ch >= sap_ctx->acs_cfg->skip_scan_range1_stch &&
ch <= sap_ctx->acs_cfg->skip_scan_range1_endch) ||
(ch >= sap_ctx->acs_cfg->skip_scan_range2_stch &&
ch <= sap_ctx->acs_cfg->skip_scan_range2_endch)) {
list[ch_count] = wlan_reg_chan_to_freq(mac_ctx->pdev,
WLAN_REG_CH_NUM(loop_count));
ch_count++;
QDF_TRACE(QDF_MODULE_ID_SAP,
QDF_TRACE_LEVEL_INFO,
FL("%d %d added to ACS ch range"),
ch_count, ch);
} else {
QDF_TRACE(QDF_MODULE_ID_SAP,
QDF_TRACE_LEVEL_INFO_HIGH,
FL("%d %d skipped from ACS ch range"),
ch_count, ch);
ch_freq = WLAN_REG_CH_TO_FREQ(loop_count);
if ((ch_freq >=
sap_ctx->acs_cfg->skip_scan_range1_stch &&
ch_freq <=
sap_ctx->acs_cfg->skip_scan_range1_endch) ||
(ch_freq >=
sap_ctx->acs_cfg->skip_scan_range2_stch &&
ch_freq <=
sap_ctx->acs_cfg->skip_scan_range2_endch)) {
list[ch_count] =
WLAN_REG_CH_TO_FREQ(loop_count);
ch_count++;
QDF_TRACE(QDF_MODULE_ID_SAP,
QDF_TRACE_LEVEL_INFO,
FL("%d %d added to ACS ch range"),
ch_count, ch_freq);
} else {
QDF_TRACE(QDF_MODULE_ID_SAP,
QDF_TRACE_LEVEL_INFO_HIGH,
FL("%d %d skipped from ACS ch range"),
ch_count, ch_freq);
}
} else {
list[ch_count] = wlan_reg_chan_to_freq(mac_ctx->pdev,
WLAN_REG_CH_NUM(loop_count));
list[ch_count] = WLAN_REG_CH_TO_FREQ(loop_count);
ch_count++;
QDF_TRACE(QDF_MODULE_ID_SAP,
QDF_TRACE_LEVEL_INFO,
@ -3450,8 +3457,7 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
ch_count);
}
#else
list[ch_count] = wlan_reg_chan_to_freq(mac_ctx->pdev,
WLAN_REG_CH_NUM(loop_count));
list[ch_count] = WLAN_REG_CH_TO_FREQ(loop_count);
ch_count++;
#endif
}
@ -3462,7 +3468,8 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
* LTE COEX: channel range outside the restricted 2.4GHz
* band limits
*/
if (en_lte_coex && (start_ch_num > band_end_ch))
if (en_lte_coex &&
start_ch_freq > WLAN_REG_CH_TO_FREQ(band_end_ch))
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_FATAL,
FL("SAP can't be started as due to LTE COEX"));
}

View File

@ -2300,6 +2300,42 @@ wlansap_reset_sap_config_add_ie(struct sap_config *config,
return QDF_STATUS_SUCCESS;
}
#define ACS_WLAN_20M_CH_INC 20
#define ACS_2G_EXTEND ACS_WLAN_20M_CH_INC
#define ACS_5G_EXTEND (ACS_WLAN_20M_CH_INC * 3)
#ifdef CONFIG_BAND_6GHZ
static void wlansap_update_start_range_6ghz(
uint32_t *start_ch_freq, uint32_t *bandStartChannel)
{
*bandStartChannel = CHAN_ENUM_5945;
*start_ch_freq = (*start_ch_freq - ACS_5G_EXTEND) >
wlan_reg_ch_to_freq(CHAN_ENUM_5945) ?
(*start_ch_freq - ACS_5G_EXTEND) :
wlan_reg_ch_to_freq(CHAN_ENUM_5945);
}
static void wlansap_update_end_range_6ghz(
uint32_t *end_ch_freq, uint32_t *bandEndChannel)
{
*bandEndChannel = CHAN_ENUM_7105;
*end_ch_freq = (*end_ch_freq + ACS_5G_EXTEND) <=
wlan_reg_ch_to_freq(CHAN_ENUM_7105) ?
(*end_ch_freq + ACS_5G_EXTEND) :
wlan_reg_ch_to_freq(CHAN_ENUM_7105);
}
#else
static void wlansap_update_start_range_6ghz(
uint32_t *start_ch_freq, uint32_t *bandStartChannel)
{
}
static void wlansap_update_end_range_6ghz(
uint32_t *end_ch_freq, uint32_t *bandEndChannel)
{
}
#endif
/*==========================================================================
FUNCTION wlansap_extend_to_acs_range
@ -2308,26 +2344,22 @@ wlansap_reset_sap_config_add_ie(struct sap_config *config,
DEPENDENCIES PARAMETERS
IN /OUT
*startChannelNum : ACS extend start ch
*endChannelNum : ACS extended End ch
*bandStartChannel: Band start ch
*bandEndChannel : Band end ch
* start_ch_freq : ACS extend start ch
* end_ch_freq : ACS extended End ch
* bandStartChannel: Band start ch
* bandEndChannel : Band end ch
RETURN VALUE NONE
SIDE EFFECTS
============================================================================*/
void wlansap_extend_to_acs_range(mac_handle_t mac_handle,
uint8_t *startChannelNum,
uint8_t *endChannelNum,
uint8_t *bandStartChannel,
uint8_t *bandEndChannel)
uint32_t *start_ch_freq,
uint32_t *end_ch_freq,
uint32_t *bandStartChannel,
uint32_t *bandEndChannel)
{
#define ACS_WLAN_20M_CH_INC 4
#define ACS_2G_EXTEND ACS_WLAN_20M_CH_INC
#define ACS_5G_EXTEND (ACS_WLAN_20M_CH_INC * 3)
uint8_t tmp_startChannelNum = 0, tmp_endChannelNum = 0;
uint32_t tmp_start_ch_freq = 0, tmp_end_ch_freq = 0;
struct mac_context *mac_ctx;
mac_ctx = MAC_CONTEXT(mac_handle);
@ -2336,53 +2368,83 @@ void wlansap_extend_to_acs_range(mac_handle_t mac_handle,
"%s: Invalid mac_ctx", __func__);
return;
}
if (*startChannelNum <= 14 && *endChannelNum <= 14) {
if (*start_ch_freq <= wlan_reg_ch_to_freq(CHAN_ENUM_2484)) {
*bandStartChannel = CHAN_ENUM_2412;
*bandEndChannel = CHAN_ENUM_2484;
tmp_startChannelNum = *startChannelNum > 5 ?
(*startChannelNum - ACS_2G_EXTEND) : 1;
tmp_endChannelNum = (*endChannelNum + ACS_2G_EXTEND) <= 14 ?
(*endChannelNum + ACS_2G_EXTEND) : 14;
} else if (*startChannelNum >= 36 && *endChannelNum >= 36) {
tmp_start_ch_freq = *start_ch_freq >
wlan_reg_ch_to_freq(CHAN_ENUM_2432) ?
(*start_ch_freq - ACS_2G_EXTEND) :
wlan_reg_ch_to_freq(CHAN_ENUM_2412);
} else if (*start_ch_freq <= wlan_reg_ch_to_freq(CHAN_ENUM_5865)) {
*bandStartChannel = CHAN_ENUM_5180;
*bandEndChannel = CHAN_ENUM_5865;
tmp_startChannelNum = (*startChannelNum - ACS_5G_EXTEND) > 36 ?
(*startChannelNum - ACS_5G_EXTEND) : 36;
tmp_endChannelNum = (*endChannelNum + ACS_5G_EXTEND) <=
WNI_CFG_CURRENT_CHANNEL_STAMAX ?
(*endChannelNum + ACS_5G_EXTEND) :
WNI_CFG_CURRENT_CHANNEL_STAMAX;
tmp_start_ch_freq = (*start_ch_freq - ACS_5G_EXTEND) >
wlan_reg_ch_to_freq(CHAN_ENUM_5180) ?
(*start_ch_freq - ACS_5G_EXTEND) :
wlan_reg_ch_to_freq(CHAN_ENUM_5180);
} else if (WLAN_REG_IS_6GHZ_CHAN_FREQ(*start_ch_freq)) {
tmp_start_ch_freq = *start_ch_freq;
wlansap_update_start_range_6ghz(&tmp_start_ch_freq,
bandStartChannel);
} else {
*bandStartChannel = CHAN_ENUM_2412;
*bandEndChannel = CHAN_ENUM_5865;
tmp_startChannelNum = *startChannelNum > 5 ?
(*startChannelNum - ACS_2G_EXTEND) : 1;
tmp_endChannelNum = (*endChannelNum + ACS_5G_EXTEND) <=
WNI_CFG_CURRENT_CHANNEL_STAMAX ?
(*endChannelNum + ACS_5G_EXTEND) :
WNI_CFG_CURRENT_CHANNEL_STAMAX;
tmp_start_ch_freq = *start_ch_freq >
wlan_reg_ch_to_freq(CHAN_ENUM_2432) ?
(*start_ch_freq - ACS_2G_EXTEND) :
wlan_reg_ch_to_freq(CHAN_ENUM_2412);
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
"%s: unexpected start freq %d",
__func__, *start_ch_freq);
}
if (*end_ch_freq <= wlan_reg_ch_to_freq(CHAN_ENUM_2484)) {
*bandEndChannel = CHAN_ENUM_2484;
tmp_end_ch_freq = (*end_ch_freq + ACS_2G_EXTEND) <=
wlan_reg_ch_to_freq(CHAN_ENUM_2484) ?
(*end_ch_freq + ACS_2G_EXTEND) :
wlan_reg_ch_to_freq(CHAN_ENUM_2484);
} else if (*end_ch_freq <= wlan_reg_ch_to_freq(CHAN_ENUM_5865)) {
*bandEndChannel = CHAN_ENUM_5865;
tmp_end_ch_freq = (*end_ch_freq + ACS_5G_EXTEND) <=
wlan_reg_ch_to_freq(CHAN_ENUM_5865) ?
(*end_ch_freq + ACS_5G_EXTEND) :
wlan_reg_ch_to_freq(CHAN_ENUM_5865);
} else if (WLAN_REG_IS_6GHZ_CHAN_FREQ(*end_ch_freq)) {
tmp_end_ch_freq = *end_ch_freq;
wlansap_update_end_range_6ghz(&tmp_end_ch_freq,
bandEndChannel);
} else {
*bandEndChannel = CHAN_ENUM_5865;
tmp_end_ch_freq = (*end_ch_freq + ACS_5G_EXTEND) <=
wlan_reg_ch_to_freq(CHAN_ENUM_5865) ?
(*end_ch_freq + ACS_5G_EXTEND) :
wlan_reg_ch_to_freq(CHAN_ENUM_5865);
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
"%s: unexpected end freq %d", __func__, *end_ch_freq);
}
*start_ch_freq = tmp_start_ch_freq;
*end_ch_freq = tmp_end_ch_freq;
/* Note if the ACS range include only DFS channels, do not cross range
* Active scanning in adjacent non DFS channels results in transmission
* spikes in DFS specturm channels which is due to emission spill.
* Remove the active channels from extend ACS range for DFS only range
*/
if (wlan_reg_is_dfs_ch(mac_ctx->pdev, *startChannelNum)) {
while (!wlan_reg_is_dfs_ch(mac_ctx->pdev,
tmp_startChannelNum) &&
tmp_startChannelNum < *startChannelNum)
tmp_startChannelNum += ACS_WLAN_20M_CH_INC;
if (wlan_reg_is_dfs_for_freq(mac_ctx->pdev, *start_ch_freq)) {
while (!wlan_reg_is_dfs_for_freq(
mac_ctx->pdev,
tmp_start_ch_freq) &&
tmp_start_ch_freq < *start_ch_freq)
tmp_start_ch_freq += ACS_WLAN_20M_CH_INC;
*startChannelNum = tmp_startChannelNum;
*start_ch_freq = tmp_start_ch_freq;
}
if (wlan_reg_is_dfs_ch(mac_ctx->pdev, *endChannelNum)) {
while (!wlan_reg_is_dfs_ch(mac_ctx->pdev,
tmp_endChannelNum) &&
tmp_endChannelNum > *endChannelNum)
tmp_endChannelNum -= ACS_WLAN_20M_CH_INC;
if (wlan_reg_is_dfs_for_freq(mac_ctx->pdev, *end_ch_freq)) {
while (!wlan_reg_is_dfs_for_freq(
mac_ctx->pdev,
tmp_end_ch_freq) &&
tmp_end_ch_freq > *end_ch_freq)
tmp_end_ch_freq -= ACS_WLAN_20M_CH_INC;
*endChannelNum = tmp_endChannelNum;
*end_ch_freq = tmp_end_ch_freq;
}
}