diff mbox series

tests: eht: set valid configuration for puncturing tests

Message ID 20240129192638.2e7edb580322.Ic10566c44c1e37b835e874c9a421bfc34350cc63@changeid
State Accepted
Headers show
Series tests: eht: set valid configuration for puncturing tests | expand

Commit Message

Johannes Berg Jan. 29, 2024, 6:26 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

When puncturing is used on EHT, the HT/VHT/HE channel
configuration must not encompass the punctured subchannel,
so must use a lower bandwidth. Change the puncturing tests
accordingly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 tests/hwsim/test_eht.py | 44 ++++++++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 18 deletions(-)

Comments

Jouni Malinen March 8, 2024, 8:59 a.m. UTC | #1
On Mon, Jan 29, 2024 at 07:26:39PM +0100, Johannes Berg wrote:
> When puncturing is used on EHT, the HT/VHT/HE channel
> configuration must not encompass the punctured subchannel,
> so must use a lower bandwidth. Change the puncturing tests
> accordingly.

Thanks, applied.
diff mbox series

Patch

diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py
index 28e06dc76f1d..9c3720d5e80c 100644
--- a/tests/hwsim/test_eht.py
+++ b/tests/hwsim/test_eht.py
@@ -1123,7 +1123,13 @@  def _5ghz_chanwidth_to_bw(op):
     }.get(op, "20")
 
 def _test_eht_5ghz(dev, apdev, channel, chanwidth, ccfs1, ccfs2=0,
-                   eht_oper_puncturing_override=None):
+                   eht_oper_puncturing_override=None,
+                   he_ccfs1=None, he_oper_chanwidth=None):
+    if he_ccfs1 is None:
+        he_ccfs1 = ccfs1
+    if he_oper_chanwidth is None:
+        he_oper_chanwidth = chanwidth
+
     try:
         params = {"ssid": "eht",
                   "country_code": "US",
@@ -1133,33 +1139,32 @@  def _test_eht_5ghz(dev, apdev, channel, chanwidth, ccfs1, ccfs2=0,
                   "ieee80211ac": "1",
                   "ieee80211ax": "1",
                   "ieee80211be": "1",
-                  "vht_oper_chwidth": str(chanwidth),
-                  "vht_oper_centr_freq_seg0_idx": str(ccfs1),
+                  "vht_oper_chwidth": str(he_oper_chanwidth),
+                  "vht_oper_centr_freq_seg0_idx": str(he_ccfs1),
                   "vht_oper_centr_freq_seg1_idx": str(ccfs2),
-                  "he_oper_chwidth": str(chanwidth),
+                  "he_oper_chwidth": str(he_oper_chanwidth),
+                  "he_oper_centr_freq_seg0_idx": str(he_ccfs1),
                   "he_oper_centr_freq_seg1_idx": str(ccfs2),
-                  "he_oper_centr_freq_seg0_idx": str(ccfs1),
                   "eht_oper_centr_freq_seg0_idx": str(ccfs1),
                   "eht_oper_chwidth": str(chanwidth)}
 
-        if chanwidth == 0:
-            if channel == ccfs1:
-                  bw = "20"
-            elif channel < ccfs1:
+        if he_oper_chanwidth == 0:
+            if channel < he_ccfs1:
                   params["ht_capab"] = "[HT40+]"
-            else:
+            elif channel > he_ccfs1:
                   params["ht_capab"] = "[HT40-]"
         else:
-                  params["ht_capab"] = "[HT40+]"
-                  if chanwidth == 2:
-                      params["vht_capab"] = "[VHT160]"
-                  elif chanwidth == 3:
-                      params["vht_capab"] = "[VHT160-80PLUS80]"
+            params["ht_capab"] = "[HT40+]"
+            if he_oper_chanwidth == 2:
+                params["vht_capab"] = "[VHT160]"
+            elif he_oper_chanwidth == 3:
+                params["vht_capab"] = "[VHT160-80PLUS80]"
 
         if eht_oper_puncturing_override:
             params['eht_oper_puncturing_override'] = eht_oper_puncturing_override
 
         freq = 5000 + channel * 5
+        bw = "20"
         if chanwidth != 0 or channel != ccfs1:
             bw = _5ghz_chanwidth_to_bw(chanwidth)
 
@@ -1206,21 +1211,24 @@  def test_eht_5ghz_80mhz_puncturing_override_1(dev, apdev):
 
     # The 2nd 20 MHz is punctured
     _test_eht_5ghz(dev, apdev, 36, 1, 42, 0,
-                   eht_oper_puncturing_override="0x0002")
+                   eht_oper_puncturing_override="0x0002",
+                   he_ccfs1=36, he_oper_chanwidth=0)
 
 def test_eht_5ghz_80mhz_puncturing_override_2(dev, apdev):
     """EHT with 80 MHz channel width on 5 GHz - primary=149 - puncturing override (3rd)"""
 
     # The 3rd 20 MHz is punctured
     _test_eht_5ghz(dev, apdev, 149, 1, 155, 0,
-                   eht_oper_puncturing_override="0x0004")
+                   eht_oper_puncturing_override="0x0004",
+                   he_ccfs1=151, he_oper_chanwidth=0)
 
 def test_eht_5ghz_80mhz_puncturing_override_3(dev, apdev):
     """EHT with 80 MHz channel width on 5 GHz - primary=149 - puncturing override (4th)"""
 
     # The 4th 20 MHz is punctured
     _test_eht_5ghz(dev, apdev, 149, 1, 155, 0,
-                   eht_oper_puncturing_override="0x0008")
+                   eht_oper_puncturing_override="0x0008",
+                   he_ccfs1=151, he_oper_chanwidth=0)
 
 def test_eht_5ghz_80p80mhz(dev, apdev):
     """EHT with 80+80 MHz channel width on 5 GHz"""