From ae517789faa8037180583f8eb890aa389386e71d Mon Sep 17 00:00:00 2001 From: Hu Wang Date: Tue, 11 Oct 2022 23:52:12 -0700 Subject: [PATCH] P2P: Allow PSC channel to be used for 6 GHz BW40 For the 6 GHz opclass 132, ch for loop only allows non-PSC channels { 1, 9, 17, 25, 33, 41, 49,... } to be used. This does not match the IEEE Std 802.11ax-2021 expectation of a 6 GHz-only AP "should set up the BSS with a primary 20 MHz channel that coincides with a preferred scanning channel". Increase ch by 4 to allow PSC channel to be used for 6 GHz BW40. Signed-off-by: Jouni Malinen --- src/common/ieee802_11_common.c | 11 +++++++---- wpa_supplicant/p2p_supplicant.c | 16 +++++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c index 40bbd08e9..924fe24f0 100644 --- a/src/common/ieee802_11_common.c +++ b/src/common/ieee802_11_common.c @@ -1965,11 +1965,14 @@ const struct oper_class_map global_op_class[] = { /* * IEEE Std 802.11ax-2021, Table E-4 actually talks about channel center - * frequency index 42, 58, 106, 122, 138, 155, 171 with channel spacing - * of 80 MHz, but currently use the following definition for simplicity + * frequency index for operation classes 128, 129, 130, 132, 133, 134, + * and 135, but currently use the lowest 20 MHz channel for simplicity * (these center frequencies are not actual channels, which makes - * wpas_p2p_verify_channel() fail). wpas_p2p_verify_80mhz() should take - * care of removing invalid channels. + * wpas_p2p_verify_channel() fail). + * Specially for the operation class 136, it is also defined to use the + * channel center frequency index value, but it happens to be a 20 MHz + * channel and the channel number in the channel set would match the + * value in for the frequency center. */ { HOSTAPD_MODE_IEEE80211A, 128, 36, 177, 4, BW80, P2P_SUPP }, { HOSTAPD_MODE_IEEE80211A, 129, 36, 177, 4, BW160, P2P_SUPP }, diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 46199ad70..307922b97 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3947,8 +3947,7 @@ int wpas_p2p_get_sec_channel_offset_40mhz(struct wpa_supplicant *wpa_s, for (op = 0; global_op_class[op].op_class; op++) { const struct oper_class_map *o = &global_op_class[op]; - u16 ch; - int chan = channel; + u16 ch = 0; /* Allow DFS channels marked as NO_P2P_SUPP to be used with * driver offloaded DFS. */ @@ -3959,15 +3958,22 @@ int wpas_p2p_get_sec_channel_offset_40mhz(struct wpa_supplicant *wpa_s, wpa_s->conf->p2p_6ghz_disable)) continue; + /* IEEE Std 802.11ax-2021 26.17.2.3.2: "A 6 GHz-only AP should + * set up the BSS with a primary 20 MHz channel that coincides + * with a preferred scanning channel (PSC)." + * 6 GHz BW40 operation class 132 in wpa_supplicant uses the + * lowest 20 MHz channel for simplicity, so increase ch by 4 to + * match the PSC. + */ if (is_6ghz_op_class(o->op_class) && o->bw == BW40 && get_6ghz_sec_channel(channel) < 0) - chan = channel - 4; + ch = 4; - for (ch = o->min_chan; ch <= o->max_chan; ch += o->inc) { + for (ch += o->min_chan; ch <= o->max_chan; ch += o->inc) { if (o->mode != HOSTAPD_MODE_IEEE80211A || (o->bw != BW40PLUS && o->bw != BW40MINUS && o->bw != BW40) || - ch != chan) + ch != channel) continue; ret = wpas_p2p_verify_channel(wpa_s, mode, o->op_class, ch, o->bw);