git: cff565a4c033 - main - LinuxKPI: 802.11: consider emulate_chanctx in lkpi_sync_chanctx_cw_from_rx_bw()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 22 Jun 2026 05:31:09 UTC
The branch main has been updated by bz:

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

commit cff565a4c0335e12376ea43f99ef5328c45ce933
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-06-22 01:04:36 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-06-22 01:21:39 +0000

    LinuxKPI: 802.11: consider emulate_chanctx in lkpi_sync_chanctx_cw_from_rx_bw()
    
    Only return early if the bandwidth has not changed and we are not
    using emulate_chanctx or the chandef.width already matches the new
    bandwidth.  Otherwise we have to continue to get all the values
    updated.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 1a07213a58d6..9125ed1cb4b4 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -645,6 +645,7 @@ static void
 lkpi_sync_chanctx_cw_from_rx_bw(struct ieee80211_hw *hw,
     struct ieee80211_vif *vif, struct ieee80211_sta *sta)
 {
+	struct lkpi_hw *lhw;
 	struct ieee80211_chanctx_conf *chanctx_conf;
 	enum ieee80211_sta_rx_bandwidth old_bw;
 	uint32_t changed;
@@ -660,7 +661,9 @@ lkpi_sync_chanctx_cw_from_rx_bw(struct ieee80211_hw *hw,
 	TRACE_RATES("old_bw %d sta->deflink.bandwidth %d hw->conf.chandef.width %d",
 	    old_bw, sta->deflink.bandwidth, lkpi_cw_to_rx_bw(hw->conf.chandef.width));
 
-	if (old_bw == sta->deflink.bandwidth)
+	lhw = HW_TO_LHW(hw);
+	if (old_bw == sta->deflink.bandwidth &&
+	    (!lhw->emulate_chanctx || old_bw == lkpi_cw_to_rx_bw(hw->conf.chandef.width)))
 		return;
 
 	chanctx_conf->def.width = lkpi_rx_bw_to_cw(sta->deflink.bandwidth);