2023-03-20 09:12:31

by Harshitha Prem

[permalink] [raw]
Subject: [PATCH] wifi: ath12k: incorrect channel survey dump

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 <[email protected]>
---
drivers/net/wireless/ath/ath12k/wmi.c | 3 +++
1 file changed, 3 insertions(+)

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;
--
2.17.1



2023-03-24 14:53:22

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] wifi: ath12k: incorrect channel survey dump

Harshitha Prem <[email protected]> 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 <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

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

25d165c49802 wifi: ath12k: incorrect channel survey dump

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches