From 5758cb14681541dfab829d1ae204c861c05072a7 Mon Sep 17 00:00:00 2001 From: Muna Sinada Date: Mon, 4 Oct 2021 11:05:51 -0700 Subject: [PATCH] tests: Initial EHT testing Add initial tests for EHT. Tests include the following: - eht80_to_24g_eht - EHT with 80 MHz channel width reconfigured to 2.4 GHz EHT - eht_40 - EHT and 40 MHz channel - eht_use_sta_nsts - EHT with 80 MHz channel width and use_sta_nsts=1 - eht_open - EHT AP with open mode configuration - eht80_invalid2 - EHT with invalid 80 MHz channel configuration (seg0) - eht80b - EHT with 80 MHz channel width (HT40- channel 40) - eht80d - EHT with 80 MHz channel width (HT40- channel 48) - eht_on_24ghz - Subset of EHT features on 2.4 GHz - eht_params - EHT AP parameters - eht_wifi_generation_24 - eht_wifi_generation - eht80 - EHT with 80 MHz channel width - eht_20 - EHT and 20 MHz channel - eht_disabled_on_sta - EHT AP and EHT STA disabled on STA - eht80c - EHT with 80 MHz channel width (HT40+ channel 44) - eht80_params - EHT with 80 MHz channel width and number of optional features enabled - eht80_csa - EHT with 80 MHz channel width and CSA - eht160 - EHT with 160 MHz channel width [long] - eht80_invalid - EHT with invalid 80 MHz channel configuration (seg1: 80+80 not supported) Signed-off-by: Muna Sinada --- tests/hwsim/example-hostapd.config | 1 + tests/hwsim/example-wpa_supplicant.config | 2 + tests/hwsim/test_eht.py | 691 ++++++++++++++++++++++++++++++ tests/hwsim/wpasupplicant.py | 2 +- 4 files changed, 695 insertions(+), 1 deletion(-) create mode 100644 tests/hwsim/test_eht.py diff --git a/tests/hwsim/example-hostapd.config b/tests/hwsim/example-hostapd.config index d01a1d2edcfe..17cde61069a3 100644 --- a/tests/hwsim/example-hostapd.config +++ b/tests/hwsim/example-hostapd.config @@ -50,6 +50,7 @@ CONFIG_LIBNL3_ROUTE=y CONFIG_IEEE80211R=y CONFIG_IEEE80211AC=y CONFIG_IEEE80211AX=y +CONFIG_IEEE80211BE=y CONFIG_OCV=y diff --git a/tests/hwsim/example-wpa_supplicant.config b/tests/hwsim/example-wpa_supplicant.config index 5e5acd695729..6ed491f7a713 100644 --- a/tests/hwsim/example-wpa_supplicant.config +++ b/tests/hwsim/example-wpa_supplicant.config @@ -60,6 +60,7 @@ CONFIG_CTRL_IFACE_DBUS_INTRO=y CONFIG_IEEE80211R=y CONFIG_IEEE80211AC=y CONFIG_IEEE80211AX=y +CONFIG_IEEE80211BE=y CONFIG_OCV=y @@ -103,6 +104,7 @@ CONFIG_TLSV12=y CONFIG_HT_OVERRIDES=y CONFIG_VHT_OVERRIDES=y CONFIG_HE_OVERRIDES=y +CONFIG_EHT_OVERRIDES=y CONFIG_DEBUG_LINUX_TRACING=y diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py new file mode 100644 index 000000000000..70206bcf375a --- /dev/null +++ b/tests/hwsim/test_eht.py @@ -0,0 +1,691 @@ +# EHT tests +# Copyright (c) 2019, The Linux Foundation +# Copyright (c) 2022, Qualcomm Innovation Center, Inc +# +# This software may be distributed under the terms of the BSD license. +# See README for more details. + +import logging +logger = logging.getLogger() +import os +import subprocess, time + +import hwsim_utils +import hostapd +from wpasupplicant import WpaSupplicant +from utils import * +from test_dfs import wait_dfs_event + +def test_eht_open(dev, apdev): + """EHT AP with open mode configuration""" + params = {"ssid": "eht", + "ieee80211ax": "1", + "ieee80211be": "1"} + hapd = hostapd.add_ap(apdev[0], params) + if hapd.get_status_field("ieee80211be") != "1": + raise Exception("STATUS did not indicate ieee80211be=1") + dev[0].connect("eht", key_mgmt="NONE", scan_freq="2412") + sta = hapd.get_sta(dev[0].own_addr()) + if "[EHT]" not in sta['flags']: + raise Exception("Missing STA flag: EHT") + +def test_eht_disabled_on_sta(dev, apdev): + """EHT AP and EHT STA disabled on STA""" + params = {"ssid": "eht", + "ieee80211ax": "1", + "ieee80211be": "1"} + hapd = hostapd.add_ap(apdev[0], params) + dev[0].connect("eht", key_mgmt="NONE", scan_freq="2412", disable_eht="1") + sta = hapd.get_sta(dev[0].own_addr()) + if "[EHT]" in sta['flags']: + raise Exception("Unexpected STA flag: EHT") + +def test_eht_params(dev, apdev): + """EHT AP parameters""" + params = {"ssid": "eht", + "ieee80211ax": "1", + "ieee80211be": "1", + "eht_su_beamformer": "0", + "eht_mu_beamformer": "0", + "eht_oper_chwidth": "0", + "eht_oper_centr_freq_seg0_idx": "1"} + hapd = hostapd.add_ap(apdev[0], params) + if hapd.get_status_field("ieee80211be") != "1": + raise Exception("STATUS did not indicate ieee80211be=1") + dev[0].connect("eht", key_mgmt="NONE", scan_freq="2412") + +def eht_supported(): + cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE) + reg = cmd.stdout.read().decode() + if "@ 80)" in reg or "@ 160)" in reg: + return True + return False + +def test_eht80(dev, apdev): + """EHT with 80 MHz channel width""" + try: + hapd = None + params = {"ssid": "eht", + "country_code": "FI", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "1", + "vht_capab": "[MAX-MPDU-11454]", + "vht_oper_centr_freq_seg0_idx": "42", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42", + "ieee80211be": "1", + "eht_oper_chwidth": "1", + "eht_oper_centr_freq_seg0_idx": "42"} + hapd = hostapd.add_ap(apdev[0], params) + bssid = apdev[0]['bssid'] + + dev[0].connect("eht", key_mgmt="NONE", scan_freq="5180") + hwsim_utils.test_connectivity(dev[0], hapd) + sig = dev[0].request("SIGNAL_POLL").splitlines() + if "FREQUENCY=5180" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig)) + if "WIDTH=80 MHz" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig)) + est = dev[0].get_bss(bssid)['est_throughput'] + if est != "600502": + raise Exception("Unexpected BSS est_throughput: " + est) + status = dev[0].get_status() + if status["ieee80211ac"] != "1": + raise Exception("Unexpected STATUS ieee80211ac value (STA)") + status = hapd.get_status() + logger.info("hostapd STATUS: " + str(status)) + if status["ieee80211n"] != "1": + raise Exception("Unexpected STATUS ieee80211n value") + if status["ieee80211ac"] != "1": + raise Exception("Unexpected STATUS ieee80211ac value") + if status["ieee80211ax"] != "1": + raise Exception("Unexpected STATUS ieee80211ax value") + if status["secondary_channel"] != "1": + raise Exception("Unexpected STATUS secondary_channel value") + if status["vht_oper_chwidth"] != "1": + raise Exception("Unexpected STATUS vht_oper_chwidth value") + if status["vht_oper_centr_freq_seg0_idx"] != "42": + raise Exception("Unexpected STATUS vht_oper_centr_freq_seg0_idx value") + if "vht_caps_info" not in status: + raise Exception("Missing vht_caps_info") + if status["he_oper_chwidth"] != "1": + raise Exception("Unexpected STATUS he_oper_chwidth value") + if status["he_oper_centr_freq_seg0_idx"] != "42": + raise Exception("Unexpected STATUS he_oper_centr_freq_seg0_idx value") + if status["ieee80211be"] != "1": + raise Exception("Unexpected STATUS ieee80211be value") + if status["eht_oper_chwidth"] != "1": + raise Exception("Unexpected STATUS eht_oper_chwidth value") + if status["eht_oper_centr_freq_seg0_idx"] != "42": + raise Exception("Unexpected STATUS eht_oper_centr_freq_seg0_idx value") + + sta = hapd.get_sta(dev[0].own_addr()) + logger.info("hostapd STA: " + str(sta)) + if "[HT]" not in sta['flags']: + raise Exception("Missing STA flag: HT") + if "[VHT]" not in sta['flags']: + raise Exception("Missing STA flag: VHT") + if "[HE]" not in sta['flags']: + raise Exception("Missing STA flag: HE") + if "[EHT]" not in sta['flags']: + raise Exception("Missing STA flag: EHT") + + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not eht_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + dev[0].request("DISCONNECT") + clear_regdom(hapd, dev) + +def _test_eht_wifi_generation(dev, apdev, conf, scan_freq): + """EHT and wifi_generation""" + try: + hapd = None + params = {"ssid": "eht", + "country_code": "FI", + "ieee80211n": "1", + "ieee80211ax": "1", + "ieee80211be": "1"} + params.update(conf) + hapd = hostapd.add_ap(apdev[0], params) + bssid = apdev[0]['bssid'] + + dev[0].connect("eht", key_mgmt="NONE", scan_freq=scan_freq) + status = dev[0].get_status() + if 'wifi_generation' not in status: + # For now, assume this is because of missing kernel support + raise HwsimSkip("Association Request IE reporting not supported") + if status['wifi_generation'] != "7": + raise Exception("Unexpected wifi_generation value: " + status['wifi_generation']) + + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add("wlan5", drv_params="force_connect_cmd=1") + wpas.connect("eht", key_mgmt="NONE", scan_freq=scan_freq) + status = wpas.get_status() + if 'wifi_generation' not in status: + # For now, assume this is because of missing kernel support + raise HwsimSkip("Association Request IE reporting not supported") + if status['wifi_generation'] != "7": + raise Exception("Unexpected wifi_generation value (connect): " + status['wifi_generation']) + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not eht_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + dev[0].request("DISCONNECT") + clear_regdom(hapd, dev) + +def test_eht_wifi_generation(dev, apdev): + conf = {"hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211ac": "1", + "vht_capab": "[MAX-MPDU-11454]", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42", + "eht_oper_chwidth": "1", + "eht_oper_centr_freq_seg0_idx": "42"} + + _test_eht_wifi_generation(dev, apdev, conf, "5180") + +def test_eht_wifi_generation_24(dev, apdev): + conf = {"hw_mode": "g", + "channel": "1"} + _test_eht_wifi_generation(dev, apdev, conf, "2412") + +def eht80_test(apdev, dev, channel, ht_capab): + clear_scan_cache(apdev) + try: + hapd = None + params = {"ssid": "eht", + "country_code": "FI", + "hw_mode": "a", + "channel": str(channel), + "ieee80211n": "1", + "ht_capab": ht_capab, + "ieee80211ac": "1", + "vht_capab": "[MAX-MPDU-11454]", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "ieee80211ax": "1", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42", + "ieee80211be": "1", + "eht_oper_chwidth": "1", + "eht_oper_centr_freq_seg0_idx": "42"} + hapd = hostapd.add_ap(apdev, params) + bssid = apdev['bssid'] + + dev[0].connect("eht", key_mgmt="NONE", + scan_freq=str(5000 + 5 * channel)) + hwsim_utils.test_connectivity(dev[0], hapd) + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not eht_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev) + +def test_eht80b(dev, apdev): + """EHT with 80 MHz channel width (HT40- channel 40)""" + eht80_test(apdev[0], dev, 40, "[HT40-]") + +def test_eht80c(dev, apdev): + """EHT with 80 MHz channel width (HT40+ channel 44)""" + eht80_test(apdev[0], dev, 44, "[HT40+]") + +def test_eht80d(dev, apdev): + """EHT with 80 MHz channel width (HT40- channel 48)""" + eht80_test(apdev[0], dev, 48, "[HT40-]") + +def test_eht80_params(dev, apdev): + """EHT with 80 MHz channel width and number of optional features enabled""" + try: + hapd = None + params = {"ssid": "eht", + "country_code": "FI", + "hw_mode": "a", + "channel": "36", + "ieee80211n": "1", + "ht_capab": "[HT40+][SHORT-GI-40][DSS_CCK-40]", + "ieee80211ac": "1", + "vht_capab": "[MAX-MPDU-11454][RXLDPC][SHORT-GI-80][TX-STBC-2BY1][RX-STBC-1][MAX-A-MPDU-LEN-EXP0]", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "require_vht": "1", + "ieee80211ax": "1", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42", + "ieee80211be": "1", + "eht_oper_chwidth": "1", + "eht_oper_centr_freq_seg0_idx": "42", + "eht_su_beamformer": "1", + "eht_mu_beamformer": "1"} + hapd = hostapd.add_ap(apdev[0], params) + + dev[1].connect("eht", key_mgmt="NONE", scan_freq="5180", + disable_vht="1", wait_connect=False) + dev[0].connect("eht", key_mgmt="NONE", scan_freq="5180") + dev[2].connect("eht", key_mgmt="NONE", scan_freq="5180", + disable_sgi="1") + ev = dev[1].wait_event(["CTRL-EVENT-ASSOC-REJECT"]) + if ev is None: + raise Exception("Association rejection timed out") + if "status_code=104" not in ev: + raise Exception("Unexpected rejection status code") + dev[1].request("DISCONNECT") + hwsim_utils.test_connectivity(dev[0], hapd) + sta0 = hapd.get_sta(dev[0].own_addr()) + sta2 = hapd.get_sta(dev[2].own_addr()) + capab0 = int(sta0['vht_caps_info'], base=16) + capab2 = int(sta2['vht_caps_info'], base=16) + if capab0 & 0x60 == 0: + raise Exception("dev[0] did not support SGI") + if capab2 & 0x60 != 0: + raise Exception("dev[2] claimed support for SGI") + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not eht_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev, count=3) + +def test_eht80_invalid(dev, apdev): + """EHT with invalid 80 MHz channel configuration (seg1: 80+80 not supported)""" + try: + hapd = None + params = {"ssid": "eht", + "country_code": "US", + "hw_mode": "a", + "channel": "36", + "ieee80211n": "1", + "ht_capab": "[HT40+]", + "ieee80211ac": "1", + "vht_capab": "[MAX-MPDU-11454]", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "vht_oper_centr_freq_seg1_idx": "159", + "ieee80211ax": "1", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42", + "he_oper_centr_freq_seg1_idx": "159", + "ieee80211be": "1", + "eht_oper_chwidth": "1", + "eht_oper_centr_freq_seg0_idx": "42", + "ieee80211d": "1", + "ieee80211h": "1"} + hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) + # This fails due to unexpected seg1 configuration + ev = hapd.wait_event(["AP-DISABLED"], timeout=5) + if ev is None: + raise Exception("AP-DISABLED not reported") + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not eht_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev) + +def test_eht80_invalid2(dev, apdev): + """EHT with invalid 80 MHz channel configuration (seg0)""" + try: + hapd = None + params = {"ssid": "eht", + "country_code": "US", + "hw_mode": "a", + "channel": "36", + "ieee80211n": "1", + "ht_capab": "[HT40+]", + "ieee80211ac": "1", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "ieee80211ax": "1", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42", + "ieee80211be": "1", + "eht_oper_chwidth": "1", + "eht_oper_centr_freq_seg0_idx": "46", + "ieee80211d": "1", + "ieee80211h": "1"} + hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) + # This fails due to invalid seg0 configuration + ev = hapd.wait_event(["AP-DISABLED"], timeout=5) + if ev is None: + raise Exception("AP-DISABLED not reported") + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not eht_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev) + +def test_eht80_to_24g_eht(dev, apdev): + """EHT with 80 MHz channel width reconfigured to 2.4 GHz EHT""" + try: + params = {"ssid": "eht", + "country_code": "FI", + "hw_mode": "a", + "channel": "36", + "ieee80211n": "1", + "ht_capab": "[HT40+]", + "ieee80211ac": "1", + "vht_capab": "[MAX-MPDU-11454]", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "ieee80211ax": "1", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42", + "ieee80211be": "1", + "eht_oper_chwidth": "1", + "eht_oper_centr_freq_seg0_idx": "42"} + hapd = hostapd.add_ap(apdev[0], params) + bssid = apdev[0]['bssid'] + + hapd.disable() + hapd.set("ieee80211ac", "0") + hapd.set("hw_mode", "g") + hapd.set("channel", "1") + hapd.set("ht_capab", "") + hapd.set("vht_capab", "") + hapd.set("vht_oper_chwidth", "") + hapd.set("vht_oper_centr_freq_seg0_idx", "") + hapd.set("he_oper_chwidth", "") + hapd.set("he_oper_centr_freq_seg0_idx", "") + hapd.set("eht_oper_chwidth", "") + hapd.set("eht_oper_centr_freq_seg0_idx", "") + hapd.enable() + + dev[0].connect("eht", key_mgmt="NONE", scan_freq="2412") + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not eht_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + dev[0].request("DISCONNECT") + clear_regdom(hapd, dev) + +def test_eht_20(devs, apdevs): + """EHT and 20 MHz channel""" + dev = devs[0] + ap = apdevs[0] + try: + hapd = None + params = {"ssid": "eht", + "country_code": "DE", + "hw_mode": "a", + "channel": "36", + "ieee80211n": "1", + "ht_capab": "", + "ieee80211ac": "1", + "vht_capab": "", + "vht_oper_chwidth": "0", + "vht_oper_centr_freq_seg0_idx": "0", + "supported_rates": "60 120 240 360 480 540", + "require_vht": "1", + "ieee80211ax": "1", + "he_oper_chwidth": "0", + "he_oper_centr_freq_seg0_idx": "0", + "ieee80211be": "1", + "eht_oper_chwidth": "0", + "eht_oper_centr_freq_seg0_idx": "0"} + + hapd = hostapd.add_ap(ap, params) + dev.connect("eht", scan_freq="5180", key_mgmt="NONE") + hwsim_utils.test_connectivity(dev, hapd) + finally: + dev.request("DISCONNECT") + clear_regdom(hapd, devs) + +def test_eht_40(devs, apdevs): + """EHT and 40 MHz channel""" + dev = devs[0] + ap = apdevs[0] + try: + hapd = None + params = {"ssid": "eht", + "country_code": "DE", + "hw_mode": "a", + "channel": "36", + "ieee80211n": "1", + "ht_capab": "[HT40+]", + "ieee80211ac": "1", + "vht_capab": "", + "vht_oper_chwidth": "0", + "vht_oper_centr_freq_seg0_idx": "38", + "ieee80211ax": "1", + "he_oper_chwidth": "0", + "he_oper_centr_freq_seg0_idx": "38", + "ieee80211be": "1", + "eht_oper_chwidth": "0", + "eht_oper_centr_freq_seg0_idx": "38", + "eht_su_beamformer": "1", + "eht_mu_beamformer": "1"} + hapd = hostapd.add_ap(ap, params) + dev.connect("eht", scan_freq="5180", key_mgmt="NONE") + hwsim_utils.test_connectivity(dev, hapd) + finally: + dev.request("DISCONNECT") + clear_regdom(hapd, devs) + +@long_duration_test +def test_eht160(dev, apdev): + """EHT with 160 MHz channel width""" + try: + hapd = None + params = {"ssid": "eht", + "country_code": "FI", + "hw_mode": "a", + "channel": "36", + "ieee80211n": "1", + "ht_capab": "[HT40+]", + "ieee80211ac": "1", + "vht_capab": "[VHT160]", + "vht_oper_chwidth": "2", + "vht_oper_centr_freq_seg0_idx": "50", + "ieee80211ax": "1", + "he_oper_chwidth": "2", + "he_oper_centr_freq_seg0_idx": "50", + "ieee80211be": "1", + "eht_oper_chwidth": "2", + "eht_oper_centr_freq_seg0_idx": "50", + "ieee80211d": "1", + "ieee80211h": "1"} + + hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) + bssid = apdev[0]['bssid'] + + ev = wait_dfs_event(hapd, "DFS-CAC-START", 5) + if "DFS-CAC-START" not in ev: + raise Exception("Unexpected DFS event") + + state = hapd.get_status_field("state") + if state != "DFS": + if state == "DISABLED" and not os.path.exists("dfs"): + # Not all systems have recent enough CRDA version and + # wireless-regdb changes to support 160 MHz and DFS. For now, + # do not report failures for this test case. + raise HwsimSkip("CRDA or wireless-regdb did not support 160 MHz") + raise Exception("Unexpected interface state: " + state) + + logger.info("Waiting for CAC to complete") + + ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70) + if "success=1" not in ev: + raise Exception("CAC failed") + if "freq=5180" not in ev: + raise Exception("Unexpected DFS freq result") + + ev = hapd.wait_event(["AP-ENABLED"], timeout=5) + if not ev: + raise Exception("AP setup timed out") + + dev[0].connect("eht", key_mgmt="NONE", scan_freq="5180") + dev[0].wait_regdom(country_ie=True) + hwsim_utils.test_connectivity(dev[0], hapd) + sig = dev[0].request("SIGNAL_POLL").splitlines() + if "FREQUENCY=5180" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig)) + if "WIDTH=160 MHz" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig)) + est = dev[0].get_bss(bssid)['est_throughput'] + if est != "1201002": + raise Exception("Unexpected BSS est_throughput: " + est) + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not eht_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + if hapd: + hapd.request("DISABLE") + dev[0].disconnect_and_stop_scan() + subprocess.call(['iw', 'reg', 'set', '00']) + dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5) + dev[0].flush_scan_cache() + +def test_eht_on_24ghz(dev, apdev): + """Subset of EHT features on 2.4 GHz""" + hapd = None + params = {"ssid": "eht", + "hw_mode": "g", + "channel": "1", + "ieee80211n": "1", + "vht_oper_chwidth": "0", + "vht_oper_centr_freq_seg0_idx": "1", + "ieee80211ax": "1", + "he_oper_chwidth": "0", + "he_oper_centr_freq_seg0_idx": "1", + "ieee80211be": "1", + "eht_oper_chwidth": "0", + "eht_oper_centr_freq_seg0_idx": "1"} + hapd = hostapd.add_ap(apdev[0], params) + try: + dev[0].connect("eht", scan_freq="2412", key_mgmt="NONE") + hwsim_utils.test_connectivity(dev[0], hapd) + sta = hapd.get_sta(dev[0].own_addr()) + + dev[1].connect("eht", scan_freq="2412", key_mgmt="NONE") + sta = hapd.get_sta(dev[1].own_addr()) + + finally: + dev[0].request("DISCONNECT") + dev[1].request("DISCONNECT") + if hapd: + hapd.request("DISABLE") + subprocess.call(['iw', 'reg', 'set', '00']) + dev[0].flush_scan_cache() + dev[1].flush_scan_cache() + +def test_eht80_csa(dev, apdev): + """EHT with 80 MHz channel width and CSA""" + csa_supported(dev[0]) + try: + hapd = None + params = {"ssid": "eht", + "country_code": "US", + "hw_mode": "a", + "channel": "149", + "ieee80211n": "1", + "ht_capab": "[HT40+]", + "ieee80211ac": "1", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "155", + "ieee80211ax": "1", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "155", + "ieee80211be": "1", + "eht_oper_chwidth": "1", + "eht_oper_centr_freq_seg0_idx": "155"} + hapd = hostapd.add_ap(apdev[0], params) + + dev[0].connect("eht", key_mgmt="NONE", scan_freq="5745") + hwsim_utils.test_connectivity(dev[0], hapd) + + hapd.request("CHAN_SWITCH 5 5180 ht vht he eht blocktx center_freq1=5210 sec_channel_offset=1 bandwidth=80") + ev = hapd.wait_event(["CTRL-EVENT-STARTED-CHANNEL-SWITCH"], timeout=10) + if ev is None: + raise Exception("Channel switch start event not seen") + if "freq=5180" not in ev: + raise Exception("Unexpected channel in CS started") + ev = hapd.wait_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=10) + if ev is None: + raise Exception("Channel switch completion event not seen") + if "freq=5180" not in ev: + raise Exception("Unexpected channel in CS completed") + ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) + if ev is None: + raise Exception("CSA finished event timed out") + if "freq=5180" not in ev: + raise Exception("Unexpected channel in CSA finished event") + time.sleep(0.5) + hwsim_utils.test_connectivity(dev[0], hapd) + + hapd.request("CHAN_SWITCH 5 5745") + ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) + if ev is None: + raise Exception("CSA finished event timed out") + if "freq=5745" not in ev: + raise Exception("Unexpected channel in CSA finished event") + time.sleep(0.5) + hwsim_utils.test_connectivity(dev[0], hapd) + + # This CSA to same channel will fail in kernel, so use this only for + # extra code coverage. + hapd.request("CHAN_SWITCH 5 5745") + hapd.wait_event(["AP-CSA-FINISHED"], timeout=1) + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not eht_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + dev[0].request("DISCONNECT") + clear_regdom(hapd, dev) + +def test_eht_use_sta_nsts(dev, apdev): + """EHT with 80 MHz channel width and use_sta_nsts=1""" + try: + hapd = None + params = {"ssid": "eht", + "country_code": "FI", + "hw_mode": "a", + "channel": "36", + "ieee80211n": "1", + "ht_capab": "[HT40+]", + "ieee80211ac": "1", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "ieee80211ax": "1", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42", + "ieee80211be": "1", + "eht_oper_chwidth": "1", + "eht_oper_centr_freq_seg0_idx": "42", + "use_sta_nsts": "1"} + hapd = hostapd.add_ap(apdev[0], params) + bssid = apdev[0]['bssid'] + + dev[0].connect("eht", key_mgmt="NONE", scan_freq="5180") + hwsim_utils.test_connectivity(dev[0], hapd) + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not eht_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 160aa3e2df88..2aacbe046ecb 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -1092,7 +1092,7 @@ class WpaSupplicant: "wep_tx_keyidx", "scan_freq", "freq_list", "eap", "eapol_flags", "fragment_size", "scan_ssid", "auth_alg", "wpa_ptk_rekey", "disable_ht", "disable_vht", "bssid", - "disable_he", + "disable_he", "disable_eht", "disable_max_amsdu", "ampdu_factor", "ampdu_density", "disable_ht40", "disable_sgi", "disable_ldpc", "ht40_intolerant", "update_identifier", "mac_addr", -- 2.7.4