]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
mesh: Add support for 40 MHz bandwidth in 6 GHz
authorSuraj P Kizhakkethil <quic_surapk@quicinc.com>
Thu, 10 Apr 2025 11:11:25 +0000 (16:41 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 11 Apr 2025 09:56:26 +0000 (12:56 +0300)
Currently, 40 MHz bandwidth operation in 6 GHz is not supported in mesh.
Add support to bring up mesh in 40 MHz bandwidth in 6 GHz.

Signed-off-by: Suraj P Kizhakkethil <quic_surapk@quicinc.com>
wpa_supplicant/wpa_supplicant.c

index 465554cd906572e0f302cc88ad1af603ae7dfd98..82b9288f385604f620816e8259c1f374685fc0b9 100644 (file)
@@ -3090,18 +3090,25 @@ static void ibss_mesh_select_40mhz(struct wpa_supplicant *wpa_s,
                                   const struct wpa_ssid *ssid,
                                   struct hostapd_hw_modes *mode,
                                   struct hostapd_freq_params *freq,
-                                  int obss_scan) {
+                                  int obss_scan, bool is_6ghz)
+{
        int chan_idx;
        struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL;
        int i, res;
        unsigned int j;
-       static const int ht40plus[] = {
+       static const int ht40plus_5ghz[] = {
                36, 44, 52, 60, 100, 108, 116, 124, 132, 140,
                149, 157, 165, 173, 184, 192
        };
+       static const int ht40plus_6ghz[] = {
+               1, 9, 17, 25, 33, 41, 49, 57, 65, 73,
+               81, 89, 97, 105, 113, 121, 129, 137, 145, 153,
+               161, 169, 177, 185, 193, 201, 209, 217, 225
+       };
+
        int ht40 = -1;
 
-       if (!freq->ht_enabled)
+       if (!freq->ht_enabled && !is_6ghz)
                return;
 
        for (chan_idx = 0; chan_idx < mode->num_channels; chan_idx++) {
@@ -3123,10 +3130,19 @@ static void ibss_mesh_select_40mhz(struct wpa_supplicant *wpa_s,
 #endif
 
        /* Check/setup HT40+/HT40- */
-       for (j = 0; j < ARRAY_SIZE(ht40plus); j++) {
-               if (ht40plus[j] == freq->channel) {
-                       ht40 = 1;
-                       break;
+       if (is_6ghz) {
+               for (j = 0; j < ARRAY_SIZE(ht40plus_6ghz); j++) {
+                       if (ht40plus_6ghz[j] == freq->channel) {
+                               ht40 = 1;
+                               break;
+                       }
+               }
+       } else {
+               for (j = 0; j < ARRAY_SIZE(ht40plus_5ghz); j++) {
+                       if (ht40plus_5ghz[j] == freq->channel) {
+                               ht40 = 1;
+                               break;
+                       }
                }
        }
 
@@ -3144,12 +3160,14 @@ static void ibss_mesh_select_40mhz(struct wpa_supplicant *wpa_s,
        if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
                return;
 
-       if (ht40 == -1) {
-               if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS))
-                       return;
-       } else {
-               if (!(pri_chan->flag & HOSTAPD_CHAN_HT40PLUS))
-                       return;
+       if (freq->ht_enabled) {
+               if (ht40 == -1) {
+                       if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS))
+                               return;
+               } else {
+                       if (!(pri_chan->flag & HOSTAPD_CHAN_HT40PLUS))
+                               return;
+               }
        }
        freq->sec_channel_offset = ht40;
 
@@ -3467,9 +3485,10 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
                freq->he_enabled = ibss_mesh_can_use_he(wpa_s, ssid, mode,
                                                        ieee80211_mode);
        freq->channel = channel;
-       /* Setup higher BW only for 5 GHz */
+       /* Setup higher BW only for 5 and 6 GHz */
        if (mode->mode == HOSTAPD_MODE_IEEE80211A) {
-               ibss_mesh_select_40mhz(wpa_s, ssid, mode, freq, obss_scan);
+               ibss_mesh_select_40mhz(wpa_s, ssid, mode, freq, obss_scan,
+                                      is_6ghz);
                if (!ibss_mesh_select_80_160mhz(wpa_s, ssid, mode, freq,
                                                ieee80211_mode, is_6ghz))
                        freq->he_enabled = freq->vht_enabled = false;