Re: [PATCH v2 3/4] wifi: ath11k: Connect to the QMI server belonging to the device owned by this driver
From: Manivannan Sadhasivam
Date: Tue Sep 22 2026 - 12:11:05 EST
On Tue, Sep 22, 2026 at 04:32:07PM +0530, Vasanthakumar Thiagarajan wrote:
>
>
> On 9/21/2026 4:53 PM, Manivannan Sadhasivam via B4 Relay wrote:
> > From: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
> >
> > When two identical ath11k PCIe devices are connected to the same host, both
> > advertise the WLFW service with the same service and instance id. The QMI
> > lookup reports both servers to each device, so a device may connect to the
> > firmware running on the other device.
> >
> > But now, QRTR provides each MHI endpoint a unique node id which is
> > different from the node id announced by the device. So use the same id to
> > pick the correct server. Add a get_qrtr_node_id() HIF callback that returns
> > the node id derived from the MHI controller index and zero for transports
> > that do not assign one. In the new_server callback, skip any service whose
> > node id does not match. A node id of zero disables the check, so transports
> > that do not assign one keep their current behavior.
> >
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
> > ---
> > drivers/net/wireless/ath/ath11k/hif.h | 9 +++++++++
> > drivers/net/wireless/ath/ath11k/pci.c | 9 +++++++++
> > drivers/net/wireless/ath/ath11k/qmi.c | 10 ++++++++++
> > 3 files changed, 28 insertions(+)
> >
> > diff --git a/drivers/net/wireless/ath/ath11k/hif.h b/drivers/net/wireless/ath/ath11k/hif.h
> > index 017fed1b4bd1..0da9025c7ed8 100644
> > --- a/drivers/net/wireless/ath/ath11k/hif.h
> > +++ b/drivers/net/wireless/ath/ath11k/hif.h
> > @@ -32,6 +32,7 @@ struct ath11k_hif_ops {
> > void (*ce_irq_disable)(struct ath11k_base *ab);
> > void (*get_ce_msi_idx)(struct ath11k_base *ab, u32 ce_id, u32 *msi_idx);
> > void (*coredump_download)(struct ath11k_base *ab);
> > + int (*get_qrtr_node_id)(struct ath11k_base *ab);
> > };
> > static inline void ath11k_hif_ce_irq_enable(struct ath11k_base *ab)
> > @@ -159,4 +160,12 @@ static inline void ath11k_hif_coredump_download(struct ath11k_base *ab)
> > ab->hif.ops->coredump_download(ab);
> > }
> > +static inline int ath11k_hif_get_qrtr_node_id(struct ath11k_base *ab)
> > +{
> > + if (!ab->hif.ops->get_qrtr_node_id)
> > + return 0;
> > +
> > + return ab->hif.ops->get_qrtr_node_id(ab);
> > +}
> > +
> > #endif /* _HIF_H_ */
> > diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
> > index a163168f3617..4d327b5cc98a 100644
> > --- a/drivers/net/wireless/ath/ath11k/pci.c
> > +++ b/drivers/net/wireless/ath/ath11k/pci.c
> > @@ -10,6 +10,7 @@
> > #include <linux/of.h>
> > #include <linux/time.h>
> > #include <linux/vmalloc.h>
> > +#include <net/qrtr.h>
> > #include "pci.h"
> > #include "core.h"
> > @@ -900,6 +901,13 @@ static int ath11k_pci_start(struct ath11k_base *ab)
> > return 0;
> > }
> > +static int ath11k_pci_get_qrtr_node_id(struct ath11k_base *ab)
> > +{
> > + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
> > +
> > + return qrtr_host_node_id(ab_pci->mhi_ctrl->index);
>
> nit: since qrtr_host_node_id() returns node_id in unsigned int,
> may be maintain that in the return type of the callers as well.
> Mostly harmless as it is unlikely that node_id is allocated with
> an extremely high id. Either way is fine with me. Same applicable
> for ath12k patch as well.
>
Thanks for spotting it. For the sake of correctness, it makes sense to use same
type everywhere. I'll fix it in next version.
- Mani
--
மணிவண்ணன் சதாசிவம்