Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jun 2025 14:34:07 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 58dae28f665b - main - LinuxKPI: 802.11: make synching from HT more resilient
Message-ID:  <202506051434.555EY76i056695@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=58dae28f665b32650f452730378693de40e96d68

commit 58dae28f665b32650f452730378693de40e96d68
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-05-27 19:33:13 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-06-05 11:32:27 +0000

    LinuxKPI: 802.11: make synching from HT more resilient
    
    During testing I hit a case where htcap->mcs.rx_mask[0,1] were zero.
    This should not happen as that would mean we are not supporting HT.
    After adding extra caution for debugging I could no longer reproduce
    the case.
    
    So just to deal with the eventuality make synching from HT more
    resilient by checking that we have nss > 0 or otherwise disable
    HT operations.
    
    Move setting the bandwidth below this check to not alter it in
    case of the now early return.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index d424bb6c8d44..390b27802fc4 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -482,12 +482,6 @@ lkpi_sta_sync_ht_from_ni(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
 	sta->deflink.ht_cap.cap = htcap->cap_info;
 	sta->deflink.ht_cap.mcs = htcap->mcs;
 
-	if ((sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) != 0 &&
-	    IEEE80211_IS_CHAN_HT40(ni->ni_chan))
-		sta->deflink.bandwidth = IEEE80211_STA_RX_BW_40;
-	else
-		sta->deflink.bandwidth = IEEE80211_STA_RX_BW_20;
-
 	/*
 	 * 802.11n-2009 20.6 Parameters for HT MCSs gives the mandatory/
 	 * optional MCS for Nss=1..4.  We need to check the first four
@@ -496,11 +490,21 @@ lkpi_sta_sync_ht_from_ni(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
 	 */
 	rx_nss = 0;
 	for (i = 0; i < 4; i++) {
-		if (htcap->mcs.rx_mask[i])
+		if (htcap->mcs.rx_mask[i] != 0)
 			rx_nss++;
 	}
-	if (rx_nss > 0)
+	if (rx_nss > 0) {
 		sta->deflink.rx_nss = rx_nss;
+	} else {
+		sta->deflink.ht_cap.ht_supported = false;
+		return;
+	}
+
+	if ((sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) != 0 &&
+	    IEEE80211_IS_CHAN_HT40(ni->ni_chan))
+		sta->deflink.bandwidth = IEEE80211_STA_RX_BW_40;
+	else
+		sta->deflink.bandwidth = IEEE80211_STA_RX_BW_20;
 
 	IMPROVE("sta->wme");
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202506051434.555EY76i056695>