wlan-ap-Telecominfraproject/feeds/ipq807x_v5.4/mac80211/patches/pending/0004-ath11k-Accept-new-regdomain-during-initialization.patch
John Crispin 3b6582117b ipq807x: add ath12 / v5.4 support
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:48 +02:00

86 lines
3.6 KiB
Diff

From: Sven Eckelmann <sven@narfation.org>
Date: Fri, 30 Oct 2020 12:02:21 +0100
Subject: ath11k: Accept new regdomain during initialization
The driver is registering as iee80211_hw with its OPs and is then able to
be called by the upper layer. This for example happens early in the phase
when the correct regulary domain should be set. But the regulary domain
will only be accepted when the ATH11K_FLAG_REGISTERED flag was set after
the ATH11K_QMI_EVENT_FW_READY was processed. So it can easily happen that
the regularly domain is not correctly processed when
ATH11K_QMI_EVENT_FW_READY isn't handled immediately:
$ iw reg set CA
$ iw reg get|grep country
country CA: DFS-FCC
country CA: DFS-FCC
country CA: DFS-FCC
$ echo "c000000.wifi1" > /sys/bus/platform/drivers/ath11k/unbind
$ echo "c000000.wifi1" > /sys/bus/platform/drivers/ath11k/bind
$ iw reg get|grep country
country CA: DFS-FCC
country US: DFS-FCC
country US: DFS-FCC
It is therefore essential to accept the regulatory changes without having
seen the ATH11K_QMI_EVENT_FW_READY. And since there are also potentially
more problems in ath11k_debug_pdev_create, ath11k_mac_register and
ath11k_mac_allocate with their use of ATH11K_FLAG_REGISTERED, it is better
to move the ATH11K_QMI_EVENT_FW_READY. to a new flag.
Tested with 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>
Forwarded: https://lore.kernel.org/all/1829665.1PRlr7bOQj@ripper/
Index: backports-20210222_001-5.4.164-b157d2276/drivers/net/wireless/ath/ath11k/core.h
===================================================================
--- backports-20210222_001-5.4.164-b157d2276.orig/drivers/net/wireless/ath/ath11k/core.h
+++ backports-20210222_001-5.4.164-b157d2276/drivers/net/wireless/ath/ath11k/core.h
@@ -222,7 +222,7 @@ enum ath11k_scan_state {
enum ath11k_dev_flags {
ATH11K_CAC_RUNNING,
- ATH11K_FLAG_CORE_REGISTERED,
+ ATH11K_FLAG_FW_READY,
ATH11K_FLAG_CRASH_FLUSH,
ATH11K_FLAG_RAW_MODE,
ATH11K_FLAG_HW_CRYPTO_DISABLED,
Index: backports-20210222_001-5.4.164-b157d2276/drivers/net/wireless/ath/ath11k/mac.c
===================================================================
--- backports-20210222_001-5.4.164-b157d2276.orig/drivers/net/wireless/ath/ath11k/mac.c
+++ backports-20210222_001-5.4.164-b157d2276/drivers/net/wireless/ath/ath11k/mac.c
@@ -11613,6 +11613,8 @@ static int __ath11k_mac_register(struct
goto err_free_if_combs;
}
+ set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags);
+
if (!ab->hw_params.supports_monitor)
/* There's a race between calling ieee80211_register_hw()
* and here where the monitor mode is enabled for a little
Index: backports-20210222_001-5.4.164-b157d2276/drivers/net/wireless/ath/ath11k/qmi.c
===================================================================
--- backports-20210222_001-5.4.164-b157d2276.orig/drivers/net/wireless/ath/ath11k/qmi.c
+++ backports-20210222_001-5.4.164-b157d2276/drivers/net/wireless/ath/ath11k/qmi.c
@@ -4573,7 +4573,7 @@ static void ath11k_qmi_driver_event_work
break;
case ATH11K_QMI_EVENT_FW_READY:
clear_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags);
- if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) {
+ if (test_bit(ATH11K_FLAG_FW_READY, &ab->dev_flags)) {
ath11k_hal_dump_srng_stats(ab);
queue_work(ab->workqueue, &ab->restart_work);
break;
@@ -4601,7 +4601,7 @@ static void ath11k_qmi_driver_event_work
set_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags);
break;
}
- set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags);
+ set_bit(ATH11K_FLAG_FW_READY, &ab->dev_flags);
}
break;