git: 9040277864ab - main - iwlwifi/mld: only get tid after checking that it is a dataqos frame

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 19 Nov 2025 02:27:28 UTC
The branch main has been updated by bz:

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

commit 9040277864ab28cabfc53f238e900bc19ac75d7e
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-11-19 02:13:15 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-11-19 02:25:38 +0000

    iwlwifi/mld: only get tid after checking that it is a dataqos frame
    
    Like we did for mvm, only get the tid after all the other checks are
    done by the function in order to not trigger an assert.  Linux will
    likely return a random value there which later is not used as the
    driver does an early return.  In LinuxKPI we do check that the frame
    assumptions hold up, which does not go so well for a random frame.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    PR:             290808
---
 sys/contrib/dev/iwlwifi/mld/agg.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys/contrib/dev/iwlwifi/mld/agg.c b/sys/contrib/dev/iwlwifi/mld/agg.c
index 3a346bcd6665..e3bc8767297a 100644
--- a/sys/contrib/dev/iwlwifi/mld/agg.c
+++ b/sys/contrib/dev/iwlwifi/mld/agg.c
@@ -201,7 +201,11 @@ iwl_mld_reorder(struct iwl_mld *mld, struct napi_struct *napi,
 	struct iwl_mld_link_sta *mld_link_sta;
 	u32 reorder = le32_to_cpu(desc->reorder_data);
 	bool amsdu, last_subframe, is_old_sn, is_dup;
+#if defined(__linux__)
 	u8 tid = ieee80211_get_tid(hdr);
+#elif defined(__FreeBSD__)
+	u8 tid;
+#endif
 	u8 baid;
 	u16 nssn, sn;
 	u32 sta_mask = 0;
@@ -243,6 +247,10 @@ iwl_mld_reorder(struct iwl_mld *mld, struct napi_struct *napi,
 	for_each_mld_link_sta(mld_sta, mld_link_sta, link_id)
 		sta_mask |= BIT(mld_link_sta->fw_id);
 
+#if defined(__FreeBSD__)
+	tid = ieee80211_get_tid(hdr);
+#endif
+
 	/* verify the BAID is correctly mapped to the sta and tid */
 	if (IWL_FW_CHECK(mld,
 			 tid != baid_data->tid ||