linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath11k: Fix number of rules in filtered ETSI regdomain
@ 2020-10-30 10:19 Sven Eckelmann
  2020-11-07  8:03 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Eckelmann @ 2020-10-30 10:19 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Sven Eckelmann

The ath11k code will try to insert wheather rader related limits when the
DFS region is set to ETSI. For this reason, it will add two more entries in
the array of reg_rules. But the 2.4.0.1 firmware is prefiltering the list
of reg rules it returns for 2.4GHz PHYs. They will then not contain the
list of 5GHz rules and thus no wheather radar band rules were inserted by
this code.

But the code didn't fix the n_reg_rules for this regulatory domain and PHY
when this happened. This resulted in a rejection by is_valid_rd because it
found rules which start and end at 0khz. This resulted in a splat like:

  Invalid regulatory domain detected
  ------------[ cut here ]------------
  WARNING: at backports-20200628-4.4.60-9a94b73e75/net/wireless/reg.c:3721
  [...]
  ath11k c000000.wifi1: failed to perform regd update : -22

The number of rules must therefore be saved after they were converted from
the ath11k format to the ieee80211_regdomain format and not before.

Tested with IPQ8074 WLAN.HK.2.4.0.1.r1-00019-QCAHKSWPL_SILICONZ-1

Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 drivers/net/wireless/ath/ath11k/reg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c
index f6a1f0352989..26e7e75191c7 100644
--- a/drivers/net/wireless/ath/ath11k/reg.c
+++ b/drivers/net/wireless/ath/ath11k/reg.c
@@ -584,7 +584,6 @@ ath11k_reg_build_regd(struct ath11k_base *ab,
 	if (!tmp_regd)
 		goto ret;
 
-	tmp_regd->n_reg_rules = num_rules;
 	memcpy(tmp_regd->alpha2, reg_info->alpha2, REG_ALPHA2_LEN + 1);
 	memcpy(alpha2, reg_info->alpha2, REG_ALPHA2_LEN + 1);
 	alpha2[2] = '\0';
@@ -597,7 +596,7 @@ ath11k_reg_build_regd(struct ath11k_base *ab,
 	/* Update reg_rules[] below. Firmware is expected to
 	 * send these rules in order(2G rules first and then 5G)
 	 */
-	for (; i < tmp_regd->n_reg_rules; i++) {
+	for (; i < num_rules; i++) {
 		if (reg_info->num_2g_reg_rules &&
 		    (i < reg_info->num_2g_reg_rules)) {
 			reg_rule = reg_info->reg_rules_2g_ptr + i;
@@ -652,6 +651,8 @@ ath11k_reg_build_regd(struct ath11k_base *ab,
 			   flags);
 	}
 
+	tmp_regd->n_reg_rules = i;
+
 	if (intersect) {
 		default_regd = ab->default_regd[reg_info->phy_id];
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ath11k: Fix number of rules in filtered ETSI regdomain
  2020-10-30 10:19 [PATCH] ath11k: Fix number of rules in filtered ETSI regdomain Sven Eckelmann
@ 2020-11-07  8:03 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2020-11-07  8:03 UTC (permalink / raw)
  To: Sven Eckelmann; +Cc: ath11k, linux-wireless, Sven Eckelmann

Sven Eckelmann <sven@narfation.org> wrote:

> The ath11k code will try to insert wheather rader related limits when the
> DFS region is set to ETSI. For this reason, it will add two more entries in
> the array of reg_rules. But the 2.4.0.1 firmware is prefiltering the list
> of reg rules it returns for 2.4GHz PHYs. They will then not contain the
> list of 5GHz rules and thus no wheather radar band rules were inserted by
> this code.
> 
> But the code didn't fix the n_reg_rules for this regulatory domain and PHY
> when this happened. This resulted in a rejection by is_valid_rd because it
> found rules which start and end at 0khz. This resulted in a splat like:
> 
>   Invalid regulatory domain detected
>   ------------[ cut here ]------------
>   WARNING: at backports-20200628-4.4.60-9a94b73e75/net/wireless/reg.c:3721
>   [...]
>   ath11k c000000.wifi1: failed to perform regd update : -22
> 
> The number of rules must therefore be saved after they were converted from
> the ath11k format to the ieee80211_regdomain format and not before.
> 
> Tested with IPQ8074 WLAN.HK.2.4.0.1.r1-00019-QCAHKSWPL_SILICONZ-1
> 
> Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

6189be7d145c ath11k: Fix number of rules in filtered ETSI regdomain

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20201030101940.2387952-1-sven@narfation.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-07  8:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30 10:19 [PATCH] ath11k: Fix number of rules in filtered ETSI regdomain Sven Eckelmann
2020-11-07  8:03 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).