summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/intel/iwlwifi/mld/mlo.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/mld/mlo.c')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mld/mlo.c110
1 files changed, 47 insertions, 63 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mld/mlo.c b/drivers/net/wireless/intel/iwlwifi/mld/mlo.c
index dba5379ed009..e57f5388fe77 100644
--- a/drivers/net/wireless/intel/iwlwifi/mld/mlo.c
+++ b/drivers/net/wireless/intel/iwlwifi/mld/mlo.c
@@ -287,6 +287,36 @@ int iwl_mld_block_emlsr_sync(struct iwl_mld *mld, struct ieee80211_vif *vif,
return _iwl_mld_emlsr_block(mld, vif, reason, link_to_keep, true);
}
+#define IWL_MLD_EMLSR_BLOCKED_TMP_NON_BSS_TIMEOUT (10 * HZ)
+
+static void iwl_mld_vif_iter_emlsr_block_tmp_non_bss(void *_data, u8 *mac,
+ struct ieee80211_vif *vif)
+{
+ struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
+ int ret;
+
+ if (!iwl_mld_vif_has_emlsr_cap(vif))
+ return;
+
+ ret = iwl_mld_block_emlsr_sync(mld_vif->mld, vif,
+ IWL_MLD_EMLSR_BLOCKED_TMP_NON_BSS,
+ iwl_mld_get_primary_link(vif));
+ if (ret)
+ return;
+
+ wiphy_delayed_work_queue(mld_vif->mld->wiphy,
+ &mld_vif->emlsr.tmp_non_bss_done_wk,
+ IWL_MLD_EMLSR_BLOCKED_TMP_NON_BSS_TIMEOUT);
+}
+
+void iwl_mld_emlsr_block_tmp_non_bss(struct iwl_mld *mld)
+{
+ ieee80211_iterate_active_interfaces_mtx(mld->hw,
+ IEEE80211_IFACE_ITER_NORMAL,
+ iwl_mld_vif_iter_emlsr_block_tmp_non_bss,
+ NULL);
+}
+
static void _iwl_mld_select_links(struct iwl_mld *mld,
struct ieee80211_vif *vif);
@@ -530,10 +560,12 @@ void iwl_mld_emlsr_check_tpt(struct wiphy *wiphy, struct wiphy_work *wk)
/*
* TPT is unblocked, need to check if the TPT criteria is still met.
*
- * If EMLSR is active, then we also need to check the secondar link
- * requirements.
+ * If EMLSR is active for at least 5 seconds, then we also
+ * need to check the secondary link requirements.
*/
- if (iwl_mld_emlsr_active(vif)) {
+ if (iwl_mld_emlsr_active(vif) &&
+ time_is_before_jiffies(mld_vif->emlsr.last_entry_ts +
+ IWL_MLD_TPT_COUNT_WINDOW)) {
sec_link_id = iwl_mld_get_other_link(vif, iwl_mld_get_primary_link(vif));
sec_link = iwl_mld_link_dereference_check(mld_vif, sec_link_id);
if (WARN_ON_ONCE(!sec_link))
@@ -657,42 +689,6 @@ s8 iwl_mld_get_emlsr_rssi_thresh(struct iwl_mld *mld,
#undef RSSI_THRESHOLD
}
-#define IWL_MLD_BT_COEX_DISABLE_EMLSR_RSSI_THRESH -69
-#define IWL_MLD_BT_COEX_ENABLE_EMLSR_RSSI_THRESH -63
-#define IWL_MLD_BT_COEX_WIFI_LOSS_THRESH 7
-
-VISIBLE_IF_IWLWIFI_KUNIT
-bool
-iwl_mld_bt_allows_emlsr(struct iwl_mld *mld, struct ieee80211_bss_conf *link,
- bool check_entry)
-{
- int bt_penalty, rssi_thresh;
- s32 link_rssi;
-
- if (WARN_ON_ONCE(!link->bss))
- return false;
-
- link_rssi = MBM_TO_DBM(link->bss->signal);
- rssi_thresh = check_entry ?
- IWL_MLD_BT_COEX_ENABLE_EMLSR_RSSI_THRESH :
- IWL_MLD_BT_COEX_DISABLE_EMLSR_RSSI_THRESH;
- /* No valid RSSI - force to take low rssi */
- if (!link_rssi)
- link_rssi = rssi_thresh - 1;
-
- if (link_rssi > rssi_thresh)
- bt_penalty = max(mld->last_bt_notif.wifi_loss_mid_high_rssi[PHY_BAND_24][0],
- mld->last_bt_notif.wifi_loss_mid_high_rssi[PHY_BAND_24][1]);
- else
- bt_penalty = max(mld->last_bt_notif.wifi_loss_low_rssi[PHY_BAND_24][0],
- mld->last_bt_notif.wifi_loss_low_rssi[PHY_BAND_24][1]);
-
- IWL_DEBUG_EHT(mld, "BT penalty for link-id %0X is %d\n",
- link->link_id, bt_penalty);
- return bt_penalty < IWL_MLD_BT_COEX_WIFI_LOSS_THRESH;
-}
-EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_mld_bt_allows_emlsr);
-
static u32
iwl_mld_emlsr_disallowed_with_link(struct iwl_mld *mld,
struct ieee80211_vif *vif,
@@ -707,8 +703,7 @@ iwl_mld_emlsr_disallowed_with_link(struct iwl_mld *mld,
if (WARN_ON_ONCE(!conf))
return IWL_MLD_EMLSR_EXIT_INVALID;
- if (link->chandef->chan->band == NL80211_BAND_2GHZ &&
- !iwl_mld_bt_allows_emlsr(mld, conf, true))
+ if (link->chandef->chan->band == NL80211_BAND_2GHZ && mld->bt_is_active)
ret |= IWL_MLD_EMLSR_EXIT_BT_COEX;
if (link->signal <
@@ -1046,41 +1041,30 @@ static void iwl_mld_emlsr_check_bt_iter(void *_data, u8 *mac,
struct ieee80211_vif *vif)
{
struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
- const struct iwl_bt_coex_profile_notif zero_notif = {};
struct iwl_mld *mld = mld_vif->mld;
struct ieee80211_bss_conf *link;
unsigned int link_id;
- const struct iwl_bt_coex_profile_notif *notif = &mld->last_bt_notif;
if (!iwl_mld_vif_has_emlsr_cap(vif))
return;
- /* zeroed structure means that BT is OFF */
- if (!memcmp(notif, &zero_notif, sizeof(*notif))) {
+ if (!mld->bt_is_active) {
iwl_mld_retry_emlsr(mld, vif);
return;
}
- for_each_vif_active_link(vif, link, link_id) {
- bool emlsr_active, emlsr_allowed;
+ /* BT is turned ON but we are not in EMLSR, nothing to do */
+ if (!iwl_mld_emlsr_active(vif))
+ return;
- if (WARN_ON(!link->chanreq.oper.chan))
- continue;
+ /* In EMLSR and BT is turned ON */
- if (link->chanreq.oper.chan->band != NL80211_BAND_2GHZ)
+ for_each_vif_active_link(vif, link, link_id) {
+ if (WARN_ON(!link->chanreq.oper.chan))
continue;
- emlsr_active = iwl_mld_emlsr_active(vif);
- emlsr_allowed = iwl_mld_bt_allows_emlsr(mld, link,
- !emlsr_active);
- if (emlsr_allowed && !emlsr_active) {
- iwl_mld_retry_emlsr(mld, vif);
- return;
- }
-
- if (!emlsr_allowed && emlsr_active) {
- iwl_mld_exit_emlsr(mld, vif,
- IWL_MLD_EMLSR_EXIT_BT_COEX,
+ if (link->chanreq.oper.chan->band == NL80211_BAND_2GHZ) {
+ iwl_mld_exit_emlsr(mld, vif, IWL_MLD_EMLSR_EXIT_BT_COEX,
iwl_mld_get_primary_link(vif));
return;
}
@@ -1167,8 +1151,8 @@ void iwl_mld_retry_emlsr(struct iwl_mld *mld, struct ieee80211_vif *vif)
{
struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
- if (!iwl_mld_vif_has_emlsr_cap(vif) || iwl_mld_emlsr_active(vif) ||
- mld_vif->emlsr.blocked_reasons)
+ if (!IWL_MLD_AUTO_EML_ENABLE || !iwl_mld_vif_has_emlsr_cap(vif) ||
+ iwl_mld_emlsr_active(vif) || mld_vif->emlsr.blocked_reasons)
return;
iwl_mld_int_mlo_scan(mld, vif);