mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] wifi: ath12k: fix survey indexing across bands
@ 2026-06-17 10:18 Matthew Leach
  2026-06-22  5:11 ` Rameshkumar Sundaram
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Leach @ 2026-06-17 10:18 UTC (permalink / raw)
  To: Jeff Johnson, Vasanthakumar Thiagarajan, Baochen Qiang,
	Ramya Gnanasekar, Karthikeyan Periyasamy
  Cc: Kalle Valo, Pradeep Kumar Chitrapu, P Praneesh, Sriram R,
	linux-wireless, ath12k, linux-kernel, kernel, Matthew Leach

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")
Signed-off-by: Matthew Leach <matthew.leach@collabora.com>
---
 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];
 
 	ath12k_mac_update_bss_chan_survey(ar, &sband->channels[idx]);
 

---
base-commit: 8cd9520d35a6c38db6567e97dd93b1f11f185dc6
change-id: 20260617-ath12-survey-band-fix-4b5e78579379

Best regards,
--  
Matt


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] wifi: ath12k: fix survey indexing across bands
  2026-06-17 10:18 [PATCH] wifi: ath12k: fix survey indexing across bands Matthew Leach
@ 2026-06-22  5:11 ` Rameshkumar Sundaram
  0 siblings, 0 replies; 2+ messages in thread
From: Rameshkumar Sundaram @ 2026-06-22  5:11 UTC (permalink / raw)
  To: Matthew Leach, Jeff Johnson, Vasanthakumar Thiagarajan,
	Baochen Qiang, Ramya Gnanasekar, Karthikeyan Periyasamy
  Cc: Kalle Valo, Pradeep Kumar Chitrapu, P Praneesh, Sriram R,
	linux-wireless, ath12k, linux-kernel, kernel

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@collabora.com>
> ---
>   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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-22  5:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-17 10:18 [PATCH] wifi: ath12k: fix survey indexing across bands Matthew Leach
2026-06-22  5:11 ` Rameshkumar Sundaram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®