Skip to contentSkip to conversation

wifi: ath12k: fix mac pdev frequency range update

PATCH Applied Aditya Kumar Singh 3 participants 3 messages May 20, 2025 – May 21, 2025 Qualcomm ATH12K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: ath12k: fix mac pdev frequency range update

The current implementation of per-pdev frequency range updates assumes that each pdev supports only a single band. As a result in ath12k_regd_update(), bands are handled using an if-else structure, which limits updates to only one of the band per pdev. This assumption does not hold for all chipsets. For example, the WCN7850 supports multiple bands within a single pdev.

Hence to accommodate such cases, update the logic to account for all band cases by handling each band in a separate if conditions instead of the previous if-else structure.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1

Fixes 13324cecbb2c ("wifi: ath12k: Update frequency range if reg rules changes")
---
 drivers/net/wireless/ath/ath12k/mac.c | 16 ++++++++--
 drivers/net/wireless/ath/ath12k/reg.c | 56 +++++++++++++++++------------------
 2 files changed, 42 insertions(+), 30 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +14 -2
index fa39537fa4ce8a4a2aad5aff87868aeaecd73565..64500b04675dbeb1cdf52b3fa77f4d831f43103e 100644
@@ -11353,8 +11353,20 @@ void ath12k_mac_update_freq_range(struct ath12k *ar,
 	if (!(freq_low && freq_high))
 		return;
 
-	ar->freq_range.start_freq = MHZ_TO_KHZ(freq_low);
-	ar->freq_range.end_freq = MHZ_TO_KHZ(freq_high);
+	if (ar->freq_range.start_freq || ar->freq_range.end_freq) {
+		ar->freq_range.start_freq = min(ar->freq_range.start_freq,
+						MHZ_TO_KHZ(freq_low));
+		ar->freq_range.end_freq = max(ar->freq_range.end_freq,
+					      MHZ_TO_KHZ(freq_high));
+	} else {
+		ar->freq_range.start_freq = MHZ_TO_KHZ(freq_low);
+		ar->freq_range.end_freq = MHZ_TO_KHZ(freq_high);
+	}
+
+	ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+		   "mac pdev %u freq limit updated. New range %u->%u MHz\n",
+		   ar->pdev->pdev_id, KHZ_TO_MHZ(ar->freq_range.start_freq),
+		   KHZ_TO_MHZ(ar->freq_range.end_freq));
 }
 
 static void ath12k_mac_update_ch_list(struct ath12k *ar,
drivers/net/wireless/ath/ath12k/reg.c +28 -28

81 lines not on this page · raw message

---
base-commit: 0b7122d5c6a84dd18d2ebffbcc46db835f24628f
change-id: 20250520-fix_freq_range_update-2cb86b41b196

Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Aditya Kumar Singh

The current implementation of per-pdev frequency range updates assumes that each pdev supports only a single band. As a result in ath12k_regd_update(), bands are handled using an if-else structure, which limits updates to only one of the band per pdev. This assumption does not hold for all chipsets. For example, the WCN7850 supports multiple bands within a single pdev.

Quoted 8 lines

Hence to accommodate such cases, update the logic to account for all band cases by handling each band in a separate if conditions instead of the previous if-else structure.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1

Fixes 13324cecbb2c ("wifi: ath12k: Update frequency range if reg rules changes")
Applied
#2 lore raw
In reply to Aditya Kumar Singh
Quoted 11 lines · Aditya Kumar Singh

The current implementation of per-pdev frequency range updates assumes that each pdev supports only a single band. As a result in ath12k_regd_update(), bands are handled using an if-else structure, which limits updates to only one of the band per pdev. This assumption does not hold for all chipsets. For example, the WCN7850 supports multiple bands within a single pdev.

Hence to accommodate such cases, update the logic to account for all band cases by handling each band in a separate if conditions instead of the previous if-else structure.

[...]

Applied, thanks!

[1/1] wifi: ath12k: fix mac pdev frequency range update

      commit: 0d777aa2ca77584b339ce195db86fe0ee7dda5d5

Best regards,

Signature · 1 line
Jeff Johnson <[email protected]>