From patchwork Thu Dec 21 06:49:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1878516 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SwD4w0y4Zz20LV for ; Wed, 20 Dec 2023 23:53:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wkrEQmRALm34JFMoh66ma8SllN3oz/LTm+Oa/EE9VQs=; b=Ma0b0UnsRPkPo/ k7JrU7pE1zhkT7CPOODjGpvsB6BXKu+PhQOUwrvS3z/HiUZ07MZggZwrwd9UphsbK7F/ZS70QNuWc aCTUQq45l/puUcY31hXYZ+WiMW/v47J5s1t1F2g1LQnPNEbgfoOgpsTbgH5QE2l+mqQLL7G41BczQ F7Gt6WqJIZ1JH5F3F0pQIxsleWUSYlnMt+MYGvyxwig5cudalM7ok3oN4/O6BA9EWV8lEnDVwjz5u j8wmJcII04G5MzxWRIgrjs4cYZmfl5HwNtvYs7TL1lV+2d3YH7sXb8ID3JGEyXtcKKyH0YvEgUtVX 9ozHnmRMWrItFA1awO7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rFw3k-00HPxB-2M; Wed, 20 Dec 2023 12:52:24 +0000 Received: from mgamail.intel.com ([192.55.52.43]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rFw3e-00HPt4-2T for hostap@lists.infradead.org; Wed, 20 Dec 2023 12:52:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703076738; x=1734612738; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/th1UQaYjespkhk9SzZulAwbMnVbm9hvTufNmKhCxug=; b=ezMFdFtLDRROtEIDQs4VccGDX6FCcJzMxp/3ZZcdTMl2IBVBQcht/gQn 2x38lVEqGCqX/3K4hCz5koZIRZG3hjrxAKW2H4F5rJ4wFeLtqmIiR3r5R XhsVagCxlC7MSzeY7s97schc9VsuDJC+iJtOidK+GO6MTXJb9JsMOu1dH L9YFBdN1w5bVM1wxdWVQLITkb9sYxM0TgN+kwEl9ON3ontlTP+S25I9Sl I4CMkjKlSDea7iaz+oe9J6y+qOF7UJitTtNd8+pdC06PrSJhbshNYp31C zQB9yivQnCjEAopOQ7u/z2+VqM8AFGyYwB69oQx8Q656vJ/tyQlqYQuMZ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="481996435" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="481996435" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 04:52:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="17943128" Received: from unknown (HELO WEIS0042.iil.intel.com) ([10.12.217.211]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 04:52:09 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Andrei Otcheretianski , Ilan Peer Subject: [PATCH 2/5] tests: Add more EHT tests with various bandwidths and channels Date: Thu, 21 Dec 2023 08:49:31 +0200 Message-ID: <20231221064934.3887910-2-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221064934.3887910-1-andrei.otcheretianski@intel.com> References: <20231221064934.3887910-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231220_045218_845686_9E45C718 X-CRM114-Status: GOOD ( 11.10 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Test EHT connection on 5Ghz band with channels 20-160Mhz and up to 320Mhz on 6Ghz band. Signed-off-by: Ilan Peer Signed-off-by: Andrei Otcheretianski --- tests/hwsim/hostapd.py | 44 +++++++++++ tests/hwsim/test_eht.py | 165 ++++++++ [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [192.55.52.43 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 2.5 DATE_IN_FUTURE_12_24 Date: is 12 to 24 hours after Received: date -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Test EHT connection on 5Ghz band with channels 20-160Mhz and up to 320Mhz on 6Ghz band. Signed-off-by: Ilan Peer Signed-off-by: Andrei Otcheretianski --- tests/hwsim/hostapd.py | 44 +++++++++++ tests/hwsim/test_eht.py | 165 ++++++++++++++++++++++++++++++++++++++++ tests/hwsim/utils.py | 24 ++++++ 3 files changed, 233 insertions(+) diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py index 205f15e9a4..65771ee007 100644 --- a/tests/hwsim/hostapd.py +++ b/tests/hwsim/hostapd.py @@ -898,6 +898,50 @@ def ht40_minus_params(channel="1", ssid=None, country=None): params['ht_capab'] = "[HT40-]" return params +def he_params(ssid=None): + params = {"ssid": "he6ghz", + "ieee80211n": "1", + "ieee80211ac": "1", + "wmm_enabled": "1", + "channel": "5", + "op_class": "131", + "ieee80211ax": "1", + "hw_mode": "a", + "he_oper_centr_freq_seg0_idx": "15", + "he_oper_chwidth": "2", + "vht_oper_chwidth": "2"} + if ssid: + params["ssid"] = ssid + + return params + +def he_wpa_params(ssid=None, passphrase=None): + params = he_params(ssid) + params["wpa"] = "1" + params["wpa_key_mgmt"] = "WPA-PSK" + params["wpa_pairwise"] = "TKIP" + if passphrase: + params["wpa_passphrase"] = passphrase + + return params + +def he_wpa2_params(ssid=None, wpa_key_mgmt="SAE", rsn_pairwise="CCMP", + group_cipher="CCMP", sae_pwe="1", passphrase=None): + params = he_params(ssid) + params["wpa"] = "2" + params["wpa_key_mgmt"] = wpa_key_mgmt + params["rsn_pairwise"] = rsn_pairwise + params["group_cipher"] = group_cipher + params["ieee80211w"] = "2" + if wpa_key_mgmt == "SAE": + params["sae_pwe"] = sae_pwe + params["sae_groups"] = "19" + + if passphrase: + params["wpa_passphrase"] = passphrase + + return params + def cmd_execute(apdev, cmd, shell=False): hapd_global = HostapdGlobal(apdev) return hapd_global.cmd_execute(cmd, shell=shell) diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py index b799fcd855..883099298b 100644 --- a/tests/hwsim/test_eht.py +++ b/tests/hwsim/test_eht.py @@ -1075,3 +1075,168 @@ def test_eht_ap_mld_proto(dev, apdev): mle += "3004010802040b160c12182432043048606c2d1afe131bffff000000000000000000000100000000000000000000ff16230178c81a400000bfce0000000000000000fafffaffff126c07007c0000feffff7f0100888888880000" hdr = "00000000" + bssid0 + mld_addr + bssid0 + "1000" send_check(hapd0, hdr + assocreq_start + mle + assocreq_end) + +def _5ghz_chanwidth_to_bw(op): + return { + 0: "40", + 1: "80", + 2: "160", + 3: "80+80", + }.get(op, "20") + +def _test_eht_5ghz(dev, apdev, channel, chanwidth, ccfs1, ccfs2=0): + try: + params = {"ssid": "eht", + "country_code": "US", + "hw_mode": "a", + "channel": str(channel), + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "ieee80211be": "1", + "vht_oper_chwidth": str(chanwidth), + "vht_oper_centr_freq_seg0_idx": str(ccfs1), + "vht_oper_centr_freq_seg1_idx": str(ccfs2), + "he_oper_chwidth": str(chanwidth), + "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: + params["ht_capab"] = "[HT40+]" + else: + params["ht_capab"] = "[HT40-]" + else: + params["ht_capab"] = "[HT40+]" + if chanwidth == 2: + params["vht_capab"] = "[VHT160]" + elif chanwidth == 3: + params["vht_capab"] = "[VHT160-80PLUS80]" + + freq = 5000 + channel * 5 + if chanwidth != 0 or channel != ccfs1: + bw = _5ghz_chanwidth_to_bw(chanwidth) + + hapd = hostapd.add_ap(apdev[0], params) + dev[0].connect("eht", key_mgmt="NONE", scan_freq=str(freq)) + + eht_verify_status(dev[0], hapd, freq, bw, is_ht=True, is_vht=True) + eht_verify_wifi_version(dev[0]) + hwsim_utils.test_connectivity(dev[0], hapd) + + finally: + dev[0].request("DISCONNECT") + set_world_reg(apdev[0], None, dev[0]) + +def test_eht_5ghz_20mhz(dev, apdev): + """EHT with 20 MHz channel width on 5GHz""" + _test_eht_5ghz(dev, apdev, 36, 0, 36, 0) + +def test_eht_5ghz_40mhz_low(dev, apdev): + """EHT with 40 MHz channel width on 5GHz. Secondary channel above""" + _test_eht_5ghz(dev, apdev, 36, 0, 38, 0) + +def test_eht_5ghz_40mhz_high(dev, apdev): + """EHT with 80 MHz channel width on 5GHz. Secondary channel below""" + _test_eht_5ghz(dev, apdev, 40, 0, 38, 0) + +def test_eht_5ghz_80mhz_1(dev, apdev): + """EHT with 80 MHz channel width on 5GHz. Primary=149""" + _test_eht_5ghz(dev, apdev, 36, 1, 42, 0) + +def test_eht_5ghz_80mhz_2(dev, apdev): + """EHT with 80 MHz channel width on 5GHz. Primary=149""" + _test_eht_5ghz(dev, apdev, 149, 1, 155, 0) + +def test_eht_5ghz_80p80mhz(dev, apdev): + """EHT with 80+80 MHz channel width on 5GHz""" + _test_eht_5ghz(dev, apdev, 36, 3, 42, 155) + +def _6ghz_op_class_to_bw(op): + return { + 131: "20", + 132: "40", + 133: "80", + 134: "160", + 137: "320", + }.get(op, "20") + +def _test_eht_6ghz(dev, apdev, channel, op_class, ccfs1): + check_sae_capab(dev[0]) + + # CA enables 320mhz channels without NO-IR restriction + dev[0].cmd_execute(['iw', 'reg', 'set', 'CA']) + wait_regdom_changes(dev[0]) + + try: + ssid = "eht_6ghz_sae" + passphrase = "12345678" + params = hostapd.he_wpa2_params(ssid=ssid, passphrase=passphrase) + params["ieee80211be"] = "1" + params["channel"] = str(channel) + params["op_class"] = str(op_class) + params["he_oper_centr_freq_seg0_idx"] = str(ccfs1) + params["eht_oper_centr_freq_seg0_idx"] = str(ccfs1) + params["country_code"] = "CA" + + if not he_6ghz_supported(): + raise HwsimSkip("6GHz frequency is not supported") + if op_class == 137 and not eht_320mhz_supported(): + raise HwsimSkip("320Mhz channels are not supported") + + hapd = hostapd.add_ap(apdev[0], params) + status = hapd.get_status() + logger.info("hostapd STATUS: " + str(status)) + if hapd.get_status_field("ieee80211ax") != "1": + raise Exception("STATUS did not indicate ieee80211ax=1") + + if hapd.get_status_field("ieee80211be") != "1": + raise Exception("STATUS did not indicate ieee80211be=1") + + wpas = dev[0] + wpas.set("sae_pwe", "1") + + freq = 5950 + channel * 5 + bw = _6ghz_op_class_to_bw(op_class) + + wpas.connect(ssid, key_mgmt="SAE", psk=passphrase, ieee80211w="2", + scan_freq=str(freq)) + + eht_verify_status(wpas, hapd, freq, bw) + eht_verify_wifi_version(wpas) + hwsim_utils.test_connectivity(wpas, hapd) + finally: + dev[0].cmd_execute(['iw', 'reg', 'set', '00']) + wait_regdom_changes(dev[0]) + +def test_eht_6ghz_20mhz(dev, apdev): + """EHT with 20 MHz channel width on 6GHz""" + _test_eht_6ghz(dev, apdev, 5, 131, 5) + +def test_eht_6ghz_40mhz(dev, apdev): + """EHT with 40 MHz channel width on 6GHz""" + _test_eht_6ghz(dev, apdev, 5, 132, 3) + +def test_eht_6ghz_80mhz(dev, apdev): + """EHT with 80 MHz channel width on 6GHz""" + _test_eht_6ghz(dev, apdev, 5, 133, 7) + +def test_eht_6ghz_160mhz(dev, apdev): + """EHT with 160 MHz channel width on 6GHz""" + _test_eht_6ghz(dev, apdev, 5, 134, 15) + +def test_eht_6ghz_320mhz(dev, apdev): + """EHT with 320 MHz channel width on 6GHz""" + _test_eht_6ghz(dev, apdev, 5, 137, 31) + +def test_eht_6ghz_320mhz_2(dev, apdev): + """EHT with 320 MHz channel width on 6GHz center 63""" + _test_eht_6ghz(dev, apdev, 37, 137, 63) + +def test_eht_6ghz_320mhz_3(dev, apdev): + """EHT with 320 MHz channel width on 6GHz center 31 primary 37""" + _test_eht_6ghz(dev, apdev, 37, 137, 31) \ No newline at end of file diff --git a/tests/hwsim/utils.py b/tests/hwsim/utils.py index d572bdc4c9..d01e1fbbfe 100644 --- a/tests/hwsim/utils.py +++ b/tests/hwsim/utils.py @@ -12,6 +12,7 @@ import subprocess import time import remotehost import logging +import re logger = logging.getLogger() import hostapd @@ -156,6 +157,29 @@ def vht_supported(): return True return False +def eht_320mhz_supported(): + cmd = subprocess.Popen(["iw", "reg", "get"], + stdout=subprocess.PIPE) + cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE) + reg = cmd.stdout.read().decode() + if "@ 320)" in reg: + return True + return False + +def he_6ghz_supported(freq=5975): + cmd = subprocess.Popen(["iw", "reg", "get"], + stdout=subprocess.PIPE) + reg_rules = cmd.stdout.read().decode().splitlines() + for rule in reg_rules: + m = re.search(r"\s*\(\d+\s*-\s*\d+", rule) + if not m: + continue + freqs = re.findall(r"\d+", m.group(0)) + if int(freqs[0]) <= freq and freq <= int(freqs[1]): + return True + + return False + # This function checks whether the provided dev, which may be either # WpaSupplicant or Hostapd supports CSA. def csa_supported(dev):