Commit ae7fe563 authored by Yedidya Benshimol's avatar Yedidya Benshimol Committed by Johannes Berg
Browse files

wifi: iwlwifi: mvm: Disable/enable EMLSR due to link's bandwidth/band



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

Signed-off-by: default avatarYedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240505091420.4e473d4f7f5c.I3adf5619b60bfba8af0cd7eae9dac947419603b6@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 8ecdc570
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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;
}
+27 −0
Original line number Diff line number Diff line
@@ -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;
+3 −0
Original line number Diff line number Diff line
@@ -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
+26 −35
Original line number Diff line number Diff line
@@ -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,
	},
};