wifi: iwlwifi: mvm: always set the TWT IE offset
authorShaul Triebitz <shaul.triebitz@intel.com>
Sun, 12 May 2024 12:25:04 +0000 (15:25 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 29 May 2024 13:26:05 +0000 (15:26 +0200)
In beacon template version 14, make sure to always set
the TWT IE offset before sending the beacon template command,
also in the debugfs inject_beacon_ie path.
If the TWT IE does not exist, the offset will be set to zero.

Fixes: bf0212fd8faa ("wifi: iwlwifi: mvm: add beacon template version 14")
Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240512152312.eb27175c345a.If30ef24aba10fe47fd42a7a9703eb8903035e294@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

index 79f4ac8cbc729e9a6caaf393080fe99a4320892e..8101ecbb478b6ff5b38107aa0c5a3975d878c914 100644 (file)
@@ -1617,6 +1617,15 @@ static int _iwl_dbgfs_inject_beacon_ie(struct iwl_mvm *mvm, char *bin, int len)
                                         &beacon_cmd.tim_size,
                                         beacon->data, beacon->len);
 
+               if (iwl_fw_lookup_cmd_ver(mvm->fw,
+                                         BEACON_TEMPLATE_CMD, 0) >= 14) {
+                       u32 offset = iwl_mvm_find_ie_offset(beacon->data,
+                                                           WLAN_EID_S1G_TWT,
+                                                           beacon->len);
+
+                       beacon_cmd.btwt_offset = cpu_to_le32(offset);
+               }
+
                iwl_mvm_mac_ctxt_send_beacon_cmd(mvm, beacon, &beacon_cmd,
                                                 sizeof(beacon_cmd));
        }
index 5a06f887769a6ad2de8f73c59afb1b75aa37aa1f..5144fa0f96b0e047a5feea0d2e8f564ec6d1cb94 100644 (file)
@@ -873,7 +873,7 @@ void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm,
        }
 }
 
-static u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size)
+u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size)
 {
        struct ieee80211_mgmt *mgmt = (void *)beacon;
        const u8 *ie;
index 1f58c727fa632df016241ed1a64ba5731d0b1d79..0a1959bd4079997854d9f3c2c444adc2f2f945a5 100644 (file)
@@ -1758,6 +1758,7 @@ u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx);
 void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, int clock_type, u32 *gp2,
                           u64 *boottime, ktime_t *realtime);
 u32 iwl_mvm_get_systime(struct iwl_mvm *mvm);
+u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size);
 
 /* Tx / Host Commands */
 int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm,