Commit 187accaa authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Johannes Berg
Browse files

wifi: iwlwifi: mvm: don't send an ROC command with max_delay = 0



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: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: default avatarJohannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20240703064027.e12f8d84c8fd.I3dd9f720c678c06ec7a5bf7ca56e21cf0b614c8c@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 4278d88f
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -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) {