From nobody Thu Sep 24 20:03:26 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 38E1648988D; Mon, 21 Sep 2026 11:23:33 +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=1789989813; cv=none; b=XrZl2mWLWwuKwWaH4svFdUAkXWRJ/NEjJBHmssAXExh8DTzfK62bpqESXPo20ZF8vT2CYtbrSlXO8tHtBGNLzcUlxu704bZdN26tM0N7mH2In2HHJ3XboSA/+5zOOvKaY/rJ747LbF4Pmq7ZcmpiFGLpwCboQLtxpR7KJN/CJDE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789989813; c=relaxed/simple; bh=fdjlnrJ3LToW7onxkiWd5XchU6A7o130iGBmLyfFfkE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HNaCRmYITNPaKspKGD7KaFQZLdZvhKzZLZQEqzaH64taPBloBmqXYu8bHC5bbXWL163uLqeEycYxcIDuhIxJggqBdlDPNvGURzG9wj+ZVKUTm4avxRomMB8ZVy9jExONWGS083bbCTdTLiPpCZVkLAki0h7PnImRoKjDyoBgN0Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ap+4NXlQ; 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="Ap+4NXlQ" Received: by smtp.kernel.org (Postfix) with ESMTPS id D1A03C2BCF6; Mon, 21 Sep 2026 11:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789989812; bh=fdjlnrJ3LToW7onxkiWd5XchU6A7o130iGBmLyfFfkE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Ap+4NXlQt7jA0vv+EHGlsWu6+W+JQiiR7XqVa56aCE+8/eEvr+pWvfYPpQy2tm67O MjmwoplfurNTgCcsD+hibRmBJXNDd6Q3pmMTudbCqXmo2OBPP4+0V3etU5v+Lbo2N7 Q1U8rr/E50SKGDD+tLJi6yrRCpT7nIlpGiCq/3w/eCX376JdLG6N5YIr4LQ+Nxl5mP lcrDuQjVsLQMwTaINf3e3Wex3zN8SIOmHquPmInmFm///c9dfori0YR6/XoeocdFpu GOGyQKcbR/kglyJ0aPRk/y3vzYEE856sgV2PjoiIZEJaykCCH1UswOVRMsSm/0ur8a g0TwB+SU3MD/Q== 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 BA890C982E1; Mon, 21 Sep 2026 11:23:32 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 21 Sep 2026 13:23:27 +0200 Subject: [PATCH v2 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: <20260921-qrtr-multi-ep-v2-1-27dd80d841a0@oss.qualcomm.com> References: <20260921-qrtr-multi-ep-v2-0-27dd80d841a0@oss.qualcomm.com> In-Reply-To: <20260921-qrtr-multi-ep-v2-0-27dd80d841a0@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=5669; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=bkqF9LbWdL45ipEr0xLieI3UD5ICmD54p2NVl4pcadA=; b=owGbwMvMwMUYOl/w2b+J574ynlZLYsjaKLxx6fdy601hF/d6Hw+Y5NN8fVXRPPaXHRMEY8w0g nus9VR3djIaszAwcjHIiimypC911mr0OH1jSYT6dJhBrEwgUxi4OAVgIm+zORi6LMJ1ZvnvdRRQ W23spem4yGhS7/VgnvUpz3evO1m8r97gIavC/1c6nLkz/rxS2xWT4hiRavY95n3KhGlLy357Mtu 9tHwR+9/r4HzXRu+WYxzuTmL9Mbc2S6TYcVdGTO1p2sf9U6Hd7Y1VT7nw0Q/sBd0nyxzOFztc36 xvn+MswF/L5F6bJ5Gj0MBlHtvt6+/QkLR20VnP8HP7tBMurlQ9xSHxXNyee8+WzkuSD89xJb2pU Fm8Z1Ol2BGR1uMV9snm8i8WHGDal+WxO+QgQ7/EkZfZ6frbH/teEJ6fv3xbX0NDEIfQ3Om1H5sn nl3UezakNkJ0O5/nv+y/m3b1tPx5YRJTq9a5+vGD6cFzAQ== 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 78347c937af7..ad62f3caede8 100644 --- a/net/qrtr/af_qrtr.c +++ b/net/qrtr/af_qrtr.c @@ -118,7 +118,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 * @hello_sent: hello packet send successful @@ -131,6 +132,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 */ @@ -347,6 +349,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 mutex_lock(&node->ep_lock); @@ -369,10 +372,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(READ_ONCE(node->nid)); + hdr->dst_node_id =3D cpu_to_le32(READ_ONCE(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 READ_ONCE(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 @@ -441,6 +448,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 @@ -531,16 +564,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) + WRITE_ONCE(node->ep_nid, 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 { @@ -646,6 +692,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 node->hello_sent =3D false; --=20 2.43.0 From nobody Thu Sep 24 20:03:26 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 38CAD489882; Mon, 21 Sep 2026 11:23:33 +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=1789989813; cv=none; b=qSDqzdPI/uiXHtjtX8pASjg8HgnyRIuD2EwTM8IpCj955Wm5rxhNwG1zqSMzbbyakdJdW34dtk+899xEzfPX/ECh3Cz5j6Wjr8vvPzSHE81NYlTbuupxadhcscWwdvOGMn/u0U7R4YPN+A5S0RIEE7khBxKVI5RyRw48DNNksX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789989813; c=relaxed/simple; bh=vyCcA7tnPPht7PT85axNJlbH910qapPAZZT/pgWHgoY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HHZtbvE7jsrAhKoa/TlXX3vCMw7B3yUWxlrf4aw+Obr1sRLm+YEGBk+E7DbbYhQI8ayQOo1jmnZf/X+23mb8bFVeDv5PQT6jXV+W9dTgVdpxcM9WlKYRxNbGaPSlrTXyBTXRIh+khudeIqFzgcNrr0qDJz1b/UXPAEulFNy5dk8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lxUMBD5G; 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="lxUMBD5G" Received: by smtp.kernel.org (Postfix) with ESMTPS id E44D3C2BCFF; Mon, 21 Sep 2026 11:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789989813; bh=vyCcA7tnPPht7PT85axNJlbH910qapPAZZT/pgWHgoY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=lxUMBD5G54nJgHXI6SATEKvH+MU27PmJquDxCTRuAt2KHEsTl3dFWkAp4asflXij4 ZC6lxjFQoNsOAFSXA8G5Vnqtil3yGS83Uh4gZaAhKguvC6KuMwlUkPnj+Kvk26RsOz 6cLxkCpCYpY7xNFXNpnLpU5vzsIgla9cRTwYU2PxiPDXd7EWwqLFV3oJspeZrNQHO5 UDSdYJ4mdmpMZo7hnV/3cH7mhpYmKIAVnafCzlv3TIdeV6L2jNS62TW0IShD4tJshR /VQaVhUH3oiokuGJ1kKi6YAFL6uumPI351xv9a+6XT3Tpwa6dgkphQexnam+1kEHsh CkclvWQccpP5g== 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 CC475C982ED; Mon, 21 Sep 2026 11:23:32 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 21 Sep 2026 13:23:28 +0200 Subject: [PATCH v2 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: <20260921-qrtr-multi-ep-v2-2-27dd80d841a0@oss.qualcomm.com> References: <20260921-qrtr-multi-ep-v2-0-27dd80d841a0@oss.qualcomm.com> In-Reply-To: <20260921-qrtr-multi-ep-v2-0-27dd80d841a0@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=KeQEnANlAXYlpqTacuONKxeWxAocy2Ur191CkncsK00=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBqsROxhF+92CDxgS35185SmgsprWtjBnV+oBe9+ 3ZJfi9jfeGJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCarETsQAKCRBVnxHm/pHO 9bWtB/9lgpiwXH/3Z6Hr5+ZWeqKn/0lH6dSmm0rphk3SVc+Hhlf7vO8JtsKzrhlyR5mpZ1P1LeE dS/xq4GhKbLzLPKBKw1YAA0UqqVP4u/Vrs7zG1KAfLxNrffNp15doNYvMFxV+ni8xGCKxtLXps0 mfEgPOO/e/2Zm8ALCSnuOjftKWt+RxFdRfkfBJHVvCGXUZANRebV6+cYOKxBEWNuKgU4oLP74Ie o6RIpe7QGFlKsmHqPd91v/pL0IZGnuB5l8b+mcRGZbnHpi8EuhQYrif79Ct20IRcXWBPCUv9UK0 LR/92bLY8nWvHesLT/9ibgy6BPwa4LjxRwrOJ0tBsvANvIMk 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 df8ab9b82402..9c8bb086be28 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22511,6 +22511,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 Thu Sep 24 20:03:26 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 3E2FC489FCF; Mon, 21 Sep 2026 11:23:33 +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=1789989813; cv=none; b=mEy8XWYsYnm9pYcj+8m9kDc1bdmOAwj8+DGqmO49UanxJjfz9Yj1c3ZOaWkPmWlXBPeBGTxthnq+zMSaUgAdE8AvIjMSaX3UqRnx+27oTt0tc75415SlycC+qsVIqTY6ctkeaYcy/g60izWYT7eN8tIYI9d1vQhvgthtrHi5Z4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789989813; c=relaxed/simple; bh=XDDzM4aSYEc7ZNFEAujEu7CcK5fcN2uK5xdWdBsU3Yw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MZvfvZbhxlr6oF4Maaejo81bFvYin7V0zwt/IZAe7maxcyZE3kiXlR9CIww2+hIN3buqoPatf1n9JBdDDgIkOCIfwbvLHcQ9I0iCMqdfkdxbtf8hrHFI0rQo6nNSPFs7+Vad5NqKw1mfwFPoz0aapNSI9PqZevYPHkaniTZYWew= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cs8/B+By; 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="cs8/B+By" Received: by smtp.kernel.org (Postfix) with ESMTPS id F3CA4C2BCB8; Mon, 21 Sep 2026 11:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789989813; bh=XDDzM4aSYEc7ZNFEAujEu7CcK5fcN2uK5xdWdBsU3Yw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=cs8/B+Bye797EpeKOxmRaLOuwb9aCQO014x9iKpdFxfR0jLEce4qEc6vwIhFYrJZw 1HHVSrb0vPoIWBytZu2XxHIKEl78nYl9EycBXXiNH+vk3pWNAzbvleX/9qHVz0et69 rUGf8/zCirwS5SZv9+D1vCIfvCHwcVIQqNe5t//N9oyGzS4uKVZXJLqT1tCbBDWPkU ABtWmn95bVt9iVM54xpytzEiZQRrlCVVNJ5j5KlPO2Mt6ebdCcPmaXfsDrG7bmX319 OzN2p4kcmpdUDJzGLpteUYfnIgvj4RqMzn4gaszoc/IJci45KLO8KHYZFVFmUnf6hu 6BP3D5u37082g== 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 DF677C982EE; Mon, 21 Sep 2026 11:23:32 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 21 Sep 2026 13:23:29 +0200 Subject: [PATCH v2 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: <20260921-qrtr-multi-ep-v2-3-27dd80d841a0@oss.qualcomm.com> References: <20260921-qrtr-multi-ep-v2-0-27dd80d841a0@oss.qualcomm.com> In-Reply-To: <20260921-qrtr-multi-ep-v2-0-27dd80d841a0@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+kc71AcsmYgBqsROyVCfNYWTDn5qcRfNToj9qFO2htOZUzMN3s vrz1q4dyAKJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCarETsgAKCRBVnxHm/pHO 9eNSCACPGty/j8lFSPl+QCifkvQNjbShpBxzw1ygp9/O18AplWnNbPIP/4ftMibyRFpOFJKi/RX c4KQpUqPxEYyqSh/Zcz8ghoUsofrYYh4ZJoc7i+c4QxuOj9NDX00ZpbRH5Gh3JAc09G2oPooN67 WkPVy671dVTjdSBaCnchkM4w1AC/cT8T/cIlv7lHPwIyS8E/GtDYf9HK1ioE8kdKP3Lf2u+99Nu 88zzcXynmO2hZ/XMjoiHtapT4Ow3SffKWeti3PX8HRoxoGaOve9mFI/Dln3aCO9IO/BbLtJ6FfE Z4FZU9R0SHtMVDY8QR2tuQv8zn8R6XrELTPPAlXH7RgA2F+Z 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 Reviewed-by: Vasanthakumar Thiagarajan 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 Thu Sep 24 20:03:26 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 435533B71A5; Mon, 21 Sep 2026 11:23:33 +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=1789989813; cv=none; b=cUM6Wn2KHMkpCkmIUQcn7VwhtFHextzKG/xOsmuUQ5XslnxPF83pPXANbDR1zHwS9Uh0Qk2Rilpw24tM/87ZNbJJvJLmXAL8G17waAn7SWny8u8UlqPe6da07HNFYgaI9/9bChsFPSWo5Y4CdhzLVrLAV8EFEBSVRlLtbVkBuko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789989813; c=relaxed/simple; bh=hkOGfl3uMR+TD4cA7bZLolJR7gTPPKlkrku5dBBzcmk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IRb2wPhzW9A7hsxlaRY5trfQp56i7t5qTuHXg2+EUo7A76lqyhui+DOjeOQ7orfiyUrlfDsgrYiUZFe+t/UW0lxxPRdowxGNjvD9zA1PpX4besMewum0nPWeneGWyO5ufv7YOjvILYJLyrGICAJ4LGNDfKQXuWbz+cRe4hdSQLw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ItywH7yS; 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="ItywH7yS" Received: by smtp.kernel.org (Postfix) with ESMTPS id 124F1C32781; Mon, 21 Sep 2026 11:23:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789989813; bh=hkOGfl3uMR+TD4cA7bZLolJR7gTPPKlkrku5dBBzcmk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ItywH7ySUgyIRibh2QkNRtLu2QSFXxfPmCbzPjwfPlCZzTFWdB/WAIrUGCdExe7mW gdaNJB/LuWZYaGgJ0ZO39NrnfQyzoZ0gBQfqkZYeGB1BaieswUY26MBt80ZArB8IQn KjQaaZii5iRlj5FRJkOkN5XhM5DoM8emvRFDNaPn6TlQaOAirBwihL+Zg1d7eblSZT ypgmGBpmXq5M08Xjf9047Iv3fspSQB7XUM6RpGT9oWChsmmUAqspgtbR8xug5hHb0h OOn3lxtPb7mZHHHirQ3jMzv5cCNIGmQEkPEfW6XDbC0+fVqndoN8aREhALUUo3y304 2CPi36z1gCLuA== 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 F108FC982F1; Mon, 21 Sep 2026 11:23:32 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 21 Sep 2026 13:23:30 +0200 Subject: [PATCH v2 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: <20260921-qrtr-multi-ep-v2-4-27dd80d841a0@oss.qualcomm.com> References: <20260921-qrtr-multi-ep-v2-0-27dd80d841a0@oss.qualcomm.com> In-Reply-To: <20260921-qrtr-multi-ep-v2-0-27dd80d841a0@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+kc71AcsmYgBqsROyWsTe7CPHCDfSrklguphvrDTeebUQcmibe P5mYBiAnGmJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCarETsgAKCRBVnxHm/pHO 9bmHB/4hEKmPMHJeTP7s6r44zQpK0dEbXTf+c2QMD4FOtXceJRN2//xYJIf72j7RxRMEoDedmq1 VkQKYoV6voaaSttLz0/c9+S1pKxxgNJxfyKnRCaiCmkEkb/LW0xT8UA5dMqiBakAo4yS4WHydow 7BFGM9ZANASKOY76FfgNAugyc09MBvh6NpecfYr/EJSYsxLSJIHqTj6MOWzZD04FhKNbcueer6e UZyfRKRKLGdCbB8IgG2ii5flYS9XSuuVpOmD64tp1S1UbPg/gUHzZOg7NxbQ9uBjLgLA511UrAU hnwP6EQIqg52AaUpN+2TDRpykctIRarS57G7CTy29i0axiFN 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 Reviewed-by: Vasanthakumar Thiagarajan Tested-by: Juha-Matti Tilli --- 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