#include "fw/api/context.h"
#include "fw/dbg.h"
+/**
+ * struct iwl_mld_link_chan_load_threshold - channel load thresholds
+ * @high_lim: level up transition thresholds, in percentage
+ * @low_lim: level down transition thresholds, in percentage
+ */
+struct iwl_mld_link_chan_load_threshold {
+ u8 high_lim;
+ u8 low_lim;
+};
+
+static const struct iwl_mld_link_chan_load_threshold
+link_chan_load_thresh_tbl[] = {
+ [LINK_CHAN_LOAD_LVL1] = { .high_lim = 45, .low_lim = 40 },
+ [LINK_CHAN_LOAD_LVL2] = { .high_lim = 70, .low_lim = 65 },
+ [LINK_CHAN_LOAD_LVL3] = { .high_lim = 85, .low_lim = 80 },
+};
+
int iwl_mld_send_link_cmd(struct iwl_mld *mld,
struct iwl_link_config_cmd *cmd,
enum iwl_ctxt_action action)
return chan_load;
}
+/* Returns whether internal MLO Scan needs to be triggered */
+bool iwl_mld_chan_load_requires_scan(struct iwl_mld *mld,
+ struct ieee80211_bss_conf *link_conf,
+ u32 new_chan_load)
+{
+ struct iwl_mld_link *mld_link = iwl_mld_link_from_mac80211(link_conf);
+ enum iwl_mld_link_chan_load_level new_lvl;
+ bool scan_trig = false;
+
+ if (WARN_ON(!mld_link))
+ return false;
+
+ /* For each Level,
+ * First check if high limit threshold crosses
+ * If not then, check if low limit threshold crosses
+ * Set new level based on low limit thresh only if old level
+ * is not lower than level threshold
+ */
+ for (new_lvl = LINK_CHAN_LOAD_LVL_MAX;
+ new_lvl > LINK_CHAN_LOAD_LVL_NONE; new_lvl--) {
+ if (new_chan_load >=
+ link_chan_load_thresh_tbl[new_lvl].high_lim)
+ break;
+ if (new_chan_load >=
+ link_chan_load_thresh_tbl[new_lvl].low_lim &&
+ mld_link->chan_load_lvl >= new_lvl)
+ break;
+ }
+
+ /* Trigger scan only for Level Up Transition */
+ if (new_lvl > mld_link->chan_load_lvl)
+ scan_trig = true;
+
+ IWL_DEBUG_EHT(mld,
+ "Link %d: chan_load=%d%%, old_lvl=%d, new_lvl=%d, scan_trig=%d\n",
+ link_conf->link_id, new_chan_load,
+ mld_link->chan_load_lvl, new_lvl, scan_trig);
+
+ /* Update computed new level */
+ mld_link->chan_load_lvl = new_lvl;
+
+ return scan_trig;
+}
+
static unsigned int
iwl_mld_get_default_chan_load(struct ieee80211_bss_conf *link_conf)
{
#include "mld.h"
#include "sta.h"
+enum iwl_mld_link_chan_load_level {
+ LINK_CHAN_LOAD_LVL_NONE,
+ LINK_CHAN_LOAD_LVL1,
+ LINK_CHAN_LOAD_LVL2,
+ LINK_CHAN_LOAD_LVL3,
+ LINK_CHAN_LOAD_LVL_MAX = LINK_CHAN_LOAD_LVL3
+};
+
/**
* struct iwl_probe_resp_data - data for NoA/CSA updates
* @rcu_head: used for freeing the data on update
* @silent_deactivation: next deactivation needs to be silent.
* @probe_resp_data: data from FW notification to store NOA related data to be
* inserted into probe response.
+ * @chan_load_lvl: current channel load level for a link, computed based on
+ * channel load by others on a link.
*/
struct iwl_mld_link {
struct rcu_head rcu_head;
bool he_ru_2mhz_block;
struct ieee80211_key_conf *tx_igtk;
struct ieee80211_key_conf __rcu *bigtks[2];
+ enum iwl_mld_link_chan_load_level chan_load_lvl;
);
/* And here fields that survive a fw restart */
struct iwl_mld_int_sta bcast_sta;
struct ieee80211_bss_conf *link_conf,
bool expect_active_link);
+bool iwl_mld_chan_load_requires_scan(struct iwl_mld *mld,
+ struct ieee80211_bss_conf *link_conf,
+ u32 new_chan_load);
+
void iwl_mld_handle_beacon_filter_notif(struct iwl_mld *mld,
struct iwl_rx_packet *pkt);
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
- * Copyright (C) 2024-2025 Intel Corporation
+ * Copyright (C) 2024-2026 Intel Corporation
*/
#include "mlo.h"
#include "phy.h"
container_of((const void *)phy, struct ieee80211_chanctx_conf,
drv_priv);
struct iwl_mld *mld = iwl_mld_vif_from_mac80211(vif)->mld;
- struct ieee80211_bss_conf *prim_link;
+ u32 new_chan_load = phy->avg_channel_load_not_by_us;
+ struct ieee80211_bss_conf *prim_link, *link_conf;
unsigned int prim_link_id;
+ int link_id;
+
+ if (!ieee80211_vif_is_mld(vif) || hweight16(vif->valid_links) <= 1)
+ return;
prim_link_id = iwl_mld_get_primary_link(vif);
prim_link = link_conf_dereference_protected(vif, prim_link_id);
if (WARN_ON(!prim_link))
return;
+ /* Evaluate MLO Internal Scan for high chan load beyond thresholds */
+ for_each_vif_active_link(vif, link_conf, link_id) {
+ if (rcu_access_pointer(link_conf->chanctx_conf) != chanctx)
+ continue;
+
+ if (iwl_mld_chan_load_requires_scan(mld,
+ link_conf,
+ new_chan_load)) {
+ /* When EMLSR is active, only trigger scan based on
+ * primary link
+ */
+ if (iwl_mld_emlsr_active(vif) && link_conf != prim_link)
+ continue;
+
+ iwl_mld_int_mlo_scan(mld, vif);
+ return;
+ }
+ }
+
if (chanctx != rcu_access_pointer(prim_link->chanctx_conf))
return;
prim_link_id);
} else {
u32 old_chan_load = data->prev_chan_load_not_by_us;
- u32 new_chan_load = phy->avg_channel_load_not_by_us;
u32 min_thresh = iwl_mld_get_min_chan_load_thresh(chanctx);
#define THRESHOLD_CROSSED(threshold) \
(old_load >> 1);
}
+ IWL_DEBUG_EHT(phy->mld,
+ "PHY %d: load_by_us=%u%% load_not_by_us=%u%%\n",
+ phy->fw_id, phy->channel_load_by_us, new_load);
+
iwl_mld_emlsr_check_chan_load(hw, phy, old_load);
}