[PATCH] wifi: ath12k: order hw group devices by WSI index
Benoit Masson
benoitm at perenite.com
Sat Sep 26 18:23:14 PDT 2026
On multi-chip (WSI/MLO) platforms the devices of a hardware group are
added to ag->ab[] in PCI probe completion order (ab->device_id =
ag->num_probed++). PCI probe is asynchronous, so the order in which the
chips complete firmware bring-up is not stable across boots.
ath12k_mac_allocate() builds the wiphy radio array directly from
ag->ab[], and takes the wiphy device from the first entry. As a result
both the wiphy sysfs path and the mapping of radio indices to bands
change from boot to boot on boards such as the TP-Link Archer BE800,
which has three single-band QCN9274/QCN9224 radios in one group. A
persisted hostapd configuration that pins radio0 to a band then attaches
to a random band.
Order the devices used to build pdev_map[] by ab->wsi_info.index, which
is derived deterministically from the device tree WSI ring and the
qcom,wsi-controller node. ath12k already uses wsi_info.index as the
canonical per-device index for the firmware link IDs in
ath12k_host_cap_hw_link_id_init().
Note that ag->ab[] itself is left untouched: the unassign path indexes it
by ab->device_id, which is the probe-order id.
Fixes: 6f245ea0ec6c ("wifi: ath12k: introduce device group abstraction")
Cc: stable at vger.kernel.org # 6.14+
Signed-off-by: Benoit Masson <yahoo at perenite.com>
---
drivers/net/wireless/ath/ath12k/mac.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 99bf5cf..6505255 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -15444,6 +15444,7 @@ static void ath12k_mac_set_device_defaults(struct ath12k_base *ab)
int ath12k_mac_allocate(struct ath12k_hw_group *ag)
{
struct ath12k_pdev_map pdev_map[ATH12K_GROUP_MAX_RADIO];
+ struct ath12k_base *ab_order[ATH12K_MAX_DEVICES] = {};
int mac_id, device_id, total_radio, num_hw;
struct ath12k_base *ab;
struct ath12k_hw *ah;
@@ -15467,6 +15468,21 @@ int ath12k_mac_allocate(struct ath12k_hw_group *ag)
if (WARN_ON(total_radio > ATH12K_GROUP_MAX_RADIO))
return -ENOSPC;
+ /*
+ * Order the devices deterministically by WSI index instead of PCI
+ * probe completion order, so that the wiphy and the radio index to
+ * band mapping do not change from boot to boot.
+ */
+ for (i = 0; i < ag->num_devices; i++) {
+ ab = ag->ab[i];
+ if (!ab)
+ continue;
+ if (WARN_ON(ab->wsi_info.index >= ATH12K_MAX_DEVICES))
+ return -EINVAL;
+
+ ab_order[ab->wsi_info.index] = ab;
+ }
+
/* All pdev get combined and register as single wiphy based on
* hardware group which participate in multi-link operation else
* each pdev get register separately.
@@ -15483,12 +15499,12 @@ int ath12k_mac_allocate(struct ath12k_hw_group *ag)
mac_id = 0;
for (i = 0; i < num_hw; i++) {
for (j = 0; j < radio_per_hw; j++) {
- if (device_id >= ag->num_devices || !ag->ab[device_id]) {
+ if (device_id >= ag->num_devices || !ab_order[device_id]) {
ret = -ENOSPC;
goto err;
}
- ab = ag->ab[device_id];
+ ab = ab_order[device_id];
/*
* the assumption is all devices within an ah
--
2.54.0 (Apple Git-157)
More information about the ath12k
mailing list