Search Linux Wireless

[PATCH 10/15] wifi: iwlwifi: mvm: Disable/enable EMLSR due to link's bandwidth/band

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Yedidya Benshimol <yedidya.ben.shimol@xxxxxxxxx>

Enable EMLSR when bandwidth settings meet the criteria in
both band and width, otherwise disable.

Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@xxxxxxxxx>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@xxxxxxxxx>
---
 drivers/net/wireless/intel/iwlwifi/mvm/link.c |  7 +++
 .../wireless/intel/iwlwifi/mvm/mld-mac80211.c | 27 ++++++++
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  3 +
 .../wireless/intel/iwlwifi/mvm/tests/links.c  | 61 ++++++++-----------
 4 files changed, 63 insertions(+), 35 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/link.c b/drivers/net/wireless/intel/iwlwifi/mvm/link.c
index 9d7f9e5be253..b2a52e7b4a1c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/link.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/link.c
@@ -629,6 +629,13 @@ bool iwl_mvm_mld_valid_link_pair(struct ieee80211_vif *vif,
 	    iwl_mvm_esr_disallowed_with_link(vif, b, false))
 		return false;
 
+	if (a->chandef->width != b->chandef->width)
+		return false;
+
+	if (!(a->chandef->chan->band == NL80211_BAND_6GHZ &&
+	      b->chandef->chan->band == NL80211_BAND_5GHZ))
+		return false;
+
 	/* Per-combination considerations */
 	return a->chandef->chan->band != b->chandef->chan->band;
 }
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
index 31669996ecce..de04b44bcf48 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
@@ -693,6 +693,25 @@ static int iwl_mvm_mld_mac_sta_state(struct ieee80211_hw *hw,
 					    &callbacks);
 }
 
