diff mbox series

wifi: ath12k: incorrect channel survey dump

Message ID 20230320091208.25535-1-quic_hprem@quicinc.com
State New
Headers show
Series wifi: ath12k: incorrect channel survey dump | expand

Commit Message

Harshitha Prem March 20, 2023, 9:12 a.m. UTC
When underlying hardware supports more than one band, then wiphy
is aware of all the frequency bands present. Example, say
wiphy0 is aware of 2 GHz, 5 GHz and 6 GHz band information.
Hence, when an virtual AP interface is brought up in auto channel
selection on each band. Survey is initiated from the userspace application
for all the virtual AP interfaces simultaneously.

For survey dump collection, freq_to_idx() api is used to map the index of
particular frequency to populate its survey. When the dump was collected,
the index fetched was incorrect. Example, in case of multi-hardware,
the index of channel 36 was reported as 14, because wiphy0 had index 0-13
for 2 GHz channels, instead of 0 for that ar which resulted in invalid
survey sent to userspace application.

The incorrect index was because of the mapping did not consider whether
the freq band is present in its radio structure (ar) or not.

To handle this, the freq_to_idx() api should map index for the
particular band in the ar structure.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/wmi.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Kalle Valo March 24, 2023, 2:49 p.m. UTC | #1
Harshitha Prem <quic_hprem@quicinc.com> wrote:

> When underlying hardware supports more than one band, then wiphy
> is aware of all the frequency bands present. Example, say
> wiphy0 is aware of 2 GHz, 5 GHz and 6 GHz band information.
> Hence, when an virtual AP interface is brought up in auto channel
> selection on each band. Survey is initiated from the userspace application
> for all the virtual AP interfaces simultaneously.
> 
> For survey dump collection, freq_to_idx() api is used to map the index of
> particular frequency to populate its survey. When the dump was collected,
> the index fetched was incorrect. Example, in case of multi-hardware,
> the index of channel 36 was reported as 14, because wiphy0 had index 0-13
> for 2 GHz channels, instead of 0 for that ar which resulted in invalid
> survey sent to userspace application.
> 
> The incorrect index was because of the mapping did not consider whether
> the freq band is present in its radio structure (ar) or not.
> 
> To handle this, the freq_to_idx() api should map index for the
> particular band in the ar structure.
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

25d165c49802 wifi: ath12k: incorrect channel survey dump
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index 3e6991120e53..f37b5c3a3ceb 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -4934,6 +4934,9 @@  static int freq_to_idx(struct ath12k *ar, int freq)
 	int band, ch, idx = 0;
 
 	for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) {
+		if (!ar->mac.sbands[band].channels)
+			continue;
+
 		sband = ar->hw->wiphy->bands[band];
 		if (!sband)
 			continue;