Re: [PATCH] wifi: ath12k: fix survey indexing across bands
From: Rameshkumar Sundaram
Date: Mon Jun 22 2026 - 01:11:42 EST
On 6/17/2026 3:48 PM, Matthew Leach wrote:
When running 'iw dev wlan0 survey dump' the values for the channel busy
time have the same sequence across bands. This is caused by indexing
into the ath12k survey array using a band-local index rather than the
global index passed by mac80211. This results in surveys for 5 GHz and 6
GHz channels returning values from 2.4 GHz slots, making the survey
unusable on those bands.
Fix by indexing into ar->survey[] using the original index passed by
mac80211.
Band busy-times Before this fix:
2.4 GHz: 9, 2, 2, 2, 4, 2, 10, 16, 4, 12, 5
5 GHz: 9, 2, 2, 2, 4, 2, 10, 16, 4, 12, 5
6 GHz: 9, 2, 2, 2, 4, 2, 10, 16, 4, 12, 5
After this fix, times are independent:
2.4 GHz: 23, 5, 5, 12, 2, 12, 26, 5, 3, 1, 27
5 GHz: 30, 40, 29, 27, 118, 118, 112, 120, 11, 11, 11
6 GHz: 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
Tested-on: wcn7850 hw2.0 PCI WLAN.IOE_HMT.1.1-00018-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1
Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
The Fixes: tag is probably too broad,
4f242b1d6996 ("wifi: ath12k: support get_survey mac op for single wiphy") changed ath12k_mac_op_get_survey() for single-wiphy handling and moved survey lookup after band index adjustment.
Signed-off-by: Matthew Leach <matthew.leach@xxxxxxxxxxxxx>
---
drivers/net/wireless/ath/ath12k/mac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 2cff9485c95a..9474d7e70823 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -13351,6 +13351,7 @@ int ath12k_mac_op_get_survey(struct ieee80211_hw *hw, int idx,
struct ath12k *ar;
struct ieee80211_supported_band *sband;
struct survey_info *ar_survey;
+ int survey_index = idx;
lockdep_assert_wiphy(hw->wiphy);
@@ -13385,7 +13386,7 @@ int ath12k_mac_op_get_survey(struct ieee80211_hw *hw, int idx,
return -ENOENT;
}
- ar_survey = &ar->survey[idx];
+ ar_survey = &ar->survey[survey_index];
There is an existing discussion on similar lines, see [1].
This could break survey dump on multi-radio/single-wiphy setups, for example split-radio QCN9274 configurations.
I would suggest to move the survey results from ar to ath12k_hw, since not all bands in ar->survey[] are effectively utilized for a multi‑radio wiphy. In that model, this patch's approach of preserving the original idx would make sense, and freq_to_idx() should also stop skipping bands based on ar->mac.sbands[] so that WMI population uses the same global index.
- if (!ar->mac.sbands[band].channels)
- continue;
[1] https://lore.kernel.org/linux-wireless/aYtRBg498h_aLPBK@pilgrim/
--
Ramesh