The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=34c150cc5fdb3c599bb6ff14eb56afee00c45258
commit 34c150cc5fdb3c599bb6ff14eb56afee00c45258 Author: Bjoern A. Zeeb <b...@freebsd.org> AuthorDate: 2025-05-14 00:30:00 +0000 Commit: Bjoern A. Zeeb <b...@freebsd.org> CommitDate: 2025-06-03 18:35:10 +0000 LinuxKPI: 802.11: move rx_nss check to be at least 1 into sync function We set rx_nss to at least 1 and the sync functions for HT and VHT are careful not to set it to 0. Rather than relying on that and any possible future call to lkpi_sta_sync_from_ni() migrate the MAX() call into the sync function after each standard level went through to make sure that at the end we at least have rx_nss set to 1. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index e92656ed41c5..d424bb6c8d44 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -619,6 +619,13 @@ lkpi_sta_sync_from_ni(struct ieee80211_hw *hw, struct ieee80211_vif *vif, #if defined(LKPI_80211_VHT) lkpi_sta_sync_vht_from_ni(vif, sta, ni); #endif + + /* + * Ensure rx_nss is at least 1 as otherwise drivers run into + * unexpected problems. + */ + sta->deflink.rx_nss = MAX(1, sta->deflink.rx_nss); + /* * We are also called from node allocation which net80211 * can do even on `ifconfig down`; in that case the chanctx @@ -2938,7 +2945,6 @@ lkpi_sta_assoc_to_run(struct ieee80211vap *vap, enum ieee80211_state nstate, int IMPROVE("net80211 does not consider node authorized"); } - sta->deflink.rx_nss = MAX(1, sta->deflink.rx_nss); IMPROVE("Is this the right spot, has net80211 done all updates already?"); lkpi_sta_sync_from_ni(hw, vif, sta, ni, true);