SM8750: apply wifi country on ath12k - #3173
Conversation
2b335aa to
c4b2313
Compare
c93f6bd to
135d112
Compare
apply_regdomain() writes /storage/.cache/regdomain.conf, which iw's 60-iw-regdomain.rules hook applies on ieee80211 "add" at every boot, and applies the domain directly otherwise. Nothing wrote that file before, so the hook was dead code and the country picked in ES never reached the radio. - Skipped when the phy (or the global domain) already reports the country, since re-applying rebuilds the channel list and drops the link. Validated to two letters before it is written, because setregdomain sources the file as root. - With no country picked, ask for the world domain and store 00. wcn7860 otherwise comes up as country US, which allows 30 dBm on 2.4 GHz and on 5735-5855 where ETSI allows 20 and 14, so leaving the firmware's own choice in place is wrong in Europe. - Called from both "enable" and "connect". ES passes the country on the connect call only, so wiring just "enable" left it unapplied; on connect it runs before connect_wifi so the rescan loop refills the scan cache the domain change empties. - The iw reg set moves out of wait_for_wifi(), which four callers reach including the connect path; emptying the scan cache there makes the following connect fail with the SSID not found. - connect_wifi() rescans until the SSID is in the scan cache.
EXPERT=y, CFG80211_CERTIFICATION_ONUS=y and ATH_REG_DYNAMIC_USER_REG_HINTS=y. Without the last, ath12k discards user country hints and the self-managed phy stays at country 00 with all 5 GHz rules passive-scan and capped at 20 dBm. Regenerated with olddefconfig.
c4b2313 to
49d3208
Compare
|
FYI you should check #3189 and test if it applies here too. We hit a bug on SM8550 in the same area: the 11d/country scan starves normal scans (ath12k never sends its scan priority to the firmware), scans get refused and association with the SSID fails, so a wifi off/on ends up with a slow reconnect. Since this PR plays with the country flag you may introduce the same thing on SM8750. |
thanks for the hint. i will look into that. seems like ath12k is pretty buggy, huh.. |
Summary
apply wifi country/domain on ath12k driver, which ignores that currently and instead falls back back to either unset/global or US (unclear what triggers each of these, but the latter is a compliance violation!).
properly setting domain will e.g. enable active 5ghz band scanning (global just allows passive scanning) and change signal strength/power (depending on domain).
the main practical change for a user is that some 5ghz networks are not visible without this fix, and 5ghz wifi discovery speed increases ~30% (2.4s -> 1.6s in my test).
Testing
tested on my konkr pocket fit elite. changed WIFI COUNTRY in the es network menu and checked iw reg get
before: regardless of es wifi country setting, stayed at country "00: DFS-UNSET" (sometimes US, again, unclear what triggers which), every 5 GHz rule passive-scan only and capped at 20 dBm.
after: change flushes, e.g. sweden -> country "SE: DFS-ETSI", with 5 GHz actively scannable, 23 dBm on the low band and 30 dBm on the DFS band.
Additional Context
needs new kernel build config, including EXPERT=y to enable CFG80211_CERTIFICATION_ONUS, which actually enables us to change the country through the driver.
i compared all flags that now show up in the conf, most are still unset, and the ones that are set are set to the same value that they were defaulting to with EXPERT not set.
just like #3170 and #3171 : slightly unclear about restriction of this config. technically applies to all devices using the ath12k driver, in practice i only have a sm8750 to validate this on.
AI Usage
While ROCKNIX doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.
Did you use AI tools to help write this code? YES | PARTIALLY | NO
yes