diff mbox series

[ath-next] wifi: ath12k: disable pdev for non supported country

Message ID 20250502230240.3692678-1-muna.sinada@oss.qualcomm.com
State Superseded
Headers show
Series [ath-next] wifi: ath12k: disable pdev for non supported country | expand

Commit Message

Muna Sinada May 2, 2025, 11:02 p.m. UTC
From: Karthik M <quic_karm@quicinc.com>

In MLO configuration, ath12k_mac_radio_start() iterates through all
the radios and makes the ar state 'ON'. Even though some bands are
not supported in certain countries, ath12k_reg_update_chan_list()
tries to update the channel list for all the active pdevs and ends
up in the warn_on for non-supported band.

To prevent this, disable the pdev when the num of channels in a band
for a particular country is zero.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1

Signed-off-by: Karthik M <quic_karm@quicinc.com>
Signed-off-by: Muna Sinada <muna.sinada@oss.qualcomm.com>
---
 drivers/net/wireless/ath/ath12k/mac.c | 12 +++++++++++-
 drivers/net/wireless/ath/ath12k/reg.c |  7 +++++--
 2 files changed, 16 insertions(+), 3 deletions(-)


base-commit: 885e5cbaa0ee3738fcd99167439459ede2cc102c

Comments

Jeff Johnson May 5, 2025, 5:46 p.m. UTC | #1
On 5/2/2025 4:02 PM, Muna Sinada wrote:
> From: Karthik M <quic_karm@quicinc.com>
> 
> In MLO configuration, ath12k_mac_radio_start() iterates through all
> the radios and makes the ar state 'ON'. Even though some bands are
> not supported in certain countries, ath12k_reg_update_chan_list()
> tries to update the channel list for all the active pdevs and ends
> up in the warn_on for non-supported band.
> 
> To prevent this, disable the pdev when the num of channels in a band

s/num/number/

> for a particular country is zero.

Can you explain what is meant by disabling the pdev? There are plenty of
countries where not all bands are supported, but I'd expect the pdev to be
active on the bands that are supported.

Or is it more accurate to say:
disable the pdev when the number of channels across all bands supported by the
pdev is zero for a particular country?

I just want to make sure the description is accurate.

/jeff
Muna Sinada May 6, 2025, 6:52 p.m. UTC | #2
On 5/5/2025 10:46 AM, Jeff Johnson wrote:
> On 5/2/2025 4:02 PM, Muna Sinada wrote:
>> From: Karthik M <quic_karm@quicinc.com>
>>
>> In MLO configuration, ath12k_mac_radio_start() iterates through all
>> the radios and makes the ar state 'ON'. Even though some bands are
>> not supported in certain countries, ath12k_reg_update_chan_list()
>> tries to update the channel list for all the active pdevs and ends
>> up in the warn_on for non-supported band.
>>
>> To prevent this, disable the pdev when the num of channels in a band
> 
> s/num/number/
> 
>> for a particular country is zero.
> 
> Can you explain what is meant by disabling the pdev? There are plenty of
> countries where not all bands are supported, but I'd expect the pdev to be
> active on the bands that are supported.
> 
> Or is it more accurate to say:
> disable the pdev when the number of channels across all bands supported by the
> pdev is zero for a particular country?
> 
> I just want to make sure the description is accurate.
> 
> /jeff
You are correct that it is more accurate to specify that we are
disabling the pdev when the number of channels across all bands
supported by the pdev is zero for a particular country.

I will update commit message in new patchset
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 4dae941c9615..f731a5759ac3 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -7726,7 +7726,17 @@  static int ath12k_mac_start(struct ath12k *ar)
 
 	/* TODO: Do we need to enable ANI? */
 
-	ath12k_reg_update_chan_list(ar, false);
+	ret = ath12k_reg_update_chan_list(ar, false);
+
+	/* The ar state alone can be turned off for non supported country
+	 * without returning the error value. As we need to update the channel
+	 * for the next ar.
+	 */
+	if (ret) {
+		if (ret == -EINVAL)
+			ret = 0;
+		goto err;
+	}
 
 	ar->num_started_vdevs = 0;
 	ar->num_created_vdevs = 0;
diff --git a/drivers/net/wireless/ath/ath12k/reg.c b/drivers/net/wireless/ath/ath12k/reg.c
index 7048834e0d14..a6c9c670e91d 100644
--- a/drivers/net/wireless/ath/ath12k/reg.c
+++ b/drivers/net/wireless/ath/ath12k/reg.c
@@ -65,7 +65,7 @@  ath12k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
 
 		for_each_ar(ah, ar, i) {
 			ret = ath12k_reg_update_chan_list(ar, true);
-			if (ret) {
+			if (ret && ret != -EINVAL) {
 				ath12k_warn(ar->ab,
 					    "failed to update chan list for pdev %u, ret %d\n",
 					    i, ret);
@@ -181,8 +181,11 @@  int ath12k_reg_update_chan_list(struct ath12k *ar, bool wait)
 		}
 	}
 
-	if (WARN_ON(!num_channels))
+	if (!num_channels) {
+		ath12k_dbg(ar->ab, ATH12K_DBG_REG,
+			   "pdev is not supported for this country\n");
 		return -EINVAL;
+	}
 
 	arg = kzalloc(struct_size(arg, channel, num_channels), GFP_KERNEL);