Move CHANWIDTH_* definitions from ieee80211_defs.h to defs.h

Move most of CHANWIDTH_* definitions from ieee80211_defs.h to defs.h as
the definitions are getting used mostly for internal purpose only. Also
change prefix of the definitions to CONF_OPER_CHWIDTH_* and update in
all the files accordingly.

Leave the couple of VHT-specific exceptions to use the old defines (the
reason why they were originally added as VHT values), to avoid use of
clearly marked configuration values in information elements. In
addition, use the defines instead of magic values where appropriate.

Signed-off-by: Aleti Nageshwar Reddy <quic_anageshw@quicinc.com>
This commit is contained in:
Aleti Nageshwar Reddy 2022-05-13 21:47:40 +05:30 committed by Jouni Malinen
parent 92f5499010
commit bafe35df03
31 changed files with 275 additions and 227 deletions

View file

@ -710,7 +710,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
if (mode->mode == HOSTAPD_MODE_IEEE80211A &&
(iface->conf->ieee80211ac || iface->conf->ieee80211ax)) {
if (hostapd_get_oper_chwidth(iface->conf) ==
CHANWIDTH_80MHZ &&
CONF_OPER_CHWIDTH_80MHZ &&
!acs_usable_bw80_chan(chan)) {
wpa_printf(MSG_DEBUG,
"ACS: Channel %d: not allowed as primary channel for 80 MHz bandwidth",
@ -719,7 +719,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
}
if (hostapd_get_oper_chwidth(iface->conf) ==
CHANWIDTH_160MHZ &&
CONF_OPER_CHWIDTH_160MHZ &&
!acs_usable_bw160_chan(chan)) {
wpa_printf(MSG_DEBUG,
"ACS: Channel %d: not allowed as primary channel for 160 MHz bandwidth",
@ -873,12 +873,14 @@ acs_find_ideal_chan(struct hostapd_iface *iface)
if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) {
switch (hostapd_get_oper_chwidth(iface->conf)) {
case CHANWIDTH_80MHZ:
case CONF_OPER_CHWIDTH_80MHZ:
n_chans = 4;
break;
case CHANWIDTH_160MHZ:
case CONF_OPER_CHWIDTH_160MHZ:
n_chans = 8;
break;
default:
break;
}
}
@ -915,13 +917,13 @@ static void acs_adjust_center_freq(struct hostapd_iface *iface)
wpa_printf(MSG_DEBUG, "ACS: Adjusting VHT center frequency");
switch (hostapd_get_oper_chwidth(iface->conf)) {
case CHANWIDTH_USE_HT:
case CONF_OPER_CHWIDTH_USE_HT:
offset = 2 * iface->conf->secondary_channel;
break;
case CHANWIDTH_80MHZ:
case CONF_OPER_CHWIDTH_80MHZ:
offset = 6;
break;
case CHANWIDTH_160MHZ:
case CONF_OPER_CHWIDTH_160MHZ:
offset = 14;
break;
default:

View file

@ -1048,7 +1048,7 @@ struct hostapd_config {
u32 vht_capab;
int ieee80211ac;
int require_vht;
u8 vht_oper_chwidth;
enum oper_chan_width vht_oper_chwidth;
u8 vht_oper_centr_freq_seg0_idx;
u8 vht_oper_centr_freq_seg1_idx;
u8 ht40_plus_minus_allowed;
@ -1092,7 +1092,7 @@ struct hostapd_config {
struct he_operation he_op;
struct ieee80211_he_mu_edca_parameter_set he_mu_edca;
struct spatial_reuse spr;
u8 he_oper_chwidth;
enum oper_chan_width he_oper_chwidth;
u8 he_oper_centr_freq_seg0_idx;
u8 he_oper_centr_freq_seg1_idx;
u8 he_6ghz_max_mpdu;
@ -1130,7 +1130,7 @@ struct hostapd_config {
int ieee80211be;
#ifdef CONFIG_IEEE80211BE
u8 eht_oper_chwidth;
enum oper_chan_width eht_oper_chwidth;
u8 eht_oper_centr_freq_seg0_idx;
struct eht_phy_capabilities_info eht_phy_capab;
#endif /* CONFIG_IEEE80211BE */
@ -1142,7 +1142,8 @@ struct hostapd_config {
};
static inline u8 hostapd_get_oper_chwidth(struct hostapd_config *conf)
static inline enum oper_chan_width
hostapd_get_oper_chwidth(struct hostapd_config *conf)
{
#ifdef CONFIG_IEEE80211BE
if (conf->ieee80211be)
@ -1156,7 +1157,8 @@ static inline u8 hostapd_get_oper_chwidth(struct hostapd_config *conf)
}
static inline void
hostapd_set_oper_chwidth(struct hostapd_config *conf, u8 oper_chwidth)
hostapd_set_oper_chwidth(struct hostapd_config *conf,
enum oper_chan_width oper_chwidth)
{
#ifdef CONFIG_IEEE80211BE
if (conf->ieee80211be)

View file

@ -978,12 +978,13 @@ int hostapd_drv_do_acs(struct hostapd_data *hapd)
hapd->iface->conf->ieee80211ax ||
hapd->iface->conf->ieee80211ac) &&
params.ht40_enabled) {
u8 oper_chwidth = hostapd_get_oper_chwidth(hapd->iface->conf);
enum oper_chan_width oper_chwidth;
if (oper_chwidth == CHANWIDTH_80MHZ)
oper_chwidth = hostapd_get_oper_chwidth(hapd->iface->conf);
if (oper_chwidth == CONF_OPER_CHWIDTH_80MHZ)
params.ch_width = 80;
else if (oper_chwidth == CHANWIDTH_160MHZ ||
oper_chwidth == CHANWIDTH_80P80MHZ)
else if (oper_chwidth == CONF_OPER_CHWIDTH_160MHZ ||
oper_chwidth == CONF_OPER_CHWIDTH_80P80MHZ)
params.ch_width = 160;
}

View file

@ -1280,22 +1280,24 @@ static u16 hostapd_fils_discovery_cap(struct hostapd_data *hapd)
}
} else {
switch (hostapd_get_oper_chwidth(hapd->iconf)) {
case CHANWIDTH_80P80MHZ:
case CONF_OPER_CHWIDTH_80P80MHZ:
mcs_nss_size += 4;
/* fallthrough */
case CHANWIDTH_160MHZ:
case CONF_OPER_CHWIDTH_160MHZ:
mcs_nss_size += 4;
chwidth = FD_CAP_BSS_CHWIDTH_160_80_80;
break;
case CHANWIDTH_80MHZ:
case CONF_OPER_CHWIDTH_80MHZ:
chwidth = FD_CAP_BSS_CHWIDTH_80;
break;
case CHANWIDTH_USE_HT:
case CONF_OPER_CHWIDTH_USE_HT:
if (hapd->iconf->secondary_channel)
chwidth = FD_CAP_BSS_CHWIDTH_40;
else
chwidth = FD_CAP_BSS_CHWIDTH_20;
break;
default:
break;
}
#ifdef CONFIG_IEEE80211AX

View file

@ -50,15 +50,15 @@ static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1)
if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) {
switch (hostapd_get_oper_chwidth(iface->conf)) {
case CHANWIDTH_USE_HT:
case CONF_OPER_CHWIDTH_USE_HT:
break;
case CHANWIDTH_80MHZ:
case CONF_OPER_CHWIDTH_80MHZ:
n_chans = 4;
break;
case CHANWIDTH_160MHZ:
case CONF_OPER_CHWIDTH_160MHZ:
n_chans = 8;
break;
case CHANWIDTH_80P80MHZ:
case CONF_OPER_CHWIDTH_80P80MHZ:
n_chans = 4;
*seg1 = 4;
break;
@ -311,7 +311,7 @@ static void dfs_adjust_center_freq(struct hostapd_iface *iface,
*oper_centr_freq_seg1_idx = 0;
switch (hostapd_get_oper_chwidth(iface->conf)) {
case CHANWIDTH_USE_HT:
case CONF_OPER_CHWIDTH_USE_HT:
if (secondary_channel == 1)
*oper_centr_freq_seg0_idx = chan->chan + 2;
else if (secondary_channel == -1)
@ -319,13 +319,13 @@ static void dfs_adjust_center_freq(struct hostapd_iface *iface,
else
*oper_centr_freq_seg0_idx = chan->chan;
break;
case CHANWIDTH_80MHZ:
case CONF_OPER_CHWIDTH_80MHZ:
*oper_centr_freq_seg0_idx = chan->chan + 6;
break;
case CHANWIDTH_160MHZ:
case CONF_OPER_CHWIDTH_160MHZ:
*oper_centr_freq_seg0_idx = chan->chan + 14;
break;
case CHANWIDTH_80P80MHZ:
case CONF_OPER_CHWIDTH_80P80MHZ:
*oper_centr_freq_seg0_idx = chan->chan + 6;
*oper_centr_freq_seg1_idx = sec_chan_idx_80p80 + 6;
break;
@ -361,17 +361,17 @@ static int dfs_get_start_chan_idx(struct hostapd_iface *iface, int *seg1_start)
/* VHT/HE */
if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) {
switch (hostapd_get_oper_chwidth(iface->conf)) {
case CHANWIDTH_USE_HT:
case CONF_OPER_CHWIDTH_USE_HT:
break;
case CHANWIDTH_80MHZ:
case CONF_OPER_CHWIDTH_80MHZ:
channel_no = hostapd_get_oper_centr_freq_seg0_idx(
iface->conf) - 6;
break;
case CHANWIDTH_160MHZ:
case CONF_OPER_CHWIDTH_160MHZ:
channel_no = hostapd_get_oper_centr_freq_seg0_idx(
iface->conf) - 14;
break;
case CHANWIDTH_80P80MHZ:
case CONF_OPER_CHWIDTH_80P80MHZ:
channel_no = hostapd_get_oper_centr_freq_seg0_idx(
iface->conf) - 6;
chan_seg1 = hostapd_get_oper_centr_freq_seg1_idx(
@ -555,7 +555,8 @@ dfs_get_valid_channel(struct hostapd_iface *iface,
*secondary_channel = 0;
/* Get secondary channel for HT80P80 */
if (hostapd_get_oper_chwidth(iface->conf) == CHANWIDTH_80P80MHZ) {
if (hostapd_get_oper_chwidth(iface->conf) ==
CONF_OPER_CHWIDTH_80P80MHZ) {
if (num_available_chandefs <= 1) {
wpa_printf(MSG_ERROR,
"only 1 valid chan, can't support 80+80");
@ -1220,7 +1221,7 @@ dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel,
int oper_chwidth;
oper_chwidth = hostapd_get_oper_chwidth(iface->conf);
if (oper_chwidth == CHANWIDTH_USE_HT)
if (oper_chwidth == CONF_OPER_CHWIDTH_USE_HT)
break;
*channel_type = DFS_AVAILABLE;
hostapd_set_oper_chwidth(iface->conf, oper_chwidth - 1);

View file

@ -891,19 +891,19 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
switch (width) {
case CHAN_WIDTH_80:
chwidth = CHANWIDTH_80MHZ;
chwidth = CONF_OPER_CHWIDTH_80MHZ;
break;
case CHAN_WIDTH_80P80:
chwidth = CHANWIDTH_80P80MHZ;
chwidth = CONF_OPER_CHWIDTH_80P80MHZ;
break;
case CHAN_WIDTH_160:
chwidth = CHANWIDTH_160MHZ;
chwidth = CONF_OPER_CHWIDTH_160MHZ;
break;
case CHAN_WIDTH_20_NOHT:
case CHAN_WIDTH_20:
case CHAN_WIDTH_40:
default:
chwidth = CHANWIDTH_USE_HT;
chwidth = CONF_OPER_CHWIDTH_USE_HT;
break;
}
@ -979,10 +979,10 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
hostapd_set_oper_centr_freq_seg1_idx(hapd->iconf, seg1_idx);
if (hapd->iconf->ieee80211ac) {
hapd->iconf->vht_capab &= ~VHT_CAP_SUPP_CHAN_WIDTH_MASK;
if (chwidth == CHANWIDTH_160MHZ)
if (chwidth == CONF_OPER_CHWIDTH_160MHZ)
hapd->iconf->vht_capab |=
VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
else if (chwidth == CHANWIDTH_80P80MHZ)
else if (chwidth == CONF_OPER_CHWIDTH_80P80MHZ)
hapd->iconf->vht_capab |=
VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
}
@ -1145,7 +1145,7 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd,
/* set defaults for backwards compatibility */
hostapd_set_oper_centr_freq_seg1_idx(hapd->iconf, 0);
hostapd_set_oper_centr_freq_seg0_idx(hapd->iconf, 0);
hostapd_set_oper_chwidth(hapd->iconf, CHANWIDTH_USE_HT);
hostapd_set_oper_chwidth(hapd->iconf, CONF_OPER_CHWIDTH_USE_HT);
if (acs_res->ch_width == 40) {
if (is_6ghz_freq(acs_res->pri_freq))
hostapd_set_oper_centr_freq_seg0_idx(
@ -1155,17 +1155,19 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd,
hostapd_set_oper_centr_freq_seg0_idx(
hapd->iconf, acs_res->vht_seg0_center_ch);
if (acs_res->vht_seg1_center_ch == 0) {
hostapd_set_oper_chwidth(hapd->iconf,
CHANWIDTH_80MHZ);
hostapd_set_oper_chwidth(
hapd->iconf, CONF_OPER_CHWIDTH_80MHZ);
} else {
hostapd_set_oper_chwidth(hapd->iconf,
CHANWIDTH_80P80MHZ);
hostapd_set_oper_chwidth(
hapd->iconf,
CONF_OPER_CHWIDTH_80P80MHZ);
hostapd_set_oper_centr_freq_seg1_idx(
hapd->iconf,
acs_res->vht_seg1_center_ch);
}
} else if (acs_res->ch_width == 160) {
hostapd_set_oper_chwidth(hapd->iconf, CHANWIDTH_160MHZ);
hostapd_set_oper_chwidth(hapd->iconf,
CONF_OPER_CHWIDTH_160MHZ);
hostapd_set_oper_centr_freq_seg0_idx(
hapd->iconf, acs_res->vht_seg1_center_ch);
}

View file

@ -1718,7 +1718,7 @@ static int setup_interface2(struct hostapd_iface *iface)
goto fail;
if (iface->conf->op_class) {
int ch_width;
enum oper_chan_width ch_width;
ch_width = op_class_to_ch_width(iface->conf->op_class);
hostapd_set_oper_chwidth(iface->conf, ch_width);
@ -3503,16 +3503,18 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
case 0:
case 20:
case 40:
hostapd_set_oper_chwidth(conf, CHANWIDTH_USE_HT);
hostapd_set_oper_chwidth(conf, CONF_OPER_CHWIDTH_USE_HT);
break;
case 80:
if (params->center_freq2)
hostapd_set_oper_chwidth(conf, CHANWIDTH_80P80MHZ);
hostapd_set_oper_chwidth(conf,
CONF_OPER_CHWIDTH_80P80MHZ);
else
hostapd_set_oper_chwidth(conf, CHANWIDTH_80MHZ);
hostapd_set_oper_chwidth(conf,
CONF_OPER_CHWIDTH_80MHZ);
break;
case 160:
hostapd_set_oper_chwidth(conf, CHANWIDTH_160MHZ);
hostapd_set_oper_chwidth(conf, CONF_OPER_CHWIDTH_160MHZ);
break;
default:
return -1;
@ -3550,15 +3552,15 @@ static int hostapd_fill_csa_settings(struct hostapd_data *hapd,
switch (settings->freq_params.bandwidth) {
case 80:
if (settings->freq_params.center_freq2)
bandwidth = CHANWIDTH_80P80MHZ;
bandwidth = CONF_OPER_CHWIDTH_80P80MHZ;
else
bandwidth = CHANWIDTH_80MHZ;
bandwidth = CONF_OPER_CHWIDTH_80MHZ;
break;
case 160:
bandwidth = CHANWIDTH_160MHZ;
bandwidth = CONF_OPER_CHWIDTH_160MHZ;
break;
default:
bandwidth = CHANWIDTH_USE_HT;
bandwidth = CONF_OPER_CHWIDTH_USE_HT;
break;
}
@ -3688,7 +3690,8 @@ void
hostapd_switch_channel_fallback(struct hostapd_iface *iface,
const struct hostapd_freq_params *freq_params)
{
int seg0_idx = 0, seg1_idx = 0, bw = CHANWIDTH_USE_HT;
int seg0_idx = 0, seg1_idx = 0;
enum oper_chan_width bw = CONF_OPER_CHWIDTH_USE_HT;
wpa_printf(MSG_DEBUG, "Restarting all CSA-related BSSes");
@ -3701,16 +3704,16 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface,
case 0:
case 20:
case 40:
bw = CHANWIDTH_USE_HT;
bw = CONF_OPER_CHWIDTH_USE_HT;
break;
case 80:
if (freq_params->center_freq2)
bw = CHANWIDTH_80P80MHZ;
bw = CONF_OPER_CHWIDTH_80P80MHZ;
else
bw = CHANWIDTH_80MHZ;
bw = CONF_OPER_CHWIDTH_80MHZ;
break;
case 160:
bw = CHANWIDTH_160MHZ;
bw = CONF_OPER_CHWIDTH_160MHZ;
break;
default:
wpa_printf(MSG_WARNING, "Unknown CSA bandwidth: %d",

View file

@ -371,7 +371,7 @@ static void ieee80211n_check_scan(struct hostapd_iface *iface)
iface->conf->secondary_channel = 0;
hostapd_set_oper_centr_freq_seg0_idx(iface->conf, 0);
hostapd_set_oper_centr_freq_seg1_idx(iface->conf, 0);
hostapd_set_oper_chwidth(iface->conf, CHANWIDTH_USE_HT);
hostapd_set_oper_chwidth(iface->conf, CONF_OPER_CHWIDTH_USE_HT);
res = 1;
wpa_printf(MSG_INFO, "Fallback to 20 MHz");
}

View file

@ -7033,7 +7033,7 @@ u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid)
#endif /* CONFIG_IEEE80211AX */
switch (hostapd_get_oper_chwidth(iconf)) {
case CHANWIDTH_USE_HT:
case CONF_OPER_CHWIDTH_USE_HT:
if (iconf->secondary_channel == 0) {
/* Max Transmit Power count = 0 (20 MHz) */
tx_pwr_count = 0;
@ -7042,12 +7042,12 @@ u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid)
tx_pwr_count = 1;
}
break;
case CHANWIDTH_80MHZ:
case CONF_OPER_CHWIDTH_80MHZ:
/* Max Transmit Power count = 2 (20, 40, and 80 MHz) */
tx_pwr_count = 2;
break;
case CHANWIDTH_80P80MHZ:
case CHANWIDTH_160MHZ:
case CONF_OPER_CHWIDTH_80P80MHZ:
case CONF_OPER_CHWIDTH_160MHZ:
/* Max Transmit Power count = 3 (20, 40, 80, 160/80+80 MHz) */
tx_pwr_count = 3;
break;

View file

@ -176,7 +176,8 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
{
struct hostapd_config *conf = hapd->iconf;
struct ieee80211_eht_operation *oper;
u8 *pos = eid, chwidth, seg0 = 0, seg1 = 0;
u8 *pos = eid, seg0 = 0, seg1 = 0;
enum oper_chan_width chwidth;
if (!hapd->iface->current_mode)
return eid;
@ -207,7 +208,7 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
seg0 += 16;
break;
#endif
case CHANWIDTH_160MHZ:
case CONF_OPER_CHWIDTH_160MHZ:
oper->oper_info.control |= EHT_OPER_CHANNEL_WIDTH_160MHZ;
seg1 = seg0;
if (hapd->iconf->channel < seg0)
@ -215,10 +216,10 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
else
seg0 += 8;
break;
case CHANWIDTH_80MHZ:
case CONF_OPER_CHWIDTH_80MHZ:
oper->oper_info.control |= EHT_OPER_CHANNEL_WIDTH_80MHZ;
break;
case CHANWIDTH_USE_HT:
case CONF_OPER_CHWIDTH_USE_HT:
if (seg0)
oper->oper_info.control |= EHT_OPER_CHANNEL_WIDTH_40MHZ;
break;
@ -286,10 +287,12 @@ static bool check_valid_eht_mcs(struct hostapd_data *hapd,
switch (hapd->iface->conf->eht_oper_chwidth) {
/* TODO: CHANWIDTH_320MHZ */
case CHANWIDTH_80P80MHZ:
case CHANWIDTH_160MHZ:
case CONF_OPER_CHWIDTH_80P80MHZ:
case CONF_OPER_CHWIDTH_160MHZ:
mcs_count = 2;
break;
default:
break;
}
return check_valid_eht_mcs_nss(hapd, ap_mcs, sta_mcs, mcs_count,

View file

@ -102,20 +102,22 @@ u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid,
mode->he_capab[opmode].phy_cap);
switch (hapd->iface->conf->he_oper_chwidth) {
case CHANWIDTH_80P80MHZ:
case CONF_OPER_CHWIDTH_80P80MHZ:
he_oper_chwidth |=
HE_PHYCAP_CHANNEL_WIDTH_SET_80PLUS80MHZ_IN_5G;
mcs_nss_size += 4;
/* fall through */
case CHANWIDTH_160MHZ:
case CONF_OPER_CHWIDTH_160MHZ:
he_oper_chwidth |= HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G;
mcs_nss_size += 4;
/* fall through */
case CHANWIDTH_80MHZ:
case CHANWIDTH_USE_HT:
case CONF_OPER_CHWIDTH_80MHZ:
case CONF_OPER_CHWIDTH_USE_HT:
he_oper_chwidth |= HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_IN_2G |
HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G;
break;
default:
break;
}
ie_size += mcs_nss_size + ppet_size;
@ -430,10 +432,10 @@ static int check_valid_he_mcs(struct hostapd_data *hapd, const u8 *sta_he_capab,
* band/stream cases.
*/
switch (hapd->iface->conf->he_oper_chwidth) {
case CHANWIDTH_80P80MHZ:
case CONF_OPER_CHWIDTH_80P80MHZ:
mcs_count = 3;
break;
case CHANWIDTH_160MHZ:
case CONF_OPER_CHWIDTH_160MHZ:
mcs_count = 2;
break;
default:

View file

@ -998,7 +998,7 @@ int get_tx_parameters(struct sta_info *sta, int ap_max_chanwidth,
* If a VHT Operation element was present, use it to determine
* the supported channel bandwidth.
*/
if (oper->vht_op_info_chwidth == 0) {
if (oper->vht_op_info_chwidth == CHANWIDTH_USE_HT) {
requested_bw = ht_40mhz ? 40 : 20;
} else if (oper->vht_op_info_chan_center_freq_seg1_idx == 0) {
requested_bw = 80;

View file

@ -96,12 +96,12 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
hapd->iconf->vht_oper_centr_freq_seg1_idx;
oper->vht_op_info_chwidth = hapd->iconf->vht_oper_chwidth;
if (hapd->iconf->vht_oper_chwidth == 2) {
if (hapd->iconf->vht_oper_chwidth == CONF_OPER_CHWIDTH_160MHZ) {
/*
* Convert 160 MHz channel width to new style as interop
* workaround.
*/
oper->vht_op_info_chwidth = 1;
oper->vht_op_info_chwidth = CHANWIDTH_80MHZ;
oper->vht_op_info_chan_center_freq_seg1_idx =
oper->vht_op_info_chan_center_freq_seg0_idx;
if (hapd->iconf->channel <
@ -109,12 +109,13 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
oper->vht_op_info_chan_center_freq_seg0_idx -= 8;
else
oper->vht_op_info_chan_center_freq_seg0_idx += 8;
} else if (hapd->iconf->vht_oper_chwidth == 3) {
} else if (hapd->iconf->vht_oper_chwidth ==
CONF_OPER_CHWIDTH_80P80MHZ) {
/*
* Convert 80+80 MHz channel width to new style as interop
* workaround.
*/
oper->vht_op_info_chwidth = 1;
oper->vht_op_info_chwidth = CHANWIDTH_80MHZ;
}
/* VHT Basic MCS set comes from hw */

View file

@ -199,19 +199,21 @@ void hostapd_free_neighbor_db(struct hostapd_data *hapd)
static enum nr_chan_width hostapd_get_nr_chan_width(struct hostapd_data *hapd,
int ht, int vht, int he)
{
u8 oper_chwidth = hostapd_get_oper_chwidth(hapd->iconf);
enum oper_chan_width oper_chwidth;
oper_chwidth = hostapd_get_oper_chwidth(hapd->iconf);
if (!ht && !vht && !he)
return NR_CHAN_WIDTH_20;
if (!hapd->iconf->secondary_channel)
return NR_CHAN_WIDTH_20;
if ((!vht && !he) || oper_chwidth == CHANWIDTH_USE_HT)
if ((!vht && !he) || oper_chwidth == CONF_OPER_CHWIDTH_USE_HT)
return NR_CHAN_WIDTH_40;
if (oper_chwidth == CHANWIDTH_80MHZ)
if (oper_chwidth == CONF_OPER_CHWIDTH_80MHZ)
return NR_CHAN_WIDTH_80;
if (oper_chwidth == CHANWIDTH_160MHZ)
if (oper_chwidth == CONF_OPER_CHWIDTH_160MHZ)
return NR_CHAN_WIDTH_160;
if (oper_chwidth == CHANWIDTH_80P80MHZ)
if (oper_chwidth == CONF_OPER_CHWIDTH_80P80MHZ)
return NR_CHAN_WIDTH_80P80;
return NR_CHAN_WIDTH_20;
}