+static bool iwl_mvm_esr_bw_criteria(struct iwl_mvm *mvm,
+				    struct ieee80211_vif *vif,
+				    struct ieee80211_bss_conf *link_conf)
+{
+	struct ieee80211_bss_conf *other_link;
+	int link_id;
+
+	/* Exit EMLSR if links don't have equal bandwidths */
+	for_each_vif_active_link(vif, other_link, link_id) {
+		if (link_id == link_conf->link_id)
+			continue;
+		if (link_conf->chanreq.oper.width ==
+		    other_link->chanreq.oper.width)
+			return true;
+	}
+
+	return false;
+}
+
 static void
 iwl_mvm_mld_link_info_changed_station(struct iwl_mvm *mvm,
 				      struct ieee80211_vif *vif,
@@ -722,6 +741,14 @@ iwl_mvm_mld_link_info_changed_station(struct iwl_mvm *mvm,
 		link_changes |= LINK_CONTEXT_MODIFY_HE_PARAMS;
 	}
 
+	if ((changes & BSS_CHANGED_BANDWIDTH) &&
+	    ieee80211_vif_link_active(vif, link_conf->link_id) &&
+	    mvmvif->esr_active &&
+	    !iwl_mvm_esr_bw_criteria(mvm, vif, link_conf))
+		iwl_mvm_exit_esr(mvm, vif,
+				 IWL_MVM_ESR_EXIT_BANDWIDTH,
+				 iwl_mvm_get_primary_link(vif));
+
 	/* if associated, maybe puncturing changed - we'll check later */
 	if (vif->cfg.assoc)
 		link_changes |= LINK_CONTEXT_MODIFY_EHT_PARAMS;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index bc1826450048..433b29334039 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -363,6 +363,8 @@ struct iwl_mvm_vif_link_info {
  *	due to low RSSI.
  * @IWL_MVM_ESR_EXIT_COEX: link is deactivated/not allowed for EMLSR
  *	due to BT Coex.
+ * @IWL_MVM_ESR_EXIT_BANDWIDTH: Bandwidths of primary and secondry links
+ *	preventing the enablement of EMLSR
  */
 enum iwl_mvm_esr_state {
 	IWL_MVM_ESR_BLOCKED_PREVENTION	= 0x1,
@@ -372,6 +374,7 @@ enum iwl_mvm_esr_state {
 	IWL_MVM_ESR_EXIT_MISSED_BEACON	= 0x10000,
 	IWL_MVM_ESR_EXIT_LOW_RSSI	= 0x20000,
 	IWL_MVM_ESR_EXIT_COEX		= 0x40000,
+	IWL_MVM_ESR_EXIT_BANDWIDTH	= 0x80000,
 };
 
 #define IWL_MVM_BLOCK_ESR_REASONS 0xffff
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tests/links.c b/drivers/net/wireless/intel/iwlwifi/mvm/tests/links.c
index 217dbb823691..66dd89103dfe 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tests/links.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tests/links.c
@@ -241,15 +241,15 @@ static const struct valid_link_pair_case {
 } valid_link_pair_cases[] = {
 	{
 		.desc = "HB + UHB, valid.",
-		.chan_a = &chan_5ghz,
-		.chan_b = &chan_6ghz,
+		.chan_a = &chan_6ghz,
+		.chan_b = &chan_5ghz,
 		.valid = true,
 	},
 	{
 		.desc = "LB + HB, no BT.",
 		.chan_a = &chan_2ghz,
 		.chan_b = &chan_5ghz,
-		.valid = true,
+		.valid = false,
 	},
 	{
 		.desc = "LB + HB, with BT.",
@@ -273,75 +273,66 @@ static const struct valid_link_pair_case {
 		.valid = false,
 	},
 	{
-		.desc = "RSSI: LB, 20 MHz, high",
-		.chan_a = &chan_2ghz,
+		.desc = "RSSI: UHB, 20 MHz, high",
+		.chan_a = &chan_6ghz,
 		.cw_a = NL80211_CHAN_WIDTH_20,
 		.sig_a = -66,
 		.chan_b = &chan_5ghz,
+		.cw_b = NL80211_CHAN_WIDTH_20,
 		.valid = true,
 	},
 	{
-		.desc = "RSSI: LB, 40 MHz, low",
-		.chan_a = &chan_2ghz,
+		.desc = "RSSI: UHB, 40 MHz, low",
+		.chan_a = &chan_6ghz,
 		.cw_a = NL80211_CHAN_WIDTH_40,
 		.sig_a = -65,
 		.chan_b = &chan_5ghz,
+		.cw_b = NL80211_CHAN_WIDTH_40,
 		.valid = false,
 	},
 	{
-		.desc = "RSSI: LB, 40 MHz, high",
-		.chan_a = &chan_2ghz,
+		.desc = "RSSI: UHB, 40 MHz, high",
+		.chan_a = &chan_6ghz,
 		.cw_a = NL80211_CHAN_WIDTH_40,
 		.sig_a = -63,
 		.chan_b = &chan_5ghz,
+		.cw_b = NL80211_CHAN_WIDTH_40,
 		.valid = true,
 	},
 	{
-		.desc = "RSSI: HB, 80 MHz, low",
-		.chan_a = &chan_5ghz,
+		.desc = "RSSI: UHB, 80 MHz, low",
+		.chan_a = &chan_6ghz,
 		.cw_a = NL80211_CHAN_WIDTH_80,
 		.sig_a = -62,
-		.chan_b = &chan_2ghz,
+		.chan_b = &chan_5ghz,
+		.cw_b = NL80211_CHAN_WIDTH_80,
 		.valid = false,
 	},
 	{
-		.desc = "RSSI: HB, 80 MHz, high",
-		.chan_a = &chan_5ghz,
+		.desc = "RSSI: UHB, 80 MHz, high",
+		.chan_a = &chan_6ghz,
 		.cw_a = NL80211_CHAN_WIDTH_80,
 		.sig_a = -60,
-		.chan_b = &chan_2ghz,
+		.chan_b = &chan_5ghz,
+		.cw_b = NL80211_CHAN_WIDTH_80,
 		.valid = true,
 	},
 	{
-		.desc = "RSSI: HB, 160 MHz, low",
-		.chan_a = &chan_5ghz,
+		.desc = "RSSI: UHB, 160 MHz, low",
+		.chan_a = &chan_6ghz,
 		.cw_a = NL80211_CHAN_WIDTH_160,
 		.sig_a = -59,
-		.chan_b = &chan_2ghz,
+		.chan_b = &chan_5ghz,
+		.cw_b = NL80211_CHAN_WIDTH_160,
 		.valid = false,
 	},
 	{
 		.desc = "RSSI: HB, 160 MHz, high",
-		.chan_a = &chan_5ghz,
+		.chan_a = &chan_6ghz,
 		.cw_a = NL80211_CHAN_WIDTH_160,
 		.sig_a = -5,
-		.chan_b = &chan_2ghz,
-		.valid = true,
-	},
-	{
-		.desc = "RSSI: UHB, 320 MHz, low",
-		.chan_a = &chan_6ghz,
-		.cw_a = NL80211_CHAN_WIDTH_320,
-		.sig_a = -68,
-		.chan_b = &chan_6ghz,
-		.valid = false,
-	},
-	{
-		.desc = "RSSI: UHB, 320 MHz, high",
-		.chan_a = &chan_6ghz,
-		.cw_a = NL80211_CHAN_WIDTH_320,
-		.sig_a = -66,
 		.chan_b = &chan_5ghz,
+		.cw_b = NL80211_CHAN_WIDTH_160,
 		.valid = true,
 	},
 };
-- 
2.34.1





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux