git: 760e0a18d303 - main - iwlwifi: fixup link_id for certain cases

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Thu, 05 Mar 2026 13:44:32 UTC
The branch main has been updated by bz:

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

commit 760e0a18d3033152899fbd0e3f587dfe3c28d6bf
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-05 13:44:01 +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
    MFC after:      3 days
---
 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