From nobody Thu Sep 24 15:11:48 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 DD0F443CE6A; Tue, 22 Sep 2026 13:42:04 +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=1790084524; cv=none; b=nhi3cTaUo3MxFgPJVhHMYZ7ks4/AXMht2eEwnl77yfxc16XS6UBK2DoOTk4CdmKKcn/pSRUnKuQtR69Ox1XRoP2AAKL2bQKUY6gqzN+S0TxPChm0HX4vhlk7IKVsphtLnB6cxEN7UWfxWRF9F7MbmRDzjKCMHxrqyzh1oq7WCyU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790084524; c=relaxed/simple; bh=ui+TXvwrceC03rroE/Q4o0li/haNQJon38ShWlc2EVE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZiBQhzexD6H3PZq+L2bFSiImS7nkdoroGGrUIkqF5b+oxbXWNLzXQZdOeYYYQN9Sgamgb87Gh+R8c0o87HXAOkXBUef08eReCHRcMo2bkAv6rS6EaGIQa3Jc8q5spE+6PzY/S9vYfkx1P3c3G23LgFWDsT0S0nREXv0PY5R7B8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G6K2V3hf; 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="G6K2V3hf" Received: by smtp.kernel.org (Postfix) with ESMTPS id A14E2C2BCFA; Tue, 22 Sep 2026 13:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1790084524; bh=ui+TXvwrceC03rroE/Q4o0li/haNQJon38ShWlc2EVE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=G6K2V3hfxV8r+6ZtFmtnLu4ih7IPQs+y1XyytoQWBKS6m600IsltVrhtwrCBheq2I qUGX4r7XtKZKalpluawZjWH4qA3vmSnhGjF07qGWXHxxzqq+bWPFAo5w11YxWj9gmQ uVUHXJPfNrIYjD/bYxui47zSYqInlcy0a8E7EEfWVgb/kBd9Xd0qExY+zTai3lC8O/ BQcccDntbL7pixs++cJwDag5HVo1kBLwt1kGxcBwc9PZ35i6y/zulJcz8UtvS4WrNU gTv0XqFIwh/tQftlYhAb2IHmr5qkEUf3RlNKgIQFgLbYkTGZ1uyS0QTBB9xj7TAp1w j9122tpLF1C3w== 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 7A37CC98304; Tue, 22 Sep 2026 13:42:04 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 22 Sep 2026 15:41:45 +0200 Subject: [PATCH v3 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: <20260922-qrtr-multi-ep-v3-1-c00831e88957@oss.qualcomm.com> References: <20260922-qrtr-multi-ep-v3-0-c00831e88957@oss.qualcomm.com> In-Reply-To: <20260922-qrtr-multi-ep-v3-0-c00831e88957@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=5742; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=SBSrI+qlLmBFZ+dE+vFKRI0DdSkol2nyOzoeOTlj9jg=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBqsoWpbuOyoQKV02+GoxJrFYPlSGJH68jOs7wMr CDEg/wp0rSJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCarKFqQAKCRBVnxHm/pHO 9RcNB/9Imo5XHaW0CoxAo1arRjZkVC9Pi5NdmD5TJnnRtZtHPqJukKAgUq+T1QMDJODb9T4jQRI l1HYvNzc0DY5/RtMUbmyhv8150KdgqfHDZgSL5laDLOLSitqRXvR+Xu9PeND9KOdMb75JY1H7cn ix7DaTI9v/5ViUY39bUs3cpiLeEaSBRxU68SJieioxEzQBp4PqX6Se/r7FC+qBHZNpesj+l+ZWJ Nuc15UcBm3gzpQ05Nr3X3T9nQc06uVuyyOYxBlL9Tt4uxtVnDRmNmAg4/tugcW/dTC2EauUEuNI 4u72wA8v1E398uOzTvT0FwX1FyGRVXBYLyIPMS6fzA/4EkBs 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 | 62 ++++++++++++++++++++++++++++++++++++++++++++++++--= ---- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c index 78347c937af7..6387b85a7a2c 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 || type =3D=3D QRTR_TYPE_RESUME_TX) + 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,30 @@ 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 || + cb->type =3D=3D QRTR_TYPE_RESUME_TX) + 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 +693,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 15:11:48 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 DD04B4078DF; Tue, 22 Sep 2026 13:42:04 +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=1790084524; cv=none; b=KKgjzP7KnvsJiBZlilrB1diEYSYvqZLCkKE31j1gOhbqrWnLSkIRjNFRMwL6UbgWXN4LTxiS0fxkKKArL0PQJEREG1m0oFrR1Mt7ocaa610urX1jQ24t9zhDWGvO+WvmEuWmVFYkZn8ELVDpRvzPa33PNaa5MqLM2ScLT1Q3sI0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790084524; c=relaxed/simple; bh=vyCcA7tnPPht7PT85axNJlbH910qapPAZZT/pgWHgoY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uDVlxdv/GqoG2Ly8/qnu5c2vdX/apkmwetVhkEb77sJI20fHGy+vLn8QRq91CrCj2O3JXFzeweJTNvfUPpcVlG4iiqAxZGlFoj4QvrncaZEe1mk5u8WtW6yZrEMhonuXw5qNh1gRcKpigHo7c/6gVn+EjF5alXxqraT8BxfWdVE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ftj2INYG; 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="Ftj2INYG" Received: by smtp.kernel.org (Postfix) with ESMTPS id B2B20C2BCF6; Tue, 22 Sep 2026 13:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1790084524; bh=vyCcA7tnPPht7PT85axNJlbH910qapPAZZT/pgWHgoY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Ftj2INYG8GNVpLoH9Cxl3gEMwp+EMg9skHSOyg8V5T/unxWjWUMYXJHsdxcLJe2XZ ZVvKKIUfQwO3Q3Ie9EVAoeYiWvL2NdC/s9bOSvpTwXe3mlk7wUQKc01atGzlYi1C3I fVi76ZfY6+8WRRciZSmcXL4gSWK2k/LrsD5B2/nbgQnQpGvsMc321Ui6tOTVRHnk+8 XieRzbAHM748fHAkfsApZIRIeHMkEVg9rKsXjpjyzegsL7NBE7uTUM7aE6a+0CEIVx oS75Zwkh/0Uh6EKmVk4J1pvQSrc5hhRIc4cmY64cGWE68a43LYbX+39bUFLG8utgUN /17GFTT8IKAHw== 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 946DCC98302; Tue, 22 Sep 2026 13:42:04 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 22 Sep 2026 15:41:46 +0200 Subject: [PATCH v3 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: <20260922-qrtr-multi-ep-v3-2-c00831e88957@oss.qualcomm.com> References: <20260922-qrtr-multi-ep-v3-0-c00831e88957@oss.qualcomm.com> In-Reply-To: <20260922-qrtr-multi-ep-v3-0-c00831e88957@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+kc71AcsmYgBqsoWpgF1ERmKKFgRfllMWMhlPIpcG3nOoB3HYz G0vgm16ZU6JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCarKFqQAKCRBVnxHm/pHO 9R96B/9ZauGHrvlwTacRyUaFmAzfIhB8j9LS0NGFuRQ4iW7kU/8U0SVsOt9F//gBDbzw/1x/I8/ hqcWkSKXhmhiJ7Voi5UWakubMitFRKDVWwNOMf3arS8MRk4ukg/MZcl+jhbnoQCDEraGvW9eaGA SjLs7Il6xXA8Zh6XDN3shDJPBp4dU1fyQG5ILVNjxrerjjURcq0XKXiSeEgFS11qSvMn3vfErF3 Xnzt1tXqBnqHnlM80pKf40sK1VHDoQxGedJ0SGNOY+od1QZvJrRDZlzDAbRA37oAbie2d7mea1a vvEiBOlNOeQsu+53uiXQ7IkYWXdGW1VCe2aFjrugemfeT4so 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 15:11:48 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 280FE548562; Tue, 22 Sep 2026 13:42:05 +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=1790084525; cv=none; b=GRSEKb/e0E5l5KRslExoIbb8ZZsW7v6BY8cE3+U3WJF+zfl0beMhXgl6bH8OdmFnVI6Mi5orKzfDNkLrU5SONx/C1G/M3vTrDM/KoJnT+L0IoLNEx52jMLk1F+mj4fJXXN9V/46dG3r00Aom/Y3aOHg1046vrBk5uWNR3XJYO+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790084525; c=relaxed/simple; bh=xROrfFeYggZqxoTBcr+VcNs80P1Ms0dAQ/3w/YExYt0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MK6cqe/Cd72MGGU5zHqIs+fKWUY3DqdL4niegH6Z9/nS7p9o7w2NPEsMXyporYREbkBV0G3Ac/BVbZuiO7RwBavOKKMciP9PW+MORAK+aFdnlb/C8u+79D+Z5GyQCh54z4mfX7XCnU4okNeFAQIYWH0Ziag+GvoZ7mHHeiahFxg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IfWh8F21; 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="IfWh8F21" Received: by smtp.kernel.org (Postfix) with ESMTPS id C63A1C2BCFC; Tue, 22 Sep 2026 13:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1790084524; bh=xROrfFeYggZqxoTBcr+VcNs80P1Ms0dAQ/3w/YExYt0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=IfWh8F21m0/buevOmiCo7sUCNnXBprZ0iFgThd8GYHkF6iDHVoslxIealdpkHzafB jZ/pQQsKTZjpgPN2sSOoLEZ7KPqRkDb+nBN7ojf7BhWjfihAvN5wUkxo65rRwERxId zqtyU9MqVQo3+iLrl/9exY7ual+3F1LQenCLpCU+78iojlUXBd/jxOAZ7u6+OvdxYd cMmvI9PjmvRknBKPf7o8DespibNSFr375uTGV9YFJClPnv0XGJPuItNF9vVC0nmMuL x/+JeRxxE1WYFtHreI8RVm6513UW0ydDHoqaEy9s9sAQACKDJcOK5EkNzdBBkUZWho YbDBkKC/D83ww== 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 A9A8FC98309; Tue, 22 Sep 2026 13:42:04 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 22 Sep 2026 15:41:47 +0200 Subject: [PATCH v3 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: <20260922-qrtr-multi-ep-v3-3-c00831e88957@oss.qualcomm.com> References: <20260922-qrtr-multi-ep-v3-0-c00831e88957@oss.qualcomm.com> In-Reply-To: <20260922-qrtr-multi-ep-v3-0-c00831e88957@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 , Vasanthakumar Thiagarajan X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4309; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=ovtJzcguavWNvUinoFzMzVRQK6JoHlMcjMYxr8KLoaI=; b=kA0DAAoBVZ8R5v6RzvUByyZiAGqyhamh+RwBXtaITKsY+ZO19duTX/BJfGSgOLMUXoVSBZkcW 4kBMwQAAQoAHRYhBGelQyqBSMvYpFgnl1WfEeb+kc71BQJqsoWpAAoJEFWfEeb+kc718IwH/jtd EfnmTerjNfa6Zda5uaogCGUh5ZAvnSA1nNW1jWIwh8YEL+fEvQ7H2CdcoUUwKFPLblsPV5TmpyG RTEkhd+cJiYYyqNBkaFjo4JZX8EGppBAw03m9rYMCKf/NMhilC8Dj0q4irzL3WalzCKKmR8Sg+C HNJTj2fGZnU/DSSbg8jo4BnCtwLgWsu10PVN0ujp2pRsmS/ieKllClIjExV6OhtjBgqWR54Ay82 QptTEloryIrlMLldp8sj4cwZjzWGecnHV5DHzROiMovI1/ADzY7rk8SkhpAEOJG+PjF8oeKSLFk lNK2kcd0PXguL4hkcCMMy2rvlYpx3JqIkQIJ4WM= 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. Tested-on: 2x WCN6855 hw2.1 PCI WLAN.HSP.1.1-04685-QCAHSPSWPL_V1_V2_SILICON= Z_IOE-1 Tested-by: Juha-Matti Tilli Reviewed-by: Vasanthakumar Thiagarajan Signed-off-by: Manivannan Sadhasivam --- 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..f432fa4890be 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); + unsigned 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 unsigned 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..d40c057e130c 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 unsigned 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..9484b0eee1a9 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; + unsigned 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 15:11:48 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 38525549386; Tue, 22 Sep 2026 13:42:05 +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=1790084525; cv=none; b=HRfsJb/P+4Jde11HruWDN9/SER2Ggl+lZvKKLBpmcMp35OwsEtPRyo4GYKh2ouPoUn0N/WGWoFMuVtAYqwnRhE4AslHCZ4qeR8/DAqRxjEBobm09S1zDtFDEmb305tJKlNiUs2PRFfgpU6PRxkIPCdykE12qZhVvyvwiYYLNlCA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790084525; c=relaxed/simple; bh=0yAMb2WceSkQwRVCdI/kD46D4CZ0XgiL71tsE1aY1zI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=scsq1spUkainaSquyH67bAL+nIlM728VFgpDqseaE4h8z27FMPbPFJZzG6uCz6onPMHzGsu7uVDYHj3m7gb2Fof+0HbOmSzDeWtBo5qWv/OT4Zw7YpMhhYdBtb3SwZSouDC+csdMlrKCOsJmANTDqTj8X3wv1nsQF9KvUw1+t9E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CSkAAEkI; 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="CSkAAEkI" Received: by smtp.kernel.org (Postfix) with ESMTPS id DFF12C2BD00; Tue, 22 Sep 2026 13:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1790084524; bh=0yAMb2WceSkQwRVCdI/kD46D4CZ0XgiL71tsE1aY1zI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=CSkAAEkIcnK9VMdpmi/pwPOb9cpaccEZz2q14HWav0mRZcmCg3iBLCtXJQ44ucN9o 4Iq1GrvC+28CeMetPKhZKdpetOj6clhz17qKWklyQYt1mPwm6F5T05Y3irTF1jUp0v Dtiv79tf2d59DpLg+nNKzhrf1X2CoF4O8/HR8mHOgy9X+9sE8MSu7yd4E9R0R8+poK WjP7vMaQD8AO2WsTT3AR9zQpj+cQ/T2KigMFLr9juAHWWAuE68qI6A7CJ/Scmmp803 9wzR2G274uvM6khvRZlNjauMh7LVW3f/QUTlAvtYhKEkAMLEmp94F0Tda8jXhtQHyg uyuM5fh+b1M+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 C8232C98304; Tue, 22 Sep 2026 13:42:04 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Tue, 22 Sep 2026 15:41:48 +0200 Subject: [PATCH v3 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: <20260922-qrtr-multi-ep-v3-4-c00831e88957@oss.qualcomm.com> References: <20260922-qrtr-multi-ep-v3-0-c00831e88957@oss.qualcomm.com> In-Reply-To: <20260922-qrtr-multi-ep-v3-0-c00831e88957@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 , Vasanthakumar Thiagarajan X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4571; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=DT5YD9KTy297qpxKLqV6vZHXShu1pl5/Yf8kTL/Z9m0=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBqsoWqqaEGmIX1e1MOg+bhi/qVVyOX76+2krCmI ggELmaZBu6JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCarKFqgAKCRBVnxHm/pHO 9fnSCACPxOdLmSmSN7FrB/o4IzSO5N+EKMM6HAibXYNODm5gQjXEjcGJL9rvwR29v1pY8JSOOb0 1TXJ2gowJHdaVJ6ufYFuO2yQmEmxu46Y2+643i1fX5UHXN795Grkm3UQ7VIJgA70FX668yHYM25 7HfC2tkXqOlVQKbmIEDRkj/NItVJ8dSx1Ttq6l7AFoph2u6ebEGESJh3mtjizT/DZZMn/YRHFKb UmjCC7IEsUKf8C4vt17Ndd+IQ1roaQ+hzeJWNgmnwYOfs3MylAtqsQbwYht293L2CKT3vSWL1iM slsOmXX5PgCaKNCwOmw09wE3BUt9A8vqjlaGEjbSiGdSUnAX 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. Tested-on: 2x WCN7850 hw2.0 WLAN.IOE_HMT.1.1-00018-QCAHMTSWPL_V1.0_V2.0_SIL= ICONZ-1 Tested-on: 1x WCN6855 ath11k + 1x WCN7850 ath12k Tested-by: Juha-Matti Tilli Reviewed-by: Vasanthakumar Thiagarajan Signed-off-by: Manivannan Sadhasivam Tested-by: Raj Kumar Bhagat --- 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..b8592c3d84e7 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); + unsigned 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 unsigned 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..9b6108c1abdc 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 unsigned 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..e1e75cc9d144 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; + unsigned 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