Commit 28e02bc9 authored by Johannes Berg's avatar Johannes Berg

wifi: iwlwifi: mvm: avoid link lookup in statistics

We already iterate the link bss_conf/link_info and have the
pointer, or know that deflink/bss_conf is used, so avoid an
extra lookup and just pass the pointer. This may also avoid
a crash when this is processed during restart, where the FW
to link conf array (link_id_to_link_conf) may be NULLed out.

Fixes: c1e458b9 ("wifi: iwlwifi: mvm: Move beacon filtering to be per link")
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Reviewed-by: default avatarIlan Peer <ilan.peer@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240703064026.346a6ef67a86.Iba5d65d728ca9f58518c88d029496c1250670544@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent e715c930
...@@ -557,12 +557,10 @@ struct iwl_mvm_stat_data_all_macs { ...@@ -557,12 +557,10 @@ struct iwl_mvm_stat_data_all_macs {
}; };
static void iwl_mvm_update_link_sig(struct ieee80211_vif *vif, int sig, static void iwl_mvm_update_link_sig(struct ieee80211_vif *vif, int sig,
struct iwl_mvm_vif_link_info *link_info) struct iwl_mvm_vif_link_info *link_info,
struct ieee80211_bss_conf *bss_conf)
{ {
struct iwl_mvm *mvm = iwl_mvm_vif_from_mac80211(vif)->mvm; struct iwl_mvm *mvm = iwl_mvm_vif_from_mac80211(vif)->mvm;
struct ieee80211_bss_conf *bss_conf =
iwl_mvm_rcu_fw_link_id_to_link_conf(mvm, link_info->fw_link_id,
false);
int thold = bss_conf->cqm_rssi_thold; int thold = bss_conf->cqm_rssi_thold;
int hyst = bss_conf->cqm_rssi_hyst; int hyst = bss_conf->cqm_rssi_hyst;
int last_event; int last_event;
...@@ -670,7 +668,7 @@ static void iwl_mvm_stat_iterator(void *_data, u8 *mac, ...@@ -670,7 +668,7 @@ static void iwl_mvm_stat_iterator(void *_data, u8 *mac,
mvmvif->deflink.beacon_stats.num_beacons; mvmvif->deflink.beacon_stats.num_beacons;
/* This is used in pre-MLO API so use deflink */ /* This is used in pre-MLO API so use deflink */
iwl_mvm_update_link_sig(vif, sig, &mvmvif->deflink); iwl_mvm_update_link_sig(vif, sig, &mvmvif->deflink, &vif->bss_conf);
} }
static void iwl_mvm_stat_iterator_all_macs(void *_data, u8 *mac, static void iwl_mvm_stat_iterator_all_macs(void *_data, u8 *mac,
...@@ -705,7 +703,7 @@ static void iwl_mvm_stat_iterator_all_macs(void *_data, u8 *mac, ...@@ -705,7 +703,7 @@ static void iwl_mvm_stat_iterator_all_macs(void *_data, u8 *mac,
sig = -le32_to_cpu(mac_stats->beacon_filter_average_energy); sig = -le32_to_cpu(mac_stats->beacon_filter_average_energy);
/* This is used in pre-MLO API so use deflink */ /* This is used in pre-MLO API so use deflink */
iwl_mvm_update_link_sig(vif, sig, &mvmvif->deflink); iwl_mvm_update_link_sig(vif, sig, &mvmvif->deflink, &vif->bss_conf);
} }
static inline void static inline void
...@@ -921,7 +919,8 @@ iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm, ...@@ -921,7 +919,8 @@ iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm,
mvmvif->link[link_id]->beacon_stats.num_beacons; mvmvif->link[link_id]->beacon_stats.num_beacons;
sig = -le32_to_cpu(link_stats->beacon_filter_average_energy); sig = -le32_to_cpu(link_stats->beacon_filter_average_energy);
iwl_mvm_update_link_sig(bss_conf->vif, sig, link_info); iwl_mvm_update_link_sig(bss_conf->vif, sig, link_info,
bss_conf);
if (WARN_ONCE(mvmvif->id >= MAC_INDEX_AUX, if (WARN_ONCE(mvmvif->id >= MAC_INDEX_AUX,
"invalid mvmvif id: %d", mvmvif->id)) "invalid mvmvif id: %d", mvmvif->id))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment