From 9c6921121961cc0cecccb95652be6d98116f854b Mon Sep 17 00:00:00 2001 From: Miri Korenblit Date: Tue, 16 Apr 2024 13:53:59 +0300 Subject: wifi: iwlwifi: mvm: calculate EMLSR mode after connection The function iwl_mvm_can_enter_esr() is (among others) calculating if EMLSR mode is disabled due to BT coex by calling iwl_mvm_bt_coex_calculate_esr_mode(), then stores the decision in mvmvif::esr_disable_reason. But there is no need to calculate this every time iwl_mvm_can_enter_esr is called. Fix this by calculating it once after authorization, and in iwl_mvm_can_enter_esr only check mvmvif::esr_disable_reason. Signed-off-by: Miri Korenblit Link: https://msgid.link/20240416134215.a767e243366e.I3b32d36cda23f67dc103a28a9bdccb0039d22574@changeid Signed-off-by: Johannes Berg --- drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c') diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c index bcf2fd23300f..25d98ea6db44 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c @@ -1344,13 +1344,13 @@ static bool iwl_mvm_can_enter_esr(struct iwl_mvm *mvm, unsigned long desired_links) { struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - int primary_link = iwl_mvm_mld_get_primary_link(mvm, vif, - desired_links); + u16 usable_links = ieee80211_vif_usable_links(vif); const struct wiphy_iftype_ext_capab *ext_capa; bool ret = true; int link_id; - if (primary_link < 0) + if (!ieee80211_vif_is_mld(vif) || !vif->cfg.assoc || + hweight16(usable_links) <= 1) return false; if (!(vif->cfg.eml_cap & IEEE80211_EML_CAP_EMLSR_SUPP)) @@ -1373,12 +1373,7 @@ static bool iwl_mvm_can_enter_esr(struct iwl_mvm *mvm, if (link_conf->chanreq.oper.chan->band != NL80211_BAND_2GHZ) continue; - ret = iwl_mvm_bt_coex_calculate_esr_mode(mvm, vif, link_id, - primary_link); - // Mark eSR as disabled for the next time - if (!ret) - mvmvif->esr_disable_reason |= IWL_MVM_ESR_DISABLE_COEX; - break; + return !(mvmvif->esr_disable_reason & IWL_MVM_ESR_DISABLE_COEX); } return ret; -- cgit v1.2.3