wifi: ath12k: Refactor radio frequency information
authorKarthikeyan Periyasamy <quic_periyasa@quicinc.com>
Mon, 9 Dec 2024 18:54:17 +0000 (20:54 +0200)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Mon, 16 Dec 2024 20:46:58 +0000 (12:46 -0800)
Currently, radio stores the low frequency and high frequency information as
separate variables. However, cfg80211 already provides a suitable data
structure struct wiphy_radio_freq_range to store this information efficiently.
Additionally, for multi radio per wiphy infrastructure, this frequency range
information is essential. In future patches using struct wiphy_radio_freq_range
makes the code simpler.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20241209185421.376381-6-kvalo@kernel.org
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/core.h
drivers/net/wireless/ath/ath12k/mac.c

index d7caa58bb262dd572f73c1adb34ecec880753606..d09ebcdde94fdbb393e634c757f1a62ff07564cc 100644 (file)
@@ -711,8 +711,7 @@ struct ath12k {
        bool monitor_started;
        int monitor_vdev_id;
 
-       u32 freq_low;
-       u32 freq_high;
+       struct wiphy_radio_freq_range freq_range;
 
        bool nlo_enabled;
 
index 808af521c57c1765d95d7fc11b241e21d95dcce2..504ad36caca9ef5be9fe81b8504ec41459060a23 100644 (file)
@@ -708,8 +708,8 @@ static struct ath12k *ath12k_mac_get_ar_by_chan(struct ieee80211_hw *hw,
                return ar;
 
        for_each_ar(ah, ar, i) {
-               if (channel->center_freq >= ar->freq_low &&
-                   channel->center_freq <= ar->freq_high)
+               if (channel->center_freq >= KHZ_TO_MHZ(ar->freq_range.start_freq) &&
+                   channel->center_freq <= KHZ_TO_MHZ(ar->freq_range.end_freq))
                        return ar;
        }
        return NULL;
@@ -10203,8 +10203,8 @@ static void ath12k_mac_update_ch_list(struct ath12k *ar,
                        band->channels[i].flags |= IEEE80211_CHAN_DISABLED;
        }
 
-       ar->freq_low = freq_low;
-       ar->freq_high = freq_high;
+       ar->freq_range.start_freq = MHZ_TO_KHZ(freq_low);
+       ar->freq_range.end_freq = MHZ_TO_KHZ(freq_high);
 }
 
 static u32 ath12k_get_phy_id(struct ath12k *ar, u32 band)