[openwrt/openwrt] wifi-scripts: add hotplug handler for slow-to-initialize ath12k radios
LEDE Commits
lede-commits at lists.infradead.org
Sat Apr 12 01:39:12 PDT 2025
ansuel pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/6bbf4a540dcb7d66ef35ca8c9739c2f71e9a149d
commit 6bbf4a540dcb7d66ef35ca8c9739c2f71e9a149d
Author: Mantas Pucka <mantas at 8devices.com>
AuthorDate: Fri Apr 4 12:46:58 2025 +0300
wifi-scripts: add hotplug handler for slow-to-initialize ath12k radios
Some ath12k radios can take long time to initialize and register a
phy. This can cause netifd to fail to detect them during initial scan.
To address this issue, a hotplug script has been added to retry
configuration once they have registered their phy.
Signed-off-by: Mantas Pucka <mantas at 8devices.com>
Link: https://github.com/openwrt/openwrt/pull/18459
Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
.../etc/hotplug.d/ieee80211/11-ath12k-trigger | 36 ++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/package/network/config/wifi-scripts/files/etc/hotplug.d/ieee80211/11-ath12k-trigger b/package/network/config/wifi-scripts/files/etc/hotplug.d/ieee80211/11-ath12k-trigger
new file mode 100755
index 0000000000..3c07e52882
--- /dev/null
+++ b/package/network/config/wifi-scripts/files/etc/hotplug.d/ieee80211/11-ath12k-trigger
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# Restart ath12k radios that take long time to initialize on boot
+
+[ "${ACTION}" = "add" ] || exit 0
+[ $(grep -c DRIVER=ath12k_pci /sys/$DEVPATH/device/uevent) -gt 0 ] || exit 0
+
+. /usr/share/libubox/jshn.sh
+
+restart_radio() {
+ radio=$1
+ arg="{\"radio\": \"$radio\"}"
+ ubus call network reload
+ ubus call network.wireless down "$arg"
+ ubus call network.wireless up "$arg"
+}
+
+json_init
+json_load "$(ubus -S call network.wireless status)"
+json_get_keys radios
+for radio in $radios; do
+ json_select $radio
+ json_get_vars up
+ json_get_vars retry_setup_failed
+
+ json_select config
+ json_get_vars path
+ json_select ..
+
+ if [ $up = 0 -a $retry_setup_failed = 1 ] &&
+ [ $(iwinfo nl80211 phyname "path=$path") = "$DEVICENAME" ]; then
+ restart_radio $radio
+ fi
+
+ json_select ..
+done
More information about the lede-commits
mailing list