HE: Add helpers for getting the channel width parameters
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com> Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
parent
39b9d059cd
commit
c6b7ac077f
9 changed files with 181 additions and 104 deletions
12
src/ap/acs.c
12
src/ap/acs.c
|
@ -595,7 +595,7 @@ acs_find_ideal_chan(struct hostapd_iface *iface)
|
|||
n_chans = 2;
|
||||
|
||||
if (iface->conf->ieee80211ac) {
|
||||
switch (iface->conf->vht_oper_chwidth) {
|
||||
switch (hostapd_get_oper_chwidth(iface->conf)) {
|
||||
case CHANWIDTH_80MHZ:
|
||||
n_chans = 4;
|
||||
break;
|
||||
|
@ -648,7 +648,7 @@ acs_find_ideal_chan(struct hostapd_iface *iface)
|
|||
|
||||
if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A &&
|
||||
iface->conf->ieee80211ac) {
|
||||
if (iface->conf->vht_oper_chwidth ==
|
||||
if (hostapd_get_oper_chwidth(iface->conf) ==
|
||||
CHANWIDTH_80MHZ &&
|
||||
!acs_usable_vht80_chan(chan)) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
|
@ -657,7 +657,7 @@ acs_find_ideal_chan(struct hostapd_iface *iface)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (iface->conf->vht_oper_chwidth ==
|
||||
if (hostapd_get_oper_chwidth(iface->conf) ==
|
||||
CHANWIDTH_160MHZ &&
|
||||
!acs_usable_vht160_chan(chan)) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
|
@ -789,7 +789,7 @@ static void acs_adjust_center_freq(struct hostapd_iface *iface)
|
|||
|
||||
wpa_printf(MSG_DEBUG, "ACS: Adjusting VHT center frequency");
|
||||
|
||||
switch (iface->conf->vht_oper_chwidth) {
|
||||
switch (hostapd_get_oper_chwidth(iface->conf)) {
|
||||
case CHANWIDTH_USE_HT:
|
||||
offset = 2 * iface->conf->secondary_channel;
|
||||
break;
|
||||
|
@ -807,8 +807,8 @@ static void acs_adjust_center_freq(struct hostapd_iface *iface)
|
|||
return;
|
||||
}
|
||||
|
||||
iface->conf->vht_oper_centr_freq_seg0_idx =
|
||||
iface->conf->channel + offset;
|
||||
hostapd_set_oper_centr_freq_seg0_idx(iface->conf,
|
||||
iface->conf->channel + offset);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -911,6 +911,68 @@ struct hostapd_config {
|
|||
};
|
||||
|
||||
|
||||
static inline u8 hostapd_get_oper_chwidth(struct hostapd_config *conf)
|
||||
{
|
||||
#ifdef CONFIG_IEEE80211AX
|
||||
if (conf->ieee80211ax)
|
||||
return conf->he_oper_chwidth;
|
||||
#endif /* CONFIG_IEEE80211AX */
|
||||
return conf->vht_oper_chwidth;
|
||||
}
|
||||
|
||||
static inline void
|
||||
hostapd_set_oper_chwidth(struct hostapd_config *conf, u8 oper_chwidth)
|
||||
{
|
||||
#ifdef CONFIG_IEEE80211AX
|
||||
if (conf->ieee80211ax)
|
||||
conf->he_oper_chwidth = oper_chwidth;
|
||||
#endif /* CONFIG_IEEE80211AX */
|
||||
conf->vht_oper_chwidth = oper_chwidth;
|
||||
}
|
||||
|
||||
static inline u8
|
||||
hostapd_get_oper_centr_freq_seg0_idx(struct hostapd_config *conf)
|
||||
{
|
||||
#ifdef CONFIG_IEEE80211AX
|
||||
if (conf->ieee80211ax)
|
||||
return conf->he_oper_centr_freq_seg0_idx;
|
||||
#endif /* CONFIG_IEEE80211AX */
|
||||
return conf->vht_oper_centr_freq_seg0_idx;
|
||||
}
|
||||
|
||||
static inline void
|
||||
hostapd_set_oper_centr_freq_seg0_idx(struct hostapd_config *conf,
|
||||
u8 oper_centr_freq_seg0_idx)
|
||||
{
|
||||
#ifdef CONFIG_IEEE80211AX
|
||||
if (conf->ieee80211ax)
|
||||
conf->he_oper_centr_freq_seg0_idx = oper_centr_freq_seg0_idx;
|
||||
#endif /* CONFIG_IEEE80211AX */
|
||||
conf->vht_oper_centr_freq_seg0_idx = oper_centr_freq_seg0_idx;
|
||||
}
|
||||
|
||||
static inline u8
|
||||
hostapd_get_oper_centr_freq_seg1_idx(struct hostapd_config *conf)
|
||||
{
|
||||
#ifdef CONFIG_IEEE80211AX
|
||||
if (conf->ieee80211ax)
|
||||
return conf->he_oper_centr_freq_seg1_idx;
|
||||
#endif /* CONFIG_IEEE80211AX */
|
||||
return conf->vht_oper_centr_freq_seg1_idx;
|
||||
}
|
||||
|
||||
static inline void
|
||||
hostapd_set_oper_centr_freq_seg1_idx(struct hostapd_config *conf,
|
||||
u8 oper_centr_freq_seg1_idx)
|
||||
{
|
||||
#ifdef CONFIG_IEEE80211AX
|
||||
if (conf->ieee80211ax)
|
||||
conf->he_oper_centr_freq_seg1_idx = oper_centr_freq_seg1_idx;
|
||||
#endif /* CONFIG_IEEE80211AX */
|
||||
conf->vht_oper_centr_freq_seg1_idx = oper_centr_freq_seg1_idx;
|
||||
}
|
||||
|
||||
|
||||
int hostapd_mac_comp(const void *a, const void *b);
|
||||
struct hostapd_config * hostapd_config_defaults(void);
|
||||
void hostapd_config_defaults_bss(struct hostapd_bss_config *bss);
|
||||
|
|
|
@ -929,15 +929,15 @@ int hostapd_drv_do_acs(struct hostapd_data *hapd)
|
|||
if (hapd->iface->conf->ieee80211n && params.ht40_enabled)
|
||||
params.ch_width = 40;
|
||||
|
||||
/* Note: VHT20 is defined by combination of ht_capab & vht_oper_chwidth
|
||||
/* Note: VHT20 is defined by combination of ht_capab & oper_chwidth
|
||||
*/
|
||||
if (hapd->iface->conf->ieee80211ac && params.ht40_enabled) {
|
||||
if (hapd->iface->conf->vht_oper_chwidth == CHANWIDTH_80MHZ)
|
||||
u8 oper_chwidth = hostapd_get_oper_chwidth(hapd->iface->conf);
|
||||
|
||||
if (oper_chwidth == CHANWIDTH_80MHZ)
|
||||
params.ch_width = 80;
|
||||
else if (hapd->iface->conf->vht_oper_chwidth ==
|
||||
CHANWIDTH_160MHZ ||
|
||||
hapd->iface->conf->vht_oper_chwidth ==
|
||||
CHANWIDTH_80P80MHZ)
|
||||
else if (oper_chwidth == CHANWIDTH_160MHZ ||
|
||||
oper_chwidth == CHANWIDTH_80P80MHZ)
|
||||
params.ch_width = 160;
|
||||
}
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ static u8 * hostapd_eid_supported_op_classes(struct hostapd_data *hapd, u8 *eid)
|
|||
|
||||
if (ieee80211_freq_to_channel_ext(hapd->iface->freq,
|
||||
hapd->iconf->secondary_channel,
|
||||
hapd->iconf->vht_oper_chwidth,
|
||||
hostapd_get_oper_chwidth(hapd->iconf),
|
||||
&op_class, &channel) ==
|
||||
NUM_HOSTAPD_MODES)
|
||||
return eid;
|
||||
|
@ -1426,9 +1426,9 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
|
|||
iconf->channel, iconf->ieee80211n,
|
||||
iconf->ieee80211ac,
|
||||
iconf->secondary_channel,
|
||||
iconf->vht_oper_chwidth,
|
||||
iconf->vht_oper_centr_freq_seg0_idx,
|
||||
iconf->vht_oper_centr_freq_seg1_idx,
|
||||
hostapd_get_oper_chwidth(iconf),
|
||||
hostapd_get_oper_centr_freq_seg0_idx(iconf),
|
||||
hostapd_get_oper_centr_freq_seg1_idx(iconf),
|
||||
iface->current_mode->vht_capab) == 0)
|
||||
params.freq = &freq;
|
||||
|
||||
|
|
78
src/ap/dfs.c
78
src/ap/dfs.c
|
@ -29,7 +29,7 @@ static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1)
|
|||
n_chans = 2;
|
||||
|
||||
if (iface->conf->ieee80211ac) {
|
||||
switch (iface->conf->vht_oper_chwidth) {
|
||||
switch (hostapd_get_oper_chwidth(iface->conf)) {
|
||||
case CHANWIDTH_USE_HT:
|
||||
break;
|
||||
case CHANWIDTH_80MHZ:
|
||||
|
@ -188,8 +188,8 @@ static int is_in_chanlist(struct hostapd_iface *iface,
|
|||
* The function assumes HT40+ operation.
|
||||
* Make sure to adjust the following variables after calling this:
|
||||
* - hapd->secondary_channel
|
||||
* - hapd->vht_oper_centr_freq_seg0_idx
|
||||
* - hapd->vht_oper_centr_freq_seg1_idx
|
||||
* - hapd->vht/he_oper_centr_freq_seg0_idx
|
||||
* - hapd->vht/he_oper_centr_freq_seg1_idx
|
||||
*/
|
||||
static int dfs_find_channel(struct hostapd_iface *iface,
|
||||
struct hostapd_channel_data **ret_chan,
|
||||
|
@ -246,7 +246,7 @@ static void dfs_adjust_center_freq(struct hostapd_iface *iface,
|
|||
|
||||
*oper_centr_freq_seg1_idx = 0;
|
||||
|
||||
switch (iface->conf->vht_oper_chwidth) {
|
||||
switch (hostapd_get_oper_chwidth(iface->conf)) {
|
||||
case CHANWIDTH_USE_HT:
|
||||
if (secondary_channel == 1)
|
||||
*oper_centr_freq_seg0_idx = chan->chan + 2;
|
||||
|
@ -290,22 +290,22 @@ static int dfs_get_start_chan_idx(struct hostapd_iface *iface, int *seg1_start)
|
|||
|
||||
/* VHT */
|
||||
if (iface->conf->ieee80211ac) {
|
||||
switch (iface->conf->vht_oper_chwidth) {
|
||||
switch (hostapd_get_oper_chwidth(iface->conf)) {
|
||||
case CHANWIDTH_USE_HT:
|
||||
break;
|
||||
case CHANWIDTH_80MHZ:
|
||||
channel_no =
|
||||
iface->conf->vht_oper_centr_freq_seg0_idx - 6;
|
||||
channel_no = hostapd_get_oper_centr_freq_seg0_idx(
|
||||
iface->conf) - 6;
|
||||
break;
|
||||
case CHANWIDTH_160MHZ:
|
||||
channel_no =
|
||||
iface->conf->vht_oper_centr_freq_seg0_idx - 14;
|
||||
channel_no = hostapd_get_oper_centr_freq_seg0_idx(
|
||||
iface->conf) - 14;
|
||||
break;
|
||||
case CHANWIDTH_80P80MHZ:
|
||||
channel_no =
|
||||
iface->conf->vht_oper_centr_freq_seg0_idx - 6;
|
||||
chan_seg1 =
|
||||
iface->conf->vht_oper_centr_freq_seg1_idx - 6;
|
||||
channel_no = hostapd_get_oper_centr_freq_seg0_idx(
|
||||
iface->conf) - 6;
|
||||
chan_seg1 = hostapd_get_oper_centr_freq_seg1_idx(
|
||||
iface->conf) - 6;
|
||||
break;
|
||||
default:
|
||||
wpa_printf(MSG_INFO,
|
||||
|
@ -348,7 +348,7 @@ static int dfs_get_start_chan_idx(struct hostapd_iface *iface, int *seg1_start)
|
|||
mode->num_channels, channel_no, iface->conf->channel,
|
||||
iface->conf->ieee80211n,
|
||||
iface->conf->secondary_channel,
|
||||
iface->conf->vht_oper_chwidth);
|
||||
hostapd_get_oper_chwidth(iface->conf));
|
||||
|
||||
for (i = 0; i < mode->num_channels; i++) {
|
||||
wpa_printf(MSG_DEBUG, "Available channel: %d",
|
||||
|
@ -724,8 +724,8 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
|
|||
iface->freq = channel->freq;
|
||||
iface->conf->channel = channel->chan;
|
||||
iface->conf->secondary_channel = sec;
|
||||
iface->conf->vht_oper_centr_freq_seg0_idx = cf1;
|
||||
iface->conf->vht_oper_centr_freq_seg1_idx = cf2;
|
||||
hostapd_set_oper_centr_freq_seg0_idx(iface->conf, cf1);
|
||||
hostapd_set_oper_centr_freq_seg1_idx(iface->conf, cf2);
|
||||
}
|
||||
} while (res);
|
||||
|
||||
|
@ -736,20 +736,18 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
|
|||
"freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds",
|
||||
iface->freq,
|
||||
iface->conf->channel, iface->conf->secondary_channel,
|
||||
iface->conf->vht_oper_chwidth,
|
||||
iface->conf->vht_oper_centr_freq_seg0_idx,
|
||||
iface->conf->vht_oper_centr_freq_seg1_idx,
|
||||
hostapd_get_oper_chwidth(iface->conf),
|
||||
hostapd_get_oper_centr_freq_seg0_idx(iface->conf),
|
||||
hostapd_get_oper_centr_freq_seg1_idx(iface->conf),
|
||||
iface->dfs_cac_ms / 1000);
|
||||
|
||||
res = hostapd_start_dfs_cac(iface, iface->conf->hw_mode,
|
||||
iface->freq,
|
||||
iface->conf->channel,
|
||||
iface->conf->ieee80211n,
|
||||
iface->conf->ieee80211ac,
|
||||
iface->conf->secondary_channel,
|
||||
iface->conf->vht_oper_chwidth,
|
||||
iface->conf->vht_oper_centr_freq_seg0_idx,
|
||||
iface->conf->vht_oper_centr_freq_seg1_idx);
|
||||
res = hostapd_start_dfs_cac(
|
||||
iface, iface->conf->hw_mode, iface->freq, iface->conf->channel,
|
||||
iface->conf->ieee80211n, iface->conf->ieee80211ac,
|
||||
iface->conf->secondary_channel,
|
||||
hostapd_get_oper_chwidth(iface->conf),
|
||||
hostapd_get_oper_centr_freq_seg0_idx(iface->conf),
|
||||
hostapd_get_oper_centr_freq_seg1_idx(iface->conf));
|
||||
|
||||
if (res) {
|
||||
wpa_printf(MSG_ERROR, "DFS start_dfs_cac() failed, %d", res);
|
||||
|
@ -868,8 +866,10 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)
|
|||
iface->freq = channel->freq;
|
||||
iface->conf->channel = channel->chan;
|
||||
iface->conf->secondary_channel = secondary_channel;
|
||||
iface->conf->vht_oper_centr_freq_seg0_idx = oper_centr_freq_seg0_idx;
|
||||
iface->conf->vht_oper_centr_freq_seg1_idx = oper_centr_freq_seg1_idx;
|
||||
hostapd_set_oper_centr_freq_seg0_idx(iface->conf,
|
||||
oper_centr_freq_seg0_idx);
|
||||
hostapd_set_oper_centr_freq_seg1_idx(iface->conf,
|
||||
oper_centr_freq_seg1_idx);
|
||||
err = 0;
|
||||
|
||||
hostapd_setup_interface_complete(iface, err);
|
||||
|
@ -934,10 +934,10 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
|
|||
iface->freq = channel->freq;
|
||||
iface->conf->channel = channel->chan;
|
||||
iface->conf->secondary_channel = secondary_channel;
|
||||
iface->conf->vht_oper_centr_freq_seg0_idx =
|
||||
oper_centr_freq_seg0_idx;
|
||||
iface->conf->vht_oper_centr_freq_seg1_idx =
|
||||
oper_centr_freq_seg1_idx;
|
||||
hostapd_set_oper_centr_freq_seg0_idx(iface->conf,
|
||||
oper_centr_freq_seg0_idx);
|
||||
hostapd_set_oper_centr_freq_seg1_idx(iface->conf,
|
||||
oper_centr_freq_seg1_idx);
|
||||
|
||||
hostapd_disable_iface(iface);
|
||||
hostapd_enable_iface(iface);
|
||||
|
@ -961,7 +961,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
|
|||
iface->conf->ieee80211n,
|
||||
iface->conf->ieee80211ac,
|
||||
secondary_channel,
|
||||
iface->conf->vht_oper_chwidth,
|
||||
hostapd_get_oper_chwidth(iface->conf),
|
||||
oper_centr_freq_seg0_idx,
|
||||
oper_centr_freq_seg1_idx,
|
||||
iface->current_mode->vht_capab);
|
||||
|
@ -984,10 +984,10 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
|
|||
iface->freq = channel->freq;
|
||||
iface->conf->channel = channel->chan;
|
||||
iface->conf->secondary_channel = secondary_channel;
|
||||
iface->conf->vht_oper_centr_freq_seg0_idx =
|
||||
oper_centr_freq_seg0_idx;
|
||||
iface->conf->vht_oper_centr_freq_seg1_idx =
|
||||
oper_centr_freq_seg1_idx;
|
||||
hostapd_set_oper_centr_freq_seg0_idx(iface->conf,
|
||||
oper_centr_freq_seg0_idx);
|
||||
hostapd_set_oper_centr_freq_seg1_idx(iface->conf,
|
||||
oper_centr_freq_seg1_idx);
|
||||
|
||||
hostapd_disable_iface(iface);
|
||||
hostapd_enable_iface(iface);
|
||||
|
|
|
@ -853,9 +853,9 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
|
|||
hapd->iconf->ch_switch_vht_config = 0;
|
||||
|
||||
hapd->iconf->secondary_channel = offset;
|
||||
hapd->iconf->vht_oper_chwidth = chwidth;
|
||||
hapd->iconf->vht_oper_centr_freq_seg0_idx = seg0_idx;
|
||||
hapd->iconf->vht_oper_centr_freq_seg1_idx = seg1_idx;
|
||||
hostapd_set_oper_chwidth(hapd->iconf, chwidth);
|
||||
hostapd_set_oper_centr_freq_seg0_idx(hapd->iconf, seg0_idx);
|
||||
hostapd_set_oper_centr_freq_seg1_idx(hapd->iconf, seg1_idx);
|
||||
|
||||
is_dfs = ieee80211_is_dfs(freq, hapd->iface->hw_features,
|
||||
hapd->iface->num_hw_features);
|
||||
|
@ -962,26 +962,29 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd,
|
|||
|
||||
if (hapd->iface->conf->ieee80211ac) {
|
||||
/* set defaults for backwards compatibility */
|
||||
hapd->iconf->vht_oper_centr_freq_seg1_idx = 0;
|
||||
hapd->iconf->vht_oper_centr_freq_seg0_idx = 0;
|
||||
hapd->iconf->vht_oper_chwidth = CHANWIDTH_USE_HT;
|
||||
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);
|
||||
if (acs_res->ch_width == 80) {
|
||||
hapd->iconf->vht_oper_centr_freq_seg0_idx =
|
||||
acs_res->vht_seg0_center_ch;
|
||||
hapd->iconf->vht_oper_chwidth = CHANWIDTH_80MHZ;
|
||||
hostapd_set_oper_centr_freq_seg0_idx(
|
||||
hapd->iconf, acs_res->vht_seg0_center_ch);
|
||||
hostapd_set_oper_chwidth(hapd->iconf, CHANWIDTH_80MHZ);
|
||||
} else if (acs_res->ch_width == 160) {
|
||||
if (acs_res->vht_seg1_center_ch == 0) {
|
||||
hapd->iconf->vht_oper_centr_freq_seg0_idx =
|
||||
acs_res->vht_seg0_center_ch;
|
||||
hapd->iconf->vht_oper_chwidth =
|
||||
CHANWIDTH_160MHZ;
|
||||
hostapd_set_oper_centr_freq_seg0_idx(
|
||||
hapd->iconf,
|
||||
acs_res->vht_seg0_center_ch);
|
||||
hostapd_set_oper_chwidth(hapd->iconf,
|
||||
CHANWIDTH_160MHZ);
|
||||
} else {
|
||||
hapd->iconf->vht_oper_centr_freq_seg0_idx =
|
||||
acs_res->vht_seg0_center_ch;
|
||||
hapd->iconf->vht_oper_centr_freq_seg1_idx =
|
||||
acs_res->vht_seg1_center_ch;
|
||||
hapd->iconf->vht_oper_chwidth =
|
||||
CHANWIDTH_80P80MHZ;
|
||||
hostapd_set_oper_centr_freq_seg0_idx(
|
||||
hapd->iconf,
|
||||
acs_res->vht_seg0_center_ch);
|
||||
hostapd_set_oper_centr_freq_seg1_idx(
|
||||
hapd->iconf,
|
||||
acs_res->vht_seg1_center_ch);
|
||||
hostapd_set_oper_chwidth(hapd->iconf,
|
||||
CHANWIDTH_80P80MHZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -261,11 +261,14 @@ int hostapd_reload_config(struct hostapd_iface *iface)
|
|||
hapd->iconf->ieee80211ac = oldconf->ieee80211ac;
|
||||
hapd->iconf->ht_capab = oldconf->ht_capab;
|
||||
hapd->iconf->vht_capab = oldconf->vht_capab;
|
||||
hapd->iconf->vht_oper_chwidth = oldconf->vht_oper_chwidth;
|
||||
hapd->iconf->vht_oper_centr_freq_seg0_idx =
|
||||
oldconf->vht_oper_centr_freq_seg0_idx;
|
||||
hapd->iconf->vht_oper_centr_freq_seg1_idx =
|
||||
oldconf->vht_oper_centr_freq_seg1_idx;
|
||||
hostapd_set_oper_chwidth(hapd->iconf,
|
||||
hostapd_get_oper_chwidth(oldconf));
|
||||
hostapd_set_oper_centr_freq_seg0_idx(
|
||||
hapd->iconf,
|
||||
hostapd_get_oper_centr_freq_seg0_idx(oldconf));
|
||||
hostapd_set_oper_centr_freq_seg1_idx(
|
||||
hapd->iconf,
|
||||
hostapd_get_oper_centr_freq_seg1_idx(oldconf));
|
||||
hapd->conf = newconf->bss[j];
|
||||
hostapd_reload_bss(hapd);
|
||||
}
|
||||
|
@ -1866,9 +1869,11 @@ static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface,
|
|||
hapd->iconf->ieee80211n,
|
||||
hapd->iconf->ieee80211ac,
|
||||
hapd->iconf->secondary_channel,
|
||||
hapd->iconf->vht_oper_chwidth,
|
||||
hapd->iconf->vht_oper_centr_freq_seg0_idx,
|
||||
hapd->iconf->vht_oper_centr_freq_seg1_idx)) {
|
||||
hostapd_get_oper_chwidth(hapd->iconf),
|
||||
hostapd_get_oper_centr_freq_seg0_idx(
|
||||
hapd->iconf),
|
||||
hostapd_get_oper_centr_freq_seg1_idx(
|
||||
hapd->iconf))) {
|
||||
wpa_printf(MSG_ERROR, "Could not set channel for "
|
||||
"kernel driver");
|
||||
goto fail;
|
||||
|
@ -3200,6 +3205,7 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
|
|||
struct hostapd_freq_params *old_params)
|
||||
{
|
||||
int channel;
|
||||
u8 seg0, seg1;
|
||||
|
||||
if (!params->channel) {
|
||||
/* check if the new channel is supported by hw */
|
||||
|
@ -3217,9 +3223,9 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
|
|||
conf->channel, conf->ieee80211n,
|
||||
conf->ieee80211ac,
|
||||
conf->secondary_channel,
|
||||
conf->vht_oper_chwidth,
|
||||
conf->vht_oper_centr_freq_seg0_idx,
|
||||
conf->vht_oper_centr_freq_seg1_idx,
|
||||
hostapd_get_oper_chwidth(conf),
|
||||
hostapd_get_oper_centr_freq_seg0_idx(conf),
|
||||
hostapd_get_oper_centr_freq_seg1_idx(conf),
|
||||
conf->vht_capab))
|
||||
return -1;
|
||||
|
||||
|
@ -3227,16 +3233,16 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
|
|||
case 0:
|
||||
case 20:
|
||||
case 40:
|
||||
conf->vht_oper_chwidth = CHANWIDTH_USE_HT;
|
||||
hostapd_set_oper_chwidth(conf, CHANWIDTH_USE_HT);
|
||||
break;
|
||||
case 80:
|
||||
if (params->center_freq2)
|
||||
conf->vht_oper_chwidth = CHANWIDTH_80P80MHZ;
|
||||
hostapd_set_oper_chwidth(conf, CHANWIDTH_80P80MHZ);
|
||||
else
|
||||
conf->vht_oper_chwidth = CHANWIDTH_80MHZ;
|
||||
hostapd_set_oper_chwidth(conf, CHANWIDTH_80MHZ);
|
||||
break;
|
||||
case 160:
|
||||
conf->vht_oper_chwidth = CHANWIDTH_160MHZ;
|
||||
hostapd_set_oper_chwidth(conf, CHANWIDTH_160MHZ);
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
|
@ -3246,9 +3252,11 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
|
|||
conf->ieee80211n = params->ht_enabled;
|
||||
conf->secondary_channel = params->sec_channel_offset;
|
||||
ieee80211_freq_to_chan(params->center_freq1,
|
||||
&conf->vht_oper_centr_freq_seg0_idx);
|
||||
&seg0);
|
||||
ieee80211_freq_to_chan(params->center_freq2,
|
||||
&conf->vht_oper_centr_freq_seg1_idx);
|
||||
&seg1);
|
||||
hostapd_set_oper_centr_freq_seg0_idx(conf, seg0);
|
||||
hostapd_set_oper_centr_freq_seg1_idx(conf, seg1);
|
||||
|
||||
/* TODO: maybe call here hostapd_config_check here? */
|
||||
|
||||
|
@ -3426,9 +3434,9 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface,
|
|||
iface->freq = freq_params->freq;
|
||||
iface->conf->channel = freq_params->channel;
|
||||
iface->conf->secondary_channel = freq_params->sec_channel_offset;
|
||||
iface->conf->vht_oper_centr_freq_seg0_idx = seg0_idx;
|
||||
iface->conf->vht_oper_centr_freq_seg1_idx = seg1_idx;
|
||||
iface->conf->vht_oper_chwidth = bw;
|
||||
hostapd_set_oper_centr_freq_seg0_idx(iface->conf, seg0_idx);
|
||||
hostapd_set_oper_centr_freq_seg1_idx(iface->conf, seg1_idx);
|
||||
hostapd_set_oper_chwidth(iface->conf, bw);
|
||||
iface->conf->ieee80211n = freq_params->ht_enabled;
|
||||
iface->conf->ieee80211ac = freq_params->vht_enabled;
|
||||
|
||||
|
|
|
@ -329,9 +329,9 @@ static void ieee80211n_check_scan(struct hostapd_iface *iface)
|
|||
res = ieee80211n_allowed_ht40_channel_pair(iface);
|
||||
if (!res) {
|
||||
iface->conf->secondary_channel = 0;
|
||||
iface->conf->vht_oper_centr_freq_seg0_idx = 0;
|
||||
iface->conf->vht_oper_centr_freq_seg1_idx = 0;
|
||||
iface->conf->vht_oper_chwidth = CHANWIDTH_USE_HT;
|
||||
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);
|
||||
res = 1;
|
||||
wpa_printf(MSG_INFO, "Fallback to 20 MHz");
|
||||
}
|
||||
|
|
|
@ -141,17 +141,19 @@ 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)
|
||||
{
|
||||
u8 oper_chwidth = hostapd_get_oper_chwidth(hapd->iconf);
|
||||
|
||||
if (!ht && !vht)
|
||||
return NR_CHAN_WIDTH_20;
|
||||
if (!hapd->iconf->secondary_channel)
|
||||
return NR_CHAN_WIDTH_20;
|
||||
if (!vht || hapd->iconf->vht_oper_chwidth == CHANWIDTH_USE_HT)
|
||||
if (!vht || oper_chwidth == CHANWIDTH_USE_HT)
|
||||
return NR_CHAN_WIDTH_40;
|
||||
if (hapd->iconf->vht_oper_chwidth == CHANWIDTH_80MHZ)
|
||||
if (oper_chwidth == CHANWIDTH_80MHZ)
|
||||
return NR_CHAN_WIDTH_80;
|
||||
if (hapd->iconf->vht_oper_chwidth == CHANWIDTH_160MHZ)
|
||||
if (oper_chwidth == CHANWIDTH_160MHZ)
|
||||
return NR_CHAN_WIDTH_160;
|
||||
if (hapd->iconf->vht_oper_chwidth == CHANWIDTH_80P80MHZ)
|
||||
if (oper_chwidth == CHANWIDTH_80P80MHZ)
|
||||
return NR_CHAN_WIDTH_80P80;
|
||||
return NR_CHAN_WIDTH_20;
|
||||
}
|
||||
|
@ -205,16 +207,18 @@ void hostapd_neighbor_set_own_report(struct hostapd_data *hapd)
|
|||
|
||||
if (ieee80211_freq_to_channel_ext(hapd->iface->freq,
|
||||
hapd->iconf->secondary_channel,
|
||||
hapd->iconf->vht_oper_chwidth,
|
||||
hostapd_get_oper_chwidth(hapd->iconf),
|
||||
&op_class, &channel) ==
|
||||
NUM_HOSTAPD_MODES)
|
||||
return;
|
||||
width = hostapd_get_nr_chan_width(hapd, ht, vht);
|
||||
if (vht) {
|
||||
center_freq1_idx = hapd->iconf->vht_oper_centr_freq_seg0_idx;
|
||||
center_freq1_idx = hostapd_get_oper_centr_freq_seg0_idx(
|
||||
hapd->iconf);
|
||||
if (width == NR_CHAN_WIDTH_80P80)
|
||||
center_freq2_idx =
|
||||
hapd->iconf->vht_oper_centr_freq_seg1_idx;
|
||||
hostapd_get_oper_centr_freq_seg1_idx(
|
||||
hapd->iconf);
|
||||
} else if (ht) {
|
||||
ieee80211_freq_to_chan(hapd->iface->freq +
|
||||
10 * hapd->iconf->secondary_channel,
|
||||
|
|
Loading…
Reference in a new issue