]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: iwlwifi: mvm: parse beacon notif per layout
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 14 Jul 2026 11:19:56 +0000 (14:19 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 14 Jul 2026 17:45:20 +0000 (20:45 +0300)
The beacon TX notification can arrive in different layouts, and fields
must be read only after selecting the expected format.

Parse gp2 and TSF from the matching notification structure in each
branch, and keep using the parsed gp2 for CSA countdown and debug output.
Drop the obsolete cached gp2 field.

Assisted-by: GitHub Copilot:gpt-5.3-codex
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260714141909.cc8aa937f8e5.I921f8dadcb20cb73e8283e1b8546e1778205411f@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

index d6a8624b1ae5ce384592e2fd3dc41e47312fea14..b2c5be22c293cfb049c3174551fd6d8c6212f7d9 100644 (file)
@@ -1493,49 +1493,54 @@ void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
 {
        struct iwl_rx_packet *pkt = rxb_addr(rxb);
        unsigned int pkt_len = iwl_rx_packet_payload_len(pkt);
-       struct iwl_extended_beacon_notif *beacon = (void *)pkt->data;
-       struct iwl_extended_beacon_notif_v5 *beacon_v5 = (void *)pkt->data;
        struct ieee80211_vif *csa_vif;
        struct ieee80211_vif *tx_blocked_vif;
        struct agg_tx_status *agg_status;
+       u32 beacon_gp2;
        u16 status;
 
        lockdep_assert_held(&mvm->mutex);
 
-       mvm->ap_last_beacon_gp2 = le32_to_cpu(beacon->gp2);
-
        if (!iwl_mvm_is_short_beacon_notif_supported(mvm)) {
+               struct iwl_extended_beacon_notif_v5 *beacon = (void *)pkt->data;
                struct iwl_tx_resp *beacon_notify_hdr =
-                       &beacon_v5->beacon_notify_hdr;
+                       &beacon->beacon_notify_hdr;
 
-               if (unlikely(pkt_len < sizeof(*beacon_v5)))
+               if (unlikely(pkt_len < sizeof(*beacon)))
                        return;
 
-               mvm->ibss_manager = beacon_v5->ibss_mgr_status != 0;
+               beacon_gp2 = le32_to_cpu(beacon->gp2);
+
+               mvm->ibss_manager = beacon->ibss_mgr_status != 0;
                agg_status = iwl_mvm_get_agg_status(mvm, beacon_notify_hdr);
                status = le16_to_cpu(agg_status->status) & TX_STATUS_MSK;
                IWL_DEBUG_RX(mvm,
                             "beacon status %#x retries:%d tsf:0x%016llX gp2:0x%X rate:%d\n",
                             status, beacon_notify_hdr->failure_frame,
                             le64_to_cpu(beacon->tsf),
-                            mvm->ap_last_beacon_gp2,
+                            beacon_gp2,
                             le32_to_cpu(beacon_notify_hdr->initial_rate));
        } else {
+               const struct iwl_extended_beacon_notif *beacon =
+                       (void *)pkt->data;
+
                if (unlikely(pkt_len < sizeof(*beacon)))
                        return;
 
+               beacon_gp2 = le32_to_cpu(beacon->gp2);
+
                mvm->ibss_manager = beacon->ibss_mgr_status != 0;
                status = le32_to_cpu(beacon->status) & TX_STATUS_MSK;
                IWL_DEBUG_RX(mvm,
                             "beacon status %#x tsf:0x%016llX gp2:0x%X\n",
                             status, le64_to_cpu(beacon->tsf),
-                            mvm->ap_last_beacon_gp2);
+                            beacon_gp2);
        }
 
        csa_vif = rcu_dereference_protected(mvm->csa_vif,
                                            lockdep_is_held(&mvm->mutex));
        if (unlikely(csa_vif && csa_vif->bss_conf.csa_active))
-               iwl_mvm_csa_count_down(mvm, csa_vif, mvm->ap_last_beacon_gp2,
+               iwl_mvm_csa_count_down(mvm, csa_vif, beacon_gp2,
                                       (status == TX_STATUS_SUCCESS));
 
        tx_blocked_vif = rcu_dereference_protected(mvm->csa_tx_blocked_vif,
index 48cc10db7b967832981f76f713a90bc71c63d0da..f4f4446bef54285b11a2cb1930e7e0585e7cd918 100644 (file)
@@ -3061,7 +3061,6 @@ void iwl_mvm_stop_ap_ibss_common(struct iwl_mvm *mvm,
        }
 
        mvmvif->ap_ibss_active = false;
-       mvm->ap_last_beacon_gp2 = 0;
 
        if (vif->type == NL80211_IFTYPE_AP && !vif->p2p) {
                iwl_mvm_vif_set_low_latency(mvmvif, false,
index 683cac56822c8673e628365234ff0fd7cc394d77..31912f4d0175f8225612233e2836801c78aec1bf 100644 (file)
@@ -1168,9 +1168,6 @@ struct iwl_mvm {
        struct ieee80211_vif __rcu *csa_tx_blocked_vif;
        u8 csa_tx_block_bcn_timeout;
 
-       /* system time of last beacon (for AP/GO interface) */
-       u32 ap_last_beacon_gp2;
-
        /* indicates that we transmitted the last beacon */
        bool ibss_manager;