nl80211: Replace the channel flags for VHT support

The flags that indicate that a channel is allowed for 80/160 MHz use
are divided according to the position of the control channel (e.g.,
HOSTAPD_CHAN_VHT_10_70, HOSTAPD_CHAN_VHT_30_50, etc.).

However, the position of the control channel does not add any extra
regulatory information because when trying to use a 80/160 MHz channel
all the desired bandwidth has to be allowed for 80/160 MHz use,
regardless of the control channel position.

In addition, these flags are set only if the driver reports one
regulatory rule that allows the entire 80/160 MHz bandwidth.
However, even when a 80/160 MHz channel is allowed, in some cases the
bandwidth will be split into several regulatory rules because
different segments of the bandwidth differ in other flags (that don't
affect the use of the bandwidth for VHT channels). So, in such cases
these flags will not be set, although VHT channels are allowed.

As the result, VHT channels will not be used although they are allowed
by the regulatory domain.

Fix this by introducing new flags that indicate if a 2 0MHz channel is
allowed to be used as a part of a wider (80/160 MHz) channel.
The new flags are set for each 20 MHz channel independently and thus
will be set even if the regulatory rules for the bandwidth are split.

A 80/160 MHz channel is allowed if all its 20 MHz sub-channels are
allowed for 80/160 MHz usage.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
This commit is contained in:
Avraham Stern 2023-01-02 11:17:26 +02:00 committed by Jouni Malinen
parent f0979c4ac9
commit 6b9c86466c
4 changed files with 14 additions and 81 deletions

View file

@ -41,23 +41,12 @@
#define HOSTAPD_CHAN_DFS_AVAILABLE 0x00000300 #define HOSTAPD_CHAN_DFS_AVAILABLE 0x00000300
#define HOSTAPD_CHAN_DFS_MASK 0x00000300 #define HOSTAPD_CHAN_DFS_MASK 0x00000300
#define HOSTAPD_CHAN_VHT_10_70 0x00000800 #define HOSTAPD_CHAN_VHT_80MHZ_SUBCHANNEL 0x00000800
#define HOSTAPD_CHAN_VHT_30_50 0x00001000 #define HOSTAPD_CHAN_VHT_160MHZ_SUBCHANNEL 0x00001000
#define HOSTAPD_CHAN_VHT_50_30 0x00002000
#define HOSTAPD_CHAN_VHT_70_10 0x00004000
#define HOSTAPD_CHAN_INDOOR_ONLY 0x00010000 #define HOSTAPD_CHAN_INDOOR_ONLY 0x00010000
#define HOSTAPD_CHAN_GO_CONCURRENT 0x00020000 #define HOSTAPD_CHAN_GO_CONCURRENT 0x00020000
#define HOSTAPD_CHAN_VHT_10_150 0x00100000
#define HOSTAPD_CHAN_VHT_30_130 0x00200000
#define HOSTAPD_CHAN_VHT_50_110 0x00400000
#define HOSTAPD_CHAN_VHT_70_90 0x00800000
#define HOSTAPD_CHAN_VHT_90_70 0x01000000
#define HOSTAPD_CHAN_VHT_110_50 0x02000000
#define HOSTAPD_CHAN_VHT_130_30 0x04000000
#define HOSTAPD_CHAN_VHT_150_10 0x08000000
/* Allowed bandwidth mask */ /* Allowed bandwidth mask */
enum hostapd_chan_width_attr { enum hostapd_chan_width_attr {
HOSTAPD_CHAN_WIDTH_10 = BIT(0), HOSTAPD_CHAN_WIDTH_10 = BIT(0),

View file

@ -2318,43 +2318,15 @@ static void nl80211_set_vht_mode(struct hostapd_hw_modes *mode, int start,
for (c = 0; c < mode->num_channels; c++) { for (c = 0; c < mode->num_channels; c++) {
struct hostapd_channel_data *chan = &mode->channels[c]; struct hostapd_channel_data *chan = &mode->channels[c];
if (chan->freq - 10 >= start && chan->freq + 70 <= end)
chan->flag |= HOSTAPD_CHAN_VHT_10_70;
if (chan->freq - 30 >= start && chan->freq + 50 <= end) if (chan->freq - 10 < start || chan->freq + 10 > end)
chan->flag |= HOSTAPD_CHAN_VHT_30_50; continue;
if (chan->freq - 50 >= start && chan->freq + 30 <= end) if (max_bw >= 80)
chan->flag |= HOSTAPD_CHAN_VHT_50_30; chan->flag |= HOSTAPD_CHAN_VHT_80MHZ_SUBCHANNEL;
if (chan->freq - 70 >= start && chan->freq + 10 <= end) if (max_bw >= 160)
chan->flag |= HOSTAPD_CHAN_VHT_70_10; chan->flag |= HOSTAPD_CHAN_VHT_160MHZ_SUBCHANNEL;
if (max_bw >= 160) {
if (chan->freq - 10 >= start && chan->freq + 150 <= end)
chan->flag |= HOSTAPD_CHAN_VHT_10_150;
if (chan->freq - 30 >= start && chan->freq + 130 <= end)
chan->flag |= HOSTAPD_CHAN_VHT_30_130;
if (chan->freq - 50 >= start && chan->freq + 110 <= end)
chan->flag |= HOSTAPD_CHAN_VHT_50_110;
if (chan->freq - 70 >= start && chan->freq + 90 <= end)
chan->flag |= HOSTAPD_CHAN_VHT_70_90;
if (chan->freq - 90 >= start && chan->freq + 70 <= end)
chan->flag |= HOSTAPD_CHAN_VHT_90_70;
if (chan->freq - 110 >= start && chan->freq + 50 <= end)
chan->flag |= HOSTAPD_CHAN_VHT_110_50;
if (chan->freq - 130 >= start && chan->freq + 30 <= end)
chan->flag |= HOSTAPD_CHAN_VHT_130_30;
if (chan->freq - 150 >= start && chan->freq + 10 <= end)
chan->flag |= HOSTAPD_CHAN_VHT_150_10;
}
} }
} }

View file

@ -103,10 +103,7 @@ static enum chan_allowed verify_80mhz(struct hostapd_hw_modes *mode,
NOT_ALLOWED) NOT_ALLOWED)
return NOT_ALLOWED; return NOT_ALLOWED;
if ((i == 0 && !(flags & HOSTAPD_CHAN_VHT_10_70)) || if (!(flags & HOSTAPD_CHAN_VHT_80MHZ_SUBCHANNEL))
(i == 1 && !(flags & HOSTAPD_CHAN_VHT_30_50)) ||
(i == 2 && !(flags & HOSTAPD_CHAN_VHT_50_30)) ||
(i == 3 && !(flags & HOSTAPD_CHAN_VHT_70_10)))
return NOT_ALLOWED; return NOT_ALLOWED;
if (flags & HOSTAPD_CHAN_NO_IR) if (flags & HOSTAPD_CHAN_NO_IR)
@ -175,14 +172,8 @@ static enum chan_allowed verify_160mhz(struct hostapd_hw_modes *mode,
NOT_ALLOWED) NOT_ALLOWED)
return NOT_ALLOWED; return NOT_ALLOWED;
if ((i == 0 && !(flags & HOSTAPD_CHAN_VHT_10_150)) || if (!(flags & HOSTAPD_CHAN_VHT_80MHZ_SUBCHANNEL) ||
(i == 1 && !(flags & HOSTAPD_CHAN_VHT_30_130)) || !(flags & HOSTAPD_CHAN_VHT_160MHZ_SUBCHANNEL))
(i == 2 && !(flags & HOSTAPD_CHAN_VHT_50_110)) ||
(i == 3 && !(flags & HOSTAPD_CHAN_VHT_70_90)) ||
(i == 4 && !(flags & HOSTAPD_CHAN_VHT_90_70)) ||
(i == 5 && !(flags & HOSTAPD_CHAN_VHT_110_50)) ||
(i == 6 && !(flags & HOSTAPD_CHAN_VHT_130_30)) ||
(i == 7 && !(flags & HOSTAPD_CHAN_VHT_150_10)))
return NOT_ALLOWED; return NOT_ALLOWED;
if (flags & HOSTAPD_CHAN_NO_IR) if (flags & HOSTAPD_CHAN_NO_IR)

