git: a77abd53e83c - stable/15 - LinuxKPI: 802.11: clear CONF_IDLE earlier

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 12 Nov 2025 15:41:50 UTC
The branch stable/15 has been updated by bz:

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

commit a77abd53e83c4357ad8a8006a6e89759e65e3a5b
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-11-10 19:41:08 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-11-12 15:41:24 +0000

    LinuxKPI: 802.11: clear CONF_IDLE earlier
    
    When starting to scan and ending a scan we clear/set the hardware to
    idle.  Similarly we set the hw to idle when we remove the channel
    context but when starting we only set it to non-idle when we went from
    assoc to run.  This apparently was not a problem most of the time
    as the switch from a failed hardware scan to a software scan was
    racing against net80211.  ad4ddc83ebf8 fixed that specifically for
    rtw88 and while we were more consistently scanning, this broke
    authentication as the setting of idle at the end of the scan was
    now happening reliably.  Move the unsetting of idle from assoc_to_run
    to scan_to_auth for when we  create the chanctx to keep it
    symmetrical.  This makes authentication work again for rtw88 (though
    not for everyone due to other possible problems with net80211).
    
    This likely also fixes the problems in the listed PRs.
    
    iwlwifi(4) mvm and mld driver parts do not use this information at
    all and were never affected.
    
    Sponsored by:   The FreeBSD Foundation
    PR:             290850, 288186, 281979
    PR:             272145 (the non skb-mem-limit parts)
    
    (cherry picked from commit b568711f8ef1afd7c86ea2d8bd2f94f399f54dc1)
---
 sys/compat/linuxkpi/common/src/linux_80211.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 0dc3b2631804..f025f191a3bd 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -2308,6 +2308,10 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
 		changed |= IEEE80211_CHANCTX_CHANGE_WIDTH;
 		lkpi_80211_mo_change_chanctx(hw, chanctx_conf, changed);
 	} else {
+		/* The device is no longer idle. */
+		IMPROVE("Once we do multi-vif, only do for 1st chanctx");
+		lkpi_hw_conf_idle(hw, false);
+
 		error = lkpi_80211_mo_add_chanctx(hw, chanctx_conf);
 		if (error == 0 || error == EOPNOTSUPP) {
 			vif->bss_conf.chanreq.oper.chan = chanctx_conf->def.chan;
@@ -3081,8 +3085,6 @@ lkpi_sta_assoc_to_run(struct ieee80211vap *vap, enum ieee80211_state nstate, int
 		lsta->in_mgd = false;
 	}
 
-	lkpi_hw_conf_idle(hw, false);
-
 	/*
 	 * And then:
 	 * - (more packets)?