Skip to content

Commit

Permalink
wifi: iwlwifi: mvm: Implement new link selection algorithm
Browse files Browse the repository at this point in the history
Replaces the current logic with a new algorithm based on the link
grading introduced in a previous patch.

The new selection algorithm will be invoked upon successful scan to ensure
it has the necessary updated data it needs.

This update delegates the selection logic as the primary link
determiner in EMLSR mode, storing it in mvmvif to avoid repeated
calculations, as the result may vary.

Additionally, includes tests for iwl_mvm_valid_link_pair to validate
link pairs for EMLSR.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240416134215.309fb1b3fe44.I5baf0c293c89a5a28bd1a6386bf9ca6d2bf61ab8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Miri Korenblit authored and Johannes Berg committed Apr 19, 2024
1 parent 1b9b7d3 commit 07bf529
Show file tree
Hide file tree
Showing 9 changed files with 298 additions and 187 deletions.
14 changes: 5 additions & 9 deletions drivers/net/wireless/intel/iwlwifi/mvm/coex.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ static void iwl_mvm_bt_coex_enable_esr(struct iwl_mvm *mvm,
static bool
iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
int link_id, int primary_link)
int link_id)
{
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
struct iwl_mvm_vif_link_info *link_info = mvmvif->link[link_id];
Expand All @@ -298,7 +298,7 @@ iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm,
return true;

/* If LB link is the primary one we should always disable eSR */
if (link_id == primary_link)
if (link_id == iwl_mvm_get_primary_link(vif))
return false;

/* The feature is not supported */
Expand Down Expand Up @@ -340,17 +340,13 @@ 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,
usable_links);
bool enable;

/* Not assoc, not MLD vif or only one usable link */
if (primary_link < 0)
if (!ieee80211_vif_is_mld(vif) ||
!iwl_mvm_vif_from_mac80211(vif)->authorized)
return;

enable = iwl_mvm_bt_coex_calculate_esr_mode(mvm, vif, link_id,
primary_link);
enable = iwl_mvm_bt_coex_calculate_esr_mode(mvm, vif, link_id);

iwl_mvm_bt_coex_enable_esr(mvm, vif, enable);
}
Expand Down
27 changes: 9 additions & 18 deletions drivers/net/wireless/intel/iwlwifi/mvm/d3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,31 +1261,22 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
if (IS_ERR_OR_NULL(vif))
return 1;

if (hweight16(vif->active_links) > 1) {
mutex_lock(&mvm->mutex);

primary_link = iwl_mvm_get_primary_link(vif);
if (ieee80211_vif_is_mld(vif) && vif->cfg.assoc &&
mvmvif->esr_active) {
/*
* Select the 'best' link.
* May need to revisit, it seems better to not optimize
* for throughput but rather range, reliability and
* power here - and select 2.4 GHz ...
* Select the 'best' link. May need to revisit, it seems
* better to not optimize for throughput but rather
* range, reliability and power here - and select
* 2.4 GHz ...
*/
primary_link = iwl_mvm_mld_get_primary_link(mvm, vif,
vif->active_links);

if (WARN_ONCE(primary_link < 0, "no primary link in 0x%x\n",
vif->active_links))
primary_link = __ffs(vif->active_links);

ret = ieee80211_set_active_links(vif, BIT(primary_link));
if (ret)
return ret;
} else if (vif->active_links) {
primary_link = __ffs(vif->active_links);
} else {
primary_link = 0;
}

mutex_lock(&mvm->mutex);

set_bit(IWL_MVM_STATUS_IN_D3, &mvm->status);

synchronize_net();
Expand Down
Loading

0 comments on commit 07bf529

Please sign in to comment.