wifi: iwlwifi: mld: skip unknown FW channel load values

The firmware statistics were previously reporting bogus/old
channel load values if the device hadn't been active on a
given channel; it'll report an unknown value now for those
statistics affected (channel_load and channel_load_not_by_us.)
Handle that by simply skipping the value, the averaging would
result in the exact same value as before.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250424153620.db5410318642.I4d2981f68b915ad335bb02c926e9289c2a60ea6c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg
2025-04-24 15:38:24 +03:00
parent ccf36d82e8
commit c561ac93cd
2 changed files with 14 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
* Copyright (C) 2012-2014, 2018, 2020 - 2021, 2023 - 2024 Intel Corporation
* Copyright (C) 2012-2014, 2018, 2020-2021, 2023-2025 Intel Corporation
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
* Copyright (C) 2016-2017 Intel Deutschland GmbH
*/
@@ -584,6 +584,9 @@ struct iwl_stats_ntfy_per_phy {
__le32 last_tx_ch_width_indx;
} __packed; /* STATISTICS_NTFY_PER_PHY_API_S_VER_1 */
/* unknown channel load (due to not being active on channel) */
#define IWL_STATS_UNKNOWN_CHANNEL_LOAD 0xffffffff
/**
* struct iwl_stats_ntfy_per_sta
*

View File

@@ -467,12 +467,18 @@ static void iwl_mld_fill_chanctx_stats(struct ieee80211_hw *hw,
old_load = phy->avg_channel_load_not_by_us;
new_load = le32_to_cpu(per_phy[phy->fw_id].channel_load_not_by_us);
if (IWL_FW_CHECK(phy->mld, new_load > 100, "Invalid channel load %u\n",
new_load))
if (IWL_FW_CHECK(phy->mld,
new_load != IWL_STATS_UNKNOWN_CHANNEL_LOAD &&
new_load > 100,
"Invalid channel load %u\n", new_load))
return;
/* give a weight of 0.5 for the old value */
phy->avg_channel_load_not_by_us = (new_load >> 1) + (old_load >> 1);
if (new_load != IWL_STATS_UNKNOWN_CHANNEL_LOAD) {
/* update giving a weight of 0.5 for the old value */
phy->avg_channel_load_not_by_us = (new_load >> 1) +
(old_load >> 1);
}
iwl_mld_emlsr_check_chan_load(hw, phy, old_load);
}