2020-10-30 12:48:48

by Sven Eckelmann

[permalink] [raw]
Subject: ath11k: Country code setting ignored on bootup

Hi,

just tested here with HK01 based board. The firwmare
WLAN.HK.2.1.0.1-01228-QCAHKSWPL_SILICONZ-1 doesn't show this problematic
behavior all the time but 2.4.0.1.r1-00026-QCAHKSWPL_SILICONZ-2 or WLAN.HK.
2.4.0.1.r1-00019-QCAHKSWPL_SILICONZ-1 does.

With 2.1.0.1 I could basically do following:

iw reg set CA
echo "c000000.wifi1" > /sys/bus/platform/drivers/ath11k/unbind
echo "c000000.wifi1" > /sys/bus/platform/drivers/ath11k/bind

and the global and self managed country codes were still all CA (in many
tests). But with 2.4.0.1, they will end up with CA as global and US as self
managed. I can see that the country code change is correctly send by cfg80211
when the HW is initializes but the 2.4.0.1 firmware just ignores it.

I can see following send command by ath11k in ath11k_wmi_send_init_country_cmd:

00000000: 38 00 61 02 00 00 00 00 00 00 00 00 43 41 00 00

and I also receive a CA answer for that. But the response from the firmware comes
in when the ATH11K_FLAG_REGISTERED bit is still not set. Thus it is rejected by
ath11k_reg_chan_list_event for the regd_update_work.

This seems to be a race between receiving the
"ATH11K_QMI_EVENT_FW_READY" event and the ieee80211_register_hw() in
__ath11k_mac_register. The ieee80211_register_hw will make the hw responsible
for handling the regd updates but they will not be correctly processed until
the ATH11K_QMI_EVENT_FW_READY was handled by the firmware. And if the regd
change was processed after ath11k_regd_update was called in
__ath11k_mac_register (but before the ATH11K_QMI_EVENT_FW_READY was processed)
then we will just loose the regd change.

So I am a little bit baffled why ATH11K_FLAG_REGISTERED is bound to something
which is not related to the IEEE802211 registration code. Sounds to me like
somebody wanted a FW_READY flag but misused the ATH11K_FLAG_REGISTERED flag
for this purpose.

Btw. there are similar problems with the use of ATH11K_FLAG_REGISTERED in context
of ath11k_debug_pdev_create, ath11k_mac_register and ath11k_mac_allocate.

Maybe something like the attached patch could be used to improve this situation.

Kind regards,
Sven


Attachments:
0001-ath11k-Accept-new-regdomain-during-initialization.patch (3.69 kB)
signature.asc (849.00 B)
This is a digitally signed message part.
Download all attachments