From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 04/16] wifi: iwlwifi: mvm: calculate EMLSR mode after connection
Date: Tue, 16 Apr 2024 13:53:59 +0300 [thread overview]
Message-ID: <20240416134215.a767e243366e.I3b32d36cda23f67dc103a28a9bdccb0039d22574@changeid> (raw)
In-Reply-To: <20240416105411.706221-1-miriam.rachel.korenblit@intel.com>
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 <miriam.rachel.korenblit@intel.com>
---
drivers/net/wireless/intel/iwlwifi/mvm/coex.c | 10 ++++-----
.../net/wireless/intel/iwlwifi/mvm/mac80211.c | 21 +++++++++++++++++++
.../wireless/intel/iwlwifi/mvm/mld-mac80211.c | 13 ++++--------
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 9 +++-----
drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 4 ++--
5 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/coex.c b/drivers/net/wireless/intel/iwlwifi/mvm/coex.c
index 41afd5d50d81..f31752bcd2a2 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/coex.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/coex.c
@@ -279,7 +279,7 @@ static void iwl_mvm_bt_coex_enable_esr(struct iwl_mvm *mvm,
* This function receives the LB link id and checks if eSR should be
* enabled or disabled (due to BT coex)
*/
-bool
+static bool
iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
int link_id, int primary_link)
@@ -336,9 +336,9 @@ iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm,
return wifi_loss_rate <= IWL_MVM_BT_COEX_WIFI_LOSS_THRESH;
}
-void iwl_mvm_bt_coex_update_vif_esr(struct iwl_mvm *mvm,
- struct ieee80211_vif *vif,
- int link_id)
+void iwl_mvm_bt_coex_update_link_esr(struct iwl_mvm *mvm,
+ struct ieee80211_vif *vif,
+ int link_id)
{
unsigned long usable_links = ieee80211_vif_usable_links(vif);
int primary_link = iwl_mvm_mld_get_primary_link(mvm, vif,
@@ -400,7 +400,7 @@ static void iwl_mvm_bt_notif_per_link(struct iwl_mvm *mvm,
return;
}
- iwl_mvm_bt_coex_update_vif_esr(mvm, vif, link_id);
+ iwl_mvm_bt_coex_update_link_esr(mvm, vif, link_id);
if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2))
min_ag_for_static_smps = BT_VERY_HIGH_TRAFFIC;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index ac7d986d9cd7..0791dac086e1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -3842,6 +3842,24 @@ iwl_mvm_sta_state_auth_to_assoc(struct ieee80211_hw *hw,
return callbacks->update_sta(mvm, vif, sta);
}
+static void iwl_mvm_bt_coex_update_vif_esr(struct iwl_mvm *mvm,
+ struct ieee80211_vif *vif)
+{
+ unsigned long usable_links = ieee80211_vif_usable_links(vif);
+ u8 link_id;
+
+ for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) {
+ struct ieee80211_bss_conf *link_conf =
+ link_conf_dereference_protected(vif, link_id);
+
+ if (WARN_ON_ONCE(!link_conf))
+ return;
+
+ if (link_conf->chanreq.oper.chan->band == NL80211_BAND_2GHZ)
+ iwl_mvm_bt_coex_update_link_esr(mvm, vif, link_id);
+ }
+}
+
static int
iwl_mvm_sta_state_assoc_to_authorized(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
@@ -3869,6 +3887,9 @@ iwl_mvm_sta_state_assoc_to_authorized(struct iwl_mvm *mvm,
callbacks->mac_ctxt_changed(mvm, vif, false);
iwl_mvm_mei_host_associated(mvm, vif, mvm_sta);
+ /* Calculate eSR mode due to BT coex */
+ iwl_mvm_bt_coex_update_vif_esr(mvm, vif);
+
/* when client is authorized (AP station marked as such),
* try to enable more links
*/
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;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index c477978d8fa3..77786c1a7528 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -2155,12 +2155,9 @@ bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm,
u8 iwl_mvm_bt_coex_get_single_ant_msk(struct iwl_mvm *mvm, u8 enabled_ants);
u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
struct ieee80211_tx_info *info, u8 ac);
-bool iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm,
- struct ieee80211_vif *vif,
- int link_id, int primary_link);
-void iwl_mvm_bt_coex_update_vif_esr(struct iwl_mvm *mvm,
- struct ieee80211_vif *vif,
- int link_id);
+void iwl_mvm_bt_coex_update_link_esr(struct iwl_mvm *mvm,
+ struct ieee80211_vif *vif,
+ int link_id);
/* beacon filtering */
#ifdef CONFIG_IWLWIFI_DEBUGFS
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
index f8f57e191c59..4f578f3e7e74 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
@@ -895,8 +895,8 @@ iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm,
if (link_info->phy_ctxt &&
link_info->phy_ctxt->channel->band == NL80211_BAND_2GHZ)
- iwl_mvm_bt_coex_update_vif_esr(mvm, bss_conf->vif,
- link_id);
+ iwl_mvm_bt_coex_update_link_esr(mvm, bss_conf->vif,
+ link_id);
/* make sure that beacon statistics don't go backwards with TCM
* request to clear statistics
--
2.34.1
next prev parent reply other threads:[~2024-04-16 10:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 10:53 [PATCH 00/16] wifi: iwlwifi: updates - 2024-04-16 Miri Korenblit
2024-04-16 10:53 ` [PATCH 01/16] wifi: iwlwifi: mvm: introduce esr_disable_reason Miri Korenblit
2024-04-16 10:53 ` [PATCH 02/16] wifi: iwlwifi: mvm: send ap_tx_power_constraints cmd to FW in AP mode Miri Korenblit
2024-04-16 10:53 ` [PATCH 03/16] wifi: iwlwifi: mvm: implement link grading Miri Korenblit
2024-04-16 10:53 ` Miri Korenblit [this message]
2024-04-16 10:54 ` [PATCH 05/16] wifi: iwlwifi: mvm: don't always disable EMLSR due to BT coex Miri Korenblit
2024-04-16 10:54 ` [PATCH 06/16] wifi: iwlwifi: mvm: check if EMLSR is allowed before selecting links Miri Korenblit
2024-04-16 10:54 ` [PATCH 07/16] wifi: iwlwifi: mvm: move EMLSR/links code Miri Korenblit
2024-04-16 10:54 ` [PATCH 08/16] wifi: iwlwifi: mvm: Implement new link selection algorithm Miri Korenblit
2024-04-16 10:54 ` [PATCH 09/16] wifi: iwlwifi: mvm: Add helper functions to update EMLSR status Miri Korenblit
2024-04-16 10:54 ` [PATCH 10/16] wifi: iwlwifi: mvm: init vif works only once Miri Korenblit
2024-04-16 10:54 ` [PATCH 11/16] wifi: iwlwifi: mvm: exit EMLSR upon missed beacon Miri Korenblit
2024-04-16 10:54 ` [PATCH 12/16] wifi: iwlwifi: mvm: implement EMLSR prevention mechanism Miri Korenblit
2024-04-16 10:54 ` [PATCH 13/16] wifi: iwlwifi: mvm: don't recompute EMLSR mode in can_activate_links Miri Korenblit
2024-04-16 10:54 ` [PATCH 14/16] wifi: iwlwifi: mvm: get periodic statistics in EMLSR Miri Korenblit
2024-04-16 10:54 ` [PATCH 15/16] wifi: iwlwifi: mvm: disable EMLSR when we suspend with wowlan Miri Korenblit
2024-04-16 10:54 ` [PATCH 16/16] wifi: iwlwifi: mvm: Don't allow EMLSR when the RSSI is low Miri Korenblit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240416134215.a767e243366e.I3b32d36cda23f67dc103a28a9bdccb0039d22574@changeid \
--to=miriam.rachel.korenblit@intel.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).