From patchwork Tue Oct 15 23:16:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pradeep Kumar Chitrapu X-Patchwork-Id: 1177468 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ux1MybwE"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=codeaurora.org header.i=@codeaurora.org header.b="VZ215S2F"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="VZ215S2F"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46tBBf4jSsz9sPJ for ; Wed, 16 Oct 2019 10:16:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=K0NZvpUVRxvOgYp+W9XRMKSeLbdR5C42ChE6B1ovInY=; b=ux1 MybwEa1/7m0i6MCXvi+TXYoEmR+4Cja85iTFLP8J1uunAGhpe7xKOiymsBM5J+9cjWZNNNkzp5t0K ZTHxkZsbZk2kJ7L3rUNJnnl63pqjlGbdx9aksUWh2wO8hgQPGybWYYNaEEO6plFbep2KnOzfZ/WOJ ZMDUCCPxO7n9rDepmIRaxJ8tRwFH6/raoKALiPx7WF7w7pFZAS8kSoZA9ZLtpVB00qjMGqN4THF+X iWI+3ts3oOOP4xp8jI/G4T8QBZE/8v2dgV1FDGsoiy+2823mTLhgp7Jo5Q6XDtOnn7YTBkGVNb+tx h8TH3+crxvkigSAF5QDx0Fv61kH+6BQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iKW3B-0000mD-CU; Tue, 15 Oct 2019 23:16:21 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iKW36-0000h4-BO for hostap@lists.infradead.org; Tue, 15 Oct 2019 23:16:18 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 51D2E60D78; Tue, 15 Oct 2019 23:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1571181374; bh=ZSymjt/1LddSGSpHM8KoZO0iSbliREEpjqH+Prh/evg=; h=From:To:Cc:Subject:Date:From; b=VZ215S2Ffo2BJEsow3xNuIT9FyVTxZ9RpzCub8ofA8XoWexk1lmnKgP199LqBE2zX vjXUk/y/R5P1MdZyxAhUwWOpyaZip6nVbIp7QwafRFuTcLVicVEmhcQbCTRzDtrFYW wVWoYKhKwOCx2jND7wRGlTpw5ZrKK2vjkXguW0n0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from pradeepc2-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pradeepc@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B928F60D3E; Tue, 15 Oct 2019 23:16:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1571181374; bh=ZSymjt/1LddSGSpHM8KoZO0iSbliREEpjqH+Prh/evg=; h=From:To:Cc:Subject:Date:From; b=VZ215S2Ffo2BJEsow3xNuIT9FyVTxZ9RpzCub8ofA8XoWexk1lmnKgP199LqBE2zX vjXUk/y/R5P1MdZyxAhUwWOpyaZip6nVbIp7QwafRFuTcLVicVEmhcQbCTRzDtrFYW wVWoYKhKwOCx2jND7wRGlTpw5ZrKK2vjkXguW0n0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B928F60D3E Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=pradeepc@codeaurora.org From: Pradeep Kumar Chitrapu To: Jouni Malinen Subject: [PATCH 1/2] HE: add 11ax info to ctrl iface status Date: Tue, 15 Oct 2019 16:16:08 -0700 Message-Id: <1571181369-20731-1-git-send-email-pradeepc@codeaurora.org> X-Mailer: git-send-email 2.1.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191015_161616_539029_8B2E6BCD X-CRM114-Status: GOOD ( 10.76 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [198.145.29.96 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -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_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pradeep Kumar Chitrapu , hostap@lists.infradead.org MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Pradeep Kumar Chitrapu --- src/ap/ctrl_iface_ap.c | 14 ++++++++++++++ src/ap/sta_info.c | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index 676a4c7835f3..5ece4ae3b392 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -731,6 +731,20 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf, if (os_snprintf_error(buflen - len, ret)) return len; len += ret; + if (iface->conf->ieee80211ax) { + ret = os_snprintf(buf + len, buflen - len, + "he_oper_chwidth=%d\n" + "he_oper_centr_freq_seg0_idx=%d\n" + "he_oper_centr_freq_seg1_idx=%d\n", + iface->conf->he_oper_chwidth, + iface->conf->he_oper_centr_freq_seg0_idx, + iface->conf->he_oper_centr_freq_seg1_idx); + if (os_snprintf_error(buflen - len, ret)) + return len; + len += ret; + } + + if (iface->conf->ieee80211ac && !hapd->conf->disable_11ac) { ret = os_snprintf(buf + len, buflen - len, "vht_oper_chwidth=%d\n" diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c index d7734ee64606..cbb8752ea681 100644 --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -1406,7 +1406,7 @@ int ap_sta_flags_txt(u32 flags, char *buf, size_t buflen) int res; buf[0] = '\0'; - res = os_snprintf(buf, buflen, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", + res = os_snprintf(buf, buflen, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (flags & WLAN_STA_AUTH ? "[AUTH]" : ""), (flags & WLAN_STA_ASSOC ? "[ASSOC]" : ""), (flags & WLAN_STA_AUTHORIZED ? "[AUTHORIZED]" : ""), @@ -1425,6 +1425,7 @@ int ap_sta_flags_txt(u32 flags, char *buf, size_t buflen) (flags & WLAN_STA_GAS ? "[GAS]" : ""), (flags & WLAN_STA_HT ? "[HT]" : ""), (flags & WLAN_STA_VHT ? "[VHT]" : ""), + (flags & WLAN_STA_HE ? "[HE]" : ""), (flags & WLAN_STA_VENDOR_VHT ? "[VENDOR_VHT]" : ""), (flags & WLAN_STA_WNM_SLEEP_MODE ? "[WNM_SLEEP_MODE]" : "")); From patchwork Tue Oct 15 23:16:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pradeep Kumar Chitrapu X-Patchwork-Id: 1177748 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WLFe0gp2"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=codeaurora.org header.i=@codeaurora.org header.b="nOOsa/LJ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="YYjELnTC"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46tSx76s3vz9sPJ for ; Wed, 16 Oct 2019 21:20:43 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=H0aVZVO1UiKMDPpUPEPceU3CbST+poKa8l0/rS+c2cw=; b=WLFe0gp2LkE7qvLOYDYDkbEF7P tcMjiDcFBRPRVyzuyYC8mKmXQAPywBDv4itbJp+2rbjNOf4OyyRM1IDdT2/8zbK5AmPsMQNtjqEv0 6mIk1+MTVNFoVfIoNSFZQVjy1CFCx/CGHwYerm5O2xBdoX/OLJbCoYX0C61RoXNt57hYANozdTDiN vWXBT3QxcGy3dPlJ7eIwxoAEcTSChCzSq6rVpnbP3bgLDuY2QVgIMCvsuVDFq/uFj6iIciDlEmZ+D wrHBj9wuV7I+V2e2IuSJIXGDeXmq142gcdZvtMiTC/DJUiV+LJPefpueMsd2tLgSjV9uHqLAn89YJ IjgyyytQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iKgQ4-0006bm-BM; Wed, 16 Oct 2019 10:20:40 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iKW36-0000ig-Q6 for hostap@lists.infradead.org; Tue, 15 Oct 2019 23:16:20 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 567D860D7E; Tue, 15 Oct 2019 23:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1571181376; bh=cZtJ2X3q9EGS8LXs28bHWsk2J+IXnGMqnwCBVubNKfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nOOsa/LJ1Ka9OIXm0SvHbI2XPr0w04q2PSJLun/V3wu/wDQkloPzGm/DVa8V3rOB3 6QRuR1xpPR5+Gqi93KdJlsnYk2p0MU9ZELX6YXMST5ToL9o/o45hyQI+9SB8MvktBL 2lFQ0nDVGzO6qAnhwvUsC/fGPpqfgMCE4qwng86s= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from pradeepc2-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pradeepc@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 29EE060D3D; Tue, 15 Oct 2019 23:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1571181374; bh=cZtJ2X3q9EGS8LXs28bHWsk2J+IXnGMqnwCBVubNKfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YYjELnTCLomoD3Nro/FBf3To1np6DJN0Y/udNFdxLFWYak+HO/0ztQHPqc653qu0T nUO+aK/i7+2acpuHI08VPPla8YiQPL4w6/ILfZioxDIP2mdJ0zf8hSqC/3obhan3Fy 6yatKH+H0eQ0VWRw9cic93EHf++Rw7VZy0HjZFFE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 29EE060D3D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=pradeepc@codeaurora.org From: Pradeep Kumar Chitrapu To: Jouni Malinen Subject: [PATCH 2/2] tests: HE AP Functionality Date: Tue, 15 Oct 2019 16:16:09 -0700 Message-Id: <1571181369-20731-2-git-send-email-pradeepc@codeaurora.org> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1571181369-20731-1-git-send-email-pradeepc@codeaurora.org> References: <1571181369-20731-1-git-send-email-pradeepc@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191015_161617_084131_1F293A66 X-CRM114-Status: GOOD ( 12.88 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [198.145.29.96 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -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_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-Mailman-Approved-At: Wed, 16 Oct 2019 03:20:37 -0700 X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pradeep Kumar Chitrapu , hostap@lists.infradead.org MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Pradeep Kumar Chitrapu --- tests/hwsim/test_ap_he.py | 1010 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1010 insertions(+) create mode 100644 tests/hwsim/test_ap_he.py diff --git a/tests/hwsim/test_ap_he.py b/tests/hwsim/test_ap_he.py new file mode 100644 index 000000000000..f06b80647804 --- /dev/null +++ b/tests/hwsim/test_ap_he.py @@ -0,0 +1,1010 @@ +# Test cases for HE operations with hostapd +# Copyright (c) 2019, The Linux Foundation. +# +# 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 +from test_ap_csa import csa_supported +from test_ap_ht import clear_scan_cache + +def he_supported(): + cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE) + reg = cmd.stdout.read() + if "@ 80)" in reg or "@ 160)" in reg: + return True + return False + +def test_ap_he80(dev, apdev): + """HE with 80 MHz channel width""" + try: + hapd = None + params = {"ssid": "he", + "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"} + hapd = hostapd.add_ap(apdev[0], params) + bssid = apdev[0]['bssid'] + + dev[0].connect("he", 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 != "390001": + 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") + + 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") + + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not he_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + dev[0].request("DISCONNECT") + clear_regdom(hapd, dev) + +def test_ap_he_wifi_generation(dev, apdev): + """HE and wifi_generation""" + try: + hapd = None + params = {"ssid": "he", + "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"} + hapd = hostapd.add_ap(apdev[0], params) + bssid = apdev[0]['bssid'] + + dev[0].connect("he", key_mgmt="NONE", scan_freq="5180") + 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") + #raise Exception("Missing wifi_generation information") + if status['wifi_generation'] != "6": + 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("he", key_mgmt="NONE", scan_freq="5180") + 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") + #raise Exception("Missing wifi_generation information (connect)") + if status['wifi_generation'] != "6": + 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 he_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + dev[0].request("DISCONNECT") + clear_regdom(hapd, dev) + +def he80_test(apdev, dev, channel, ht_capab): + clear_scan_cache(apdev) + try: + hapd = None + params = {"ssid": "he", + "country_code": "FI", + "hw_mode": "a", + "channel": str(channel), + "ht_capab": ht_capab, + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42"} + hapd = hostapd.add_ap(apdev, params) + bssid = apdev['bssid'] + + dev[0].connect("he", 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 he_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev) + +def test_ap_he80b(dev, apdev): + """HE with 80 MHz channel width (HT40- channel 40)""" + he80_test(apdev[0], dev, 40, "[HT40-]") + +def test_ap_he80c(dev, apdev): + """HE with 80 MHz channel width (HT40+ channel 44)""" + he80_test(apdev[0], dev, 44, "[HT40+]") + +def test_ap_he80d(dev, apdev): + """HE with 80 MHz channel width (HT40- channel 48)""" + he80_test(apdev[0], dev, 48, "[HT40-]") + +def test_ap_he80_params(dev, apdev): + """HE with 80 MHz channel width and number of optional features enabled""" + try: + hapd = None + params = {"ssid": "he", + "country_code": "FI", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+][SHORT-GI-40][DSS_CCK-40]", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "1", + "vht_capab": "[MAX-MPDU-11454][RXLDPC][SHORT-GI-80][TX-STBC-2BY1][RX-STBC-1][MAX-A-MPDU-LEN-EXP0]", + "vht_oper_centr_freq_seg0_idx": "42", + "require_vht": "1", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42", + "he_su_beamformer": "1", + "he_mu_beamformer": "1", + "he_bss_color":"1", + "he_default_pe_duration":"1", + "he_twt_required":"1", + "he_rts_threshold":"1"} + hapd = hostapd.add_ap(apdev[0], params) + + dev[1].connect("he", key_mgmt="NONE", scan_freq="5180", + disable_vht="1", wait_connect=False) + dev[0].connect("he", key_mgmt="NONE", scan_freq="5180") + dev[2].connect("he", 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 he_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev, count=3) + +def test_ap_he80_invalid(dev, apdev): + """HE with invalid 80 MHz channel configuration (seg1)""" + try: + hapd = None + params = {"ssid": "he", + "country_code": "US", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "vht_oper_centr_freq_seg1_idx": "159", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42", + "he_oper_centr_freq_seg1_idx": "155", + '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 he_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev) + +def test_ap_he80_invalid2(dev, apdev): + """HE with invalid 80 MHz channel configuration (seg0)""" + try: + hapd = None + params = {"ssid": "he", + "country_code": "US", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "he_oper_chwidth": "1", + "he_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 he_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev) + +def test_ap_he_20(devs, apdevs): + """HE and 20 MHz channel""" + dev = devs[0] + ap = apdevs[0] + try: + hapd = None + params = {"ssid": "test-he20", + "country_code": "DE", + "hw_mode": "a", + "channel": "36", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "ht_capab": "", + "vht_capab": "", + "vht_oper_chwidth": "0", + "vht_oper_centr_freq_seg0_idx": "0", + "supported_rates": "60 120 240 360 480 540", + "require_vht": "1", + "he_oper_chwidth": "0", + "he_oper_centr_freq_seg0_idx": "0"} + hapd = hostapd.add_ap(ap, params) + dev.connect("test-he20", scan_freq="5180", key_mgmt="NONE") + hwsim_utils.test_connectivity(dev, hapd) + finally: + dev.request("DISCONNECT") + clear_regdom(hapd, devs) + +def test_ap_he_40(devs, apdevs): + """HE and 40 MHz channel""" + dev = devs[0] + ap = apdevs[0] + try: + hapd = None + params = {"ssid": "test-he40", + "country_code": "DE", + "hw_mode": "a", + "channel": "36", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "ht_capab": "[HT40+]", + "vht_capab": "", + "vht_oper_chwidth": "0", + "vht_oper_centr_freq_seg0_idx": "38", + "he_oper_chwidth": "0", + "he_oper_centr_freq_seg0_idx": "38", + "he_su_beamformer": "1", + "he_mu_beamformer": "1"} + hapd = hostapd.add_ap(ap, params) + dev.connect("test-he40", scan_freq="5180", key_mgmt="NONE") + hwsim_utils.test_connectivity(dev, hapd) + finally: + dev.request("DISCONNECT") + clear_regdom(hapd, devs) + +def test_ap_he160(dev, apdev): + """HE with 160 MHz channel width (1)""" + try: + hapd = None + params = {"ssid": "he", + "country_code": "FI", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "2", + "vht_oper_centr_freq_seg0_idx": "50", + "he_oper_chwidth": "2", + "he_oper_centr_freq_seg0_idx": "50", + 'ieee80211d': '1', + 'ieee80211h': '1'} + hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) + + 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") + + state = hapd.get_status_field("state") + if state != "ENABLED": + raise Exception("Unexpected interface state") + + dev[0].connect("he", 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)) + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not he_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_ap_he160b(dev, apdev): + """HE with 160 MHz channel width (2)""" + try: + hapd = None + + params = {"ssid": "he", + "country_code": "FI", + "hw_mode": "a", + "channel": "104", + "ht_capab": "[HT40-]", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "2", + "vht_oper_centr_freq_seg0_idx": "114", + "he_oper_chwidth": "2", + "he_oper_centr_freq_seg0_idx": "114", + 'ieee80211d': '1', + 'ieee80211h': '1'} + hapd = hostapd.add_ap(apdev[1], params, wait_enabled=False) + + ev = wait_dfs_event(hapd, "DFS-CAC-START", 5) + if "DFS-CAC-START" not in ev: + raise Exception("Unexpected DFS event(2)") + + 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(2)") + if "freq=5520" not in ev: + raise Exception("Unexpected DFS freq result(2)") + + ev = hapd.wait_event(["AP-ENABLED"], timeout=5) + if not ev: + raise Exception("AP setup timed out(2)") + + state = hapd.get_status_field("state") + if state != "ENABLED": + raise Exception("Unexpected interface state(2)") + + freq = hapd.get_status_field("freq") + if freq != "5520": + raise Exception("Unexpected frequency(2)") + + dev[0].connect("he", key_mgmt="NONE", scan_freq="5520") + dev[0].wait_regdom(country_ie=True) + hwsim_utils.test_connectivity(dev[0], hapd) + sig = dev[0].request("SIGNAL_POLL").splitlines() + if "FREQUENCY=5520" 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)) + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not he_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_ap_he160_no_dfs_100_plus(dev, apdev): + """HE with 160 MHz channel width and no DFS (100 plus)""" + run_ap_he160_no_dfs(dev, apdev, "100", "[HT40+]") + +def test_ap_he160_no_dfs(dev, apdev): + """HE with 160 MHz channel width and no DFS (104 minus)""" + run_ap_he160_no_dfs(dev, apdev, "104", "[HT40-]") + +def test_ap_he160_no_dfs_108_plus(dev, apdev): + """HE with 160 MHz channel width and no DFS (108 plus)""" + run_ap_he160_no_dfs(dev, apdev, "108", "[HT40+]") + +def test_ap_he160_no_dfs_112_minus(dev, apdev): + """HE with 160 MHz channel width and no DFS (112 minus)""" + run_ap_he160_no_dfs(dev, apdev, "112", "[HT40-]") + +def test_ap_he160_no_dfs_116_plus(dev, apdev): + """HE with 160 MHz channel width and no DFS (116 plus)""" + run_ap_he160_no_dfs(dev, apdev, "116", "[HT40+]") + +def test_ap_he160_no_dfs_120_minus(dev, apdev): + """HE with 160 MHz channel width and no DFS (120 minus)""" + run_ap_he160_no_dfs(dev, apdev, "120", "[HT40-]") + +def test_ap_he160_no_dfs_124_plus(dev, apdev): + """HE with 160 MHz channel width and no DFS (124 plus)""" + run_ap_he160_no_dfs(dev, apdev, "124", "[HT40+]") + +def test_ap_he160_no_dfs_128_minus(dev, apdev): + """HE with 160 MHz channel width and no DFS (128 minus)""" + run_ap_he160_no_dfs(dev, apdev, "128", "[HT40-]") + +def run_ap_he160_no_dfs(dev, apdev, channel, ht_capab): + try: + hapd = None + params = {"ssid": "he", + "country_code": "ZA", + "hw_mode": "a", + "channel": channel, + "ht_capab": ht_capab, + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "2", + "vht_oper_centr_freq_seg0_idx": "114", + "he_oper_chwidth": "2", + "he_oper_centr_freq_seg0_idx": "114", + 'ieee80211d': '1', + 'ieee80211h': '1'} + hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) + ev = hapd.wait_event(["AP-ENABLED"], timeout=2) + if not ev: + cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE) + reg = cmd.stdout.readlines() + for r in reg: + if "5490" in r and "DFS" in r: + raise HwsimSkip("ZA regulatory rule did not have DFS requirement removed") + raise Exception("AP setup timed out") + + freq = str(int(channel) * 5 + 5000) + dev[0].connect("he", key_mgmt="NONE", scan_freq=freq) + dev[0].wait_regdom(country_ie=True) + hwsim_utils.test_connectivity(dev[0], hapd) + sig = dev[0].request("SIGNAL_POLL").splitlines() + if "FREQUENCY=" + freq 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)) + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not he_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev) + +def test_ap_he160_no_ht40(dev, apdev): + """HE with 160 MHz channel width and HT40 disabled""" + try: + hapd = None + params = {"ssid": "he", + "country_code": "ZA", + "hw_mode": "a", + "channel": "108", + "ht_capab": "", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "2", + "vht_oper_centr_freq_seg0_idx": "114", + "he_oper_chwidth": "2", + "he_oper_centr_freq_seg0_idx": "114", + 'ieee80211d': '1', + 'ieee80211h': '1'} + hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) + ev = hapd.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=2) + if not ev: + cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE) + reg = cmd.stdout.readlines() + for r in reg: + if "5490" in r and "DFS" in r: + raise HwsimSkip("ZA regulatory rule did not have DFS requirement removed") + raise Exception("AP setup timed out") + if "AP-ENABLED" in ev: + # This was supposed to fail due to sec_channel_offset == 0 + raise Exception("Unexpected AP-ENABLED") + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not he_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev) + +def test_ap_he80plus80(dev, apdev): + """HE with 80+80 MHz channel width""" + try: + hapd = None + hapd2 = None + params = {"ssid": "he", + "country_code": "US", + "hw_mode": "a", + "channel": "52", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "3", + "vht_oper_centr_freq_seg0_idx": "58", + "vht_oper_centr_freq_seg1_idx": "155", + "he_oper_chwidth": "3", + "he_oper_centr_freq_seg0_idx": "58", + "he_oper_centr_freq_seg1_idx": "155", + 'ieee80211d': '1', + 'ieee80211h': '1'} + hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) + # This will actually fail since DFS on 80+80 is not yet supported + ev = hapd.wait_event(["AP-DISABLED"], timeout=5) + # ignore result to avoid breaking the test once 80+80 DFS gets enabled + + params = {"ssid": "he2", + "country_code": "US", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "3", + "vht_oper_centr_freq_seg0_idx": "42", + "vht_oper_centr_freq_seg1_idx": "155", + "he_oper_chwidth": "3", + "he_oper_centr_freq_seg0_idx": "42", + "he_oper_centr_freq_seg1_idx": "155"} + hapd2 = hostapd.add_ap(apdev[1], params, wait_enabled=False) + + ev = hapd2.wait_event(["AP-ENABLED", "AP-DISABLED"], timeout=5) + if not ev: + raise Exception("AP setup timed out(2)") + if "AP-DISABLED" in ev: + # Assume this failed due to missing regulatory update for now + raise HwsimSkip("80+80 MHz channel not supported in regulatory information") + + state = hapd2.get_status_field("state") + if state != "ENABLED": + raise Exception("Unexpected interface state(2)") + + dev[1].connect("he2", key_mgmt="NONE", scan_freq="5180") + hwsim_utils.test_connectivity(dev[1], hapd2) + sig = dev[1].request("SIGNAL_POLL").splitlines() + if "FREQUENCY=5180" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig)) + if "WIDTH=80+80 MHz" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig)) + if "CENTER_FRQ1=5210" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(3): " + str(sig)) + if "CENTER_FRQ2=5775" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(4): " + str(sig)) + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not he_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + dev[0].request("DISCONNECT") + dev[1].request("DISCONNECT") + if hapd: + hapd.request("DISABLE") + if hapd2: + hapd2.request("DISABLE") + subprocess.call(['iw', 'reg', 'set', '00']) + dev[0].flush_scan_cache() + dev[1].flush_scan_cache() + +def test_ap_he80plus80_invalid(dev, apdev): + """HE with invalid 80+80 MHz channel""" + try: + hapd = None + params = {"ssid": "he", + "country_code": "US", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "3", + "vht_oper_centr_freq_seg0_idx": "42", + "vht_oper_centr_freq_seg1_idx": "0", + "he_oper_chwidth": "3", + "he_oper_centr_freq_seg0_idx": "42", + "he_oper_centr_freq_seg1_idx": "0", + 'ieee80211d': '1', + 'ieee80211h': '1'} + hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) + # This fails due to missing(invalid) 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 he_supported(): + raise HwsimSkip("80/160 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev) + +def test_ap_he80_csa(dev, apdev): + """HE with 80 MHz channel width and CSA""" + csa_supported(dev[0]) + try: + hapd = None + params = {"ssid": "he", + "country_code": "US", + "hw_mode": "a", + "channel": "149", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "155", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "155"} + hapd = hostapd.add_ap(apdev[0], params) + + dev[0].connect("he", key_mgmt="NONE", scan_freq="5745") + hwsim_utils.test_connectivity(dev[0], hapd) + + hapd.request("CHAN_SWITCH 5 5180 ht vht he 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 he_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + dev[0].request("DISCONNECT") + clear_regdom(hapd, dev) + +def test_ap_he_on_24ghz(dev, apdev): + """Subset of HE features on 2.4 GHz""" + hapd = None + params = {"ssid": "test-he-2g", + "hw_mode": "g", + "channel": "1", + "ieee80211n": "1", + "vht_oper_chwidth": "0", + "vht_oper_centr_freq_seg0_idx": "1", + "he_oper_chwidth": "0", + "he_oper_centr_freq_seg0_idx": "1"} + hapd = hostapd.add_ap(apdev[0], params) + try: + dev[0].connect("test-he-2g", scan_freq="2412", key_mgmt="NONE") + hwsim_utils.test_connectivity(dev[0], hapd) + sta = hapd.get_sta(dev[0].own_addr()) + + dev[1].connect("test-he-2g", 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_ap_he80_pwr_constraint(dev, apdev): + """HE with 80 MHz channel width and local power constraint""" + hapd = None + try: + params = {"ssid": "he", + "country_code": "FI", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211d": "1", + "local_pwr_constraint": "3", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42"} + hapd = hostapd.add_ap(apdev[0], params) + + dev[0].connect("he", key_mgmt="NONE", scan_freq="5180") + dev[0].wait_regdom(country_ie=True) + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not he_supported(): + raise HwsimSkip("80 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_ap_he_use_sta_nsts(dev, apdev): + """HE with 80 MHz channel width and use_sta_nsts=1""" + try: + hapd = None + params = {"ssid": "he", + "country_code": "FI", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42", + "use_sta_nsts": "1"} + hapd = hostapd.add_ap(apdev[0], params) + bssid = apdev[0]['bssid'] + + dev[0].connect("he", 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 he_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + clear_regdom(hapd, dev) + +def test_ap_he_tkip(dev, apdev): + """HE and TKIP""" + try: + hapd = None + params = {"ssid": "he", + "wpa": "1", + "wpa_key_mgmt": "WPA-PSK", + "wpa_pairwise": "TKIP", + "wpa_passphrase": "12345678", + "country_code": "FI", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42", + "he_oper_chwidth": "1", + "he_oper_centr_freq_seg0_idx": "42"} + hapd = hostapd.add_ap(apdev[0], params) + bssid = apdev[0]['bssid'] + + dev[0].connect("he", psk="12345678", 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=20 MHz (no HT)" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig)) + status = hapd.get_status() + logger.info("hostapd STATUS: " + str(status)) + if status["ieee80211n"] != "0": + raise Exception("Unexpected STATUS ieee80211n value") + if status["ieee80211ac"] != "0": + raise Exception("Unexpected STATUS ieee80211ac value") + if status["ieee80211ax"] != "1": + raise Exception("Unexpected STATUS ieee80211ax value") + if status["secondary_channel"] != "0": + raise Exception("Unexpected STATUS secondary_channel value") + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not he_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + dev[0].request("DISCONNECT") + clear_regdom(hapd, dev) + +def test_ap_he_40_fallback_to_20(devs, apdevs): + """HE and 40 MHz channel configuration falling back to 20 MHz""" + dev = devs[0] + ap = apdevs[0] + try: + hapd = None + params = {"ssid": "test-he40", + "country_code": "US", + "hw_mode": "a", + "basic_rates": "60 120 240", + "channel": "161", + "ieee80211d": "1", + "ieee80211h": "1", + "ieee80211n": "1", + "ieee80211ac": "1", + "ieee80211ax": "1", + "ht_capab": "[HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40]", + "vht_capab": "[RXLDPC][SHORT-GI-80][TX-STBC-2BY1][RX-STBC1][MAX-MPDU-11454][MAX-A-MPDU-LEN-EXP7]", + "vht_oper_chwidth": "0", + "vht_oper_centr_freq_seg0_idx": "155", + "he_oper_chwidth": "0", + "he_oper_centr_freq_seg0_idx": "155"} + hapd = hostapd.add_ap(ap, params) + dev.connect("test-he40", scan_freq="5805", key_mgmt="NONE") + dev.wait_regdom(country_ie=True) + hwsim_utils.test_connectivity(dev, hapd) + finally: + clear_regdom(hapd, devs) + +def test_ap_he80_to_24g_he(dev, apdev): + """HE with 80 MHz channel width reconfigured to 2.4 GHz HE""" + try: + hapd = None + params = {"ssid": "he", + "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"} + 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("he_oper_chwidth", "") + hapd.set("he_oper_centr_freq_seg0_idx", "") + hapd.set("vht_oper_chwidth", "") + hapd.set("vht_oper_centr_freq_seg0_idx", "") + hapd.enable() + + dev[0].connect("he", key_mgmt="NONE", scan_freq="2412") + except Exception as e: + if isinstance(e, Exception) and str(e) == "AP startup failed": + if not he_supported(): + raise HwsimSkip("80 MHz channel not supported in regulatory information") + raise + finally: + dev[0].request("DISCONNECT") + clear_regdom(hapd, dev)