OSDN Git Service

wifi: ath12k: incorrect channel survey dump
authorHarshitha Prem <quic_hprem@quicinc.com>
Mon, 20 Mar 2023 09:12:08 +0000 (14:42 +0530)
committerKalle Valo <quic_kvalo@quicinc.com>
Fri, 24 Mar 2023 14:49:31 +0000 (16:49 +0200)
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>
Link: https://lore.kernel.org/r/20230320091208.25535-1-quic_hprem@quicinc.com
drivers/net/wireless/ath/ath12k/wmi.c

index af91029..7ae0bb7 100644 (file)
@@ -4937,6 +4937,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;