diff mbox series

Revert "ath: add support for special 0x0 regulatory domain"

Message ID 20200730124923.271429-1-alsi@bang-olufsen.dk (mailing list archive)
State New, archived
Headers show
Series Revert "ath: add support for special 0x0 regulatory domain" | expand

Commit Message

Alvin Šipraga July 30, 2020, 12:49 p.m. UTC
This reverts commit 2dc016599cfa9672a147528ca26d70c3654a5423.

Per Atheros documentation to manufacturers, the EEPROM regulatory domain
code 0x0 must always map to "US". In particular, it should not map to a
custom world regulatory domain. For references, see [1] and [2] below.
Furthermore, __ath_regd_init() has a specific condition to set the
country code to "US" in this case, which emits the following log
message:

[    7.814307] ath: EEPROM indicates default country code should be used

The patch being reverted mistakenly maps 0x0 to the custom world
regulatory domain 0x64 - the most restrictive of the world regulatory
domains. The premise of the patch is that in the case of EEPROM
regulatory domain code 0x0, ath_is_world_regd() should return true. But,
as stated above, 0x0 should not map to a world regulatory domain, and so
the function should return false. The original behaviour, whereby
NL80211_REGDOM_SET_BY_COUNTRY_IE is ignored, was correct according to
the manufacturer's intent and should not have been changed.

[1] https://wireless.wiki.kernel.org/en/users/drivers/ath#the_0x0_regulatory_domain
[2] http://article.gmane.org/gmane.linux.kernel.wireless.general/38410

Fixes: 2dc016599cfa ("ath: add support for special 0x0 regulatory domain")
Cc: Wen Gong <wgong@codeaurora.org>
Cc: Luis R. Rodriguez <mcgrof@kernel.org>
Cc: linux-wireless@vger.kernel.org
Tested-on: QCA9880 hw2.0 PCI 10.2.4-1.0-00047
Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
---
 drivers/net/wireless/ath/regd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Alvin Šipraga Aug. 27, 2020, 7:59 a.m. UTC | #1
Hi Kalle,

On 7/30/20 2:49 PM, Alvin Šipraga wrote:
> This reverts commit 2dc016599cfa9672a147528ca26d70c3654a5423.
> 
> Per Atheros documentation to manufacturers, the EEPROM regulatory domain
> code 0x0 must always map to "US". In particular, it should not map to a
> custom world regulatory domain. For references, see [1] and [2] below.
> Furthermore, __ath_regd_init() has a specific condition to set the
> country code to "US" in this case, which emits the following log
> message:
> 
> [    7.814307] ath: EEPROM indicates default country code should be used
> 
> The patch being reverted mistakenly maps 0x0 to the custom world
> regulatory domain 0x64 - the most restrictive of the world regulatory
> domains. The premise of the patch is that in the case of EEPROM
> regulatory domain code 0x0, ath_is_world_regd() should return true. But,
> as stated above, 0x0 should not map to a world regulatory domain, and so
> the function should return false. The original behaviour, whereby
> NL80211_REGDOM_SET_BY_COUNTRY_IE is ignored, was correct according to
> the manufacturer's intent and should not have been changed.
> 
> [1] https://wireless.wiki.kernel.org/en/users/drivers/ath#the_0x0_regulatory_domain
> [2] http://article.gmane.org/gmane.linux.kernel.wireless.general/38410
> 
> Fixes: 2dc016599cfa ("ath: add support for special 0x0 regulatory domain")
> Cc: Wen Gong <wgong@codeaurora.org>
> Cc: Luis R. Rodriguez <mcgrof@kernel.org>
> Cc: linux-wireless@vger.kernel.org
> Tested-on: QCA9880 hw2.0 PCI 10.2.4-1.0-00047
> Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
> ---
>   drivers/net/wireless/ath/regd.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
Do you have any feedback on this patch? No problem if you simply have 
not looked yet - I am not sure what kind of lead time to expect on the 
list. But without the patch, a (correctly) programmed 0x0 (US) card will 
not be able to operate on 5GHz channels without some hacking. I have 
cited some references to justify reverting this patch, so I would like 
to know if anything further should be done to get this into future kernels?

I wonder also if Wen Gong could comment, whose patch I am reverting in 
the first place. Maybe there is something I am missing?

Kind regards,
Alvin
Kalle Valo Aug. 27, 2020, 10:12 a.m. UTC | #2
Alvin Šipraga <alsi@bang-olufsen.dk> writes:

