[RFC] tests: verify RX/TX STBC overrides
diff mbox series

Message ID 20190109200426.4100-1-geomatsi@gmail.com
State New
Headers show
Series
  • [RFC] tests: verify RX/TX STBC overrides
Related show

Commit Message

Sergey Matyukevich Jan. 9, 2019, 8:04 p.m. UTC
From: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>

Commit cdeea70f59d0 added wpa_s configuration options allowing HT STBC
modifications for RX/TX spatial streams. Add tests to verify
overriding of default HT STBC configuration for Tx and Rx
spatial streams for hwsim driver.

The test flow is straightforward: use wpa_s 'tx_stbc' and 'rx_stbc'
configuration options to override default HT Rx/Tx STBC settings
and check HT capabilities IEs in ASSOC frames.
The following tests have been added:

- ap_ht_stbc_disabled
  make sure that HT Rx/Tx STBC is disabled by default for hwsim driver

- ap_ht_stbc_tx
  make sure that Tx STBC can be properly enabled for hwsim driver
  using wpa_s 'tx_stbc' configuration option

- ap_ht_stbc_rx
  make sure that Tx STBC can be properly enabled for hwsim driver
  using wpa_s 'tx_stbc' configuration option

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
---

This patch depends on the following hwsim driver change:
https://patchwork.kernel.org/patch/10752835/

 tests/hwsim/test_ap_ht.py | 68 +++++++++++++++++++++++++++++++++++----
 1 file changed, 62 insertions(+), 6 deletions(-)

Comments

Sergey Matyukevich Jan. 21, 2019, 8:42 a.m. UTC | #1
On Wed, Jan 09, 2019 at 11:04:26PM +0300, Sergey Matyukevich wrote:

Hello Jouni,

> Commit cdeea70f59d0 added wpa_s configuration options allowing HT STBC
> modifications for RX/TX spatial streams. Add tests to verify
> overriding of default HT STBC configuration for Tx and Rx
> spatial streams for hwsim driver.
> 
> The test flow is straightforward: use wpa_s 'tx_stbc' and 'rx_stbc'
> configuration options to override default HT Rx/Tx STBC settings
> and check HT capabilities IEs in ASSOC frames.
> The following tests have been added:
> 
> - ap_ht_stbc_disabled
>   make sure that HT Rx/Tx STBC is disabled by default for hwsim driver
> 
> - ap_ht_stbc_tx
>   make sure that Tx STBC can be properly enabled for hwsim driver
>   using wpa_s 'tx_stbc' configuration option
> 
> - ap_ht_stbc_rx
>   make sure that Tx STBC can be properly enabled for hwsim driver
>   using wpa_s 'tx_stbc' configuration option
> 
> Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
> ---
> 
> This patch depends on the following hwsim driver change:
> https://patchwork.kernel.org/patch/10752835/
> 
>  tests/hwsim/test_ap_ht.py | 68 +++++++++++++++++++++++++++++++++++----
>  1 file changed, 62 insertions(+), 6 deletions(-)

