From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793810772; b=j0rlMqh94EBnzEAQAzO4pkNk4ej1jONS2+leUZibrB44Ig2z97A6RFzVnklHN51YykAP TNvlnKDwHuX5/ASIiwb0D2CbP2AER7b1FaSi8BK2j9hpkmqz76Xm5if7qabSG2I217V0o g3gnh+Omv/tk2tUJJjw+Q/C9McpXUsZZtDsU++zqGFqZQGdfeXoVTpcSCZ/oDZMEeRWeo wXeJPprEWGlp5VN9yulu6c+Ge/74r9agzlrRN41YY/hb0npxM8lbqARTVDoKZFfi+DEWR u1k8jXU+cA/Mj8hYfX5/zShMtG7IkAUNNRpMwdA1O8IyiLK15G+HLFtJAMBVp95z8FA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793810772; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=lXC/bDKgvZAq8xaE8sidEO6SzUhZpkifQG9ccrdjriU=; b=qlyPhauwa1ifJqlsMeXVAf+QTT1XCMUPcUBvwkDfGv7fTtp4N7be29dfVXXL9+HA0AwM UF8EnkR1+nXIxoHl+IaRQlaHL4PpuPzsHEvZ6zevDpJTpaGDdQ7HYlMYF3PIEgvoupqAs oWcUKXqPBAijU1gIMhrhq4uUZbKKziwhsz73XoM/mef2SwwStK2P9nbe1k7Qudl6Yvl/8 o8i5Jti9bKzyZUHwQCdWcza6neGqOYvJwn/HE6l/Vah/zeDLKQCj+tm/TzD85MoopU3Av UK6Uelkr3Id70mA6ZS1CrxkR9QWDkNEMEha0Fe89T1aWckkG94YH5RG/4A5IYP3luDg== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Lm4a0+Y5; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 847FB606D819; Wed, 4 Nov 2026 16:46:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Lm4a0+Y5 Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1793810772; b=w31vBUzygulAJ0E1m/kwBoB65WZiniio5usWDPIpKOQj8owd7AkRaqLOsuPqeZH+9qHg RfGYl1OiGHOtTIx4DvtoTcW0xWLkkSHxM9/X5tuxcPGNyorEGqOTjbbOZLQg3Vnqs5dYM kLpSMxYiJuhilXPr86Wzvl1SU0SD6uk5gLHu+0DbKcJCD/h/5ag6qrGJXQl8fYdAI7zCN 94efNXSF1ygH/IQm2B7iIRoy1/7VNoqtNlZeKO8yiUaBc0Ws53r5RhxRE4LuI74XbGRNK JrjMOAYB87UnkS64lg+laP6Z2tZlM9p35a/ISdkMO97lollZdDyq+KQKIb4nTH80udw== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1793810772; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=lXC/bDKgvZAq8xaE8sidEO6SzUhZpkifQG9ccrdjriU=; b=kxMSp2iDthB0HRD001RVjXpJ+NxBE0xh3Cg3DZ3w8irRE73PHWlbzm3kQJo0NNijFmjP EL2BFpHTUb5glJbkqN9KA1ebJruOhXr0deLNu9KVQMbSgz92vSayxdV4Ne3H8oOFSlDNw wc5l+yvGu5b7C+rwn8xygqRp650NMgDDV/pOozxMtvRfDTUiKfi6AhA/uMrgyQA+pr14t r4zN94IXTfHRE6LWnsWT4iJrEoXJOQhPlqqsFovvtDw3nWB2PKsqKNC/ux509Lg0Hvkri vmKnvSs8tSLAYnyr7LGv2m+IF3tub8VGrT950H22MmFfRo35zpt0E0r5JH3oRGhwz2Q== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 0BC251F00A17; Wed, 4 Nov 2026 16:46:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793810772; bh=lXC/bDKgvZAq8xaE8sidEO6SzUhZpkifQG9ccrdjriU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=Lm4a0+Y5wbyRqtEWBJPzJ9K3eZAFIhVBud7e2d4r11RIze3Gn2zYHSR7+JIt2247F 0Ima9QEd2gtTD9I6A8vT819cXz8nM6ZCEwmjlx0nnyTkzImGAFAFGCuhpqX02HOk5N bXzwgXQZ82NJBX5M0UD8An7+KUBYKU2n20cm6Mgt5+x7wSqCqO64nz3vb3WqkPvb4g wFnxsKu1qeQdI/C9GLFEbGecJYANRDSWB4f3ofdjRhQgb8oijLRuRNaxLnQmPMaa/9 fQn1owF1AJWlUN5Hp+m45AP4I4iFoN7RmKW+Dx2dFfA5kF5NK3jYjkhs62ev5Vsvvu g0uU1ZQG1O49Q== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 8A26346ED6; Wed, 4 Nov 2026 16:46:09 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 04 Nov 2026 08:46:04 -0800 Subject: [PATCH net-next v5 4/4] wifi: ath12k: Connect to the QMI server belonging to the device owned by this driver X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20261104-qrtr-multi-ep-v5-4-4cdb2b4f1920@oss.qualcomm.com> References: <20261104-qrtr-multi-ep-v5-0-4cdb2b4f1920@oss.qualcomm.com> In-Reply-To: <20261104-qrtr-multi-ep-v5-0-4cdb2b4f1920@oss.qualcomm.com> To: Manivannan Sadhasivam , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Simon Horman , Jeff Johnson , Eric Dumazet , Eric Dumazet 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 , Daizhuang Bai , Jeff Johnson X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4724; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=mhErcsLQdS5uRROGeaSOA51h7VNX0VQpNNW/OtbOflM=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBq62FQQ+e73zlMkQF+JuIZ6XZ0mdAZt9RxUsC4F GjvsyPFLMiJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCauthUAAKCRBVnxHm/pHO 9evWB/9/LYxl9U54MCxD1UJD42IV/qA1YSt+cs8LuG7azAex5n1APg9aQgiYrPk5tKnCO45v8G7 IAcrCUVEg1X1f1XMJ2wppe/3TUTDcSZYmnwUabbwqH1p6q5TcGCyaiuvmKWPw4MafFaoaeFVW4m X0BJhGecv0n875+Jblcgvak15aZ/TS9DjE8qcT3gJZjNAvFAegC1R/bNoSGONrNRTklr5ncoUFP eFnILIAfHr1Zyk8dx/ypg8ggoRIPeUc8O/eDoZkJSK/Y7Qb4GP28Epwvb4T8OjuEH2RV1WTpzUs LYkrZ/mdRA/m7kVqRAnUWZ2R8OnO+ffcYE84aJmLeeLeRUD8 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 Content-Transfer-Encoding: 7bit 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, reject 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_SILICONZ-1 Tested-on: QCC2072 hw1.0 PCI WLAN.COL.1.0.c2-00277-QCACOLSWPL_V1_TO_SILICONZ-1 Reviewed-by: Simon Horman Tested-by: Juha-Matti Tilli Tested-by: Daizhuang Bai Acked-by: Jeff Johnson 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 | 12 ++++++++++++ 3 files changed, 30 insertions(+) diff --git a/drivers/net/wireless/ath/ath12k/hif.h b/drivers/net/wireless/ath/ath12k/hif.h index aecdb0c5f285..c2cfe9a75493 100644 --- a/drivers/net/wireless/ath/ath12k/hif.h +++ b/drivers/net/wireless/ath/ath12k/hif.h @@ -31,6 +31,7 @@ struct ath12k_hif_ops { void (*ce_irq_disable)(struct ath12k_base *ab); void (*get_ce_msi_idx)(struct ath12k_base *ab, u32 ce_id, u32 *msi_idx); void (*coredump_download)(struct ath12k_base *ab); + unsigned int (*get_qrtr_node_id)(struct ath12k_base *ab); }; static inline int ath12k_hif_map_service_to_pipe(struct ath12k_base *ab, u16 service_id, @@ -153,4 +154,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/ath/ath12k/pci.c index 12bbb75570f1..e56f2f9d721e 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 #include "pci.h" #include "core.h" @@ -1493,6 +1494,13 @@ void ath12k_pci_power_down(struct ath12k_base *ab, bool is_suspend) ath12k_pci_sw_reset(ab_pci->ab, false); } +static unsigned int ath12k_pci_get_qrtr_node_id(struct ath12k_base *ab) +{ + struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); + + return qrtr_host_node_id(ab_pci->mhi_ctrl->index); +} + static const struct ath12k_hif_ops ath12k_pci_hif_ops = { .start = ath12k_pci_start, .stop = ath12k_pci_stop, @@ -1513,6 +1521,7 @@ static const struct ath12k_hif_ops ath12k_pci_hif_ops = { #ifdef CONFIG_ATH12K_COREDUMP .coredump_download = ath12k_pci_coredump_download, #endif + .get_qrtr_node_id = ath12k_pci_get_qrtr_node_id, }; static enum ath12k_device_family diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c index 817bd820623d..86ec7f2431e2 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 @@ -3992,8 +3993,19 @@ static int ath12k_qmi_ops_new_server(struct qmi_handle *qmi_hdl, struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle); struct ath12k_base *ab = qmi->ab; struct sockaddr_qrtr *sq = &qmi->sq; + unsigned int node_id; int ret; + /* + * 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 = ath12k_hif_get_qrtr_node_id(ab); + if (node_id && service->node != node_id) + return -EINVAL; + sq->sq_family = AF_QIPCRTR; sq->sq_node = service->node; sq->sq_port = service->port; -- 2.43.0