]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Allow PSC channel to be used for 6 GHz BW40
authorHu Wang <quic_huw@quicinc.com>
Wed, 12 Oct 2022 06:52:12 +0000 (23:52 -0700)
committerJouni Malinen <j@w1.fi>
Sat, 5 Nov 2022 10:09:34 +0000 (12:09 +0200)
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 <quic_jouni@quicinc.com>
src/common/ieee802_11_common.c
wpa_supplicant/p2p_supplicant.c

index 40bbd08e95a935e5c5ae4e3ba4eb69b581157756..924fe24f01c1837459ed99e353e7961ca40615f8 100644 (file)
@@ -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 },
index 46199ad703e290102b188c6ea11f48bad675d2d2..307922b97c7b25264e5ccd921579fd2b5a37fd11 100644 (file)
@@ -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);