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
This commit is contained in:
Bjoern A. Zeeb
2025-05-27 19:33:13 +00:00
parent 38c655093c
commit 58dae28f66
+12 -8
View File
@@ -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");