CONFIG_CFG80211_INTERNAL_REGDB removed from kernel, forces these cards USA regulatory domain

I am stuck on a regulatory domain that is not my country for a card which has never been present in the united states. Wasn’t purchased there, wasn’t shipped there. Took me some time to figure out why my wireless signal became sub-par. CONFIG_CFG80211_INTERNAL_REGDB has been removed as an option from new kernels. This also under-powers the card based on what it was sold for. Also, it is just plain annoying that everything wants to assume everyone is USA. I would update the firmware on the card to the country I’m in if that was an option. Any suggestions before I start O/S shopping? Which may include running an outdated linux behind a FreeBSD for wireless only(and a waste of power).

I would technically prefer it if ‘default country code’ was something user-set for when the factory doesn’t set one.


iw reg get
global
country CA: DFS-FCC
    (2402 - 2472 @ 40), (N/A, 30), (N/A)
    (5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
    (5250 - 5350 @ 80), (N/A, 24), (0 ms), DFS, AUTO-BW
    (5470 - 5600 @ 80), (N/A, 24), (0 ms), DFS
    (5650 - 5730 @ 80), (N/A, 24), (0 ms), DFS
    (5735 - 5835 @ 80), (N/A, 30), (N/A)


phy#0
country US: DFS-FCC
    (2402 - 2472 @ 40), (N/A, 30), (N/A)
    (5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
    (5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
    (5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
    (5735 - 5835 @ 80), (N/A, 30), (N/A)
    (57240 - 63720 @ 2160), (N/A, 40), (N/A)


phy#1
country US: DFS-FCC
    (2402 - 2472 @ 40), (N/A, 30), (N/A)
    (5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
    (5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
    (5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
    (5735 - 5835 @ 80), (N/A, 30), (N/A)
    (57240 - 63720 @ 2160), (N/A, 40), (N/A)


dmesg|grep ath
   10.226224] ath10k_pci 0000:06:00.0: enabling device (0000 -> 0002)
   10.226643] ath10k_pci 0000:06:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0
   10.228489] ath9k 0000:01:00.0: enabling device (0000 -> 0002)
   10.236693] ath: EEPROM regdomain: 0x0
   10.236696] ath: EEPROM indicates default country code should be used
   10.236697] ath: doing EEPROM country->regdmn map search
   10.236699] ath: country maps to regdmn code: 0x3a
   10.236700] ath: Country alpha2 being used: US
   10.236701] ath: Regpair used: 0x3a
   10.434689] ath10k_pci 0000:06:00.0: qca988x hw2.0 target 0x4100016c chip_id 0x043202ff sub 19b6:d03c
   10.434694] ath10k_pci 0000:06:00.0: kconfig debug 0 debugfs 0 tracing 0 dfs 0 testmode 0
   10.435007] ath10k_pci 0000:06:00.0: firmware ver 10.2.4-1.0-00037 api 5 features no-p2p,raw-mode,mfp,allows-mesh-bcast crc32 a4a52adb
   10.582644] ath10k_pci 0000:06:00.0: board_file api 1 bmi_id N/A crc32 bebc7c08
   10.656028] ath9k 0000:01:00.0 wlp1s0: renamed from wlan0
   11.726097] ath10k_pci 0000:06:00.0: htt-ver 2.1 wmi-op 5 htt-op 2 cal otp max-sta 128 raw 0 hwcrypto 1
   11.805494] ath: EEPROM regdomain: 0x0
   11.805499] ath: EEPROM indicates default country code should be used
   11.805501] ath: doing EEPROM country->regdmn map search
   11.805504] ath: country maps to regdmn code: 0x3a
   11.805506] ath: Country alpha2 being used: US
   11.805507] ath: Regpair used: 0x3a
   11.815632] ath10k_pci 0000:06:00.0 wlp6s0: renamed from wlan0

Not clear to me if you tried to force the reg domain via the boot command line and if that worked or not.
With a similar card I add the following to the kernel command line:

cfg80211.ieee80211_regdom=XX

