From nobody Tue Jun 3 18:37:39 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bBfb82L1Qz5y0qX; Tue, 03 Jun 2025 18:37:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bBfb74Bw1z3bG5; Tue, 03 Jun 2025 18:37:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1748975859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5QaxZJ1+y1jJHoBeLiEzHQ+Iq9WLsZtTpadgfb0tNV8=; b=fgPm4ORAZi7LBK0l9LhugXIXfRbgQaG1ygaZMF29HkclPAlfZRuME3QFQh+y3b2sSm7e3K 38y0iOWn7I+9t/Bff5fFaRucOXC0E0ycHrZdHEgdJ8+jWFYgTnVMEY7kaK+faJeYG/Bqgb NSQaLWNIHrt+/XxOmBLUcRG2RSbtAiyGh2RQl1zjVuQEgc7JNf36hQSWA2kXDw1A6maFRm kA1AI4jt3IW/gcIP7u4+yXhbm82U57qxEZp0eVQ+eAOzqxdJJnuThBA66faUZiyOsWejDk lBHkKK+N8+ZHywrVUiQKhcMkSXRczdB9UOLH5arCqw3VzzogOnEDRt8xWtKRtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1748975859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5QaxZJ1+y1jJHoBeLiEzHQ+Iq9WLsZtTpadgfb0tNV8=; b=PBH4DlaequLB6/K+TspQBquwkNYsiXifvs3fR9e0XFIyvD4ELnHHNo8fIyirAuVgvxl0X2 LFjaCedCazEobsoVIGD4vYHzj9ufmC8U3NVxnHyLgrIaFn3dF0ReUeXi3KaQtz5l5f+Adw s7VY2/hBaaPgiz42S+UDIeq3HeSu6j38lFsUVJ8CUHGciE9O/ymHUXFpEY040px0jTzulB /2CFkq0QC8k9Zx24LUbKnTuxjPzI8dtPVFq0CFhsY8Bby5xIET9/ksUfX6v/VVMmdmpfvU FegJ0clxCICPgaDVxbTP26aARI8Vjz0kUuluyeCQT3VND5m4w4btujx+/D/Vzw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1748975859; a=rsa-sha256; cv=none; b=Fiev3VWv1xHaye8u1w7XRoeKqBMLbtStcI88IQQcsk2PlUfqnLxnI2NrNC0797WQ9wZSD3 my84Iu5iMiEFpd89SiPH1h4YEgwnAXLtrcrc7OWcnDtrO+NX6lmCwLpYYMGOyoZyiEEN8b bcuyD/2aegUHTBgFjfRyBrZCcrKHyGrMkEk/qcmMhLgYYC/7SYhPo4Njk99/MazdXz28mo mJknBVD07x6/5a6LWqk7tGuxvDys+C8oFMP+XebqXhmbwxmfdWkumEmn8qgxD6PwAG78C9 yUEuiP2VbsruySNu3BAULzejKh2Mzrx/V703adHj+5Xaz4EuPYhGyflGEZQ8KQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bBfb73SqZzr0p; Tue, 03 Jun 2025 18:37:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 553Ibd8G000411; Tue, 3 Jun 2025 18:37:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 553Ibdu5000408; Tue, 3 Jun 2025 18:37:39 GMT (envelope-from git) Date: Tue, 3 Jun 2025 18:37:39 GMT Message-Id: <202506031837.553Ibdu5000408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 9df0d1f3d1f3 - main - LinuxKPI: 802.11: ensure bandwidth <= channel bandwidth List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9df0d1f3d1f3dd8823800210dd49e40170d5abd8 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=9df0d1f3d1f3dd8823800210dd49e40170d5abd8 commit 9df0d1f3d1f3dd8823800210dd49e40170d5abd8 Author: Bjoern A. Zeeb AuthorDate: 2025-04-23 23:15:12 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-06-03 18:35:09 +0000 LinuxKPI: 802.11: ensure bandwidth <= channel bandwidth While we could select our own channel width and station bandwidth indepedent of net80211 that is not a good idea and will lead to trouble. Make sure the station bandwidth we select does not exceed the bandwidth of the channel we are tuned into. Now that VHT160 work we may locally disable it (-vht160) and the AP may still support it but we would be on a 80Mhz channel. Or we do support VHT160 but the AP does not. Again we would be on a 80Mhz channel and not support 160Mhz. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 42d23629bc0f..197604e04490 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -522,6 +522,7 @@ static void lkpi_sta_sync_vht_from_ni(struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_node *ni) { + enum ieee80211_sta_rx_bw bw; uint32_t width; int rx_nss; uint16_t rx_mcs_map; @@ -545,19 +546,38 @@ lkpi_sta_sync_vht_from_ni(struct ieee80211_vif *vif, struct ieee80211_sta *sta, if (ni->ni_vht_chanwidth == IEEE80211_VHT_CHANWIDTH_USE_HT) goto skip_bw; + bw = sta->deflink.bandwidth; width = (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK); switch (width) { + /* Deprecated. */ case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ: case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ: - sta->deflink.bandwidth = IEEE80211_STA_RX_BW_160; + bw = IEEE80211_STA_RX_BW_160; break; default: /* Check if we do support 160Mhz somehow after all. */ if ((sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) != 0) - sta->deflink.bandwidth = IEEE80211_STA_RX_BW_160; + bw = IEEE80211_STA_RX_BW_160; else - sta->deflink.bandwidth = IEEE80211_STA_RX_BW_80; + bw = IEEE80211_STA_RX_BW_80; } + /* + * While we can set what is possibly supported we also need to be + * on a channel which supports that bandwidth; e.g., we can support + * VHT160 but the AP only does VHT80. + * Further ni_chan will also have filtered out what we disabled + * by configuration. + * Once net80211 channel selection is fixed for 802.11-2020 and + * VHT160 we can possibly spare ourselves the above. + */ + if (bw == IEEE80211_STA_RX_BW_160 && + !IEEE80211_IS_CHAN_VHT160(ni->ni_chan) && + !IEEE80211_IS_CHAN_VHT80P80(ni->ni_chan)) + bw = IEEE80211_STA_RX_BW_80; + if (bw == IEEE80211_STA_RX_BW_80 && + !IEEE80211_IS_CHAN_VHT80(ni->ni_chan)) + bw = sta->deflink.bandwidth; + sta->deflink.bandwidth = bw; skip_bw: rx_nss = 0;