]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
mesh: Add support for 160 MHz bandwidth in 5 GHz band for mesh
authorSuraj P Kizhakkethil <quic_surapk@quicinc.com>
Thu, 10 Apr 2025 11:11:22 +0000 (16:41 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 11 Apr 2025 09:56:26 +0000 (12:56 +0300)
Add support for 160 MHz in 5 GHz band for mesh. Use max_oper_chwidth for
160 MHz bandwidth selection.

Currently, in the hwsim test cases mesh_secure_ocv_mix_legacy and
mesh_secure_ocv_mix_ht, dev0 is configured in 160 MHz bandwidth which
includes DFS channels. But the test case lacks DFS checks and since the
bandwidth downgrades to 80 MHz which excludes any DFS channels, the test
cases pass. With the addition of 160 MHz support, the test cases fail
due to the lack of DFS checks, as dev0 takes longer time to enable. Add
DFS checks to the test cases mesh_secure_ocv_mix_legacy and
mesh_secure_ocv_mix_ht.

For the test cases mesh_secure_ocv_mix_legacy and
mesh_secure_ocv_mix_ht, the regulatory domain is set using iw reg set
which does not update the country in the wpa_s structure, causing the
DFS channels to be disabled. Use control interface to update the
regulatory domain.

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

index b4ae3cd23d6a7c4ca2fc3bc965f3b9f2e781dc96..1aa3b5c17433527945575bf409c94b6b3d0eb58d 100644 (file)
@@ -490,13 +490,15 @@ def test_mesh_secure_ocv_mix_legacy(dev, apdev):
 
 def run_mesh_secure_ocv_mix_legacy(dev, apdev):
     check_mesh_support(dev[0], secure=True)
-    set_reg(dev, 'AZ')
+    dev[0].set("country", "AZ")
 
     dev[0].request("SET sae_groups ")
     id = add_mesh_secure_net(dev[0], pmf=True, ocv=True)
     dev[0].set_network(id, "frequency", "5200")
     dev[0].set_network(id, "max_oper_chwidth", "2")
     dev[0].mesh_group_add(id)
+    check_dfs_started(dev[0])
+    check_dfs_finished(dev[0])
 
     dev[1].request("SET sae_groups ")
     id = add_mesh_secure_net(dev[1], pmf=True, ocv=True)
@@ -516,13 +518,15 @@ def test_mesh_secure_ocv_mix_ht(dev, apdev):
 
 def run_mesh_secure_ocv_mix_ht(dev, apdev):
     check_mesh_support(dev[0], secure=True)
-    set_reg(dev, 'AZ')
+    dev[0].set("country", "AZ")
 
     dev[0].request("SET sae_groups ")
     id = add_mesh_secure_net(dev[0], pmf=True, ocv=True)
     dev[0].set_network(id, "frequency", "5200")
     dev[0].set_network(id, "max_oper_chwidth", "2")
     dev[0].mesh_group_add(id)
+    check_dfs_started(dev[0])
+    check_dfs_finished(dev[0])
 
     dev[1].request("SET sae_groups ")
     id = add_mesh_secure_net(dev[1], pmf=True, ocv=True)
index cbda854c5833783da09240108ac6513b828c07f7..9f4d452c43086c0084bfe0bcf9fd544eead730b4 100644 (file)
@@ -3225,7 +3225,8 @@ static bool ibss_mesh_select_80_160mhz(struct wpa_supplicant *wpa_s,
                6515, 6595, 6675, 6755, 6835, 6915, 6995
        };
        static const int bw160[] = {
-               5955, 6115, 6275, 6435, 6595, 6755, 6915
+               5180, 5500, 5745, 5955, 6115, 6275, 6435,
+               6595, 6755, 6915
        };
        static const int bw320[]= {
                5955, 6255, 6115, 6415, 6275, 6575, 6435,
@@ -3277,16 +3278,22 @@ static bool ibss_mesh_select_80_160mhz(struct wpa_supplicant *wpa_s,
 
        /* In 160 MHz, the initial four 20 MHz channels were validated
         * above. If 160 MHz is supported, check the remaining four 20 MHz
-        * channels for the total of 160 MHz bandwidth for 6 GHz.
+        * channels for the total of 160 MHz bandwidth.
         */
        if ((mode->he_capab[ieee80211_mode].phy_cap[
                     HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] &
-            HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G) && is_6ghz &&
+            HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G) &&
+           (ssid->max_oper_chwidth == CONF_OPER_CHWIDTH_160MHZ ||
+            ssid->max_oper_chwidth == CONF_OPER_CHWIDTH_320MHZ) &&
            ibss_mesh_is_80mhz_avail(channel + 16, mode)) {
                for (j = 0; j < ARRAY_SIZE(bw160); j++) {
-                       if (freq->freq == bw160[j]) {
+                       u8 start_chan;
+
+                       if (freq->freq >= bw160[j] &&
+                           freq->freq < bw160[j] + 160) {
                                chwidth = CONF_OPER_CHWIDTH_160MHZ;
-                               seg0 = channel + 14;
+                               ieee80211_freq_to_chan(bw160[j], &start_chan);
+                               seg0 = start_chan + 14;
                                break;
                        }
                }