From: Benoit Masson <benoitm@perenite.com>
To: Jeff Johnson <jjohnson@kernel.org>
Cc: linux-wireless@vger.kernel.org, ath12k@lists.infradead.org,
stable@vger.kernel.org,
Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Subject: [PATCH] wifi: ath12k: order hw group devices by WSI index
Date: Sun, 27 Sep 2026 03:23:14 +0200 [thread overview]
Message-ID: <20260927012314.34857-1-yahoo@perenite.com> (raw)
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@vger.kernel.org # 6.14+
Signed-off-by: Benoit Masson <yahoo@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)
next reply other threads:[~2026-09-27 1:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 1:23 Benoit Masson [this message]
2026-09-28 15:26 ` [PATCH] wifi: ath12k: order hw group devices by WSI index Rameshkumar Sundaram
2026-09-28 15:43 ` [PATCH] wifi: ath12k: assign device id from the " Benoit Masson
2026-09-28 18:07 ` Jeff Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260927012314.34857-1-yahoo@perenite.com \
--to=benoitm@perenite.com \
--cc=ath12k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=quic_periyasa@quicinc.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox