git: f92932149af5 - stable/13 - iwlwifi: move an ieee80211_get_tid() call

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 21 Sep 2022 14:01:28 UTC
The branch stable/13 has been updated by bz:

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

commit f92932149af5fd881ff68e372c4b72c9b28256f5
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-08-31 23:01:36 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-09-21 11:46:46 +0000

    iwlwifi: move an ieee80211_get_tid() call
    
    Introduce a local change.  It seems ieee80211_get_tid() does not deal
    with non-dataqos packets unlike net80211's ieee80211_gettid().
    Gernally all calls in Linux drivers to ieee80211_get_tid() seem to
    be proceeded by an ieee80211_is_data_qos() check.
    
    Moving the ieee80211_get_tid() has no difference in the result, but
    (a) saves us the call if we do not need it due to an earlier return,
    and (b) allows us to put an assert into the LinuxKPI ieee80211_get_tid()
    implementation to avoid accidentally returning random frame header data
    in case of a missing earlier ieee80211_is_data_qos() check in (future/
    other) drivers.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 26a36948331bd08d9afaddfc0da724eacdb953dd)
---
 sys/contrib/dev/iwlwifi/mvm/rxmq.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/contrib/dev/iwlwifi/mvm/rxmq.c b/sys/contrib/dev/iwlwifi/mvm/rxmq.c
index 1e8a5611b9f2..7325e9d44273 100644
--- a/sys/contrib/dev/iwlwifi/mvm/rxmq.c
+++ b/sys/contrib/dev/iwlwifi/mvm/rxmq.c
@@ -963,7 +963,11 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,
 	bool amsdu = desc->mac_flags2 & IWL_RX_MPDU_MFLG2_AMSDU;
 	bool last_subframe =
 		desc->amsdu_info & IWL_RX_MPDU_AMSDU_LAST_SUBFRAME;
+#if defined(__linux__)
 	u8 tid = ieee80211_get_tid(hdr);
+#elif defined(__FreeBSD__)
+	u8 tid;
+#endif
 	u8 sub_frame_idx = desc->amsdu_info &
 			   IWL_RX_MPDU_AMSDU_SUBFRAME_IDX_MASK;
 	struct iwl_mvm_reorder_buf_entry *entries;
@@ -1008,6 +1012,9 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,
 		return false;
 	}
 
+#if defined(__FreeBSD__)
+	tid = ieee80211_get_tid(hdr);
+#endif
 	if (WARN(tid != baid_data->tid || mvm_sta->sta_id != baid_data->sta_id,
 		 "baid 0x%x is mapped to sta:%d tid:%d, but was received for sta:%d tid:%d\n",
 		 baid, baid_data->sta_id, baid_data->tid, mvm_sta->sta_id,