From 2f33561ea8f98c9bbe99d09c4075fbdd648502bd Mon Sep 17 00:00:00 2001
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Date: Sun, 5 May 2024 09:19:46 +0300
Subject: wifi: iwlwifi: mvm: trigger link selection after exiting EMLSR

If the reason for exiting EMLSR was a blocking reason, wait for the
corresponding unblocking event:
- if there is an ongoing scan - do nothing. Link selection will be
  triggered at the end of it.
- If more than 30 seconds passed since the exit, trigger MLO scan, which
  will trigger link selection
- If less then 30 seconds passed since exit, reuse the latest link
  selection result

If the reason for exiting EMLSR was an exit reason (IWL_MVM_EXIT_*),
schedule MLO scan in 30 seconds.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Link: https://msgid.link/20240505091420.6a808c4ae8f5.Ia79605838eb6deee9358bec633ef537f2653db92@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 .../net/wireless/intel/iwlwifi/mvm/debugfs-vif.c   | 26 +---------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

(limited to 'drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c')

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
index af56a55063a7..aad736b7354b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
@@ -712,31 +712,7 @@ static ssize_t iwl_dbgfs_int_mlo_scan_write(struct ieee80211_vif *vif,
 	if (!action) {
 		ret = iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_INT_MLO, false);
 	} else if (action == 1) {
-		struct ieee80211_channel *channels[IEEE80211_MLD_MAX_NUM_LINKS];
-		unsigned long usable_links = ieee80211_vif_usable_links(vif);
-		size_t n_channels = 0;
-		u8 link_id;
-
-		rcu_read_lock();
-
-		for_each_set_bit(link_id, &usable_links,
-				 IEEE80211_MLD_MAX_NUM_LINKS) {
-			struct ieee80211_bss_conf *link_conf =
-				rcu_dereference(vif->link_conf[link_id]);
-
-			if (WARN_ON_ONCE(!link_conf))
-				continue;
-
-			channels[n_channels++] = link_conf->chanreq.oper.chan;
-		}
-
-		rcu_read_unlock();
-
-		if (n_channels)
-			ret = iwl_mvm_int_mlo_scan_start(mvm, vif, channels,
-							 n_channels);
-		else
-			ret = -EINVAL;
+		ret = iwl_mvm_int_mlo_scan(mvm, vif);
 	} else {
 		ret = -EINVAL;
 	}
-- 
cgit v1.2.3