From nobody Fri Sep 25 00:03:11 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B744515986; Fri, 18 Sep 2026 16:28:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789748898; cv=none; b=vFgrfC6KVdSGUcOKEiXezXz9RztiHsfHH1sDcEW1tRCFkfcGCm0iQitv/eXEZi4kGff3jdofPkLl/hhUwegkZLhtDswvHyAhwAoGHX+/Pmp3DPmlyK7ZvRmEa+qFGwQj1HzBA/xwvJaET2/KhcjkLz15+bTEcs61MpiNK8z4ZCo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789748898; c=relaxed/simple; bh=kgdfmuz91IKgYnHgaBlL+u6+Oxrtj0RHPEZmDVb08iM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JsAylNaTm+nFiREVyPtlzhhr9HNNRP+SAR5YIGGwumAd5A7ujK8jtxp9WPeAAy5F3oJx3yDsopYRVIgHT8P9bqF2E56oFHWpfzFv+8uJveHyyFB51KRob+BMIiQO2vOD7VhazZ01fNfF2IZL7fWWBtga4+bfcL+nhgRi9iHMuzU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=my3ol6di; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="my3ol6di" Received: by smtp.kernel.org (Postfix) with ESMTPS id CB1F1C2BCF6; Fri, 18 Sep 2026 16:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789748897; bh=kgdfmuz91IKgYnHgaBlL+u6+Oxrtj0RHPEZmDVb08iM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=my3ol6diPdZXiMpX6J75k6YIoWCF+zEO/ORqEDzNZkO64T3DgoR+Y0fDtuq3d3A76 xGMXAtrrLe+B3JPAXXUmVsUuyrkxqk3GhfBla5j8CJ4tIhve4d4LJkktSvPG3uMwZO TrpQVDax9evDrtPl3YjvOl8OiDdk+xYlpJFIUyCvBp53BexaPb0gYs+2dx8f4c2oqv F6E69fCi8t5ct/36NAxZeeLBKDyg6cnHwcrejwGlbGFxOuxNNEkVgzLPrcmckyCEP/ le5ouEnF0myQGtRwgQG/bce/0UYlvQvrASI0vnEMuJ/lzPkruwUUra3y+RrpxHqEEK WKSNvOqM7/q0A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA47BC982D8; Fri, 18 Sep 2026 16:28:17 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Fri, 18 Sep 2026 18:28:13 +0200 Subject: [PATCH 1/4] net: qrtr: Allow the host QRTR to assign a unique node id Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-qrtr-multi-ep-v1-1-8a06caa368d3@oss.qualcomm.com> References: <20260918-qrtr-multi-ep-v1-0-8a06caa368d3@oss.qualcomm.com> In-Reply-To: <20260918-qrtr-multi-ep-v1-0-8a06caa368d3@oss.qualcomm.com> To: Manivannan Sadhasivam , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jeff Johnson Cc: linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, Bjorn Andersson , Chris Lew , Deepak Kumar Singh , Raj Kumar Bhagat , Juha-Matti Tilli , Jeff Hugo , Manivannan Sadhasivam X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5649; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=VlK8aLzhoboE7auu5vYc1UuZbxZZJt/VIyCXXZoWGMk=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBqrWae+4cO2dbojgbEw83G/jkwSyTeYs2aVPunn bpu4T/cpOSJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaq1mngAKCRBVnxHm/pHO 9dvxB/sEml7y3srDVsxk3N612+SBuPaMFgE7x7K16pMdyiONxuSfXJZuZQvbZ4dZ4ELLXK2jV6E tyhC640BsDeUh+ACPb6PIjnsRTJpA2sUUhhVoIxxSR+y/T+xEuf5UpOruLCEAXVRQ1KbvJ5i96x skU+8FvFo42HyZCSKCDUTonQ8DwE9SpGBD/Tuj25fJBcvuUkjAxK9sTP+IWtV09Fwoyjq0nzfHm n3oH6SnGLZh+kRe3neeowx+5+QaUBbjBrV1zHPbYNJNAEDQOTIbujWV/Oi7vYAXIdTn+SEIcmWg MaNTLsS4wuyjeTWxPqSuVv9gPSfQhXxqaLpXgUhLZfZ60279 X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Currently, QRTR identifies each remote node by the value of the 'src_node_id' field in the received packet and uses the node id as the key to store the node to the internal 'qrtr_nodes' radix tree. But this approach comes with a limitation. When more than one remote node share the same id, then QRTR can only add the first node to the radix tree and has to drop the successive nodes with the same node id as the 'key' in radix tree has to be unique. This prevents connecting identical Qcom PCIe WLAN devices to a single host at the same time. To fix this limitation, allow the host QRTR to use the node id (nid) received from the endpoint driver during qrtr_endpoint_register() as the unique node id and use it as the 'key' for the internal radix tree. Also, store the received 'src_id' in a new 'qrtr_node->ep_nid' field and replace the 'ep_nid' with the unique 'nid' in the QRTR control packets if both differ i.e., an endpoint driver has passed a unique 'nid' during qrtr_endpoint_register(). To maintain symmetry, replace the 'nid' with the 'ep_nid' while sending the packet back to the remote node if both differ. Currently, all QRTR endpoint drivers pass 'QRTR_EP_NID_AUTO' as the 'nid' during qrtr_endpoint_register(). So 'ep_nid' and 'nid' are same and the functionality is not changed. Signed-off-by: Manivannan Sadhasivam --- net/qrtr/af_qrtr.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++---= ---- 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c index a30fa56e6aa3..af8ca65a7027 100644 --- a/net/qrtr/af_qrtr.c +++ b/net/qrtr/af_qrtr.c @@ -117,7 +117,8 @@ static DEFINE_XARRAY_ALLOC(qrtr_ports); * @ep_lock: lock for endpoint management and callbacks * @ep: endpoint * @ref: reference count for node - * @nid: node id + * @nid: node id assigned by the host QRTR + * @ep_nid: endpoint's own node id as received * @qrtr_tx_flow: xarray of qrtr_tx_flow, keyed by node << 32 | port * @qrtr_tx_lock: lock for qrtr_tx_flow inserts * @rx_queue: receive queue @@ -128,6 +129,7 @@ struct qrtr_node { struct qrtr_endpoint *ep; struct kref ref; unsigned int nid; + unsigned int ep_nid; =20 struct xarray qrtr_tx_flow; struct mutex qrtr_tx_lock; /* for qrtr_tx_flow */ @@ -339,6 +341,7 @@ static int qrtr_node_enqueue(struct qrtr_node *node, st= ruct sk_buff *skb, { struct qrtr_hdr_v1 *hdr; size_t len =3D skb->len; + unsigned int dst_node; int rc, confirm_rx; =20 confirm_rx =3D qrtr_tx_wait(node, to->sq_node, to->sq_port, type); @@ -353,10 +356,14 @@ static int qrtr_node_enqueue(struct qrtr_node *node, = struct sk_buff *skb, hdr->src_node_id =3D cpu_to_le32(from->sq_node); hdr->src_port_id =3D cpu_to_le32(from->sq_port); if (to->sq_port =3D=3D QRTR_PORT_CTRL) { - hdr->dst_node_id =3D cpu_to_le32(node->nid); + hdr->dst_node_id =3D cpu_to_le32(node->ep_nid); hdr->dst_port_id =3D cpu_to_le32(QRTR_PORT_CTRL); } else { - hdr->dst_node_id =3D cpu_to_le32(to->sq_node); + /* Put back the endpoint's own node id */ + dst_node =3D to->sq_node; + if (dst_node =3D=3D node->nid) + dst_node =3D node->ep_nid; + hdr->dst_node_id =3D cpu_to_le32(dst_node); hdr->dst_port_id =3D cpu_to_le32(to->sq_port); } =20 @@ -420,6 +427,32 @@ static void qrtr_node_assign(struct qrtr_node *node, u= nsigned int nid) spin_unlock_irqrestore(&qrtr_nodes_lock, flags); } =20 +/* Replace the node id in the control packet with 'node->nid', if both are + * different. + */ +static void qrtr_node_rewrite_ctrl(struct qrtr_node *node, unsigned int ty= pe, + struct sk_buff *skb) +{ + struct qrtr_ctrl_pkt *pkt; + __le32 *nid; + + if (node->nid =3D=3D node->ep_nid) + return; + + if (skb->len < sizeof(*pkt)) + return; + + pkt =3D (struct qrtr_ctrl_pkt *)skb->data; + if (type =3D=3D QRTR_TYPE_DEL_CLIENT) + nid =3D &pkt->client.node; + else + nid =3D &pkt->server.node; + + /* Rewrite only the endpoint's node id, not those of bridged nodes */ + if (le32_to_cpu(*nid) =3D=3D node->ep_nid) + *nid =3D cpu_to_le32(node->nid); +} + /** * qrtr_endpoint_post() - post incoming data * @ep: endpoint handle @@ -510,16 +543,29 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, cons= t void *data, size_t len) =20 skb_put_data(skb, data + hdrlen, size); =20 - qrtr_node_assign(node, cb->src_node); + if (node->ep_nid =3D=3D QRTR_EP_NID_AUTO) + node->ep_nid =3D cb->src_node; + + if (node->nid =3D=3D QRTR_EP_NID_AUTO || node->nid =3D=3D cb->src_node) + qrtr_node_assign(node, cb->src_node); =20 if (cb->type =3D=3D QRTR_TYPE_NEW_SERVER) { /* Remote node endpoint can bridge other distant nodes */ - const struct qrtr_ctrl_pkt *pkt; + const struct qrtr_ctrl_pkt *pkt =3D data + hdrlen; + unsigned int server_node =3D le32_to_cpu(pkt->server.node); =20 - pkt =3D data + hdrlen; - qrtr_node_assign(node, le32_to_cpu(pkt->server.node)); + if (server_node !=3D node->ep_nid) + qrtr_node_assign(node, server_node); } =20 + if (cb->src_node =3D=3D node->ep_nid) + cb->src_node =3D node->nid; + + if (cb->type =3D=3D QRTR_TYPE_NEW_SERVER || + cb->type =3D=3D QRTR_TYPE_DEL_SERVER || + cb->type =3D=3D QRTR_TYPE_DEL_CLIENT) + qrtr_node_rewrite_ctrl(node, cb->type, skb); + if (cb->type =3D=3D QRTR_TYPE_RESUME_TX) { qrtr_tx_resume(node, skb); } else { @@ -593,6 +639,7 @@ int qrtr_endpoint_register(struct qrtr_endpoint *ep, un= signed int nid) mutex_init(&node->ep_lock); skb_queue_head_init(&node->rx_queue); node->nid =3D QRTR_EP_NID_AUTO; + node->ep_nid =3D QRTR_EP_NID_AUTO; node->ep =3D ep; =20 xa_init(&node->qrtr_tx_flow); --=20 2.43.0 From nobody Fri Sep 25 00:03:11 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAA8E51589B; Fri, 18 Sep 2026 16:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789748899; cv=none; b=SmE7sP0crqLp3tDBkqtP1s4bMd3Mi5QltRZeiadQ2JPC+6gylhdctLihiK4z4E2+e+7QQ74cLH1U8kzzdXEc1cvRgC3yjchYF2a64r2ZLPuIt07F/Ij1o0NHsf6BSID1shzZE2J0w65mInnEOzYL+1ikdRAkBWb8KoZxf5pXSqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789748899; c=relaxed/simple; bh=dANEiTIv6WX9Ahf5Kk+KOtXwhtRjgal+FWoz9aBW1fc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jT/frbDIzvEaUfpQwsKb3f8oQrf6JCjYVlf5fN2SX3U2tUaWU0zvzJmzIBcMtdf3Z0fNDjq/M0m6SDhZYj75ggdpl+K1uUOkQHN8d9CSeKWuhNvmyz0gwGaRDku29HZxaT95EjKPl9TagE3IXAfXXczLgr39VxVqEzoS9zrdXH8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fonPAfuv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fonPAfuv" Received: by smtp.kernel.org (Postfix) with ESMTPS id DAF86C2BCFA; Fri, 18 Sep 2026 16:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789748897; bh=dANEiTIv6WX9Ahf5Kk+KOtXwhtRjgal+FWoz9aBW1fc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=fonPAfuvAgIi4VeFMRXeaKlB6BMFGa7mzclKgKceCK03Ab2WzHNlbVzqYzpaYFZSi oahdUs5zEdCToOwOsOQQRTWm+9zkMvIxJVkAOQniw6Hsm0BYYbsRJw+jI1P+EGq/js fGsSTdqiy72mVrCP+2LFJepCidL/6KjhR/Bx7ozMuNw/R66HwSrWusJcseJl9Pnu4Z zOd/BLOFxnFaKGjbu8QDLiz7hKWGmL7iKoDVVqVWXP1ETncPfwbzh7QtsGNcYPdbYO 0SNwMKBQ7d/Su58gZA/AR8cPNRNp3/XYXSNrtJxbaecR4lUWn2rhCw02a+3MIjSsL0 TxfUrxzAhmRkg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA4E3C982DA; Fri, 18 Sep 2026 16:28:17 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Fri, 18 Sep 2026 18:28:14 +0200 Subject: [PATCH 2/4] net: qrtr: Assign unique node id for MHI endpoints Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-qrtr-multi-ep-v1-2-8a06caa368d3@oss.qualcomm.com> References: <20260918-qrtr-multi-ep-v1-0-8a06caa368d3@oss.qualcomm.com> In-Reply-To: <20260918-qrtr-multi-ep-v1-0-8a06caa368d3@oss.qualcomm.com> To: Manivannan Sadhasivam , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jeff Johnson Cc: linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, Bjorn Andersson , Chris Lew , Deepak Kumar Singh , Raj Kumar Bhagat , Juha-Matti Tilli , Jeff Hugo , Manivannan Sadhasivam X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2620; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=uOYu1U8wIC2RDVexAi1abQkUbN13SL1t/kCkWYPYdoU=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBqrWaeF6Y6uwvyLe36Rr5ay4I2MYWQOIJL3dVs1 jNepmU7vnOJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaq1mngAKCRBVnxHm/pHO 9V4QB/9kPI0g4gGHMb3I5Vi2hxhCo0kEQntSmTve/Ue2kyHg9KUVLEW0zCa8hVLz6PnxAVHjAVA ylXCIxMiSZ1zKUtacpBbNWVX/s9aOZ4ssYRRpL1mestEhvCm7DeyUj2J8BaHtmoUOg/+4MiVgIx rtW29lzRhqyQ/KjmlziBLmWQCeO4qiHisKkHMfv8slVhRLBF17FYKFeBcXs1QnpMkzwM+0hDFKh ng90uQj02fm/GCTwNSgv5ajUHuZ5wzD+PJpivaSQrx/vtdIzZ/bo6lqEQi8k7rx8+l6bxSXFz4X jh/fhii/LHuvp7URaJdAmNt4Na3pqqrg+XH77+DLNk2iv2PX X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Now that the QRTR driver allows using the unique node id for each device, which is different from the node id received from the remote node, compute a unique node id using a new API, qrtr_host_node_id(). This API takes the 'index' parameter and adds it to QRTR_NODE_HOST_BASE, whose value is outside of the node id range used by the remote nodes (0 to 0xffff). Finally, call the new API from MHI endpoint driver by passing the MHI controller index as the parameter. The MHI controller index is unique for each controller, thereby for each MHI endpoint device. Signed-off-by: Manivannan Sadhasivam --- MAINTAINERS | 1 + include/net/qrtr.h | 21 +++++++++++++++++++++ net/qrtr/mhi.c | 4 +++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 3a19da74d00c..bc1af0cd8a8b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22504,6 +22504,7 @@ QUALCOMM IPC ROUTER (QRTR) DRIVER M: Manivannan Sadhasivam L: linux-arm-msm@vger.kernel.org S: Maintained +F: include/net/qrtr.h F: include/trace/events/qrtr.h F: include/uapi/linux/qrtr.h F: net/qrtr/ diff --git a/include/net/qrtr.h b/include/net/qrtr.h new file mode 100644 index 000000000000..745d51b4a6ba --- /dev/null +++ b/include/net/qrtr.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _NET_QRTR_H +#define _NET_QRTR_H + +#include + +/* The offset is chosen carefully to not collide with the node ids allocat= ed by + * the remote nodes. All the remote nodes use node ids in range 0 to 0xfff= f. + */ +#define QRTR_NODE_HOST_BASE 0x10000u + +/* Compute host node id from a per-device index. The index must be unique + * among the host assigned endpoints and smaller than QRTR_NODE_HOST_BASE. + */ +static inline unsigned int qrtr_host_node_id(unsigned int index) +{ + return QRTR_NODE_HOST_BASE + index; +} + +#endif /* _NET_QRTR_H */ diff --git a/net/qrtr/mhi.c b/net/qrtr/mhi.c index 3990da1a65dc..c920ab61f848 100644 --- a/net/qrtr/mhi.c +++ b/net/qrtr/mhi.c @@ -6,6 +6,7 @@ #include #include #include +#include #include =20 #include "qrtr.h" @@ -127,7 +128,8 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_d= ev, if (rc) return rc; =20 - rc =3D qrtr_endpoint_register(&qdev->ep, QRTR_EP_NID_AUTO); + rc =3D qrtr_endpoint_register(&qdev->ep, + qrtr_host_node_id(mhi_dev->mhi_cntrl->index)); if (rc) goto err_unprepare; =20 --=20 2.43.0 From nobody Fri Sep 25 00:03:11 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA6D7502784; Fri, 18 Sep 2026 16:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789748899; cv=none; b=W3jJJxgTJ0a5yjV1fclpMC807yMKI0lyW1a6SahfChKOEu7ooZxT0Z9FYFtIVazkaoTcX+AEoUxnZ9si8qkXPn2WywrCyhs2YNxh2XD4eZdeKZ/pSgncu0zizEY8KsRHFrRkhn/U2jpl6o/UHyQdBjVT6N/UvFQV/D4IhZGahFs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789748899; c=relaxed/simple; bh=XDDzM4aSYEc7ZNFEAujEu7CcK5fcN2uK5xdWdBsU3Yw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YIfv+aGOMtaDPJT3DDOyMFFk9bhPUwl/+h/cJoMqflI0cXhLM+DFy+kMV0P3nMx/XhXTTowvaWaA+mmoqfNkOPKtdOvBEOceA1OFCMD/e54zeEwpid2eO6bsc4I9veGsZb43WanutnqJYICDmfHmbkfN6W4Wpj5u048wwjLPcDs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dBmlwT23; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dBmlwT23" Received: by smtp.kernel.org (Postfix) with ESMTPS id E6202C2BCFD; Fri, 18 Sep 2026 16:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789748898; bh=XDDzM4aSYEc7ZNFEAujEu7CcK5fcN2uK5xdWdBsU3Yw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=dBmlwT23grQ1r2poQ8pqDyl7bFmXXr8okX80P0N6frqaIobgGvpXPieBP4AYzaB0A GIjvHG2rMeebcjjagev1uFAvOcZYEUWqMtlV3/YSyejk+PKXYaVhAkprQJX7J31p2d PNabm1M4g4Kch09jHWMTXvHdCW5WEoT/tcHC2ToUB0w465l9sRiwuC+xmR/1SZpOxF xDMfvUYby0GOKV/KZPN4eFXD8beFBDQD38O4zRg8UM8JzpbMkrCZDM1wDVb2MBtHWT I/GyYMssMFl3KVjcME+4N/LsC7djdB75IAAR9Dlmn24y49Y+fLAj55X2gMyMWKvxM6 3O8f+FgXcu3Hw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9747C982E0; Fri, 18 Sep 2026 16:28:17 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Fri, 18 Sep 2026 18:28:15 +0200 Subject: [PATCH 3/4] wifi: ath11k: Connect to the QMI server belonging to the device owned by this driver Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-qrtr-multi-ep-v1-3-8a06caa368d3@oss.qualcomm.com> References: <20260918-qrtr-multi-ep-v1-0-8a06caa368d3@oss.qualcomm.com> In-Reply-To: <20260918-qrtr-multi-ep-v1-0-8a06caa368d3@oss.qualcomm.com> To: Manivannan Sadhasivam , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jeff Johnson Cc: linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, Bjorn Andersson , Chris Lew , Deepak Kumar Singh , Raj Kumar Bhagat , Juha-Matti Tilli , Jeff Hugo , Manivannan Sadhasivam X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4047; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=LLx7gXAkXsmoLEJnemQrijc01fAxmMC5ydG4+GSiAaI=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBqrWafBklBrsZmrt4BmgE8n1YDSIBE/kbZYz5ko ls2iazaKiqJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaq1mnwAKCRBVnxHm/pHO 9darB/9GCeWaUd8jk94Xuf0HoNkILR8PQcn/UhXhlNns9OW3ZT1Ng9MTWnwf3b7GCx4j9NZbZXx Wnu+yuDQX0Bg/D6L9GxCp08xIU8auRoCUYTt/oYvETkdtf0RAi5FGzMDeqo2s3AM2ujUjRdYlPt CqytpeDGu5F/w3BTZfLncBSwMiCjkJ/1RS/mrz0TY4peOF+jXhedQKMvXs/vpyzSFUGlVLac2tv Hhg2W4rT9f9b8m96fVFGOueT3dMqzFfGmpjX6fdhAh+RwKutKcaheh/doNat5ts5larfe94HKIw mhXmQFjODQsrLu9lB8xwd8X9qLfhPR/ksV0PqsABTTyJN95K X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam 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 Tested-by: Juha-Matti Tilli --- 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/a= th/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); }; =20 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); } =20 +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/a= th/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 #include #include +#include =20 #include "pci.h" #include "core.h" @@ -900,6 +901,13 @@ static int ath11k_pci_start(struct ath11k_base *ab) return 0; } =20 +static int ath11k_pci_get_qrtr_node_id(struct ath11k_base *ab) +{ + struct ath11k_pci *ab_pci =3D ath11k_pci_priv(ab); + + return qrtr_host_node_id(ab_pci->mhi_ctrl->index); +} + static const struct ath11k_hif_ops ath11k_pci_hif_ops =3D { .start =3D ath11k_pci_start, .stop =3D ath11k_pcic_stop, @@ -921,6 +929,7 @@ static const struct ath11k_hif_ops ath11k_pci_hif_ops = =3D { #ifdef CONFIG_DEV_COREDUMP .coredump_download =3D ath11k_pci_coredump_download, #endif + .get_qrtr_node_id =3D ath11k_pci_get_qrtr_node_id, }; =20 static void ath11k_pci_read_hw_version(struct ath11k_base *ab, u32 *major,= u32 *minor) diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/a= th/ath11k/qmi.c index 7dc07339b957..dadf78f30b89 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -3170,8 +3170,18 @@ static int ath11k_qmi_ops_new_server(struct qmi_hand= le *qmi_hdl, struct ath11k_qmi *qmi =3D container_of(qmi_hdl, struct ath11k_qmi, handl= e); struct ath11k_base *ab =3D qmi->ab; struct sockaddr_qrtr *sq =3D &qmi->sq; + int node_id; int ret; =20 + /* Identical devices advertise the same QMI services, so connect only to + * the QMI server on this device's node. A node id of 0 means the + * transport has not assigned a unique node id, so accept the server + * unfiltered. + */ + node_id =3D ath11k_hif_get_qrtr_node_id(ab); + if (node_id && service->node !=3D node_id) + return 0; + sq->sq_family =3D AF_QIPCRTR; sq->sq_node =3D service->node; sq->sq_port =3D service->port; --=20 2.43.0 From nobody Fri Sep 25 00:03:11 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A95F9516149; Fri, 18 Sep 2026 16:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789748899; cv=none; b=JtSWe9IYftQWcmvyIUKON1hk4UZdovSeByq9ifnSgVFGv4Gr4A7o+EOkz0uHVWGmg0uNNBahVO0tq/an9PDcitzOdAWpmQZyB050Hy55W/kRD4VfHM/zcRLeP9JZbLgoO0aAIAlbK87k8vhEDG0oxu5d9t9KSNj8w3+fgkTkXB0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789748899; c=relaxed/simple; bh=hkOGfl3uMR+TD4cA7bZLolJR7gTPPKlkrku5dBBzcmk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ua0M1uphbYdHUks+3m/bpXmZLOINXbosXWXSS2iDz9zCa6GsfUBmW9b2xIcajYzCRCFXssvBwgn6zBwpy7o1xu2XfyA7NLRQcdpy/DCdQOkdFUQMJgKXYMUzHKogLT0T9LEnJgDDa1Ko8jm5SlAoTDYMzbnSUFqfR1GCELHGZiM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z8vteWUM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z8vteWUM" Received: by smtp.kernel.org (Postfix) with ESMTPS id F2A80C32781; Fri, 18 Sep 2026 16:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789748898; bh=hkOGfl3uMR+TD4cA7bZLolJR7gTPPKlkrku5dBBzcmk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Z8vteWUMfZWnzD6qkN7QDGkZR2RwHqmxHIydOYb+9UTBQqrJVOt5GoZw4mBPtByAq atZ/69FXevdWOv3GcF3GOKMHSqEso1sYAbN6+SwNEUzfoF5sBNxrfaYnidE1zr5ppK Lm+EqZfooEHEGOa4y9xyxM4y3sZKsdu6Qqf0LFm0gZQd6ynkkyN4EwP1cKl13e6NeU /GaymeqD0/j+VI29mD+QP38ioY2rVRYpz9KSp1+btYzUxo5Z/n5DbmS+jHKcRyLkdt jn9mLEdPERKNGMRAY4Ie+3JUt5CesKtBXvLESZHAili4+DccjWcj0Nwm3mhhLhfAUt si8nEWmG6l/CA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA04FC982DF; Fri, 18 Sep 2026 16:28:17 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Fri, 18 Sep 2026 18:28:16 +0200 Subject: [PATCH 4/4] wifi: ath12k: Connect to the QMI server belonging to the device owned by this driver Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260918-qrtr-multi-ep-v1-4-8a06caa368d3@oss.qualcomm.com> References: <20260918-qrtr-multi-ep-v1-0-8a06caa368d3@oss.qualcomm.com> In-Reply-To: <20260918-qrtr-multi-ep-v1-0-8a06caa368d3@oss.qualcomm.com> To: Manivannan Sadhasivam , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jeff Johnson Cc: linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, Bjorn Andersson , Chris Lew , Deepak Kumar Singh , Raj Kumar Bhagat , Juha-Matti Tilli , Jeff Hugo , Manivannan Sadhasivam X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4259; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=curbfmqjxjKsnWzL9i8aIUn+dQtL2mKCKSdc3ihT0zc=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBqrWafO1di1O4lB6nHUNfWzvdQz+gMTm6+uqD9f 2NI1o3gjLqJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaq1mnwAKCRBVnxHm/pHO 9dNECACBqfY4aXbYqtyfGh1aw0bHIUcBfUl/RrqJgbsU87TPa6Yil/k4pOBcfgsWi8H6LyL7L4L 8MnL0j7MpsK5W/M3Fa0Rs9miENaW3fgyJ/Ds8k82EyAJX06ERwWPJBFPuUKIwIdAIl67F1YBW/t xhTrc6kciZywKXMUiMRID8ePN9LAu/FY5tK2v7PQiI9b2PdUgGxOT6WuY/FppsvnmciD/xf68+J MJBSC2m7ocBiOFoFFQY3WfhLcG7iDLysHmeWs5BPTSLekphfYyKpznypApBQZS3n9UW9PZskSQj sCwsTbApOTAM2u3AZ4qQ716vhSy9uiP87Hr5JHNpPSDmj3Br X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam When two identical ath12k 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 --- drivers/net/wireless/ath/ath12k/hif.h | 9 +++++++++ drivers/net/wireless/ath/ath12k/pci.c | 9 +++++++++ drivers/net/wireless/ath/ath12k/qmi.c | 11 +++++++++++ 3 files changed, 29 insertions(+) diff --git a/drivers/net/wireless/ath/ath12k/hif.h b/drivers/net/wireless/a= th/ath12k/hif.h index 4de8667690e9..be9c070cf716 100644 --- a/drivers/net/wireless/ath/ath12k/hif.h +++ b/drivers/net/wireless/ath/ath12k/hif.h @@ -32,6 +32,7 @@ struct ath12k_hif_ops { void (*get_ce_msi_idx)(struct ath12k_base *ab, u32 ce_id, u32 *msi_idx); int (*panic_handler)(struct ath12k_base *ab); void (*coredump_download)(struct ath12k_base *ab); + int (*get_qrtr_node_id)(struct ath12k_base *ab); }; =20 static inline int ath12k_hif_map_service_to_pipe(struct ath12k_base *ab, u= 16 service_id, @@ -162,4 +163,12 @@ static inline void ath12k_hif_coredump_download(struct= ath12k_base *ab) if (ab->hif.ops->coredump_download) ab->hif.ops->coredump_download(ab); } + +static inline int ath12k_hif_get_qrtr_node_id(struct ath12k_base *ab) +{ + if (!ab->hif.ops->get_qrtr_node_id) + return 0; + + return ab->hif.ops->get_qrtr_node_id(ab); +} #endif /* ATH12K_HIF_H */ diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/a= th/ath12k/pci.c index 6441927b5382..2b1b122bbb3b 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -10,6 +10,7 @@ #include #include #include +#include =20 #include "pci.h" #include "core.h" @@ -1491,6 +1492,13 @@ static int ath12k_pci_panic_handler(struct ath12k_ba= se *ab) return NOTIFY_OK; } =20 +static int ath12k_pci_get_qrtr_node_id(struct ath12k_base *ab) +{ + struct ath12k_pci *ab_pci =3D ath12k_pci_priv(ab); + + return qrtr_host_node_id(ab_pci->mhi_ctrl->index); +} + static const struct ath12k_hif_ops ath12k_pci_hif_ops =3D { .start =3D ath12k_pci_start, .stop =3D ath12k_pci_stop, @@ -1512,6 +1520,7 @@ static const struct ath12k_hif_ops ath12k_pci_hif_ops= =3D { #ifdef CONFIG_ATH12K_COREDUMP .coredump_download =3D ath12k_pci_coredump_download, #endif + .get_qrtr_node_id =3D ath12k_pci_get_qrtr_node_id, }; =20 static enum ath12k_device_family diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/a= th/ath12k/qmi.c index 280e50a1f31d..22b8cbbbf4f4 100644 --- a/drivers/net/wireless/ath/ath12k/qmi.c +++ b/drivers/net/wireless/ath/ath12k/qmi.c @@ -9,6 +9,7 @@ #include "qmi.h" #include "core.h" #include "debug.h" +#include "hif.h" #include #include #include @@ -3940,8 +3941,18 @@ static int ath12k_qmi_ops_new_server(struct qmi_hand= le *qmi_hdl, struct ath12k_qmi *qmi =3D container_of(qmi_hdl, struct ath12k_qmi, handl= e); struct ath12k_base *ab =3D qmi->ab; struct sockaddr_qrtr *sq =3D &qmi->sq; + int node_id; int ret; =20 + /* Identical devices advertise the same QMI services, so connect only to + * the QMI server on this device's node. A node id of 0 means the + * transport has not assigned a unique node id, so accept the server + * unfiltered. + */ + node_id =3D ath12k_hif_get_qrtr_node_id(ab); + if (node_id && service->node !=3D node_id) + return 0; + sq->sq_family =3D AF_QIPCRTR; sq->sq_node =3D service->node; sq->sq_port =3D service->port; --=20 2.43.0