From patchwork Wed Oct 1 16:49:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Ewing X-Patchwork-Id: 2144470 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=zxN8+pHj; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=teledatics.com header.i=@teledatics.com header.a=rsa-sha256 header.s=mail header.b=S0FZPOli; dkim-atps=neutral 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 4ccLXh1j2Cz1yG6 for ; Thu, 2 Oct 2025 02:50:58 +1000 (AEST) 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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ud4VTQRbnfxXT8WphpOGuABkzT2tDx3deSo4xwOoz+U=; b=zxN8+pHj4yJ9T6 JSEtexK6a9PIKvAAzxL2BAXVDmZcoauRexOWUieDbR9An15+2Z2gt9sYluD2EP3GG5NE/+G3BzRHy gjOBJoVhNaM7eGvH3r2BPh1BaHjn4GwxgvzTxhMReavQdSYkWNkwszvT2Oh7+7TGBHyuQP8wxkhvp hAdM59Ey4rVE7xt1fZ/i8rhFGfCbkFZtEZB4aIb2yPlNUkFonKdOUtJnTgphGrhQakc7FdjIo/nCy Jk8uj5120m1UZYKDU6T4jGFc5EcWHP6+bm0uCzN+SQ6tEcJv8+KuCMShjkkAgYfQx8nRFSR8iSmdJ YpgSQV4BRagfb7zMbfiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v401u-00000008YvJ-2Plf; Wed, 01 Oct 2025 16:50:14 +0000 Received: from teledatics.com ([139.177.205.105]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v401q-00000008Ytg-2eas for hostap@lists.infradead.org; Wed, 01 Oct 2025 16:50:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=teledatics.com; s=mail; t=1759337410; bh=j8hSXJrm9FzaSJjUEIDrDpAUtAQxlbIH/ijMGOVpJWI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=S0FZPOlieql8HTbMIJezk+eesSRt/od3CFconYmph2REeKj1qCc2rc5hJnB1Uaa7B 8NbJ+NIPTs45bGi4WoD6l1WYtyt+Vdz156mojz84qapCy2jIuu2S2Sp7g4qwJtguat hACzUiCox6Faa6ZSg91Ah67NfFRDeOZ+YfioBjlhkijrEKbVsdfWOl9J64a55+xEni 77zb5IruTXDEbGPIow+a8VKdOzJJZWADBHwJnTLBBe7JoRzIfQWPrqUkJNEkB01Lyy xw5B7WNWZ+jRmu9bKR1nQJUuPaVKf+f873nIWB12KMy+meZkQeELe4dcoLfIN5IUoJ EKDnsOO9WoQNA== Received: from dev1.lan (185-157-161-124.pool.ovpn.com [185.157.161.124]) by teledatics.com (8.18.1/8.18.1/Debian-2) with ESMTP id 591Go4nT292035 for ; Wed, 1 Oct 2025 16:50:09 GMT From: James Ewing To: hostap@lists.infradead.org Subject: [PATCH 1/6] tests: add S1G channel helpers Date: Wed, 1 Oct 2025 12:49:56 -0400 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251001_095010_787564_C153C91D X-CRM114-Status: GOOD ( 11.62 ) X-Spam-Score: -2.1 (--) 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: Extend the hwsim utilities with `list_s1g_capable_channels()` and `s1g_supported()` so tests can detect IEEE 802.11ah capability directly from `iw phy` output. The parser copes with output variants wh [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in bl.score.senderscore.com] 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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 Extend the hwsim utilities with `list_s1g_capable_channels()` and `s1g_supported()` so tests can detect IEEE 802.11ah capability directly from `iw phy` output. The parser copes with output variants where S1G channels omit the `[idx]` token and normalises the reported MHz into a structured dictionary. This is required by the upcoming S1G smoke and association scenarios to choose an operable channel without hardcoding numbers. Tested: python3 - <<'PY' from utils import list_s1g_capable_channels list_s1g_capable_channels() PY Signed-off-by: James Ewing --- tests/hwsim/utils.py | 63 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/tests/hwsim/utils.py b/tests/hwsim/utils.py index 5c2af5635..dd9d43262 100644 --- a/tests/hwsim/utils.py +++ b/tests/hwsim/utils.py @@ -185,6 +185,69 @@ def he_6ghz_supported(freq=5975): return False + +def _list_phys(): + base = "/sys/class/ieee80211" + try: + return sorted(os.listdir(base)) + except FileNotFoundError: + return [] + + +def list_s1g_capable_channels(): + """Return S1G channel metadata exposed by available phys. + + Each entry contains ``phy`` (string), ``freq_mhz`` (float), and + ``channel`` (int). The list is empty if the running kernel/mac80211 + stack does not advertise any S1G channels. + """ + + channels = [] + phys = _list_phys() + for phy in phys: + auto_channel = 1 + try: + out = subprocess.check_output(["iw", "phy", phy, "info"], + stderr=subprocess.DEVNULL, + universal_newlines=True) + except Exception: + continue + + for line in out.splitlines(): + stripped = line.strip() + if not stripped.startswith('* '): + continue + + match = re.match(r"\*\s+([0-9]+(?:\.[0-9]+)?)\s+MHz(?:\s+\[(\d+)\])?", + stripped) + if not match: + continue + + freq_mhz = float(match.group(1)) + if freq_mhz < 700 or freq_mhz > 1000: + continue + + if match.group(2): + channel = int(match.group(2)) + auto_channel = channel + 1 + else: + channel = auto_channel + auto_channel += 1 + + channels.append({ + "phy": phy, + "freq_mhz": freq_mhz, + "channel": channel, + }) + + return channels + + +def s1g_supported(): + """Check whether any local mac80211 wiphy advertises S1G channels.""" + + return len(list_s1g_capable_channels()) > 0 + # This function checks whether the provided dev, which may be either # WpaSupplicant or Hostapd supports CSA. def csa_supported(dev): From patchwork Wed Oct 1 16:49:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Ewing X-Patchwork-Id: 2144474 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=yECIjIPJ; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=teledatics.com header.i=@teledatics.com header.a=rsa-sha256 header.s=mail header.b=KJVhCqYF; dkim-atps=neutral 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 4ccLXh23thz1yWt for ; Thu, 2 Oct 2025 02:50:58 +1000 (AEST) 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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3FOQvofj4JxJDI7K9v9WlfAxMR9fG2tfUybeM668v/s=; b=yECIjIPJuv1WNr Y7aEjRgzZjg5KQ7LEEBI77yochhhBbCkNLssiAHihFsLLPMuqn3tBpvY2LiehdSQpKyjGU4KiqTTc nrsQQz9lwEWpaFGMvaznEwZ+pZNy3un1e0QT3Gg2NLOVXEhQ9Kvt1YB/Pb8ppu1sn9yf9fg6x7Kws xtHPnufxRgpXBcw5vnhSr+PBB+fLY5AdnHIowBiUMvjczaqXcGD+QYTNvglKk/7zkxr7DOH4ewZp3 D/WVScA0JH+kAdZaRIH9EHh+2F0e4oo1J4QuA1Y6tGcREJjIZKx5IPhwj4maeugPrta2OtILpg0Xi hfFFZHhpq7LqUgFPvBQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v401u-00000008Yvh-40DJ; Wed, 01 Oct 2025 16:50:14 +0000 Received: from teledatics.com ([139.177.205.105]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v401r-00000008YuF-3z01 for hostap@lists.infradead.org; Wed, 01 Oct 2025 16:50:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=teledatics.com; s=mail; t=1759337411; bh=L3GSSqi1IiMQbUE4SrtU+f76ZncgaeHwfMkC6HdPd8o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KJVhCqYFM//GrAqtkI527HzICB0RdHSW/saWc1UgYVaDfnDlSarhvN+nEZTgiuFfW c/0n86f9HuvOdrjVVTUuX+/8jRircKTvbo+hV/Qr6/w/behFT4riozDZ1HS6FjrT/q UqeJoc5gmkexFlupqBJ53xvbp+OsydExFdKwCFho3259siaqohlg4QIP0DgggNJAzW 0hmfsZPV4usgUtozweQ+1xXJBLbUxvjXZbqs5z6wdzAgFOfyNnOah8uoYGzX3Ej7YY Bf7G0AqOEMrqu0cJT4063+1XvuizJNbDVjmbp3BWNWb9qr5uOXoYuFBLJOtv670CtE xg9wOLFPZkKlA== Received: from dev1.lan (185-157-161-124.pool.ovpn.com [185.157.161.124]) by teledatics.com (8.18.1/8.18.1/Debian-2) with ESMTP id 591Go4nU292035 for ; Wed, 1 Oct 2025 16:50:10 GMT From: James Ewing To: hostap@lists.infradead.org Subject: [PATCH 2/6] tests: add S1G smoke harness Date: Wed, 1 Oct 2025 12:49:57 -0400 Message-ID: <904eb515c1f6f76d61c9f7ee15e008cc7d8952ea.1759334464.git.james@teledatics.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251001_095012_110519_F2FF2B60 X-CRM114-Status: GOOD ( 13.13 ) X-Spam-Score: -2.1 (--) 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: Add the `test_s1g_smoke.py::test_open_assoc_freq_khz` scenario so we can stand up mac80211_hwsim, launch wpa_supplicant/hostapd, and verify the basic S1G scan plumbing. The test skips automatically wh [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in bl.score.senderscore.com] 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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 Add the `test_s1g_smoke.py::test_open_assoc_freq_khz` scenario so we can stand up mac80211_hwsim, launch wpa_supplicant/hostapd, and verify the basic S1G scan plumbing. The test skips automatically when the environment lacks an NL80211_BAND_S1GHZ phy, which lets us run it on stock kernels without spurious failures. Tested: ./tests/hwsim/run-tests.py -q test_s1g_smoke Signed-off-by: James Ewing --- tests/hwsim/test_s1g_smoke.py | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/hwsim/test_s1g_smoke.py diff --git a/tests/hwsim/test_s1g_smoke.py b/tests/hwsim/test_s1g_smoke.py new file mode 100644 index 000000000..af7d52e96 --- /dev/null +++ b/tests/hwsim/test_s1g_smoke.py @@ -0,0 +1,40 @@ +# S1G smoke checks for hwsim harness +# +# These exercises prerequisite plumbing only: we verify that the local +# mac80211/mac80211_hwsim instance advertises S1G-capable channels so later +# tests can rely on them. Full association flows land in subsequent tasks. + +import logging + +from utils import HwsimSkip, list_s1g_capable_channels + + +logger = logging.getLogger() + + +def _format_channels(channels): + preview = [ + f"{entry['phy']}:{entry['freq_mhz']:.1f}MHz(ch{entry['channel']})" + for entry in channels[:5] + ] + if len(channels) > 5: + preview.append("...") + return ", ".join(preview) + + +def test_open_assoc_freq_khz(dev, apdev): + """Baseline capability check for S1G-aware hwsim radios""" + + channels = list_s1g_capable_channels() + if not channels: + raise HwsimSkip("mac80211_hwsim does not expose any S1G channels") + + logger.info("Detected S1G channels: %s", _format_channels(channels)) + + # Sanity: ensure reported frequencies are within the expected S1G band. + for entry in channels: + freq = entry['freq_mhz'] + if freq < 700 or freq > 1000: + raise AssertionError( + f"Out-of-range S1G frequency reported: {freq} MHz") + From patchwork Wed Oct 1 16:49:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Ewing X-Patchwork-Id: 2144473 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=VrgL24VJ; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=teledatics.com header.i=@teledatics.com header.a=rsa-sha256 header.s=mail header.b=Y4wKOTyE; dkim-atps=neutral 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 4ccLXh1lFzz1yGY for ; Thu, 2 Oct 2025 02:50:58 +1000 (AEST) 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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Z42Tqeu2UqiMHf1XbFL6su1whOUKuxItjdD6lOUiiYs=; b=VrgL24VJsp2jQO 0ZFIV4I5ost67UJFLaHGyxnRuC7vapYgQscEkEiMf7PtCWyraQMkloyng/bcXofQXGbxmLEOaXItr rIS/iNeLzbzw47S3Vmtyvd4H8SYWlhz1Onx52UAVckQPdCt592Z6Q2+KwWjd5pC00vAEYDLl+aEIl 3bhgAEdFZ8ITihXgTX/ars/yMrkW7mMdm93r+fVyncILAfXXPmtKNqAM/TkWLOdueLUkeXsHjejOl RwE09WK/3Y2z80Pl4j2zvE0D19bt6tymDP26pBlsXTD/NKujt0HfcZIFAe8B7mMiSqZhxXiQ60NnC W0XftU/OBgHRBCnm3bfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v401w-00000008YwV-1V9V; Wed, 01 Oct 2025 16:50:16 +0000 Received: from teledatics.com ([139.177.205.105]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v401t-00000008Yui-0pWB for hostap@lists.infradead.org; Wed, 01 Oct 2025 16:50:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=teledatics.com; s=mail; t=1759337412; bh=6WKJPuyEDQAwNozm2HHUvXzBvH7Bb8cmjtkkPeJ5tmY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Y4wKOTyEv/oaPla5DLNnuU1LXglNrGvye+/vzFrhblCQzBfSdroxK6YW5AfuiW9cW dT2Xoc1uc2iT2KFjK0Le8vYZrt3pB9cWzs49eWT73Hmytz8jUP/VMKoLCBEJwo2x+M FRZUKm/I0iF2XoAuyPoS0nLJDnuNjRDWGdqNRhO2wCcdEXOzLZw5oLIb13MAWmPN7A 2+RbKgRHsi2t/FRHnMzw2bc9AaykMoUKY9GhEhSzkjUx8e51/j6LFCrIDr/hpQ+atW 48WC35xxg2JSrl0JK1Nw5uumhoPSzEeg/5GYagPJgoCNGpQO2RgHA73tSbEw+xpo6I v8IWRo1WqTxqg== Received: from dev1.lan (185-157-161-124.pool.ovpn.com [185.157.161.124]) by teledatics.com (8.18.1/8.18.1/Debian-2) with ESMTP id 591Go4nV292035 for ; Wed, 1 Oct 2025 16:50:11 GMT From: James Ewing To: hostap@lists.infradead.org Subject: [PATCH 3/6] common: add IEEE 802.11ah channel widths Date: Wed, 1 Oct 2025 12:49:58 -0400 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251001_095013_355873_FB794D38 X-CRM114-Status: UNSURE ( 9.69 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) 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: --- src/common/defs.h | 12 ++++++++++++ src/common/ieee802_11_common.c | 7 +++++++ src/drivers/driver_common.c | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/common/defs.h b/src/common/defs.h index 0a79ba2a6..0204358f7 100644 --- a/src/common/defs.h +++ b/src/common/defs.h @@ -446,6 +446,13 @@ enum eap_proxy_sim_state { #define OCE_STA_CFO [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in bl.score.senderscore.com] 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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 --- src/common/defs.h | 12 ++++++++++++ src/common/ieee802_11_common.c | 7 +++++++ src/drivers/driver_common.c | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/common/defs.h b/src/common/defs.h index 0a79ba2a6..0204358f7 100644 --- a/src/common/defs.h +++ b/src/common/defs.h @@ -446,6 +446,13 @@ enum eap_proxy_sim_state { #define OCE_STA_CFON BIT(1) #define OCE_AP BIT(2) +/* S1G channel bandwidth values in MHz */ +#define S1G_BANDWIDTH_1MHZ 1 +#define S1G_BANDWIDTH_2MHZ 2 +#define S1G_BANDWIDTH_4MHZ 4 +#define S1G_BANDWIDTH_8MHZ 8 +#define S1G_BANDWIDTH_16MHZ 16 + /* enum chan_width - Channel width definitions */ enum chan_width { CHAN_WIDTH_20_NOHT, @@ -459,6 +466,11 @@ enum chan_width { CHAN_WIDTH_6480, CHAN_WIDTH_8640, CHAN_WIDTH_320, + CHAN_WIDTH_1, + CHAN_WIDTH_2, + CHAN_WIDTH_4, + CHAN_WIDTH_8, + CHAN_WIDTH_16, CHAN_WIDTH_UNKNOWN }; diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c index ae7a7647a..c3c01d44c 100644 --- a/src/common/ieee802_11_common.c +++ b/src/common/ieee802_11_common.c @@ -1661,6 +1661,13 @@ int ieee80211_chaninfo_to_channel(unsigned int freq, enum chan_width chanwidth, case CHAN_WIDTH_40: cw = CONF_OPER_CHWIDTH_USE_HT; break; + case CHAN_WIDTH_16: + case CHAN_WIDTH_8: + case CHAN_WIDTH_4: + case CHAN_WIDTH_2: + case CHAN_WIDTH_1: + cw = CONF_OPER_CHWIDTH_USE_HT; + break; case CHAN_WIDTH_80: cw = CONF_OPER_CHWIDTH_80MHZ; break; diff --git a/src/drivers/driver_common.c b/src/drivers/driver_common.c index 045c82967..0a9437808 100644 --- a/src/drivers/driver_common.c +++ b/src/drivers/driver_common.c @@ -126,6 +126,16 @@ const char * channel_width_to_string(enum chan_width width) return "160 MHz"; case CHAN_WIDTH_320: return "320 MHz"; + case CHAN_WIDTH_1: + return "1 MHz"; + case CHAN_WIDTH_2: + return "2 MHz"; + case CHAN_WIDTH_4: + return "4 MHz"; + case CHAN_WIDTH_8: + return "8 MHz"; + case CHAN_WIDTH_16: + return "16 MHz"; default: return "unknown"; } @@ -147,6 +157,16 @@ int channel_width_to_int(enum chan_width width) return 160; case CHAN_WIDTH_320: return 320; + case CHAN_WIDTH_1: + return 1; + case CHAN_WIDTH_2: + return 2; + case CHAN_WIDTH_4: + return 4; + case CHAN_WIDTH_8: + return 8; + case CHAN_WIDTH_16: + return 16; default: return 0; } From patchwork Wed Oct 1 16:49:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Ewing X-Patchwork-Id: 2144471 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=O9+FgbsA; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=teledatics.com header.i=@teledatics.com header.a=rsa-sha256 header.s=mail header.b=Yp/dIsm2; dkim-atps=neutral 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 4ccLXh3FRFz1yX4 for ; Thu, 2 Oct 2025 02:50:58 +1000 (AEST) 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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nSsna1EnZjEWQHlpIPpQyUbjiOmXcA8tCKd1ItqpASQ=; b=O9+FgbsAhmQodq 2JgQxQRX4E+66z2MN9eSYvFsXiXfHqO+UwIXsox2ZWwG4ulF3UbCOmyUFiz23lYby6jNExPPr7WZJ V+zXKxYWs90ntkTv/Yrs9swpfBuWAnij/ruwCjE5ECeqwV7ExZpNnPalL3w2QoEKJQF1It+a/bP/0 ens7XAHpPbDKh6N3DICcrlfgzAF0dbllRv0ZzPJ8D2y0ZJ58XPzCeAtiMGAtQ/GuMbIABj7YJqXYF n9ogLRUlp7cmAlerEWNdFhE68wLFFmQH9su9QhMGJYO56svJdQ7H9dt+5sM2sFaLGSZdWujrFaWzZ 7k909ZlsuekxsUXlesdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v401w-00000008Ywn-3Hcl; Wed, 01 Oct 2025 16:50:16 +0000 Received: from teledatics.com ([139.177.205.105]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v401u-00000008Yv6-1upV for hostap@lists.infradead.org; Wed, 01 Oct 2025 16:50:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=teledatics.com; s=mail; t=1759337413; bh=UrichYyWKOk46VrVIEj9wNlTFdtBuvIegRjD3+9Y2sg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Yp/dIsm2A9bTpPhUx2EYbBR+X1rdwwNJtP8SLR6N7zAjZdu/fqFyGSq9XlV/O7/Jm 53bSRLfRG1gbGOjl1O8pDE4rnEi0q9Nw9Rext/Mllfa1x36RGoiQkeCm1TIWpynaDy 8U/pwnJceQao2IE/lELEVaguvrkVX23BiVod5LVsKIf9W0OdwlkNJoegktaUyykfuZ JzD1DstVOk7A+pRAhGnEMMwcakP7WDkTDek1euZxccd3j25I5W5x+ddEvrf8d3NJpN owtVekIQZY74wocIrUWzXehrUZADuz7h3+4qRjQqSirZzGxeuuHogRZwKbQ7ZYKLvS TzIqJ2EFcgRbg== Received: from dev1.lan (185-157-161-124.pool.ovpn.com [185.157.161.124]) by teledatics.com (8.18.1/8.18.1/Debian-2) with ESMTP id 591Go4nW292035 for ; Wed, 1 Oct 2025 16:50:13 GMT From: James Ewing To: hostap@lists.infradead.org Subject: [PATCH 4/6] nl80211: propagate S1G widths and freq offsets Date: Wed, 1 Oct 2025 12:49:59 -0400 Message-ID: <9c5d2983181977e45744915d0e364dbf3615bf45.1759334464.git.james@teledatics.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251001_095014_623462_943C326B X-CRM114-Status: GOOD ( 21.57 ) X-Spam-Score: -2.1 (--) 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: Teach the nl80211 backend to recognise the new S1G channel widths and to forward the kHz-level frequency metadata reported by the kernel. This includes advertising the right width in STA opmode notifi [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in bl.score.senderscore.com] 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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 Teach the nl80211 backend to recognise the new S1G channel widths and to forward the kHz-level frequency metadata reported by the kernel. This includes advertising the right width in STA opmode notifications, packaging centre-frequency offsets for hostapd, and populating scan results with freq_khz/freq_offset so higher layers can keep sub-MHz precision. Tested: tests/hwsim/run_s1g_smoke.sh Signed-off-by: James Ewing --- hostapd/ctrl_iface.c | 15 +++++ src/common/hw_features_common.c | 5 +- src/drivers/driver.h | 12 ++++ src/drivers/driver_nl80211.c | 90 +++++++++++++++++++++++++++++- src/drivers/driver_nl80211_event.c | 20 +++++++ src/drivers/driver_nl80211_scan.c | 22 ++++++++ src/utils/common.h | 33 +++++++++++ 7 files changed, 193 insertions(+), 4 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index e6ea1dc3a..747630de4 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -2533,6 +2533,21 @@ static int hostapd_ctrl_check_freq_params(struct hostapd_freq_params *params, if (params->center_freq2 || params->sec_channel_offset) return -1; + if (punct_bitmap) + return -1; + break; + case S1G_BANDWIDTH_16MHZ: + case S1G_BANDWIDTH_8MHZ: + case S1G_BANDWIDTH_4MHZ: + case S1G_BANDWIDTH_2MHZ: + case S1G_BANDWIDTH_1MHZ: + if (params->center_freq1 && + params->center_freq1 != params->freq) + return -1; + + if (params->center_freq2 || params->sec_channel_offset) + return -1; + if (punct_bitmap) return -1; break; diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c index d9276b935..48280cf2b 100644 --- a/src/common/hw_features_common.c +++ b/src/common/hw_features_common.c @@ -497,6 +497,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, os_memset(data, 0, sizeof(*data)); data->mode = mode; data->freq = freq; + data->freq_offset = 0; data->channel = channel; data->ht_enabled = ht_enabled; data->vht_enabled = vht_enabled; @@ -504,6 +505,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, data->eht_enabled = eht_enabled; data->sec_channel_offset = sec_channel_offset; data->center_freq1 = freq + sec_channel_offset * 10; + data->center_freq1_offset = 0; data->center_freq2 = 0; data->punct_bitmap = punct_bitmap; if (oper_chwidth == CONF_OPER_CHWIDTH_80MHZ) @@ -589,7 +591,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, data->ht_enabled = 0; data->vht_enabled = 0; - return 0; + goto out; } if (data->eht_enabled) switch (oper_chwidth) { @@ -832,6 +834,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, break; } +out: return 0; } diff --git a/src/drivers/driver.h b/src/drivers/driver.h index d943062fe..c8dcdeadb 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -372,6 +372,8 @@ struct hostapd_multi_hw_info { * @flags: information flags about the BSS/IBSS (WPA_SCAN_*) * @bssid: BSSID * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1) + * @freq_offset: frequency offset in kHz relative to @freq (legacy drivers + * that do not report this leave it zero) * @max_cw: the max channel width of the connection (calculated during scan * result processing) * @beacon_int: beacon interval in TUs (host byte order) @@ -410,6 +412,7 @@ struct wpa_scan_res { unsigned int flags; u8 bssid[ETH_ALEN]; int freq; + unsigned int freq_offset; enum chan_width max_cw; u16 beacon_int; u16 caps; @@ -833,6 +836,10 @@ struct hostapd_freq_params { * freq - Primary channel center frequency in MHz */ int freq; + /** + * freq_offset - Primary channel frequency offset in kHz relative to @freq + */ + unsigned int freq_offset; /** * channel - Channel number @@ -869,6 +876,11 @@ struct hostapd_freq_params { * Valid for both HT and VHT. */ int center_freq1; + /** + * center_freq1_offset - Segment 0 frequency offset in kHz relative to + * @center_freq1 + */ + unsigned int center_freq1_offset; /** * center_freq2 - Segment 1 center frequency in MHz diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index c5bbe119c..2e80cce80 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -217,6 +217,16 @@ enum chan_width convert2width(int width) return CHAN_WIDTH_80P80; case NL80211_CHAN_WIDTH_160: return CHAN_WIDTH_160; + case NL80211_CHAN_WIDTH_16: + return CHAN_WIDTH_16; + case NL80211_CHAN_WIDTH_8: + return CHAN_WIDTH_8; + case NL80211_CHAN_WIDTH_4: + return CHAN_WIDTH_4; + case NL80211_CHAN_WIDTH_2: + return CHAN_WIDTH_2; + case NL80211_CHAN_WIDTH_1: + return CHAN_WIDTH_1; case NL80211_CHAN_WIDTH_320: return CHAN_WIDTH_320; default: @@ -5115,12 +5125,58 @@ err: #endif /* CONFIG_DRIVER_NL80211_QCA */ +static bool nl80211_is_s1g_bandwidth(int bandwidth) +{ + switch (bandwidth) { + case S1G_BANDWIDTH_16MHZ: + case S1G_BANDWIDTH_8MHZ: + case S1G_BANDWIDTH_4MHZ: + case S1G_BANDWIDTH_2MHZ: + case S1G_BANDWIDTH_1MHZ: + return true; + default: + return false; + } +} + + +static int nl80211_s1g_bandwidth_to_width(int bandwidth, + enum nl80211_chan_width *width) +{ + int ret = 0; + + switch (bandwidth) { + case S1G_BANDWIDTH_16MHZ: + *width = NL80211_CHAN_WIDTH_16; + break; + case S1G_BANDWIDTH_8MHZ: + *width = NL80211_CHAN_WIDTH_8; + break; + case S1G_BANDWIDTH_4MHZ: + *width = NL80211_CHAN_WIDTH_4; + break; + case S1G_BANDWIDTH_2MHZ: + *width = NL80211_CHAN_WIDTH_2; + break; + case S1G_BANDWIDTH_1MHZ: + *width = NL80211_CHAN_WIDTH_1; + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} + static int nl80211_put_freq_params(struct nl_msg *msg, const struct hostapd_freq_params *freq) { enum hostapd_hw_mode hw_mode; int is_24ghz; u8 channel; + bool channel_type_set = false; + enum nl80211_chan_width cw = NL80211_CHAN_WIDTH_20_NOHT; wpa_printf(MSG_DEBUG, " * freq=%d", freq->freq); if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq->freq)) @@ -5137,10 +5193,16 @@ static int nl80211_put_freq_params(struct nl_msg *msg, is_24ghz = hw_mode == HOSTAPD_MODE_IEEE80211G || hw_mode == HOSTAPD_MODE_IEEE80211B; - if (freq->vht_enabled || - ((freq->he_enabled || freq->eht_enabled) && !is_24ghz)) { - enum nl80211_chan_width cw; + if (nl80211_is_s1g_bandwidth(freq->bandwidth)) { + wpa_printf(MSG_DEBUG, " * bandwidth=%d", freq->bandwidth); + if (nl80211_s1g_bandwidth_to_width(freq->bandwidth, &cw) < 0) + return -EINVAL; + wpa_printf(MSG_DEBUG, " * channel_width=%d", cw); + if (nla_put_u32(msg, NL80211_ATTR_CHANNEL_WIDTH, cw)) + return -ENOBUFS; + } else if (freq->vht_enabled || + ((freq->he_enabled || freq->eht_enabled) && !is_24ghz)) { wpa_printf(MSG_DEBUG, " * bandwidth=%d", freq->bandwidth); switch (freq->bandwidth) { case 20: @@ -5197,6 +5259,7 @@ static int nl80211_put_freq_params(struct nl_msg *msg, wpa_printf(MSG_DEBUG, " * channel_type=%d", ct); if (nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, ct)) return -ENOBUFS; + channel_type_set = true; } else if (freq->edmg.channels && freq->edmg.bw_config) { wpa_printf(MSG_DEBUG, " * EDMG configuration: channels=0x%x bw_config=%d", @@ -5207,12 +5270,33 @@ static int nl80211_put_freq_params(struct nl_msg *msg, freq->edmg.bw_config)) return -1; } else { + /* nothing to do */ + } + + if (!channel_type_set) { wpa_printf(MSG_DEBUG, " * channel_type=%d", NL80211_CHAN_NO_HT); if (nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, NL80211_CHAN_NO_HT)) return -ENOBUFS; + channel_type_set = true; + } + + if (freq->freq_offset) { + wpa_printf(MSG_DEBUG, " * freq_offset=%u", freq->freq_offset); + if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ_OFFSET, + freq->freq_offset)) + return -ENOBUFS; } + + if (freq->center_freq1 && freq->center_freq1_offset) { + wpa_printf(MSG_DEBUG, " * center_freq1_offset=%u", + freq->center_freq1_offset); + if (nla_put_u32(msg, NL80211_ATTR_CENTER_FREQ1_OFFSET, + freq->center_freq1_offset)) + return -ENOBUFS; + } + if (freq->radar_background && nla_put_flag(msg, NL80211_ATTR_RADAR_BACKGROUND)) return -ENOBUFS; diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index 9e4a3e6e1..65137d84d 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -1219,6 +1219,11 @@ static int calculate_chan_offset(int width, int freq, int cf1, int cf2) switch (convert2width(width)) { case CHAN_WIDTH_20_NOHT: case CHAN_WIDTH_20: + case CHAN_WIDTH_16: + case CHAN_WIDTH_8: + case CHAN_WIDTH_4: + case CHAN_WIDTH_2: + case CHAN_WIDTH_1: return 0; case CHAN_WIDTH_40: freq1 = cf1 - 10; @@ -3933,6 +3938,21 @@ static void nl80211_sta_opmode_change_event(struct wpa_driver_nl80211_data *drv, case NL80211_CHAN_WIDTH_320: ed.sta_opmode.chan_width = CHAN_WIDTH_320; break; + case NL80211_CHAN_WIDTH_16: + ed.sta_opmode.chan_width = CHAN_WIDTH_16; + break; + case NL80211_CHAN_WIDTH_8: + ed.sta_opmode.chan_width = CHAN_WIDTH_8; + break; + case NL80211_CHAN_WIDTH_4: + ed.sta_opmode.chan_width = CHAN_WIDTH_4; + break; + case NL80211_CHAN_WIDTH_2: + ed.sta_opmode.chan_width = CHAN_WIDTH_2; + break; + case NL80211_CHAN_WIDTH_1: + ed.sta_opmode.chan_width = CHAN_WIDTH_1; + break; default: ed.sta_opmode.chan_width = CHAN_WIDTH_UNKNOWN; break; diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c index f0313c1af..328a10f1e 100644 --- a/src/drivers/driver_nl80211_scan.c +++ b/src/drivers/driver_nl80211_scan.c @@ -806,6 +806,8 @@ nl80211_parse_bss_info(struct wpa_driver_nl80211_data *drv, [NL80211_BSS_PARENT_TSF] = { .type = NLA_U64 }, [NL80211_BSS_PARENT_BSSID] = { .type = NLA_UNSPEC }, [NL80211_BSS_LAST_SEEN_BOOTTIME] = { .type = NLA_U64 }, + [NL80211_BSS_FREQUENCY_OFFSET] = { .type = NLA_U32 }, + [NL80211_BSS_CHAN_WIDTH] = { .type = NLA_U32 }, }; struct wpa_scan_res *r; const u8 *ie, *beacon_ie; @@ -844,15 +846,35 @@ nl80211_parse_bss_info(struct wpa_driver_nl80211_data *drv, r = os_zalloc(sizeof(*r) + ie_len + beacon_ie_len); if (r == NULL) return NULL; + r->max_cw = CHAN_WIDTH_UNKNOWN; if (bss[NL80211_BSS_BSSID]) os_memcpy(r->bssid, nla_data(bss[NL80211_BSS_BSSID]), ETH_ALEN); if (bss[NL80211_BSS_FREQUENCY]) r->freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]); + if (bss[NL80211_BSS_FREQUENCY_OFFSET]) + r->freq_offset = nla_get_u32( + bss[NL80211_BSS_FREQUENCY_OFFSET]); if (bss[NL80211_BSS_BEACON_INTERVAL]) r->beacon_int = nla_get_u16(bss[NL80211_BSS_BEACON_INTERVAL]); if (bss[NL80211_BSS_CAPABILITY]) r->caps = nla_get_u16(bss[NL80211_BSS_CAPABILITY]); + if (bss[NL80211_BSS_CHAN_WIDTH]) { + switch (nla_get_u32(bss[NL80211_BSS_CHAN_WIDTH])) { + case NL80211_BSS_CHAN_WIDTH_20: + r->max_cw = CHAN_WIDTH_20; + break; + case NL80211_BSS_CHAN_WIDTH_2: + r->max_cw = CHAN_WIDTH_2; + break; + case NL80211_BSS_CHAN_WIDTH_1: + r->max_cw = CHAN_WIDTH_1; + break; + default: + r->max_cw = CHAN_WIDTH_UNKNOWN; + break; + } + } r->flags |= WPA_SCAN_NOISE_INVALID; if (bss[NL80211_BSS_SIGNAL_MBM]) { r->level = nla_get_u32(bss[NL80211_BSS_SIGNAL_MBM]); diff --git a/src/utils/common.h b/src/utils/common.h index d7b3600f2..8a3f12cc2 100644 --- a/src/utils/common.h +++ b/src/utils/common.h @@ -127,6 +127,39 @@ typedef int8_t s8; #endif /* !WPA_TYPES_DEFINED */ +#ifndef MHZ_TO_KHZ +#define MHZ_TO_KHZ(freq) ((freq) * 1000) +#endif + +#ifndef KHZ_TO_MHZ +#define KHZ_TO_MHZ(freq) ((freq) / 1000) +#endif + +static inline unsigned int mhz_to_khz_with_offset(int freq_mhz, + unsigned int offset_khz) +{ + if (freq_mhz <= 0) + return 0; + + return MHZ_TO_KHZ(freq_mhz) + offset_khz; +} + +static inline unsigned int freq_offset_from_khz(unsigned int freq_khz, + int freq_mhz) +{ + unsigned int base; + + if (freq_mhz <= 0) + return 0; + + base = MHZ_TO_KHZ(freq_mhz); + if (freq_khz <= base) + return 0; + + return freq_khz - base; +} + + /* Define platform specific byte swapping macros */ #if defined(__CYGWIN__) || defined(CONFIG_NATIVE_WINDOWS) From patchwork Wed Oct 1 16:50:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Ewing X-Patchwork-Id: 2144472 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=TdYn8S2z; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=teledatics.com header.i=@teledatics.com header.a=rsa-sha256 header.s=mail header.b=Elj1ngHq; dkim-atps=neutral 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 4ccLXh2q6Sz1yX2 for ; Thu, 2 Oct 2025 02:50:58 +1000 (AEST) 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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vZxyi4kWaUgpXT32PvQxlNGARWFX6Wulh6ASmTptQzw=; b=TdYn8S2zX0yxSf UW+yz1+DgKGjlS2GuitNv1IFiGYzhb/gen11L94rWwDSE4698l5aY0BRojNYYYDbhMNsxePbdm7Qc DYQI1PKQZ9ej4oF7c+JHh5L9qcFpJaj+8fPZvz+n+naGQvqO7fHwKDExXOiCSIL8PdfmEFnBzG/O1 53DyCZsiC5nBDq2ZykB8o67qZ2BRglTWofqUbqlmVTDhJnrw7OuXqEtAoTn+xUrALKs97E1pchimw oD1ClhB9GCY0KnDubSOxcgVrTcBEOIdd5eedcyrja+3QgjVsdZ80c7tY6fOKzw8T0vkgNjiX+qXha Mc8mhrev1335QCK3tdWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v401y-00000008Yxn-2rlr; Wed, 01 Oct 2025 16:50:18 +0000 Received: from teledatics.com ([139.177.205.105]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v401v-00000008Yvy-2si6 for hostap@lists.infradead.org; Wed, 01 Oct 2025 16:50:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=teledatics.com; s=mail; t=1759337415; bh=tIffsy4n2xCWUcyh1pbGo+PtcD2Uw4dxTeSQ5j/CZao=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Elj1ngHq5bX+0m0L6esEkPiRAGk2pRDVxz3tnxEPENa93YaOuIcMap5zBF89scBdO /nSqedcznr7IGZluiw2+KOVZS5SDEkRdYcWag/JtnB2qRo3iwNibai+GLbp9LF5984 yGaxf/GG8pExfRFf7UuA1DDRZQq2dGGlf3BlIUfutgQ2gbW06Mq+40gb0F31E1wr/Y sorFtFrFzBYFcz06vZGL09Eh9GxVZUMjhaAJH/xha80t74FxT+lwRAdQSbv6P+Ofo8 IDmwqNFYEPZ6MXUKrl3YriJzRovQW4ObKRBKQFNqhZeR4NsZmhnF2G79JzXzhtOWCE l5TSVQSyZ608g== Received: from dev1.lan (185-157-161-124.pool.ovpn.com [185.157.161.124]) by teledatics.com (8.18.1/8.18.1/Debian-2) with ESMTP id 591Go4nX292035 for ; Wed, 1 Oct 2025 16:50:14 GMT From: James Ewing To: hostap@lists.infradead.org Subject: [PATCH 5/6] wpa_supplicant: derive freq_khz from freq_offset Date: Wed, 1 Oct 2025 12:50:00 -0400 Message-ID: <74556aa1829ffba228c7fb303a2f65f329381ccd.1759334464.git.james@teledatics.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251001_095015_839397_801CD132 X-CRM114-Status: GOOD ( 15.47 ) X-Spam-Score: -2.1 (--) 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: --- wpa_supplicant/bss.c | 1 + wpa_supplicant/bss.h | 2 ++ wpa_supplicant/ctrl_iface.c | 17 ++++++++++++++++ wpa_supplicant/scan.c | 32 +++++++++++++++++++ wpa_supplicant/wpa_supplicant.c [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in bl.score.senderscore.com] 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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 --- wpa_supplicant/bss.c | 1 + wpa_supplicant/bss.h | 2 ++ wpa_supplicant/ctrl_iface.c | 17 ++++++++++++++++ wpa_supplicant/scan.c | 32 +++++++++++++++++++------------ wpa_supplicant/wpa_supplicant.c | 3 +++ wpa_supplicant/wpa_supplicant_i.h | 1 + 6 files changed, 44 insertions(+), 12 deletions(-) diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index 58adaf744..880db7606 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -384,6 +384,7 @@ static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src, dst->flags = src->flags; os_memcpy(dst->bssid, src->bssid, ETH_ALEN); dst->freq = src->freq; + dst->freq_offset = src->freq_offset; dst->max_cw = src->max_cw; dst->beacon_int = src->beacon_int; dst->caps = src->caps; diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h index 74ef3c858..c44e7fb1f 100644 --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h @@ -93,6 +93,8 @@ struct wpa_bss { size_t ssid_len; /** Frequency of the channel in MHz (e.g., 2412 = channel 1) */ int freq; + /** Frequency offset in kHz relative to @freq */ + unsigned int freq_offset; /** The max channel width supported by both the AP and the STA */ enum chan_width max_cw; /** Beacon interval in TUs (host byte order) */ diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index ebcc5d7ee..5a547e924 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -5383,10 +5383,27 @@ static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, } if (mask & WPA_BSS_MASK_FREQ) { + unsigned int freq_khz = + mhz_to_khz_with_offset(bss->freq, bss->freq_offset); + ret = os_snprintf(pos, end - pos, "freq=%d\n", bss->freq); if (os_snprintf_error(end - pos, ret)) return 0; pos += ret; + if (freq_khz) { + ret = os_snprintf(pos, end - pos, "freq_khz=%u\n", + freq_khz); + if (os_snprintf_error(end - pos, ret)) + return 0; + pos += ret; + } + if (bss->freq_offset) { + ret = os_snprintf(pos, end - pos, "freq_offset=%u\n", + bss->freq_offset); + if (os_snprintf_error(end - pos, ret)) + return 0; + pos += ret; + } } if (mask & WPA_BSS_MASK_BEACON_INT) { diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index a4824678d..d1132163c 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -3303,9 +3303,11 @@ unsigned int wpas_get_est_tpt(const struct wpa_supplicant *wpa_s, (IS_2P4GHZ(freq) ? HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_IN_2G : HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G)) && ht40) { - if (*max_cw == CHAN_WIDTH_UNKNOWN || - *max_cw < CHAN_WIDTH_40) - *max_cw = CHAN_WIDTH_40; + if (*max_cw == CHAN_WIDTH_UNKNOWN || + channel_width_to_int(*max_cw) < + channel_width_to_int(CHAN_WIDTH_40)) { + *max_cw = CHAN_WIDTH_40; + } adjusted_snr = snr + wpas_channel_width_rssi_bump( ies, ies_len, CHAN_WIDTH_40); tmp = max_he_eht_rate(he40_table, adjusted_snr, @@ -3317,9 +3319,11 @@ unsigned int wpas_get_est_tpt(const struct wpa_supplicant *wpa_s, if (!IS_2P4GHZ(freq) && (cw & HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G) && (!IS_5GHZ(freq) || vht80)) { - if (*max_cw == CHAN_WIDTH_UNKNOWN || - *max_cw < CHAN_WIDTH_80) - *max_cw = CHAN_WIDTH_80; + if (*max_cw == CHAN_WIDTH_UNKNOWN || + channel_width_to_int(*max_cw) < + channel_width_to_int(CHAN_WIDTH_80)) { + *max_cw = CHAN_WIDTH_80; + } adjusted_snr = snr + wpas_channel_width_rssi_bump( ies, ies_len, CHAN_WIDTH_80); @@ -3341,9 +3345,11 @@ unsigned int wpas_get_est_tpt(const struct wpa_supplicant *wpa_s, (cw & (HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G | HE_PHYCAP_CHANNEL_WIDTH_SET_80PLUS80MHZ_IN_5G)) && (!IS_5GHZ(freq) || vht160)) { - if (*max_cw == CHAN_WIDTH_UNKNOWN || - *max_cw < CHAN_WIDTH_160) - *max_cw = CHAN_WIDTH_160; + if (*max_cw == CHAN_WIDTH_UNKNOWN || + channel_width_to_int(*max_cw) < + channel_width_to_int(CHAN_WIDTH_160)) { + *max_cw = CHAN_WIDTH_160; + } adjusted_snr = snr + wpas_channel_width_rssi_bump( ies, ies_len, CHAN_WIDTH_160); @@ -3368,9 +3374,11 @@ unsigned int wpas_get_est_tpt(const struct wpa_supplicant *wpa_s, if (is_6ghz_freq(freq) && (eht->phy_cap[EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_IDX] & EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_MASK)) { - if (*max_cw == CHAN_WIDTH_UNKNOWN || - *max_cw < CHAN_WIDTH_320) - *max_cw = CHAN_WIDTH_320; + if (*max_cw == CHAN_WIDTH_UNKNOWN || + channel_width_to_int(*max_cw) < + channel_width_to_int(CHAN_WIDTH_320)) { + *max_cw = CHAN_WIDTH_320; + } adjusted_snr = snr + wpas_channel_width_rssi_bump( ies, ies_len, CHAN_WIDTH_320); diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index d45002fd9..b33a9eb35 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -3469,6 +3469,7 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, bool is_6ghz, is_24ghz; freq->freq = ssid->frequency; + freq->freq_offset = 0; if (ssid->mode == WPAS_MODE_IBSS && !ssid->fixed_freq) { struct wpa_bss *bss = ibss_find_existing_bss(wpa_s, ssid); @@ -3478,6 +3479,7 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, "IBSS already found in scan results, adjust control freq: %d", bss->freq); freq->freq = bss->freq; + freq->freq_offset = bss->freq_offset; obss_scan = 0; } } @@ -4640,6 +4642,7 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) wpa_s->key_mgmt == WPA_KEY_MGMT_WPS); params.bssid = bss->bssid; params.freq.freq = bss->freq; + params.freq.freq_offset = bss->freq_offset; } params.bssid_hint = bss->bssid; params.freq_hint = bss->freq; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index e7675a4ab..802e03140 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1003,6 +1003,7 @@ struct wpa_supplicant { u8 ssid[SSID_MAX_LEN]; size_t ssid_len; int freq; + unsigned int freq_offset; u8 assoc_req_ie[1500]; size_t assoc_req_ie_len; int mfp; From patchwork Wed Oct 1 16:50:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Ewing X-Patchwork-Id: 2144469 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=cwKukJgH; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=teledatics.com header.i=@teledatics.com header.a=rsa-sha256 header.s=mail header.b=gLKmQEqf; dkim-atps=neutral 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 4ccLXh1n33z1yHP for ; Thu, 2 Oct 2025 02:50:58 +1000 (AEST) 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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aAyDH13kLanzre9AAtZEZl/yAFKDArMGLT9Ge7T29Dw=; b=cwKukJgHm72xlP FP7FiKMGSdvXPVtbRrqivPm6fXp+uCBJG3+5xTKwzO1PtdMdRcItMmQZdjeV6N9pWR3aG3sbyb6RN tF8eTZ4gGUn8sLGEZ6HJrMJc3JIW7D30JeABKuOzIG+cXpL0QNftpApTxoCQ5uVqZBIAvPY3lUUJk 7USJLNsCIjQqqvNpCOHzH07akpUqRvbF69q13ogZfcFIbduhsEIO6CqBTF8hCOwjcEHGLlbYrERPh c9JWF4M8DE9uYNN2vA8yrV2fk0AMh0xKBQCpgZON6AoiJ4ppXNh+q4sWSLhDY1Fvn5EjCF36qBupx ef0l0vNtJ6f2lYIk71lw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v4021-00000008YyW-0KR2; Wed, 01 Oct 2025 16:50:21 +0000 Received: from teledatics.com ([139.177.205.105]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v401w-00000008Ywj-48Hu for hostap@lists.infradead.org; Wed, 01 Oct 2025 16:50:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=teledatics.com; s=mail; t=1759337416; bh=46i2BpfL8xUCbsSwL3z0z9iQVzUCzVqhKoPoC384WsQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gLKmQEqfjY53dB2ycd7r0X6XDt2WGXIuWz9atqJkcw+IhzSFHDMCOXU97QYIMcDcn M/qfeOp2YpROJ3LYW81NLW3/zZMXjPOZRqnOW9oJlnxnWhvEG3Zt0GX9QtlF2o0/tI 4hmoCNCLTbAJxPdwUHJZ98k9lOYXrAgbqo+owGj7+IDxtM1rvZVOAzLPB8bi0ngz3m A7dkkbSeplK/Rwy2N2fuV44DRpE9fSTbN5vPYanZxZuo5kATb9XR28eeZt/ld73X5A pmbUr4LV2YTW+FC0G3w4Z2832vXtyWSQQdyxCJQvv+SAeXxqlvoNljTKToWy/tie/b 7nyQGnIVn4zCA== Received: from dev1.lan (185-157-161-124.pool.ovpn.com [185.157.161.124]) by teledatics.com (8.18.1/8.18.1/Debian-2) with ESMTP id 591Go4nY292035 for ; Wed, 1 Oct 2025 16:50:15 GMT From: James Ewing To: hostap@lists.infradead.org Subject: [PATCH 6/6] tests: add S1G association coverage Date: Wed, 1 Oct 2025 12:50:01 -0400 Message-ID: <4c64e424fc741fd954076681ca08a0a73b5df737.1759334464.git.james@teledatics.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251001_095017_154410_9B9F89D7 X-CRM114-Status: GOOD ( 13.85 ) X-Spam-Score: -2.1 (--) 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: --- tests/hwsim/test_s1g_assoc.py | 101 ++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 tests/hwsim/test_s1g_assoc.py diff --git a/tests/hwsim/test_s1g_assoc.py b/tests/hwsim/test_s1g_assoc.py new file mode 100644 index 000000000..80ca3be31 --- /dev/null +++ b/tests/hwsim/test_s1g_assoc.py @@ -0,0 +1,101 @@ +# S1G as [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [139.177.205.105 listed in bl.score.senderscore.com] 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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 --- tests/hwsim/test_s1g_assoc.py | 101 ++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 tests/hwsim/test_s1g_assoc.py diff --git a/tests/hwsim/test_s1g_assoc.py b/tests/hwsim/test_s1g_assoc.py new file mode 100644 index 000000000..80ca3be31 --- /dev/null +++ b/tests/hwsim/test_s1g_assoc.py @@ -0,0 +1,101 @@ +# S1G association path coverage +# +# Validates that the supplicant can associate with an S1G-capable AP while +# preserving kHz-level channel metadata inside the BSS cache. + +import logging + +import hostapd + +from utils import HwsimSkip, list_s1g_capable_channels + + +logger = logging.getLogger() + + +def _pick_s1g_channel(): + channels = list_s1g_capable_channels() + if not channels: + raise HwsimSkip("mac80211_hwsim does not expose any S1G channels") + + for entry in channels: + if entry.get("channel"): + return entry + + # Fall back to the first entry even if iw does not report a channel number. + return channels[0] + + +def test_sta_assoc_s1g_channel(dev, apdev): + """Exercise STA association on an S1G channel and observe freq_khz plumbing""" + + channel_info = _pick_s1g_channel() + channel = channel_info.get("channel") + if channel is None: + raise HwsimSkip("iw phy did not report an S1G channel index") + + freq_khz = int(round(channel_info["freq_mhz"] * 1000)) + primary_freq_mhz = freq_khz // 1000 + freq_offset = freq_khz - primary_freq_mhz * 1000 + + logger.info( + "Using S1G channel %d at %.3f MHz (primary %d MHz, offset %d kHz)", + channel, + channel_info["freq_mhz"], + primary_freq_mhz, + freq_offset, + ) + + params = { + "ssid": "s1g-assoc", + "hw_mode": "ah", + "channel": str(channel), + "ieee80211n": "0", + "ieee80211ac": "0", + "ieee80211ax": "0", + } + + hapd = hostapd.add_ap(apdev[0], params, set_channel=False) + + dev[0].connect( + ssid="s1g-assoc", + key_mgmt="NONE", + scan_freq=str(primary_freq_mhz), + ) + + status = dev[0].get_status() + if status.get("freq") != str(primary_freq_mhz): + raise Exception( + "Supplicant reported freq %s, expected %d MHz" % + (status.get("freq"), primary_freq_mhz)) + + bss = dev[0].get_bss(hapd.own_addr()) + if not bss: + raise Exception("Failed to fetch BSS entry for associated S1G AP") + + if bss.get("freq") != str(primary_freq_mhz): + raise Exception( + "BSS table freq %s does not match primary %d MHz" % + (bss.get("freq"), primary_freq_mhz)) + + freq_khz_str = bss.get("freq_khz") + if freq_khz_str is None: + raise Exception("freq_khz missing from BSS table entry") + if int(freq_khz_str) != freq_khz: + raise Exception( + "freq_khz %s did not match expected %d" % + (freq_khz_str, freq_khz)) + + freq_offset_str = bss.get("freq_offset") + if freq_offset: + if freq_offset_str is None: + raise Exception("freq_offset missing from BSS table entry") + if int(freq_offset_str) != freq_offset: + raise Exception( + "freq_offset %s did not match expected %d" % + (freq_offset_str, freq_offset)) + elif freq_offset_str is not None and int(freq_offset_str) != 0: + raise Exception("Expected zero freq_offset, saw %s" % freq_offset_str) + + dev[0].request("DISCONNECT") +