View file

@ -3784,13 +3784,7 @@ static enum chan_allowed wpas_p2p_verify_80mhz(struct wpa_supplicant *wpa_s,
if (res == NO_IR) if (res == NO_IR)
ret = NO_IR; ret = NO_IR;
if (!is_6ghz) { if (!is_6ghz) {
if (i == 0 && !(flags & HOSTAPD_CHAN_VHT_10_70)) if (!(flags & HOSTAPD_CHAN_VHT_80MHZ_SUBCHANNEL))
return NOT_ALLOWED;
if (i == 1 && !(flags & HOSTAPD_CHAN_VHT_30_50))
return NOT_ALLOWED;
if (i == 2 && !(flags & HOSTAPD_CHAN_VHT_50_30))
return NOT_ALLOWED;
if (i == 3 && !(flags & HOSTAPD_CHAN_VHT_70_10))
return NOT_ALLOWED; return NOT_ALLOWED;
} else if (is_6ghz && } else if (is_6ghz &&
(!(wpas_get_6ghz_he_chwidth_capab(mode) & (!(wpas_get_6ghz_he_chwidth_capab(mode) &
@ -3868,21 +3862,8 @@ static enum chan_allowed wpas_p2p_verify_160mhz(struct wpa_supplicant *wpa_s,
ret = NO_IR; ret = NO_IR;
if (!is_6ghz_op_class(op_class)) { if (!is_6ghz_op_class(op_class)) {
if (i == 0 && !(flags & HOSTAPD_CHAN_VHT_10_150)) if (!(flags & HOSTAPD_CHAN_VHT_80MHZ_SUBCHANNEL) ||
return NOT_ALLOWED; !(flags & HOSTAPD_CHAN_VHT_160MHZ_SUBCHANNEL))
if (i == 1 && !(flags & HOSTAPD_CHAN_VHT_30_130))
return NOT_ALLOWED;
if (i == 2 && !(flags & HOSTAPD_CHAN_VHT_50_110))
return NOT_ALLOWED;
if (i == 3 && !(flags & HOSTAPD_CHAN_VHT_70_90))
return NOT_ALLOWED;
if (i == 4 && !(flags & HOSTAPD_CHAN_VHT_90_70))
return NOT_ALLOWED;
if (i == 5 && !(flags & HOSTAPD_CHAN_VHT_110_50))
return NOT_ALLOWED;
if (i == 6 && !(flags & HOSTAPD_CHAN_VHT_130_30))
return NOT_ALLOWED;
if (i == 7 && !(flags & HOSTAPD_CHAN_VHT_150_10))
return NOT_ALLOWED; return NOT_ALLOWED;
} else if (is_6ghz_op_class(op_class) && } else if (is_6ghz_op_class(op_class) &&
(!(wpas_get_6ghz_he_chwidth_capab(mode) & (!(wpas_get_6ghz_he_chwidth_capab(mode) &