where XX should be the country code of the place you are in (for instance, regdom=IT for me); without that the card defaults to the most restrictive domain, possibly reducing the power output on some channels.

I tried that, both in the kernel command line of grub and had also previously attempted it in modprobe.d. I think the issue lies in that all atheros cards default to united states and individual manufacturers(mikrotik) are not likely to update crda. Unfortunately I bought a 630mw card as advertised, to use 630mw. https://www.roc-noc.com/mikrotik/routerboard/R11e-5HacT.html as well as another in 2ghz that runs at 1000mw.

I think the problem lies in drivers/net/wireless/ath/regd.c:


     if (reg->country_code == CTRY_DEFAULT &&        regdmn == CTRY_DEFAULT) {
        printk(KERN_DEBUG "ath: EEPROM indicates default "
               "country code should be used
");
        reg->country_code = CTRY_UNITED_STATES;
    }

Where everyone regardless of country gets mapped to USA.

Sorry, I cannot replicate your problem: everything seems normal here even with 4.18 kernels…
Maybe something useful might be printed by:

iw --debug reg set <your country code here>

In principle you could even build your own kernel or add a reg domain db, but that goes beyond my experience; maybe you have better wait for a wireless guru to read this thread…

Am Wed, 07 Nov 2018 17:56:03 GMT
schrieb OrsoBruno <OrsoBruno@no-mx.forums.microfocus.com>:

> Sorry, I cannot replicate your problem: everything seems normal here
> even with 4.18 kernels…

+1

grep INTERNAL_REGDB /boot/config-$(uname -r)

CONFIG_CFG80211_INTERNAL_REGDB is not set

(Kernel 4.4.159 on 4.18.5 this option does not even exist any longer)

iw reg get
global
country 00: DFS-UNSET
(2402 - 2472 @ 40), (N/A, 20), (N/A)
(2457 - 2482 @ 20), (N/A, 20), (N/A), AUTO-BW, NO-IR
(2474 - 2494 @ 20), (N/A, 20), (N/A), NO-OFDM, NO-IR
(5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW, NO-IR
(5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW, NO-IR
(5490 - 5730 @ 160), (N/A, 20), (0 ms), DFS, NO-IR
(5735 - 5835 @ 80), (N/A, 20), (N/A), NO-IR
(57240 - 63720 @ 2160), (N/A, 0), (N/A)

iw reg set DE

iw reg get
global
country DE: DFS-ETSI
(2400 - 2483 @ 40), (N/A, 20), (N/A)
(5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
(5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW
(5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS
(5725 - 5875 @ 80), (N/A, 13), (N/A)
(57000 - 66000 @ 2160), (N/A, 40), (N/A)

iw reg set 00

iw reg get
global
country 00: DFS-UNSET
(2402 - 2472 @ 40), (N/A, 20), (N/A)
(2457 - 2482 @ 20), (N/A, 20), (N/A), AUTO-BW, NO-IR
(2474 - 2494 @ 20), (N/A, 20), (N/A), NO-OFDM, NO-IR
(5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW, NO-IR
(5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW, NO-IR
(5490 - 5730 @ 160), (N/A, 20), (0 ms), DFS, NO-IR
(5735 - 5835 @ 80), (N/A, 20), (N/A), NO-IR
(57240 - 63720 @ 2160), (N/A, 0), (N/A)

iw reg set FR

iw reg get
global
country FR: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20), (N/A)
(5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
(5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW
(5470 - 5725 @ 160), (N/A, 27), (0 ms), DFS
(5725 - 5875 @ 80), (N/A, 13), (N/A)
(57000 - 66000 @ 2160), (N/A, 40), (N/A)

iw reg set DE

iw reg get
global
country DE: DFS-ETSI
(2400 - 2483 @ 40), (N/A, 20), (N/A)
(5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
(5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW
(5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS
(5725 - 5875 @ 80), (N/A, 13), (N/A)
(57000 - 66000 @ 2160), (N/A, 40), (N/A)

… and so on …

Works for me™ on both kernels mentioned above with an atheros card.

The card uses the ath9k driver in my case, but this driver
also uses/depends on ath,ko,

AK


Never attribute to malice that which can be adequately explained by stupidity.
(R.J. Hanlon)

Sorry, allow me to show the issue more plainly:
As I can change global country, but the phy#1 and phy#2 (both atheros, one ath9k, one ath10k) sticks to US.


# iw reg get
global
country CA: DFS-FCC
	(2402 - 2472 @ 40), (N/A, 30), (N/A)
	(5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
	(5250 - 5350 @ 80), (N/A, 24), (0 ms), DFS, AUTO-BW
	(5470 - 5600 @ 80), (N/A, 24), (0 ms), DFS
	(5650 - 5730 @ 80), (N/A, 24), (0 ms), DFS
	(5735 - 5835 @ 80), (N/A, 30), (N/A)


phy#0
country US: DFS-FCC
	(2402 - 2472 @ 40), (N/A, 30), (N/A)
	(5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
	(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
	(5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
	(5735 - 5835 @ 80), (N/A, 30), (N/A)
	(57240 - 63720 @ 2160), (N/A, 40), (N/A)


phy#1
country US: DFS-FCC
	(2402 - 2472 @ 40), (N/A, 30), (N/A)
	(5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
	(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
	(5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
	(5735 - 5835 @ 80), (N/A, 30), (N/A)
	(57240 - 63720 @ 2160), (N/A, 40), (N/A)


# iw reg set US
# iw reg get
global
country US: DFS-FCC
	(2402 - 2472 @ 40), (N/A, 30), (N/A)
	(5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
	(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
	(5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
	(5735 - 5835 @ 80), (N/A, 30), (N/A)
	(57240 - 63720 @ 2160), (N/A, 40), (N/A)


phy#0
country US: DFS-FCC
	(2402 - 2472 @ 40), (N/A, 30), (N/A)
	(5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
	(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
	(5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
	(5735 - 5835 @ 80), (N/A, 30), (N/A)
	(57240 - 63720 @ 2160), (N/A, 40), (N/A)


phy#1
country US: DFS-FCC
	(2402 - 2472 @ 40), (N/A, 30), (N/A)
	(5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
	(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
	(5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
	(5735 - 5835 @ 80), (N/A, 30), (N/A)
	(57240 - 63720 @ 2160), (N/A, 40), (N/A)


# iw reg set CA
# iw reg get
global
country CA: DFS-FCC
	(2402 - 2472 @ 40), (N/A, 30), (N/A)
	(5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
	(5250 - 5350 @ 80), (N/A, 24), (0 ms), DFS, AUTO-BW
	(5470 - 5600 @ 80), (N/A, 24), (0 ms), DFS
	(5650 - 5730 @ 80), (N/A, 24), (0 ms), DFS
	(5735 - 5835 @ 80), (N/A, 30), (N/A)


phy#0
country US: DFS-FCC
	(2402 - 2472 @ 40), (N/A, 30), (N/A)
	(5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
	(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
	(5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
	(5735 - 5835 @ 80), (N/A, 30), (N/A)
	(57240 - 63720 @ 2160), (N/A, 40), (N/A)


phy#1
country US: DFS-FCC
	(2402 - 2472 @ 40), (N/A, 30), (N/A)
	(5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
	(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
	(5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
	(5735 - 5835 @ 80), (N/A, 30), (N/A)
	(57240 - 63720 @ 2160), (N/A, 40), (N/A)


# 



If your phy#1, etc differs from mine during these changes, I would love to see how your computer is handling the bootup. ‘dmesg|grep ath’

I am currently attempting options with recompiling the kernel, though I have not compiled a linux kernel in about 15 years, and only switched to linux for the wireless driver. Much has changed. Though, I would prefer to just zypper dup in the future.

I have only one card installed in this box and I see no difference of “global” vs. “phy” settings:

LT_B:~ # iw reg set IT
LT_B:~ # iw reg get
global
country IT: DFS-ETSI
    (2402 - 2482 @ 40), (N/A, 20), (N/A)
    (5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW
    (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW
    (5490 - 5710 @ 160), (N/A, 27), (0 ms), DFS
    (57000 - 66000 @ 2160), (N/A, 40), (N/A)

LT_B:~ # iw phy0 reg get
global
country IT: DFS-ETSI
    (2402 - 2482 @ 40), (N/A, 20), (N/A)
    (5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW
    (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW
    (5490 - 5710 @ 160), (N/A, 27), (0 ms), DFS
    (57000 - 66000 @ 2160), (N/A, 40), (N/A)

LT_B:~ #

I don’t think that the country code is setup during boot, since I see no difference in dmesg whether or not the reg domain is set in the boot command line:

bruno@LT_B:~> dmesg |grep ath
    6.106379] ath: phy0: Set parameters for CUS198
    6.106380] ath: phy0: Set BT/WLAN RX diversity capability
    6.112429] ath: phy0: Enable LNA combining
    6.113585] ath: phy0: ASPM enabled: 0x42
    6.113586] ath: **EEPROM regdomain: 0x60**
    6.113587] ath: **EEPROM indicates we should expect a direct regpair map**
    6.113588] ath: **Country alpha2 being used: 00**
    6.113589] ath: Regpair used: 0x60
    7.176955] usbcore: registered new interface driver ath3k
bruno@LT_B:~>

since apparently the card boots in “Unset - International” mode and is then switched afterwards, but I see an important difference in the “EEPROM” lines compared to what you see on your system.
HTH

I have not had time to dive into regd.c yet and figure out what ‘lazy’ policies has done, probably on the part of Qualcomm. I believe I read something in a specification somewhere that all cards of unknown country default to USA.

I did a quick and dirty just replacing mentions of CTRY_UNITED_STATES with CTRY_CANADA which appeared on lines 123 and 706. For anyone with a similar issues, a list of countries can be seen on line 62 of regd.h

This lack of a proper policy creates incentive to mutilate regd.c which is not what it was intended for. Unfortunately this will become userfriendly as people like me find they are forced to the wrong country spec. I do not wish to recompile a kernel constantly on a severely underpowered motherboard/cpu, or others who might do it on arm. So please manufacturers, create a better policy, or method to update old eeproms for people in other countries. (my wireless cards we not manufactured, or ever stepped foot in USA). I also believe there is probably little incentive for a manufacturer to fix an older card. (Mine are both Mikrotik)

The dead spots in my home have now disappeared due to the hack.


iw reg get
global
country CA: DFS-FCC
    (2402 - 2472 @ 40), (N/A, 30), (N/A)
    (5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
    (5250 - 5350 @ 80), (N/A, 24), (0 ms), DFS, AUTO-BW
    (5470 - 5600 @ 80), (N/A, 24), (0 ms), DFS
    (5650 - 5730 @ 80), (N/A, 24), (0 ms), DFS
    (5735 - 5835 @ 80), (N/A, 30), (N/A)


phy#0
country CA: DFS-FCC
    (2402 - 2472 @ 40), (N/A, 30), (N/A)
    (5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
    (5250 - 5350 @ 80), (N/A, 24), (0 ms), DFS, AUTO-BW
    (5470 - 5600 @ 80), (N/A, 24), (0 ms), DFS
    (5650 - 5730 @ 80), (N/A, 24), (0 ms), DFS
    (5735 - 5835 @ 80), (N/A, 30), (N/A)


phy#1
country CA: DFS-FCC
    (2402 - 2472 @ 40), (N/A, 30), (N/A)
    (5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
    (5250 - 5350 @ 80), (N/A, 24), (0 ms), DFS, AUTO-BW
    (5470 - 5600 @ 80), (N/A, 24), (0 ms), DFS
    (5650 - 5730 @ 80), (N/A, 24), (0 ms), DFS
    (5735 - 5835 @ 80), (N/A, 30), (N/A)

for anyone interested:
uname -a
Linux asrock 4.18.15-1-default #1 SMP PREEMPT Sat Nov 10 10:35:29 EST 2018 x86_64 x86_64 x86_64 GNU/Linux

Thanks for reporting back, and nice to see you are up and running again.