]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: mvm: don't send an ROC command with max_delay = 0
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Wed, 3 Jul 2024 03:43:17 +0000 (06:43 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 4 Jul 2024 11:49:17 +0000 (13:49 +0200)
The firmware can't handle that (it will crash with ASSERT 300A).
This happened because we looked at vif->bss_conf which is not
the right bss_conf to look at in case of an MLD connection.
Fix iwl_mvm_roc_duration_and_delay to iterate on the active links to
get the right value for the dtim_interval.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20240703064027.e12f8d84c8fd.I3dd9f720c678c06ec7a5bf7ca56e21cf0b614c8c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c

index 77b0cae8566fead692445b69c0b65d4673effe0d..a8c42ce3b6300816ccc9d0a18c0aeeb01e9d1b2a 100644 (file)
@@ -1057,12 +1057,21 @@ void iwl_mvm_roc_duration_and_delay(struct ieee80211_vif *vif,
                                    u32 *duration_tu,
                                    u32 *delay)
 {
-       u32 dtim_interval = vif->bss_conf.dtim_period *
-               vif->bss_conf.beacon_int;
+       struct ieee80211_bss_conf *link_conf;
+       unsigned int link_id;
+       u32 dtim_interval = 0;
 
        *delay = AUX_ROC_MIN_DELAY;
        *duration_tu = MSEC_TO_TU(duration_ms);
 
+       rcu_read_lock();
+       for_each_vif_active_link(vif, link_conf, link_id) {
+               dtim_interval =
+                       max_t(u32, dtim_interval,
+                             link_conf->dtim_period * link_conf->beacon_int);
+       }
+       rcu_read_unlock();
+
        /*
         * If we are associated we want the delay time to be at least one
         * dtim interval so that the FW can wait until after the DTIM and
@@ -1071,8 +1080,10 @@ void iwl_mvm_roc_duration_and_delay(struct ieee80211_vif *vif,
         * Since we want to use almost a whole dtim interval we would also
         * like the delay to be for 2-3 dtim intervals, in case there are
         * other time events with higher priority.
+        * dtim_interval should never be 0, it can be 1 if we don't know it
+        * (we haven't heard any beacon yet).
         */
-       if (vif->cfg.assoc) {
+       if (vif->cfg.assoc && !WARN_ON(!dtim_interval)) {
                *delay = min_t(u32, dtim_interval * 3, AUX_ROC_MAX_DELAY);
                /* We cannot remain off-channel longer than the DTIM interval */
                if (dtim_interval <= *duration_tu) {