]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: iwlwifi: mvm: fix beacon template/fixed rate
authorJohannes Berg <johannes.berg@intel.com>
Wed, 8 Oct 2025 09:20:44 +0000 (11:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Nov 2025 09:37:32 +0000 (10:37 +0100)
[ Upstream commit 3592c0083fb29cca13cd9978b8844d58b4eff548 ]

During the development of the rate changes, I evidently made
some changes that shouldn't have been there; beacon templates
with rate_n_flags are only in old versions, so no changes to
them should have been necessary, and evidently broke on some
devices. This also would have broken fixed (injection) rates,
it would seem. Restore the old handling of this.

Fixes: dabc88cb3b78 ("wifi: iwlwifi: handle v3 rates")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220558
Reviewed-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20251008112044.3bb8ea849d8d.I90f4d2b2c1f62eaedaf304a61d2ab9e50c491c2d@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/utils.c

index 8805ab344895a14e74787850acce4dc7f6839155..0065c2ead56b1596cfc3e691c75d07aa84bbe3ed 100644 (file)
@@ -938,19 +938,12 @@ u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct iwl_mvm *mvm,
 
 u16 iwl_mvm_mac_ctxt_get_beacon_flags(const struct iwl_fw *fw, u8 rate_idx)
 {
+       u16 flags = iwl_mvm_mac80211_idx_to_hwrate(fw, rate_idx);
        bool is_new_rate = iwl_fw_lookup_cmd_ver(fw, BEACON_TEMPLATE_CMD, 0) > 10;
-       u16 flags, cck_flag;
-
-       if (is_new_rate) {
-               flags = iwl_mvm_mac80211_idx_to_hwrate(fw, rate_idx);
-               cck_flag = IWL_MAC_BEACON_CCK;
-       } else {
-               cck_flag = IWL_MAC_BEACON_CCK_V1;
-               flags = iwl_fw_rate_idx_to_plcp(rate_idx);
-       }
 
        if (rate_idx <= IWL_LAST_CCK_RATE)
-               flags |= cck_flag;
+               flags |= is_new_rate ? IWL_MAC_BEACON_CCK
+                         : IWL_MAC_BEACON_CCK_V1;
 
        return flags;
 }
index 62da0132f3838a5e870c9ba27546304efe44e554..a62f5288dfd0642be53e935b07e369d530cce6ca 100644 (file)
@@ -169,9 +169,15 @@ int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags,
 
 u8 iwl_mvm_mac80211_idx_to_hwrate(const struct iwl_fw *fw, int rate_idx)
 {
-       return (rate_idx >= IWL_FIRST_OFDM_RATE ?
-               rate_idx - IWL_FIRST_OFDM_RATE :
-               rate_idx);
+       if (iwl_fw_lookup_cmd_ver(fw, TX_CMD, 0) > 8)
+               /* In the new rate legacy rates are indexed:
+                * 0 - 3 for CCK and 0 - 7 for OFDM.
+                */
+               return (rate_idx >= IWL_FIRST_OFDM_RATE ?
+                       rate_idx - IWL_FIRST_OFDM_RATE :
+                       rate_idx);
+
+       return iwl_fw_rate_idx_to_plcp(rate_idx);
 }
 
 u8 iwl_mvm_mac80211_ac_to_ucode_ac(enum ieee80211_ac_numbers ac)