diff mbox series

[2/3] wifi: ath12k: Refactor radio freq low and high information

Message ID 20240814103423.3980958-3-quic_periyasa@quicinc.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series wifi: ath12k: Add multi radio iface combination support | expand

Commit Message

Karthikeyan Periyasamy Aug. 14, 2024, 10:34 a.m. UTC
Currently, radio stores the low frequency and high frequency information
as a 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. Therefore, to enhance
adaptibility and leverage existing structures, modify the storage of
frequency low and high information to the struct wiphy_radio_freq_range
data structure.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00188-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00183-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1

Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/core.h | 3 +--
 drivers/net/wireless/ath/ath12k/mac.c  | 8 ++++----
 2 files changed, 5 insertions(+), 6 deletions(-)

Comments

Jeff Johnson Aug. 14, 2024, 6:21 p.m. UTC | #1
On 8/14/2024 3:34 AM, Karthikeyan Periyasamy wrote:
> Currently, radio stores the low frequency and high frequency information
> as a separate variables. However, cfg80211 already provides a suitable

nit: s/as a/as/

> 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. Therefore, to enhance
> adaptibility and leverage existing structures, modify the storage of

nit: s/adaptibility /adaptability /

> frequency low and high information to the struct wiphy_radio_freq_range
> data structure.
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00188-QCAHKSWPL_SILICONZ-1
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00183-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1
> 
> Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>

(Kalle can make the nit changes in the pending branch)
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index cdfd43a7321a..ff830d91ceb6 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -645,8 +645,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;
 };
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 69f50c1a52d6..6761204048f6 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -639,8 +639,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;
@@ -8717,8 +8717,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)