qcacld-3.0: Use frequency based channel enumerations

CONFIG_LEGACY_CHAN_ENUM has been removed. That macro needs channel number
based enumeration. Use channel frequency going forward. So change to
frequency based channel enumeration.

Change-Id: I234eb070a6dcfaf3325bbd523c19188d5b2bbd24
CRs-Fixed: 2513098
This commit is contained in:
Amar Singhal 2019-08-06 12:47:18 -07:00 • committed by nshrivas
commit 2e4ccccf54
7 changed files with 52 additions and 46 deletions

View file

@ -1059,7 +1059,7 @@ int wlan_hdd_get_adjacent_chan(uint8_t chan, bool upper)
if (upper && (ch_idx < (NUM_CHANNELS - 1)))
ch_idx++;
else if (!upper && (ch_idx > CHAN_ENUM_1))
else if (!upper && (ch_idx > CHAN_ENUM_2412))
ch_idx--;
else
return -EINVAL;
@ -1721,20 +1721,20 @@ 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_1);
sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_14);
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);
} 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_1);
sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_13);
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);
} 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_36);
sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_173);
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);
} 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_1);
sap_cfg->acs_cfg.end_ch = WLAN_REG_CH_NUM(CHAN_ENUM_173);
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);
}
if (ht_enabled)
@ -2903,7 +2903,7 @@ 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_36) &&
sap_config->acs_cfg.end_ch >= WLAN_REG_CH_NUM(CHAN_ENUM_5180) &&
((adapter->device_mode == QDF_SAP_MODE &&
!sap_force_11n_for_11ac &&
sap_11ac_override) ||
@ -14722,7 +14722,7 @@ QDF_STATUS wlan_hdd_validate_operation_channel(struct hdd_adapter *adapter,
hdd_err("Unable to fetch sap allow all channels");
if (value) {
/* Validate the channel */
for (count = CHAN_ENUM_1; count <= CHAN_ENUM_173; count++) {
for (count = CHAN_ENUM_2412; count <= CHAN_ENUM_5865; count++) {
if (channel == WLAN_REG_CH_NUM(count)) {
is_valid_channel = true;
break;

View file

@ -1995,7 +1995,7 @@ static int iw_get_channel_list(struct net_device *dev,
{
uint32_t num_channels = 0;
uint8_t i = 0;
uint8_t band_start_channel = CHAN_ENUM_1;
uint8_t band_start_channel = MIN_24GHZ_CHANNEL;
uint8_t band_end_channel = MAX_5GHZ_CHANNEL;
struct hdd_adapter *hostapd_adapter = (netdev_priv(dev));
struct channel_list_info *channel_list =
@ -2023,10 +2023,10 @@ static int iw_get_channel_list(struct net_device *dev,
}
if (BAND_2G == cur_band) {
band_start_channel = CHAN_ENUM_1;
band_end_channel = CHAN_ENUM_14;
band_start_channel = MIN_24GHZ_CHANNEL;
band_end_channel = MAX_24GHZ_CHANNEL;
} else if (BAND_5G == cur_band) {
band_start_channel = CHAN_ENUM_36;
band_start_channel = MIN_5GHZ_CHANNEL;
band_end_channel = MAX_5GHZ_CHANNEL;
}

View file

@ -659,7 +659,7 @@ void hdd_update_indoor_channel(struct hdd_context *hdd_ctx,
{
int band_num;
int chan_num;
enum channel_enum chan_enum = CHAN_ENUM_1;
enum channel_enum chan_enum = CHAN_ENUM_2412;
struct ieee80211_channel *wiphy_chan, *wiphy_chan_144 = NULL;
struct regulatory_channel *cds_chan;
uint8_t band_capability;
@ -682,7 +682,7 @@ void hdd_update_indoor_channel(struct hdd_context *hdd_ctx,
wiphy_chan =
&(wiphy->bands[band_num]->channels[chan_num]);
cds_chan = &(reg_channels[chan_enum]);
if (chan_enum == CHAN_ENUM_144)
if (chan_enum == CHAN_ENUM_5720)
wiphy_chan_144 = wiphy_chan;
chan_enum++;
@ -1381,10 +1381,15 @@ int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy)
{
bool offload_enabled;
struct reg_config_vars config_vars;
struct regulatory_channel cur_chan_list[NUM_CHANNELS];
struct regulatory_channel *cur_chan_list;
enum country_src cc_src;
uint8_t alpha2[REG_ALPHA2_LEN + 1];
cur_chan_list = qdf_mem_malloc(sizeof(*cur_chan_list) * NUM_CHANNELS);
if (!cur_chan_list) {
return -ENOMEM;
}
reg_program_config_vars(hdd_ctx, &config_vars);
ucfg_reg_register_chan_change_callback(hdd_ctx->psoc,
hdd_regulatory_dyn_cbk,
@ -1420,6 +1425,7 @@ int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy)
hdd_ctx->reg_offload = false;
}
qdf_mem_free(cur_chan_list);
return 0;
}

View file

@ -5773,7 +5773,7 @@ QDF_STATUS lim_send_ies_per_band(struct mac_context *mac_ctx,
lim_set_ht_caps(mac_ctx, session, ht_caps,
DOT11F_IE_HTCAPS_MIN_LEN + 2);
/* Get LDPC and over write for 2G */
p_ht_cap->advCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_6);
p_ht_cap->advCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_2437);
/* Get self cap for HT40 support in 2G */
if (mac_ctx->roam.configParam.channelBondingMode24GHz) {
p_ht_cap->supportedChannelWidthSet = 1;
@ -5797,7 +5797,7 @@ QDF_STATUS lim_send_ies_per_band(struct mac_context *mac_ctx,
* Get LDPC and over write for 5G - using channel 64 because it
* is available in all reg domains.
*/
p_ht_cap->advCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_64);
p_ht_cap->advCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_5320);
/* Get self cap for HT40 support in 5G */
if (mac_ctx->roam.configParam.channelBondingMode5GHz) {
p_ht_cap->supportedChannelWidthSet = 1;
@ -5819,7 +5819,7 @@ QDF_STATUS lim_send_ies_per_band(struct mac_context *mac_ctx,
* Get LDPC and over write for 5G - using channel 64 because it
* is available in all reg domains.
*/
p_vht_cap->ldpcCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_64);
p_vht_cap->ldpcCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_5320);
lim_populate_mcs_set_vht_per_vdev(mac_ctx, vht_caps,
vdev_id, NSS_CHAINS_BAND_5GHZ);
@ -5834,7 +5834,7 @@ QDF_STATUS lim_send_ies_per_band(struct mac_context *mac_ctx,
CDS_BAND_5GHZ, &vht_caps[2], DOT11F_IE_VHTCAPS_MIN_LEN);
/* Get LDPC and over write for 2G */
p_vht_cap->ldpcCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_6);
p_vht_cap->ldpcCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_2437);
/* Self VHT 80/160/80+80 channel width for 2G is 0 */
p_vht_cap->supportedChannelWidthSet = 0;
p_vht_cap->shortGI80MHz = 0;

View file

@ -1975,8 +1975,8 @@ static void sap_sort_chl_weight_ht80(tSapChSelSpectInfo *pSpectInfoParams)
*/
pSpectInfo = pSpectInfoParams->pSpectCh;
for (j = 0; j < pSpectInfoParams->numSpectChans; j++) {
if ((pSpectInfo[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_1) &&
pSpectInfo[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_14)) ||
if ((pSpectInfo[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_2412) &&
pSpectInfo[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_2484)) ||
(pSpectInfo[j].chNum >= CHANNEL_165))
pSpectInfo[j].weight = SAP_ACS_WEIGHT_MAX * 4;
}
@ -2120,10 +2120,10 @@ static void sap_sort_chl_weight_vht160(tSapChSelSpectInfo *pSpectInfoParams)
*/
pSpectInfo = pSpectInfoParams->pSpectCh;
for (j = 0; j < pSpectInfoParams->numSpectChans; j++) {
if ((pSpectInfo[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_1) &&
pSpectInfo[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_14)) ||
(pSpectInfo[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_132) &&
pSpectInfo[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_173)))
if ((pSpectInfo[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_2412) &&
pSpectInfo[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_2484)) ||
(pSpectInfo[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_5660) &&
pSpectInfo[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_5865)))
pSpectInfo[j].weight = SAP_ACS_WEIGHT_MAX * 8;
}
@ -2158,8 +2158,8 @@ static void sap_allocate_max_weight_ht40_24_g(
*/
spect_info = spect_info_params->pSpectCh;
for (j = 0; j < spect_info_params->numSpectChans; j++) {
if ((spect_info[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_1) &&
spect_info[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_14)))
if ((spect_info[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_2412) &&
spect_info[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_2484)))
spect_info[j].weight = SAP_ACS_WEIGHT_MAX * 2;
}
}
@ -2183,8 +2183,8 @@ static void sap_allocate_max_weight_ht40_5_g(
*/
spect_info = spect_info_params->pSpectCh;
for (j = 0; j < spect_info_params->numSpectChans; j++) {
if ((spect_info[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_36) &&
spect_info[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_173)))
if ((spect_info[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_5180) &&
spect_info[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_5865)))
spect_info[j].weight = SAP_ACS_WEIGHT_MAX * 2;
}
}

View file

@ -3274,10 +3274,10 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
en_lte_coex = mac_ctx->mlme_cfg->sap_cfg.enable_lte_coex;
/* Check if LTE coex is enabled and 2.4GHz is selected */
if (en_lte_coex && (band_start_ch == CHAN_ENUM_1) &&
(band_end_ch == CHAN_ENUM_14)) {
if (en_lte_coex && (band_start_ch == CHAN_ENUM_2412) &&
(band_end_ch == CHAN_ENUM_2484)) {
/* Set 2.4GHz upper limit to channel 9 for LTE COEX */
band_end_ch = CHAN_ENUM_9;
band_end_ch = CHAN_ENUM_2452;
}
/* Allocate the max number of channel supported */
@ -3353,15 +3353,15 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
* band. So, don't even scan on 2.4Ghz channels if bw is
* 40/80/160Mhz and channel list has any 5Ghz channel.
*/
if (end_ch_num >= WLAN_REG_CH_NUM(CHAN_ENUM_36) &&
if (end_ch_num >= WLAN_REG_CH_NUM(CHAN_ENUM_5180) &&
((ch_width == CH_WIDTH_40MHZ) ||
(ch_width == CH_WIDTH_80MHZ) ||
(ch_width == CH_WIDTH_80P80MHZ) ||
(ch_width == CH_WIDTH_160MHZ))) {
if (WLAN_REG_CH_NUM(loop_count) >=
WLAN_REG_CH_NUM(CHAN_ENUM_1) &&
WLAN_REG_CH_NUM(CHAN_ENUM_2412) &&
WLAN_REG_CH_NUM(loop_count) <=
WLAN_REG_CH_NUM(CHAN_ENUM_14))
WLAN_REG_CH_NUM(CHAN_ENUM_2484))
continue;
}

View file

@ -1254,7 +1254,7 @@ QDF_STATUS wlansap_deauth_sta(struct sap_context *sap_ctx,
*/
static QDF_STATUS
wlansap_update_csa_channel_params(struct sap_context *sap_context,
uint32_t channel)
enum channel_enum channel)
{
struct mac_context *mac_ctx;
uint8_t bw;
@ -1265,7 +1265,7 @@ wlansap_update_csa_channel_params(struct sap_context *sap_context,
return QDF_STATUS_E_FAULT;
}
if (channel <= CHAN_ENUM_14) {
if (channel <= CHAN_ENUM_2484) {
/*
* currently OBSS scan is done in hostapd, so to avoid
* SAP coming up in HT40 on channel switch we are
@ -2347,15 +2347,15 @@ void wlansap_extend_to_acs_range(mac_handle_t mac_handle,
return;
}
if (*startChannelNum <= 14 && *endChannelNum <= 14) {
*bandStartChannel = CHAN_ENUM_1;
*bandEndChannel = CHAN_ENUM_14;
*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) {
*bandStartChannel = CHAN_ENUM_36;
*bandEndChannel = CHAN_ENUM_173;
*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) <=
@ -2363,8 +2363,8 @@ void wlansap_extend_to_acs_range(mac_handle_t mac_handle,
(*endChannelNum + ACS_5G_EXTEND) :
WNI_CFG_CURRENT_CHANNEL_STAMAX;
} else {
*bandStartChannel = CHAN_ENUM_1;
*bandEndChannel = CHAN_ENUM_173;
*bandStartChannel = CHAN_ENUM_2412;
*bandEndChannel = CHAN_ENUM_5865;
tmp_startChannelNum = *startChannelNum > 5 ?
(*startChannelNum - ACS_2G_EXTEND) : 1;
tmp_endChannelNum = (*endChannelNum + ACS_5G_EXTEND) <=