The accompanying mac80211 fix (https://patchwork.kernel.org/patch/10752835)
has been merged to mac80211-next tree. So now STBC configuration in hwsim
driver by wpa_s should be working as expected. These suggested changes
in hwsim test suite can be used to verify that.

Regards,
Sergey
Sergey Matyukevich Feb. 13, 2019, 6:54 p.m. UTC | #2
Hello Jouni,

> > Commit cdeea70f59d0 added wpa_s configuration options allowing HT STBC
> > modifications for RX/TX spatial streams. Add tests to verify
> > overriding of default HT STBC configuration for Tx and Rx
> > spatial streams for hwsim driver.
> >
> > The test flow is straightforward: use wpa_s 'tx_stbc' and 'rx_stbc'
> > configuration options to override default HT Rx/Tx STBC settings
> > and check HT capabilities IEs in ASSOC frames.
> > The following tests have been added:
> >
> > - ap_ht_stbc_disabled
> >   make sure that HT Rx/Tx STBC is disabled by default for hwsim driver
> >
> > - ap_ht_stbc_tx
> >   make sure that Tx STBC can be properly enabled for hwsim driver
> >   using wpa_s 'tx_stbc' configuration option
> >
> > - ap_ht_stbc_rx
> >   make sure that Tx STBC can be properly enabled for hwsim driver
> >   using wpa_s 'tx_stbc' configuration option
> >
> > Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
> > ---
> >
> > This patch depends on the following hwsim driver change:
> > https://patchwork.kernel.org/patch/10752835/
> >
> >  tests/hwsim/test_ap_ht.py | 68 +++++++++++++++++++++++++++++++++++----
> >  1 file changed, 62 insertions(+), 6 deletions(-)
> 
> The accompanying mac80211 fix (https://patchwork.kernel.org/patch/10752835)
> has been merged to mac80211-next tree. So now STBC configuration in hwsim
> driver by wpa_s should be working as expected. These suggested changes
> in hwsim test suite can be used to verify that.

Are there any comments or concerns for this patch ?
Let me know if it should be updated for python3.

Regards,
Sergey

Patch
diff mbox series

diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py
index e6f6502f4..bd452d5ba 100644
--- a/tests/hwsim/test_ap_ht.py
+++ b/tests/hwsim/test_ap_ht.py
@@ -9,11 +9,13 @@  import time
 import logging
 logger = logging.getLogger()
 import struct
+import os
 
 import hostapd
 from utils import HwsimSkip, alloc_fail, parse_ie
 import hwsim_utils
 from test_ap_csa import csa_supported
+from tshark import run_tshark
 
 def clear_scan_cache(apdev):
     ifname = apdev['ifname']
@@ -851,16 +853,70 @@  def test_ap_require_ht(dev, apdev):
                    ampdu_density="1", disable_ht40="1", disable_sgi="1",
                    disable_ldpc="1", rx_stbc="2", tx_stbc="1")
 
-def test_ap_ht_stbc(dev, apdev):
-    """HT STBC overrides"""
+def test_ap_ht_stbc_disabled(dev, apdev, p):
+    """HT STBC overrides: RX/TX STBC is disabled by default"""
     params = { "ssid": "ht" }
     hapd = hostapd.add_ap(apdev[0], params)
 
     dev[0].connect("ht", key_mgmt="NONE", scan_freq="2412")
-    dev[1].connect("ht", key_mgmt="NONE", scan_freq="2412",
-                   rx_stbc="0", tx_stbc="0")
-    dev[2].connect("ht", key_mgmt="NONE", scan_freq="2412",
-                   rx_stbc="1", tx_stbc="1")
+    dev[1].connect("ht", key_mgmt="NONE", scan_freq="2412", tx_stbc="-1", rx_stbc="-1")
+    dev[2].connect("ht", key_mgmt="NONE", scan_freq="2412", tx_stbc="0", rx_stbc="0")
+
+    capfile = os.path.join(p['logdir'], "hwsim0.pcapng")
+    filt = "wlan.sa==%s && wlan.fc.type_subtype == 0x0"
+
+    for sta in [0, 1, 2]:
+        res = run_tshark(capfile, filt % dev[sta].own_addr(), [ "wlan.ht.capabilities.txstbc" ])
+        res = res.splitlines()
+        res = [int(x) for x in res]
+        for tx_stbc in res:
+            if tx_stbc != 0:
+                raise Exception("STA[%d]: TX STBC should be disabled, actual value: %d" % (sta, tx_stbc))
+
+        res = run_tshark(capfile, filt % dev[sta].own_addr(), [ "wlan.ht.capabilities.rxstbc" ])
+        res = res.splitlines()
+        res = [int(x, 16) for x in res]
+        for rx_stbc in res:
+            if rx_stbc != 0:
+                raise Exception("STA[%d]: RX STBC should be disabled, actual value: %d" % (sta, rx_stbc))
+
+def test_ap_ht_stbc_tx(dev, apdev, p):
+    """HT STBC overrides: verify TX STBC configuration"""
+    params = { "ssid": "ht" }
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    dev[0].connect("ht", key_mgmt="NONE", scan_freq="2412", tx_stbc="1")
+
+    capfile = os.path.join(p['logdir'], "hwsim0.pcapng")
+    filt = "wlan.sa==%s && wlan.fc.type_subtype == 0x0"
+
+    res = run_tshark(capfile, filt % dev[0].own_addr(), [ "wlan.ht.capabilities.txstbc" ])
+    res = res.splitlines()
+    res = [int(x) for x in res]
+    for tx_stbc in res:
+        if tx_stbc != 1:
+            raise Exception("TX STBC should be enabled, actual value: %d" % tx_stbc)
+
+def test_ap_ht_stbc_rx(dev, apdev, p):
+    """HT STBC overrides: verify RX STBC configuration"""
+    params = { "ssid": "ht" }
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    dev[0].connect("ht", key_mgmt="NONE", scan_freq="2412", rx_stbc="1")
+    dev[1].connect("ht", key_mgmt="NONE", scan_freq="2412", rx_stbc="2")
+    dev[2].connect("ht", key_mgmt="NONE", scan_freq="2412", rx_stbc="3")
+
+    capfile = os.path.join(p['logdir'], "hwsim0.pcapng")
+    filt = "wlan.sa==%s && wlan.fc.type_subtype == 0x0"
+
+    for sta in [0, 1, 2]:
+        res = run_tshark(capfile, filt % dev[sta].own_addr(), [ "wlan.ht.capabilities.rxstbc" ])
+        res = res.splitlines()
+        res = [int(x, 16) for x in res]
+        expected = sta + 1
+        for actual in res:
+            if actual != expected:
+                raise Exception("STA[%d]: RX STBC expected %d, actual %d" % (sta, expected, actual))
 
 @remote_compatible
 def test_ap_require_ht_limited_rates(dev, apdev):