> Hi Kalle,
>
> On 7/30/20 2:49 PM, Alvin Šipraga wrote:
>> This reverts commit 2dc016599cfa9672a147528ca26d70c3654a5423.
>>
>> Per Atheros documentation to manufacturers, the EEPROM regulatory domain
>> code 0x0 must always map to "US". In particular, it should not map to a
>> custom world regulatory domain. For references, see [1] and [2] below.
>> Furthermore, __ath_regd_init() has a specific condition to set the
>> country code to "US" in this case, which emits the following log
>> message:
>>
>> [    7.814307] ath: EEPROM indicates default country code should be used
>>
>> The patch being reverted mistakenly maps 0x0 to the custom world
>> regulatory domain 0x64 - the most restrictive of the world regulatory
>> domains. The premise of the patch is that in the case of EEPROM
>> regulatory domain code 0x0, ath_is_world_regd() should return true. But,
>> as stated above, 0x0 should not map to a world regulatory domain, and so
>> the function should return false. The original behaviour, whereby
>> NL80211_REGDOM_SET_BY_COUNTRY_IE is ignored, was correct according to
>> the manufacturer's intent and should not have been changed.
>>
>> [1] https://wireless.wiki.kernel.org/en/users/drivers/ath#the_0x0_regulatory_domain
>> [2] http://article.gmane.org/gmane.linux.kernel.wireless.general/38410
>>
>> Fixes: 2dc016599cfa ("ath: add support for special 0x0 regulatory domain")
>> Cc: Wen Gong <wgong@codeaurora.org>
>> Cc: Luis R. Rodriguez <mcgrof@kernel.org>
>> Cc: linux-wireless@vger.kernel.org
>> Tested-on: QCA9880 hw2.0 PCI 10.2.4-1.0-00047
>> Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
>> ---
>>   drivers/net/wireless/ath/regd.c | 10 +++++-----
>>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> Do you have any feedback on this patch? No problem if you simply have
> not looked yet - I am not sure what kind of lead time to expect on the
> list. But without the patch, a (correctly) programmed 0x0 (US) card
> will not be able to operate on 5GHz channels without some hacking. I
> have cited some references to justify reverting this patch, so I would
> like to know if anything further should be done to get this into
> future kernels?
>
> I wonder also if Wen Gong could comment, whose patch I am reverting in
> the first place. Maybe there is something I am missing?

I'm working on it, I just need to check something internally first.

BTW, Brian submitted an identical revert first so I'm planning to use
his patch instead of yours:

https://patchwork.kernel.org/patch/11573585/
Alvin Šipraga Aug. 27, 2020, 10:25 a.m. UTC | #3
On 8/27/20 12:12 PM, Kalle Valo wrote:
> Alvin Šipraga <alsi@bang-olufsen.dk> writes:
> 
>> Hi Kalle,
>>
>> On 7/30/20 2:49 PM, Alvin Šipraga wrote:
>>> This reverts commit 2dc016599cfa9672a147528ca26d70c3654a5423.
>>>
>>> Per Atheros documentation to manufacturers, the EEPROM regulatory domain
>>> code 0x0 must always map to "US". In particular, it should not map to a
>>> custom world regulatory domain. For references, see [1] and [2] below.
>>> Furthermore, __ath_regd_init() has a specific condition to set the
>>> country code to "US" in this case, which emits the following log
>>> message:
>>>
>>> [    7.814307] ath: EEPROM indicates default country code should be used
>>>
>>> The patch being reverted mistakenly maps 0x0 to the custom world
>>> regulatory domain 0x64 - the most restrictive of the world regulatory
>>> domains. The premise of the patch is that in the case of EEPROM
>>> regulatory domain code 0x0, ath_is_world_regd() should return true. But,
>>> as stated above, 0x0 should not map to a world regulatory domain, and so
>>> the function should return false. The original behaviour, whereby
>>> NL80211_REGDOM_SET_BY_COUNTRY_IE is ignored, was correct according to
>>> the manufacturer's intent and should not have been changed.
>>>
>>> [1] https://wireless.wiki.kernel.org/en/users/drivers/ath#the_0x0_regulatory_domain
>>> [2] http://article.gmane.org/gmane.linux.kernel.wireless.general/38410
>>>
>>> Fixes: 2dc016599cfa ("ath: add support for special 0x0 regulatory domain")
>>> Cc: Wen Gong <wgong@codeaurora.org>
>>> Cc: Luis R. Rodriguez <mcgrof@kernel.org>
>>> Cc: linux-wireless@vger.kernel.org
>>> Tested-on: QCA9880 hw2.0 PCI 10.2.4-1.0-00047
>>> Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
>>> ---
>>>    drivers/net/wireless/ath/regd.c | 10 +++++-----
>>>    1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> Do you have any feedback on this patch? No problem if you simply have
>> not looked yet - I am not sure what kind of lead time to expect on the
>> list. But without the patch, a (correctly) programmed 0x0 (US) card
>> will not be able to operate on 5GHz channels without some hacking. I
>> have cited some references to justify reverting this patch, so I would
>> like to know if anything further should be done to get this into
>> future kernels?
>>
>> I wonder also if Wen Gong could comment, whose patch I am reverting in
>> the first place. Maybe there is something I am missing?
> 
> I'm working on it, I just need to check something internally first.
> 
> BTW, Brian submitted an identical revert first so I'm planning to use
> his patch instead of yours:
> 
> https://patchwork.kernel.org/patch/11573585/

Hi Kalle,

Thank you for the update, glad to hear it. Sorry that I did not notice 
Brian's patch - I guess you can close my one on patchwork then.

Kind regards,
Alvin
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index bee9110b91f3..20f4f8ea9f89 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -666,14 +666,14 @@  ath_regd_init_wiphy(struct ath_regulatory *reg,
 
 /*
  * Some users have reported their EEPROM programmed with
- * 0x8000 or 0x0 set, this is not a supported regulatory
- * domain but since we have more than one user with it we
- * need a solution for them. We default to 0x64, which is
- * the default Atheros world regulatory domain.
+ * 0x8000 set, this is not a supported regulatory domain
+ * but since we have more than one user with it we need
+ * a solution for them. We default to 0x64, which is the
+ * default Atheros world regulatory domain.
  */
 static void ath_regd_sanitize(struct ath_regulatory *reg)
 {
-	if (reg->current_rd != COUNTRY_ERD_FLAG && reg->current_rd != 0)
+	if (reg->current_rd != COUNTRY_ERD_FLAG)
 		return;
 	printk(KERN_DEBUG "ath: EEPROM regdomain sanitized\n");
 	reg->current_rd = 0x64;