git: d9f606424916 - stable/15 - iwlwifi: fixup link_id for certain cases

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 09 Mar 2026 11:03:48 UTC
The branch stable/15 has been updated by bz:

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

commit d9f60642491649b6a05d8478ff16c3252acd8993
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-03-05 09:47:10 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-03-09 11:03:10 +0000

    iwlwifi: fixup link_id for certain cases
    
    In iwl_mvm_mld_vif_cfg_changed_station() if we do not do MLO (which we
    do not do yet at all), dtim_period is not yet set but asssoc is
    (our common case) the link_id can become -1 as active_links is always
    0 for the non-MLO case.
    
    This leads to logging of a WARN;
    Invalid link ID for session protection: 4294967295
    
    Fixup the link_id if it is -1 to be 0.  This is the deflink link_id so
    that should always be fine in this case.
    
    For Linux 7.0-rc2 that code is already gone so this is a local temporary
    stopgap measure for the mvm-mld devices (e.g., some AX210).
    
    Sponosred by:   The FreeBSD Foundation
    
    (cherry picked from commit 760e0a18d3033152899fbd0e3f587dfe3c28d6bf)
---
 sys/contrib/dev/iwlwifi/mvm/mld-mac80211.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys/contrib/dev/iwlwifi/mvm/mld-mac80211.c b/sys/contrib/dev/iwlwifi/mvm/mld-mac80211.c
index bf24f8cb673e..8b88f211066d 100644
--- a/sys/contrib/dev/iwlwifi/mvm/mld-mac80211.c
+++ b/sys/contrib/dev/iwlwifi/mvm/mld-mac80211.c
@@ -838,6 +838,14 @@ static void iwl_mvm_mld_vif_cfg_changed_station(struct iwl_mvm *mvm,
 				 */
 				unsigned int link_id =
 					ffs(vif->active_links) - 1;
+#if defined(__FreeBSD__)
+				/* link_id is gone in Linux v7.0.
+				 * For us it can become -1 if this is non-MLO
+				 * and dtim_period is still 0.
+				 */
+				if (link_id == -1)
+					link_id = 0;
+#endif
 
 				/* If we're not restarting and still haven't
 				 * heard a beacon (dtim period unknown) then