diff mbox series

[RFC] tests: verify RX/TX STBC overrides

Message ID 20190109200426.4100-1-geomatsi@gmail.com
State Changes Requested
Headers show
Series [RFC] tests: verify RX/TX STBC overrides | expand

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
Jouni Malinen Dec. 30, 2019, 4:33 p.m. UTC | #3
On Wed, Jan 09, 2019 at 11:04:26PM +0300, Sergey Matyukevich wrote:
> 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

This fails for me:

START ap_ht_stbc_disabled 2/4
Exception: STA[0]: TX STBC should be disabled, actual value: 1
Exception: STA[0]: TX STBC should be disabled, actual value: 1
FAIL ap_ht_stbc_disabled 0.260623 2019-12-30 16:37:16.001906

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

This passed.

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

This fails:

START ap_ht_stbc_rx 4/4
Exception: STA[0]: RX STBC expected 1, actual 3
Exception: STA[0]: RX STBC expected 1, actual 3
FAIL ap_ht_stbc_rx 0.26011 2019-12-30 16:37:16.421911


What is the expected behavior for these with the current mac80211
snapshot?

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

This and a fix to that (commit e9f33a8fee53, "mac80211: fix RX STBC
override byte order") are included in the kernel version I tested with.
Sergey Matyukevich Dec. 30, 2019, 8:37 p.m. UTC | #4
> On Wed, Jan 09, 2019 at 11:04:26PM +0300, Sergey Matyukevich wrote:
> > 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
>
> This fails for me:
>
> START ap_ht_stbc_disabled 2/4
> Exception: STA[0]: TX STBC should be disabled, actual value: 1
> Exception: STA[0]: TX STBC should be disabled, actual value: 1
> FAIL ap_ht_stbc_disabled 0.260623 2019-12-30 16:37:16.001906
>
> > - ap_ht_stbc_tx
> >   make sure that Tx STBC can be properly enabled for hwsim driver
> >   using wpa_s 'tx_stbc' configuration option
>
> This passed.
>
> > - ap_ht_stbc_rx
> >   make sure that Tx STBC can be properly enabled for hwsim driver
> >   using wpa_s 'tx_stbc' configuration option
>
> This fails:
>
> START ap_ht_stbc_rx 4/4
> Exception: STA[0]: RX STBC expected 1, actual 3
> Exception: STA[0]: RX STBC expected 1, actual 3
> FAIL ap_ht_stbc_rx 0.26011 2019-12-30 16:37:16.421911
>
>
> What is the expected behavior for these with the current mac80211
> snapshot?
>
> > This patch depends on the following hwsim driver change:
> > https://patchwork.kernel.org/patch/10752835/
>
> This and a fix to that (commit e9f33a8fee53, "mac80211: fix RX STBC
> override byte order") are included in the kernel version I tested with.

Ok, I will take a look.

Regards,
Sergey
Sergey Matyukevich Jan. 8, 2020, 11:33 a.m. UTC | #5
> > 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
> 
> This fails for me:
> 
> START ap_ht_stbc_disabled 2/4
> Exception: STA[0]: TX STBC should be disabled, actual value: 1
> Exception: STA[0]: TX STBC should be disabled, actual value: 1
> FAIL ap_ht_stbc_disabled 0.260623 2019-12-30 16:37:16.001906
> 
> > - ap_ht_stbc_tx
> >   make sure that Tx STBC can be properly enabled for hwsim driver
> >   using wpa_s 'tx_stbc' configuration option
> 
> This passed.
> 
> > - ap_ht_stbc_rx
> >   make sure that Tx STBC can be properly enabled for hwsim driver
> >   using wpa_s 'tx_stbc' configuration option
> 
> This fails:
> 
> START ap_ht_stbc_rx 4/4
> Exception: STA[0]: RX STBC expected 1, actual 3
> Exception: STA[0]: RX STBC expected 1, actual 3
> FAIL ap_ht_stbc_rx 0.26011 2019-12-30 16:37:16.421911
> 
> 
> What is the expected behavior for these with the current mac80211
> snapshot?
> 
> > This patch depends on the following hwsim driver change:
> > https://patchwork.kernel.org/patch/10752835/
> 
> This and a fix to that (commit e9f33a8fee53, "mac80211: fix RX STBC
> override byte order") are included in the kernel version I tested with.

Hi Jouni,

I rebased the patch with tests on the top of the latest hostapd source
tree (commit 8296ee18053c, "RSN IBSS: Fix EAPOL TX using control port")
and checked new tests as well as all the other HT tests. For testing I
used the latest mac80211-next kernel: commit 1ee7826ab68f, "mac80211:
Remove redundant assertion". All the necessary STBC changes and fixes
are included in that kernel.

IIUC, the test procedure is a standard one to use for hwsim tests:
$ git clone git://w1.fi/hostap.git
$ cd hostap/tests/hwsim
$ ./build.sh
$ ./start.sh
$ sudo ./run-tests.py ap_ht_stbc*
$ sudo ./run-tests.py -f ap_ht

In my case all 4 STBC tests passed.

I attached rebased patch with STBC tests. In comparison with v1, this
patch does not modify your original test_ap_ht_stbc test. It just adds
three more STBC tests including test_ap_ht_stbc_rx, test_ap_ht_stbc_tx,
test_ap_ht_stbc_disabled. That is why 4 STBC tests.

If it still does not work for you, then could you please share a bit
more details about your test setup: kernel tree/version, platform.
So that I can try and reproduce the issue on my side.

Regards,
Sergey

---
 tests/hwsim/test_ap_ht.py | 67 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py
index 14c53666f..08d184dd8 100644
--- a/tests/hwsim/test_ap_ht.py
+++ b/tests/hwsim/test_ap_ht.py
@@ -9,12 +9,14 @@ import time
 import logging
 logger = logging.getLogger()
 import struct
+import os
 
 import hostapd
 from wpasupplicant import WpaSupplicant
 from utils import HwsimSkip, alloc_fail, parse_ie, clear_regdom
 import hwsim_utils
 from test_ap_csa import csa_supported
+from tshark import run_tshark
 
 def clear_scan_cache(apdev):
     ifname = apdev['ifname']
@@ -903,6 +905,71 @@ def test_ap_ht_stbc(dev, apdev):
     dev[2].connect("ht", key_mgmt="NONE", scan_freq="2412",
                    rx_stbc="1", tx_stbc="1")
 
+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", 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):
     """Require HT with limited supported rates"""
diff mbox series

Patch

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):