From patchwork Mon Nov 25 03:50:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845552 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 47C65BE4E; Mon, 25 Nov 2024 04:00:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732507225; cv=none; b=mH4c/sg7SgrAavqYUgYbpFxdby8t4m0XbSP+JtV3mT0cL2hjZeNlNQUBGcM4U/uD+KvTco6Xhnmg6obmlxBTEYeh/XzfaO5lUFds4GeQw9kGJIW6nJtfPw86hsZ2bGtyI0M4+liyzAfuAYt6g1c/SEv02QL0BuqxC/JULX9za00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732507225; c=relaxed/simple; bh=APPsH5pzntsYizn7wbJLWf7AWNXzwzr+IK7xfg0q/Aw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pZbACcPCwrLjJs0jNGMMWj9D02f1HZG0kHUl7MUQgSx2JaytbAUSYB/4+CcYklmwe6GEOdGPME8GFAUgOWFk+j529W9DTKst2s1itvMSMopzfdI05V+qdDSKq/x5vW9MWRec7akONcAn7/eUF6AX6/EYLHidv3b/kyxqKRCRfQM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=P4jPyIG1; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="P4jPyIG1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506707; bh=APPsH5pzntsYizn7wbJLWf7AWNXzwzr+IK7xfg0q/Aw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P4jPyIG17nibxS+0psdv9p6rnm/FodEILE66B3C2IpW8hsORh7Krk/W6pSczoZcER tM8qzynhvX+PCvnMdpwgOI/IIjxS0BCsfGQWxLjm1DoFian4REf03j9h1jfjhXKkt6 VBo0jTYeFE22sddCIY/YrfP5HocrtYjbm2miLyR0= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id A1E2314873AA; Mon, 25 Nov 2024 04:51:47 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 01/13] net: qrtr: support registering endpoint-specific data Date: Mon, 25 Nov 2024 04:50:16 +0100 Message-ID: <064e351e175e809e9a774022fa2f104b67862d9e.1732506261.git.ionic@ionic.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This adds the infrastructure for registering endpoint-specific data for endpoint IDs. Endpoint-specific data can be used to map an endpoint ID to a specific endpoint backend. Additional API is introduced as a common header in include/net to allow other parts of the kernel to query endpoint IDs for endpoint-specific data or make the QRTR subsystem assign a new endpoint ID for passed endpoint-specific data. This will allow other systems to register endpoint IDs before actual socket creation and usage, which in turn allows proper binding to endpoint IDs from the start. The endpoint registration function is changed to re-use endpoint IDs that match the backend's endpoint-specific data if possible, assign a new endpoint ID if the endpoint-specific data is not known yet, or create a new endpoint ID without endpoint-specific data attached to it if all else fails. There is one gripe with this implementation: other kernel subsystems can, theoretically, assign an unlimited number of new endpoint IDs and thus exhaust endpoint ID space. No API is provided to delete endpoint IDs and we also do not track which endpoint IDs are in use and which are not, which means that even the QRTR-internal code cannot easily clean up unused endpoint IDs. The only exception to this are endpoint IDs attached to QRTR nodes, which will be deleted when the QRTR nodes themselves are deleted. This is probably a potential memory leak that we can live with. Fixing that is rather difficult. We would either have to add some form of refcounting, wrap the endpoint-specific data pointer into yet another structure together with a kref and use that to free unused endpoint IDs, or periodically clean unused endpoint IDs up in a timer (executing, say, every 10 minutes), essentially doing garbage collection. Garbage collection is being frowned upon, especially in the kernel, but in this case, it really would make the most sense. Clients might allocate endpoint IDs that are never actually used (for instance because the client uses a wrong endpoint-specific data pointer, which is not used by a QRTR backend), and will need to hold a reference to this for their entire life time, which essentially defeats the concept of cleanup of unused endpoint IDs via reference counting. Clients can create endpoint IDs quite some time before the QRTR subsystem uses them, but there is no way to easily tell when this will be. The idea is that minutes as orders of magnitude would probably be a safe value for which to regard an endpoint ID as unused. Signed-off-by: Mihai Moldovan Depends-on: 25a7151cdc98 ("net: qrtr: ns: support multiple endpoints") Link: https://patch.msgid.link/20241018181842.1368394-1-denkenz@gmail.com --- MAINTAINERS | 1 + include/net/qrtr.h | 11 ++++ net/qrtr/af_qrtr.c | 124 +++++++++++++++++++++++++++++++++++++++++++-- net/qrtr/qrtr.h | 5 ++ 4 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 include/net/qrtr.h diff --git a/MAINTAINERS b/MAINTAINERS index 96b9344c3524..6993067c4194 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19115,6 +19115,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..799c84eb35ad --- /dev/null +++ b/include/net/qrtr.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef __NET_QRTR_H +#define __NET_QRTR_H + +#include + +int qrtr_endpoint_id_get(const void *data, u32 *id); +int qrtr_endpoint_id_assign(void *data, u32 *id); +int qrtr_endpoint_id_get_or_assign(void *data, u32 *id); + +#endif /* __NET_QRTR_H */ diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c index cf8b5483ba2c..59227b3d49f4 100644 --- a/net/qrtr/af_qrtr.c +++ b/net/qrtr/af_qrtr.c @@ -11,6 +11,7 @@ #include #include +#include #include "qrtr.h" @@ -649,6 +650,114 @@ static struct sk_buff *qrtr_alloc_ctrl_packet(struct qrtr_ctrl_pkt **pkt, return skb; } +/** + * qrtr_endpoint_id_get() - get a registered endpoint for given data + * @data: endpoint-specific data to fetch ID for + * @id: pointer to store endpoint ID into + * Return: 0 on success, negative error code on failure + * + * The endpoint-specific data must not be NULL. + * The output parameter id must not be NULL. + * If no endpoint ID can be mapped to the endpoint-specific data, id will be + * set to 0. + */ +int qrtr_endpoint_id_get(const void *data, u32 *id) +{ + unsigned long idx = 0; + void *iter_data = NULL; + + if (!id) + return -EINVAL; + + if (!data) + return -EINVAL; + + *id = 0; + rcu_read_lock(); + xa_for_each_range(&qrtr_endpoints, idx, iter_data, + QRTR_ENDPOINT_RANGE.min, QRTR_ENDPOINT_RANGE.max) { + if (iter_data == data) { + *id = idx; + break; + } + } + rcu_read_unlock(); + + return 0; +} +EXPORT_SYMBOL_GPL(qrtr_endpoint_id_get); + +/** + * qrtr_endpoint_id_assign() - assigns a new endpoint ID for given data + * @data: endpoint-specific data to assign new ID for + * @id: pointer to store endpoint ID into + * Return: 0 on success, negative error code on failure + * + * The endpoint-specific data must not be NULL. + * The output parameter id must not be NULL. + * On error, id will be set to 0. + */ +int qrtr_endpoint_id_assign(void *data, u32 *id) +{ + int rc = 0; + + if (!id) + return -EINVAL; + + if (!data) + return -EINVAL; + + rc = xa_alloc_cyclic(&qrtr_endpoints, id, data, QRTR_ENDPOINT_RANGE, + &next_endpoint_id, GFP_KERNEL); + if (rc) + *id = 0; + + return rc; +} +EXPORT_SYMBOL_GPL(qrtr_endpoint_id_assign); + +/** + * qrtr_endpoint_id_get_or_assign() - gets or assigns endpoint ID for data + * @data: endpoint-specific data to assign new ID for + * @id: pointer to store endpoint ID into + * Return: positive on success, negative error code on failure + * + * The endpoint-specific data must not be NULL. + * + * If the endpoint-specific data is already registered to an endpoint ID, this + * ID will be assigned to id. Otherwise, this function assigns a new + * endpoint ID and associates it with the given endpoint-specific data. + * + * The output parameter id must not be NULL. It will either be set to the + * fetched or newly assigned endpoint ID on success, or set to 0 on error. + */ +int qrtr_endpoint_id_get_or_assign(void *data, u32 *id) +{ + int rc = 0; + + if (!data) + return -EINVAL; + + if (!id) + return -EINVAL; + + rc = qrtr_endpoint_id_get(data, id); + + if (rc) { + *id = 0; + return rc; + } + + if (!*id) + rc = qrtr_endpoint_id_assign(data, id); + + if (rc) + *id = 0; + + return rc; +} +EXPORT_SYMBOL_GPL(qrtr_endpoint_id_get_or_assign); + /** * qrtr_endpoint_register() - register a new endpoint * @ep: endpoint to register @@ -670,9 +779,18 @@ int qrtr_endpoint_register(struct qrtr_endpoint *ep, unsigned int nid) if (!node) return -ENOMEM; - rc = xa_alloc_cyclic(&qrtr_endpoints, &endpoint_id, NULL, - QRTR_ENDPOINT_RANGE, &next_endpoint_id, - GFP_KERNEL); + rc = qrtr_endpoint_id_get_or_assign(ep->endpoint_data, &endpoint_id); + + /* + * The previous function fails if ep->endpoint_data is NULL, so retry. + * + * We're going to assign an endpoint ID without endpoint-specific data + * set in this case. + */ + if (rc) + rc = xa_alloc_cyclic(&qrtr_endpoints, &endpoint_id, NULL, + QRTR_ENDPOINT_RANGE, &next_endpoint_id, + GFP_KERNEL); if (rc < 0) goto free_node; diff --git a/net/qrtr/qrtr.h b/net/qrtr/qrtr.h index b4f50336ae75..3509168e8a40 100644 --- a/net/qrtr/qrtr.h +++ b/net/qrtr/qrtr.h @@ -12,13 +12,18 @@ struct sk_buff; /** * struct qrtr_endpoint - endpoint handle * @xmit: Callback for outgoing packets + * @endpoint_data: endpoint-specific data pointer, can be NULL * * The socket buffer passed to the xmit function becomes owned by the endpoint * driver. As such, when the driver is done with the buffer, it should * call kfree_skb() on failure, or consume_skb() on success. + * + * If endpoint_data is NULL, endpoint IDs can not be directly mapped to a + * specific endpoint. */ struct qrtr_endpoint { int (*xmit)(struct qrtr_endpoint *ep, struct sk_buff *skb); + void *endpoint_data; /* private: not for endpoint use */ struct qrtr_node *node; u32 id; From patchwork Mon Nov 25 03:50:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845551 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 50F8445003; Mon, 25 Nov 2024 04:00:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732507225; cv=none; b=Uu0JQn6aIJ5zQ40pnEihVbhlRcXPSogqHmoMLAq8ZATmLeVt+mbQs7Lh0YGxWzMTNmJdW6LKJ96m4IlUqnpeDAty4jFnAiww+bq7Zd525sEXgCajnMxK+bAn8Alxgjb2aNpML0UtDSo0GLWO6CEsxek7bFZKAGmUWQdidqxtISI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732507225; c=relaxed/simple; bh=3yCjE5tdSxEAWWiNtIYYOrdwsDaWqbpFW99BaTLk7HE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e7hPEckKJViq7iyqUyMVPES8AsUGofUNvBaBV642QfuUHy/veceN3m9EOcn2aG/kPxZ9ggupY6leCGyfJJJCXOM06DMcGVDe9GeWLlta9bAOviBIRn+9haPIFwmnzx19J0SP8Y6TnKIdo4n/PmYWF73UKxL7Xtpule2oaksZw/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=f4lEPPq6; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="f4lEPPq6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506708; bh=3yCjE5tdSxEAWWiNtIYYOrdwsDaWqbpFW99BaTLk7HE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f4lEPPq6yN01kQf4+fKAw0YTENFTPo/MlDnzIcFrF0d4czSDRBLx96AgcpwMaMMGc gMSQcKXSNZ3Eed7ETl5vXX+GcQZMcRS/wO2L/JONzHyrqwQVUBB9HpzAfmwY6VT6Qh zhACAhvk/LrEBF6BN/quVmICVol2t4OytK1VT/hk= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id DD3981487FB2; Mon, 25 Nov 2024 04:51:47 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 02/13] net: qrtr: mhi: register mhi_controller as endpoint-specific data Date: Mon, 25 Nov 2024 04:50:17 +0100 Message-ID: <90e0394bfd97d28853d17e9c62b6e372b236b760.1732506261.git.ionic@ionic.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For the MHI backend, we will use the mhi_controller pointer as the endpoint-specific data. This means that we can only have one endpoint ID per MHI controller, but since the MHI controller is the bus master in charge of the physical link, this is probably okay. Signed-off-by: Mihai Moldovan --- net/qrtr/mhi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/qrtr/mhi.c b/net/qrtr/mhi.c index 9a23c888e234..fc6869c3a7ec 100644 --- a/net/qrtr/mhi.c +++ b/net/qrtr/mhi.c @@ -95,6 +95,7 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev, qdev->mhi_dev = mhi_dev; qdev->dev = &mhi_dev->dev; qdev->ep.xmit = qcom_mhi_qrtr_send; + qdev->ep.endpoint_data = mhi_dev->mhi_cntrl; dev_set_drvdata(&mhi_dev->dev, qdev); rc = qrtr_endpoint_register(&qdev->ep, QRTR_EP_NID_AUTO); From patchwork Mon Nov 25 03:50:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845739 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 47CA02AE7F; Mon, 25 Nov 2024 04:00:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732507225; cv=none; b=RWLU+cA6Mgya9RspFp5/HY/AhbqvwPYAGHDkt0VrAZ6ipwo0176sEvagzmTaEIytc5r5OtZFhmXKdtpN6YH4IjkyNGgPZuztiOoqO3SfM0ERPop6T5tsvX+GRGHAZQbeS6TQwEwer/DTQkvxv04mwSMHD0CA4e5uhwFbh4Nmaig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732507225; c=relaxed/simple; bh=CcApLCzMROUQU/RunBcPJFusQCj4QXpyFrT2DKnQP7w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=krjAmOZwkNqfS0dxXQf/Dpd8aB5dFe27kYufXkT0hPbRLEecmTyD3BOowVImxZB9F4pgv5/fTSD5UNz/1eYExNVC0FRvucIQxl8JbrrXUN6xWGNkQ+BD2pOfbTFaK5X7lr+rWR/CW84KklY/TnTwBGyxWRW+cCMva410FDsukBQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=Z6iKAJH5; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="Z6iKAJH5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506708; bh=CcApLCzMROUQU/RunBcPJFusQCj4QXpyFrT2DKnQP7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z6iKAJH5JsYjx4sr75/4g+0kGMhiOlbPLMXkjy/593ut3Vv9MlfrTHweTGOyyKuVx a7l3hJfWA+3Vu3SQvc1L2CDnRxjAcWmHMe06c6vMEicH+eItRog4Dq2fJCuW9V7s5+ qxFIbLzWWVxmZLKUUJPYoQXvbwcOJYueiNdmGegA= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id 28705148839C; Mon, 25 Nov 2024 04:51:48 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 03/13] net: qrtr: smd: register rpmsg_device as endpoint-specific data Date: Mon, 25 Nov 2024 04:50:18 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For the SMD backend, we will use the rpmsg_device pointer as the endpoint-specific data. Signed-off-by: Mihai Moldovan --- net/qrtr/smd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/qrtr/smd.c b/net/qrtr/smd.c index c91bf030fbc7..cb3eeb6835ca 100644 --- a/net/qrtr/smd.c +++ b/net/qrtr/smd.c @@ -68,6 +68,7 @@ static int qcom_smd_qrtr_probe(struct rpmsg_device *rpdev) qdev->channel = rpdev->ept; qdev->dev = &rpdev->dev; qdev->ep.xmit = qcom_smd_qrtr_send; + qdev->ep.endpoint_data = rpdev; rc = qrtr_endpoint_register(&qdev->ep, QRTR_EP_NID_AUTO); if (rc) From patchwork Mon Nov 25 03:50:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845740 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 50F112B9A8; Mon, 25 Nov 2024 04:00:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732507224; cv=none; b=U58N04u3XTXULvf1BwDsRgbMS+0HupETB3G1baMK7PxQjSsGzuulAideIke7XZuhcR4n75Vg3AcvxBrKCOOzSHxWBiUhhc9UcPY/LhjV1GYTK4oO1TLPccYymrYbHZA72JY5VkjX8Ap1fNgsWxQLvauMc2BEskF/yy82Pi/57OY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732507224; c=relaxed/simple; bh=WaJt0MbfiLuCLmsPYGY3mx15UPFsO9CVWdVbdNYCpxs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DrIrfzZ0IQEfFZP74fcZcSbYnG88xi72weMgurTnKSDz7u4TVCaUb8amooQK4LlgmlALnjPv0h+TFAyon+Gis+SkrUMSmCZ+s34uv8h8pggwxqjRO5KH6kCV1DCUNaMJbebpUdCvf2YBX7LRBVVel3ZzCbHoSEUhXmn44Kk45ic= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=Q2dlXsmY; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="Q2dlXsmY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506708; bh=WaJt0MbfiLuCLmsPYGY3mx15UPFsO9CVWdVbdNYCpxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q2dlXsmYZNtjt+BaM/dXnrvh/kDHw8Xwzol01zB9m94ZFaQ2M88DmD4bE137cK/Sz /6rKf6Aia2xOF3UQj3AKKTAy8kL8XLTkFvCbp9xLRo2s+RtOhnBzOYsglpLi6FjCkP TfaNUhiDUBZK1NCjhJbiiTVVtyh80ZmXNeJoHIgw= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id 6BD2314886FD; Mon, 25 Nov 2024 04:51:48 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 04/13] net: qrtr: tun: register inode as endpoint-specific data Date: Mon, 25 Nov 2024 04:50:19 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For the TUN backend, we will use the inode pointer as the endpoint-specific data. Signed-off-by: Mihai Moldovan --- net/qrtr/tun.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/qrtr/tun.c b/net/qrtr/tun.c index 304b41fea5ab..9dcfecd529f7 100644 --- a/net/qrtr/tun.c +++ b/net/qrtr/tun.c @@ -41,6 +41,7 @@ static int qrtr_tun_open(struct inode *inode, struct file *filp) init_waitqueue_head(&tun->readq); tun->ep.xmit = qrtr_tun_send; + tun->ep.endpoint_data = inode; filp->private_data = tun; From patchwork Mon Nov 25 03:50:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845553 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 222D71E517; Mon, 25 Nov 2024 03:51:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506720; cv=none; b=LufKyER0kaBdgy6wpdCWs4mwB2UnSqupYaLPIBHYxK6j7zIb+Oem3LMOLQWcH+z6KiUC9R647fzUxvla1Nwi3PJsH/5RUSq6jcp/GrFh/gHfrS5+KG0F90ba8etcljIW1PLJYsMe9jcF2JXbgm6PnlNfICeUfpfCCJqoImB7kew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506720; c=relaxed/simple; bh=mwFNh6fCQilCetdqM9GB1/3XnP01zdiqQkD768arI/8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rsQrS1s1mzsbu45lZuUGU1XhTaDqVE7CAFDFuBKSgIyWTmHWDXstydcLcj+z/irCOecoysn46czfozOSDT/VbtcbmVLABT+NRReXYnKn8Fi2LkaCk09WzYkLCgA6rpL2jErENuWhSLR2jKGf99IFO71AbNUYD8/20qx4BQCNClk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=RmytRxVv; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="RmytRxVv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506708; bh=mwFNh6fCQilCetdqM9GB1/3XnP01zdiqQkD768arI/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RmytRxVv1y+Zq5OYaqttZVMLivau0IYhRxwDvVY+ojzSleN2mmJoHmjbxsXymNdoO lVZo9iESVcl4XbItZ/dsRvh08KYDo/4R5l3N0/x+wWh2ORmbHEEb66QNXK+83VpCsV OsgGsH7OXVlNjJDVL7bKj0+w3Z8pTmlXT2Vd0XXk= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id AFE0E14886FE; Mon, 25 Nov 2024 04:51:48 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 05/13] soc: qcom: qmi_helpers: add QRTR endpoint ID to qmi_handle Date: Mon, 25 Nov 2024 04:50:20 +0100 Message-ID: <68f8f8e04b6076d8f497f101ecae9c78b128f59b.1732506261.git.ionic@ionic.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Adding this allows us to easily supply an endpoint ID to bind on later on when creating the socket. Signed-off-by: Mihai Moldovan --- include/linux/soc/qcom/qmi.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/soc/qcom/qmi.h b/include/linux/soc/qcom/qmi.h index 469e02d2aa0d..77743c855762 100644 --- a/include/linux/soc/qcom/qmi.h +++ b/include/linux/soc/qcom/qmi.h @@ -212,6 +212,7 @@ struct qmi_msg_handler { * @txns: outstanding transactions * @txn_lock: lock for modifications of @txns * @handlers: list of handlers for incoming messages + * @endpoint_id: QRTR endpoint ID to bind on */ struct qmi_handle { struct socket *sock; @@ -235,6 +236,8 @@ struct qmi_handle { struct mutex txn_lock; const struct qmi_msg_handler *handlers; + + u32 endpoint_id; }; int qmi_add_lookup(struct qmi_handle *qmi, unsigned int service, From patchwork Mon Nov 25 03:50:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845557 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 22290EAC7; Mon, 25 Nov 2024 03:51:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; cv=none; b=fEe3AFAvVSHRRMeibut706tJlI0sivt39n60SU88PEkQXi8C10/fL5OPq1TE3IIPHFGtxJgKjO2D4gcc/0EfsaELG1n10W70xK3keS5D6hF9v04OVg3RAuWhr6/KXPaIPSrROOJGKKRdeqcAWKiHOUBZL9WfVnqjTK6C1qmqWKY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; c=relaxed/simple; bh=UyuABPlzyiqkE23T62xlQISSVDBGgpm7/N5AP3n04ZM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jNMaPrXobqe7dKecTup92lF890FZG+iTWKLt9wugKkBXav7Rc26RJUnr4fo5ocxb+U7agUlnpp84F5wdX6KCEF00qR60EfnSO3LCzZ4bh1YEqBolzbgA9gIRca5sVUO9b30ePktBzLs12DC4X2fkYxmf8lBmQChz9bHuxERj4w4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=fOuCpeqV; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="fOuCpeqV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506709; bh=UyuABPlzyiqkE23T62xlQISSVDBGgpm7/N5AP3n04ZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fOuCpeqVtL5FKsBHcNc5N1UebrdiEJ/+F/uQBttmoTfpS2aWt829DskHdXSpCT3F2 HE/XTHZiYaBx4sqRacNewnMz13cYiptrM27eeUfN6BXk3nFa6yqAAboLRwxjI319n5 YuGzb30QQIxQdjZ9+GI+urwnqtgv1ogHNrtmOG5c= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id F028314886FF; Mon, 25 Nov 2024 04:51:48 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 06/13] soc: qcom: qmi_helpers: optionally bind to QRTR endpoint ID in qmi_sock_create Date: Mon, 25 Nov 2024 04:50:21 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For clients that already know the QRTR endpoint ID before actually creating the QMI socket and set it in struct qmi_handle, optionally try to bind to this QRTR endpoint ID when creating the socket. This can fail, and qmi_sock_create will issue diagnostic messages, but otherwise ignore the error. Signed-off-by: Mihai Moldovan --- drivers/soc/qcom/qmi_interface.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/soc/qcom/qmi_interface.c b/drivers/soc/qcom/qmi_interface.c index bb98b06e87f8..dd3978682c09 100644 --- a/drivers/soc/qcom/qmi_interface.c +++ b/drivers/soc/qcom/qmi_interface.c @@ -586,6 +586,7 @@ static struct socket *qmi_sock_create(struct qmi_handle *qmi, struct sockaddr_qrtr *sq) { struct socket *sock; + const struct proto_ops *ops = NULL; int ret; ret = sock_create_kern(&init_net, AF_QIPCRTR, SOCK_DGRAM, @@ -593,6 +594,33 @@ static struct socket *qmi_sock_create(struct qmi_handle *qmi, if (ret < 0) return ERR_PTR(ret); + ops = READ_ONCE(sock->ops); + + if (!ops) { + pr_warn("sock->ops not available for QMI socket\n"); + pr_warn("will not be able to bind to endpoint ID.\n"); + /* N.B.: this error value will not be passed out. */ + ret = -ENXIO; + } + + if (!ret && !ops->setsockopt) { + pr_warn("ops->setsockopt not available for QMI socket\n"); + pr_warn("will not be able to bind to endpoint ID.\n"); + /* N.B.: this error value will not be passed out. */ + ret = -ENXIO; + } + + /* Only bind to a specific endpoint if a valid one was provided. */ + if (!ret && qmi->endpoint_id) { + ret = ops->setsockopt(sock, SOL_QRTR, QRTR_BIND_ENDPOINT, + KERNEL_SOCKPTR(&qmi->endpoint_id), + sizeof(qmi->endpoint_id)); + + if (ret < 0) + pr_warn("binding to QRTR endpoint ID failed: %d\n", + ret); + } + ret = kernel_getsockname(sock, (struct sockaddr *)sq); if (ret < 0) { sock_release(sock); From patchwork Mon Nov 25 03:50:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845744 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 2F92121345; Mon, 25 Nov 2024 03:51:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; cv=none; b=FoUH4SEMzHJuty132vGJasGtfO8EHY16OV81JjOunggugEeQbI/0oKG7zvtsMwLZAvfg2r5dzPTquOiwz1kXlxDe6AVFoR1Z540GPHES5c1tF1jowt+YVZpZeR5mRQpUc/Hl9oDziyjD5HnXJklv9sRHxcrfbxu75E1dKWOZ5ME= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; c=relaxed/simple; bh=B0CUVB3BiReU1INqg0ftqJTFKqCT/0KKba8biA8OdJ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QaJQgiS94PlhbKd39VOSEkHVd2wDAJ27Ql+j3/tlHpN12BA9Bq2i+5PFaSAYJE/N+rbwGEIlTqPtYHPSicxzyS1zAg9hOy1aE41nDm2fKXaDDTigV3E9RmIc7hRr5Kaevjn3RX7I1I3SMC/k9A4Fnfu4BZ2cEr4IaPl2zoomLVA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=EGXpzYAF; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="EGXpzYAF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506709; bh=B0CUVB3BiReU1INqg0ftqJTFKqCT/0KKba8biA8OdJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EGXpzYAFlJabh352FD9ZEGRCrkJnoaPntThsMRA/hR3WriXXhcAOIeNPHj26jj7xi bplzQfOik2+bnP1z4McwoxGhnHbQQBrH9c4kJzf848nSUQx5hrZ77UBRN376Zd3iyK EWkUUvnuYOnIvnUcmFn6Ge9KmyW6/nB8y/jQ260M= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id 382F9148870B; Mon, 25 Nov 2024 04:51:49 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 07/13] wifi: ath11k: add QRTR endpoint ID hif feature Date: Mon, 25 Nov 2024 04:50:22 +0100 Message-ID: <9cebc829e915888bce0190e3791f425a9a54a02f.1732506261.git.ionic@ionic.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This will allow fetching the QRTR endpoint ID via hardware-specific means. Signed-off-by: Mihai Moldovan --- drivers/net/wireless/ath/ath11k/hif.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/hif.h b/drivers/net/wireless/ath/ath11k/hif.h index 674ff772b181..07ba45c9924a 100644 --- a/drivers/net/wireless/ath/ath11k/hif.h +++ b/drivers/net/wireless/ath/ath11k/hif.h @@ -31,6 +31,7 @@ struct ath11k_hif_ops { void (*ce_irq_enable)(struct ath11k_base *ab); void (*ce_irq_disable)(struct ath11k_base *ab); void (*get_ce_msi_idx)(struct ath11k_base *ab, u32 ce_id, u32 *msi_idx); + int (*set_qrtr_endpoint_id)(struct ath11k_base *ab); }; static inline void ath11k_hif_ce_irq_enable(struct ath11k_base *ab) @@ -146,4 +147,12 @@ static inline void ath11k_get_ce_msi_idx(struct ath11k_base *ab, u32 ce_id, *msi_data_idx = ce_id; } +static inline int ath11k_set_qrtr_endpoint_id(struct ath11k_base *ab) +{ + if (!ab->hif.ops->set_qrtr_endpoint_id) + return -EOPNOTSUPP; + else + return ab->hif.ops->set_qrtr_endpoint_id(ab); +} + #endif /* _HIF_H_ */ From patchwork Mon Nov 25 03:50:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845741 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 2F8AC1E519; Mon, 25 Nov 2024 03:51:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; cv=none; b=eFHq1YHZxpVDRvDjZPEEBDFl+J94gQBDf8hphML5w8lJOFXREh6ek3Z0aBZd/lFMuNot6vicIo3i05ELCWiXDdxISm2BxBO9ue9RHsnorZ38gxbEongy07oUH5kANTantHUniNE6q9kkUjkGhLU0LEtz6SZ9SkvyLdcFGDZSpaY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; c=relaxed/simple; bh=HdvvnX3oBwORMiG9uXHBr/WQrekrk+ivf29v/3cUx50=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BMoIadOcB4BjL7YxLxHJt5Q8HYbg6PVO1ju0gA4hlLrAcwqAWWp+v9n8PXjZoHg9HleXVuJV7Eh+octD7hAL2aFTIghb873JaswaZbqPAmL4zGU/510FJKmvoQwkq05CM4oV0gXGyOTKv7rYkMu+QqpHo8rZ5BGAhZcys7IwDPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=aIAVrJjG; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="aIAVrJjG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506709; bh=HdvvnX3oBwORMiG9uXHBr/WQrekrk+ivf29v/3cUx50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aIAVrJjGD8zUzNnhL67os6yVqTq+SDbezurYDgZOJ4/jl0mszLwnop60k83ZVOyM1 QFCKKkEaXMGVmYz/GIJBsY6ehvFjDjBJdVokc7BqQPrGWEvVzi8KPy7McOPpv1d3vI RnsLC/UK959s2w9nNIi6GltV8Lpoj6tPFuLAhqEA= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id 7798F148870D; Mon, 25 Nov 2024 04:51:49 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 08/13] wifi: ath11k: stub QRTR endpoint ID fetching for AHB Date: Mon, 25 Nov 2024 04:50:23 +0100 Message-ID: <1213282db93cb9aa126440bf46212f47dd015e69.1732506261.git.ionic@ionic.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 QRTR endpoint ID fetching will currently not be available for AHB. Signed-off-by: Mihai Moldovan --- drivers/net/wireless/ath/ath11k/ahb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c index f2fc04596d48..acb12d6d647f 100644 --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c @@ -773,6 +773,7 @@ static const struct ath11k_hif_ops ath11k_ahb_hif_ops_ipq8074 = { .map_service_to_pipe = ath11k_ahb_map_service_to_pipe, .power_down = ath11k_ahb_power_down, .power_up = ath11k_ahb_power_up, + .set_qrtr_endpoint_id = ath11k_ahb_set_qrtr_endpoint_id, }; static const struct ath11k_hif_ops ath11k_ahb_hif_ops_wcn6750 = { @@ -792,6 +793,7 @@ static const struct ath11k_hif_ops ath11k_ahb_hif_ops_wcn6750 = { .resume = ath11k_ahb_hif_resume, .ce_irq_enable = ath11k_pci_enable_ce_irqs_except_wake_irq, .ce_irq_disable = ath11k_pci_disable_ce_irqs_except_wake_irq, + .set_qrtr_endpoint_id = ath11k_ahb_set_qrtr_endpoint_id, }; static int ath11k_core_get_rproc(struct ath11k_base *ab) @@ -1312,6 +1314,11 @@ static void ath11k_ahb_shutdown(struct platform_device *pdev) ath11k_ahb_free_resources(ab); } +static ath11k_ahb_set_qrtr_endpoint_id(struct ath11k_base *ab) +{ + return -EOPNOTSUPP; +} + static struct platform_driver ath11k_ahb_driver = { .driver = { .name = "ath11k", From patchwork Mon Nov 25 03:50:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845742 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 2F9652B9A8; Mon, 25 Nov 2024 03:51:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506720; cv=none; b=mdRnwxbmE651YFlCqCOL91T7Y2yXzm3sEn/AMEx0qL+66+Zo19CTrit+j0e/lcAiwPjWxYwoVGO3vcgXXPfJ591WPdieGsgLKLN7FKhFYrDODiKmT2wSLwRepSyTPI3xnh0lxbsKjiSb4rNRuWGpnQsRi1v9gPaBOs52Y4x3Mqo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506720; c=relaxed/simple; bh=uarmoy9+EMg/fFr/hCx5+LAu3sMG/dpzPKmrg3NEXGw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k9vMRyzXf8zW8H+Jsnz/6sTPXjzJLFNethba33ufp3M6xHCQUYyZ9Z1LM2p+flhpO4HTzi0Zjo5r96bZ1k7UjrwoyRgDQmX0w02NsLf4xxFy7q0NtO2dwuIGLe1frDFBH9Ru/Wb57fW4rcBsNFDCEybRJ1RPd2n46BH/Fi1BDRs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=Ar3/++OM; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="Ar3/++OM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506709; bh=uarmoy9+EMg/fFr/hCx5+LAu3sMG/dpzPKmrg3NEXGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ar3/++OM2MF5d6/Q8wCmnrnQ0bVadEZtObzAEYedGk+CunBNax65rbQ30jDcn6AY8 ky4xKKHY/exRuD3ye+AmzyXSqWdYht9Ge8OrRX1C7UKW/wLBmz1XRW7Jw9bXPoqBUt oijbjbuTk9PHeDHtruife5YXIojidn2N0yP+9L5o= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id B7059148870F; Mon, 25 Nov 2024 04:51:49 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 09/13] wifi: ath11k: implement QRTR endpoint ID fetching for PCI Date: Mon, 25 Nov 2024 04:50:24 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 QRTR endpoint ID fetching for PCIe devices will use MHI. Signed-off-by: Mihai Moldovan --- drivers/net/wireless/ath/ath11k/mhi.c | 22 ++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/mhi.h | 1 + drivers/net/wireless/ath/ath11k/pci.c | 1 + 3 files changed, 24 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c index 6e45f464a429..0b3f9f965aee 100644 --- a/drivers/net/wireless/ath/ath11k/mhi.c +++ b/drivers/net/wireless/ath/ath11k/mhi.c @@ -11,6 +11,8 @@ #include #include +#include + #include "core.h" #include "debug.h" #include "mhi.h" @@ -491,3 +493,23 @@ int ath11k_mhi_resume(struct ath11k_pci *ab_pci) return 0; } + +int ath11k_mhi_set_qrtr_endpoint_id(struct ath11k_base *ab) +{ + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + struct ath11k_qmi *qmi = &ab->qmi; + int ret; + + /* Pass endpoint ID up for QMI usage. */ + ret = qrtr_endpoint_id_get_or_assign(ab_pci->mhi_ctrl, + &qmi->handle.endpoint_id); + ath11k_dbg(ab, ATH11K_DBG_PCI, + "queried mhi_ctrl QRTR endpoint ID: %u\n", + qmi->handle.endpoint_id); + if (ret) { + ath11k_warn(ab, "failed to query QRTR endpoint ID: %d\n", ret); + return ret; + } + + return 0; +} diff --git a/drivers/net/wireless/ath/ath11k/mhi.h b/drivers/net/wireless/ath/ath11k/mhi.h index a682aad52fc5..84465fb5d5da 100644 --- a/drivers/net/wireless/ath/ath11k/mhi.h +++ b/drivers/net/wireless/ath/ath11k/mhi.h @@ -27,4 +27,5 @@ void ath11k_mhi_clear_vector(struct ath11k_base *ab); int ath11k_mhi_suspend(struct ath11k_pci *ar_pci); int ath11k_mhi_resume(struct ath11k_pci *ar_pci); +int ath11k_mhi_set_qrtr_endpoint_id(struct ath11k_base *ab); #endif diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c index a6cc2a4f072d..6f3c1db11f69 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -744,6 +744,7 @@ static const struct ath11k_hif_ops ath11k_pci_hif_ops = { .ce_irq_enable = ath11k_pci_hif_ce_irq_enable, .ce_irq_disable = ath11k_pci_hif_ce_irq_disable, .get_ce_msi_idx = ath11k_pcic_get_ce_msi_idx, + .set_qrtr_endpoint_id = ath11k_mhi_set_qrtr_endpoint_id, }; static void ath11k_pci_read_hw_version(struct ath11k_base *ab, u32 *major, u32 *minor) From patchwork Mon Nov 25 03:50:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845556 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 2F9A82D052; Mon, 25 Nov 2024 03:51:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; cv=none; b=jeFQe4RvGf2DMRbg3NqPgD9n+BkYyxHeUyqIAy/Sf1z07vpwWQmnwhNp7QW+KHBz0mUsa1gbu5ehMTBZzsDMKhlrXb6q9EUflZQsfj2AJDPBrJEsbnzbsZSmz/JcL5AJwfZqfyyCTFOZhRbcK+j71r5C/od4oIqS6ixPRLQESk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; c=relaxed/simple; bh=DN2g4ZHT+mEUQwKRS2uJbaQDq8nZOw1i3/GADcXe3KM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SaviGpFyThqtmUMyHRVGP0ZFeEz+A9oiO0X+mjnGKm9FTkDbQ1vfkde2QFKZlYTgvkDuZ0678jy50J9VT8uBotwJKC8p12Mu/S8A+N2KdoqiDFVolGDGCvIyAs62yX0BFNc1YvDj+LBxC4C7aHvaIkub9nzrPGG9EmvXE8B4xeI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=BlTEBWpV; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="BlTEBWpV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506710; bh=DN2g4ZHT+mEUQwKRS2uJbaQDq8nZOw1i3/GADcXe3KM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BlTEBWpV4kuIL+1fMS8p847xYpPDDP4R3d1iOBDTal1JvmToNZtH7NbWJINDDq472 /jphI5Y8QjAQ1tRdZ4gLZaVUIwQaJyG2sHl1hVPBeo6ypaM5WIzBUQXpUK+irLJabo 9BtTcRaVl4cXi42EefwlprBxMAyaourlzLefysfk= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id 028AB1488710; Mon, 25 Nov 2024 04:51:50 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 10/13] wifi: ath11k: bind to QRTR endpoint ID in ath11k_qmi_init_service Date: Mon, 25 Nov 2024 04:50:25 +0100 Message-ID: <8768f055a92edb14d5f7bab8e497f437f06272b9.1732506261.git.ionic@ionic.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If possible, fetch the QRTR endpoint ID in ath11k_qmi_init_service, just before calling qmi_handle_init, and make it available in the qmi_handle. qmi_helpers will then automatically bind to this endpoint for us. This finally allows using multiple ath11k-based cards with the same QRTR node/port combination to work simultanenous (and, for that matter, at all). Signed-off-by: Mihai Moldovan Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-05266-QCAHSTSWPLZ_V2_TO_X86-1 --- drivers/net/wireless/ath/ath11k/qmi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c index 5759fc521316..604d7211b980 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -15,6 +15,7 @@ #include #include #include +#include #define SLEEP_CLOCK_SELECT_INTERNAL_BIT 0x02 #define HOST_CSTATE_BIT 0x04 @@ -3315,6 +3316,13 @@ int ath11k_qmi_init_service(struct ath11k_base *ab) ab->qmi.ab = ab; ab->qmi.target_mem_mode = ab->hw_params.fw_mem_mode; + + ret = ath11k_set_qrtr_endpoint_id(ab); + if (ret) { + ath11k_warn(ab, "failed to set QRTR endpoint ID: %d\n", ret); + ath11k_warn(ab, "only one device per system will be supported\n"); + } + ret = qmi_handle_init(&ab->qmi.handle, ATH11K_QMI_RESP_LEN_MAX, &ath11k_qmi_ops, ath11k_qmi_msg_handlers); if (ret < 0) { From patchwork Mon Nov 25 03:50:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845743 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 49003374CB; Mon, 25 Nov 2024 03:51:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; cv=none; b=AJvWY+MQ1QK4Esx+48hQUNQ7Ca7uncWx0SsWOJ5CmhDZDAcy/FM++iyirkBzBynpj0Bv5+LuEmB4R6lrnrIUm+z6G0Xq4Xz1APnrS5H1xD1OCrmJYcUNsJ55LCt2ReReIih6n1ohSdHc58bphkA/tCsno2RBxxqFNtpuVK+gAP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; c=relaxed/simple; bh=fJ5/+15P5dhrg0NMpWbzGLjNOdGkm1v3b3nKjUFCfBQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iK5z3/CzBV4DAcATWjOcTbenE/JoO/EubSx9gNbY7semsvhalj/9ZhqW2Mat821zD25RiTot0Ugyrt619UUP3jOANBd0Opc2qm7iU86lyl+JJ8vPiVEgrtn/OszTruuKNlj66NkOy8aPaOQW2oWT16GtKcz272SzUPf0jUuRvoU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=KJ31Ehwn; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="KJ31Ehwn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506710; bh=fJ5/+15P5dhrg0NMpWbzGLjNOdGkm1v3b3nKjUFCfBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KJ31EhwnYD76oavNBBm9KGk+rzzdk5vr7S88kThmlZqyh1was+kU4MlGhcUrYGBZZ vM9cMj+Ep6Eki1O/51oLN/objlSkIiXMFJTedI3oMTmojLX1HJKiJ8E47gyKpVl4t2 Um0f3q5y7o1NuucgQaM4oam5OCSnrzog5OpbKZl0= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id 415731488716; Mon, 25 Nov 2024 04:51:50 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 11/13] wifi: ath12k: add QRTR endpoint ID hif feature Date: Mon, 25 Nov 2024 04:50:26 +0100 Message-ID: <64ef55cbae887d07b3d4452db2f1fa8d0b0602c0.1732506261.git.ionic@ionic.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This will allow fetching the QRTR endpoint ID via hardware-specific means. Signed-off-by: Mihai Moldovan --- drivers/net/wireless/ath/ath12k/hif.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/wireless/ath/ath12k/hif.h b/drivers/net/wireless/ath/ath12k/hif.h index e8840fab6061..fcf055c8dae2 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 (*set_qrtr_endpoint_id)(struct ath12k_base *ab); }; static inline int ath12k_hif_map_service_to_pipe(struct ath12k_base *ab, u16 service_id, @@ -162,4 +163,13 @@ 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_set_qrtr_endpoint_id(struct ath12k_base *ab) +{ + if (!ab->hif.ops->set_qrtr_endpoint_id) + return -EOPNOTSUPP; + else + return ab->hif.ops->set_qrtr_endpoint_id(ab); +} + #endif /* ATH12K_HIF_H */ From patchwork Mon Nov 25 03:50:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845554 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 2F8EB1EB2F; Mon, 25 Nov 2024 03:51:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; cv=none; b=Xs2iSRtoqs+aAr4ssVMWLGDDXF1AEmlrpHPA1ZwGi3nwLGcROUE23j1LEJAtUhQ70dq+yMnx0YMc1G21cArNHwNDJ/5oGq1lXqT5oaSJ7wRc7i8qhOtLK4BlsQCakSoa9zS8DTKW0OpzWumrhQuKlhhpBCcekTtuZ8rNmbxc4pk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; c=relaxed/simple; bh=JHo5yCp8VACc+UBmU5nSM4syrbWRWoUtL5s/bOzLsRk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oeiCMK7SkbJ7ze1TSy+qL66tDt7xTH0KgTDePQYq3ZQW8fhLFiUVpWWh6aSGE2Zc9PlrERkRpQyokSd/PLxl5/jKSXTjfTsVmmCsa/fTaXxtL7JhqlRk3r6Yy1BU3e/Jvr0VgQe15Mp3EdrFg1JoGr8Rd39GW0xM/KjG5aPGPvY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=oE3KuVgx; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="oE3KuVgx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506710; bh=JHo5yCp8VACc+UBmU5nSM4syrbWRWoUtL5s/bOzLsRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oE3KuVgx2WBFexO24XieyFZYZiWv/m2a6S0hf3cx0zh2q1v+/BbTwSASL6imFkU5l 7X7oxmHqFFsx+sko+OaiUPWZ6aO8zm5BvZRHSdpBuTM+UxiST1OuPtfr0y3aVMdpeP PRmHbz/a5yisZr2GjG/VnZFc+nA3dOcNJRVqmR6g= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id 80CF81488DDB; Mon, 25 Nov 2024 04:51:50 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 12/13] wifi: ath12k: implement QRTR endpoint ID fetching for PCI Date: Mon, 25 Nov 2024 04:50:27 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 QRTR endpoint ID fetching for PCIe devices will use MHI. Signed-off-by: Mihai Moldovan --- drivers/net/wireless/ath/ath12k/mhi.c | 22 ++++++++++++++++++++++ drivers/net/wireless/ath/ath12k/mhi.h | 2 ++ drivers/net/wireless/ath/ath12k/pci.c | 1 + 3 files changed, 25 insertions(+) diff --git a/drivers/net/wireless/ath/ath12k/mhi.c b/drivers/net/wireless/ath/ath12k/mhi.c index 2f6d14382ed7..a6067c236c0d 100644 --- a/drivers/net/wireless/ath/ath12k/mhi.c +++ b/drivers/net/wireless/ath/ath12k/mhi.c @@ -8,6 +8,8 @@ #include #include +#include + #include "core.h" #include "debug.h" #include "mhi.h" @@ -654,3 +656,23 @@ void ath12k_mhi_coredump(struct mhi_controller *mhi_ctrl, bool in_panic) { mhi_download_rddm_image(mhi_ctrl, in_panic); } + +int ath12k_mhi_set_qrtr_endpoint_id(struct ath12k_base *ab) +{ + struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); + struct ath12k_qmi *qmi = &ab->qmi; + int ret; + + /* Pass endpoint ID up for QMI usage. */ + ret = qrtr_endpoint_id_get_or_assign(ab_pci->mhi_ctrl, + &qmi->handle.endpoint_id); + ath12k_dbg(ab, ATH12K_DBG_PCI, + "queried mhi_ctrl QRTR endpoint ID: %u\n", + qmi->handle.endpoint_id); + if (ret) { + ath12k_warn(ab, "failed to query QRTR endpoint ID: %d\n", ret); + return ret; + } + + return 0; +} diff --git a/drivers/net/wireless/ath/ath12k/mhi.h b/drivers/net/wireless/ath/ath12k/mhi.h index 7358b8477536..c4e00c1747c8 100644 --- a/drivers/net/wireless/ath/ath12k/mhi.h +++ b/drivers/net/wireless/ath/ath12k/mhi.h @@ -44,4 +44,6 @@ void ath12k_mhi_clear_vector(struct ath12k_base *ab); void ath12k_mhi_suspend(struct ath12k_pci *ar_pci); void ath12k_mhi_resume(struct ath12k_pci *ar_pci); void ath12k_mhi_coredump(struct mhi_controller *mhi_ctrl, bool in_panic); + +int ath12k_mhi_set_qrtr_endpoint_id(struct ath12k_base *ab); #endif diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index cf907550e6a4..3d65c64d1b31 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -1514,6 +1514,7 @@ static const struct ath12k_hif_ops ath12k_pci_hif_ops = { #ifdef CONFIG_ATH12K_COREDUMP .coredump_download = ath12k_pci_coredump_download, #endif + .set_qrtr_endpoint_id = ath12k_mhi_set_qrtr_endpoint_id, }; static From patchwork Mon Nov 25 03:50:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Moldovan X-Patchwork-Id: 845555 Received: from mail.ionic.de (ionic.de [145.239.234.145]) (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 8122E38382; Mon, 25 Nov 2024 03:51:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=145.239.234.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; cv=none; b=T5ClZnqPYCeAVvX69T6j+N6o92fxghA7u9t8shuyaWr+v8bjOqww3lreqd7n3UqFdwXYr4d00X19/YZIT+5NrbkKH0cZpgms1+FdYQlhfbZCsm6GxNarWSKDTId2AVrVtMZnoNtbCb4+Chs2SJRRqZr4eFMQd3cm1I2IaTIzGUo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732506719; c=relaxed/simple; bh=uKVKRmRDkN/eSoUbniCNPAitj2cpMMyzr4m9wHpkjkM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fppbDxsy9f0dGZdfZXzzQz59GFwFjd5neTTULauKL1pkGxs4uBQAMUYHl8+BQy/LoWFuR46xEb1K4CREEclRhr7fFe76fm6ddsu2e28oV/EPw8VNmLOPwY0VluzQGXsvIajDBol+CzRXAM6L3605v2HHbD3x8Rkf9GYMgaDxyVo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de; spf=pass smtp.mailfrom=ionic.de; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b=AqEXqkJH; arc=none smtp.client-ip=145.239.234.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ionic.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionic.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ionic.de header.i=@ionic.de header.b="AqEXqkJH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ionic.de; s=default; t=1732506710; bh=uKVKRmRDkN/eSoUbniCNPAitj2cpMMyzr4m9wHpkjkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqEXqkJHG/9LQ53Vq3mgTjeMfkWYogi1qAhApXi/U20Ul2/8jiXZyPjyLRHyQNXwy XeGMlirfy/6uT5ceN+LP9gCQQ9YIgIMfOJImBdcoLbQjk0jTLcfOkOgLhuH+5mv/gL uWwoH3qUyxMnD5vAxjl2hj+kpvRF1VgBeNvReHGA= Received: from grml.local.home.ionic.de (unknown [IPv6:2a00:11:fb41:7a00:21b:21ff:fe5e:dddc]) by mail.ionic.de (Postfix) with ESMTPSA id C02871488DDC; Mon, 25 Nov 2024 04:51:50 +0100 (CET) From: Mihai Moldovan To: ath11k@lists.infradead.org, ath12k@lists.infradead.org, Kalle Valo , Jeff Johnson , Manivannan Sadhasivam Cc: Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC] [PATCH v2 13/13] wifi: ath12k: bind to QRTR endpoint ID in ath12k_qmi_init_service Date: Mon, 25 Nov 2024 04:50:28 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If possible, fetch the QRTR endpoint ID in ath12k_qmi_init_service, just before calling qmi_handle_init, and make it available in the qmi_handle. qmi_helpers will then automatically bind to this endpoint for us. This finally allows using multiple ath12k-based cards with the same QRTR node/port combination to work simultanenous (and, for that matter, at all), including combinations of ath11k-based and ath12k-based cards. Signed-off-by: Mihai Moldovan Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 --- drivers/net/wireless/ath/ath12k/qmi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c index d2d9d03c7a28..a96bad490b10 100644 --- a/drivers/net/wireless/ath/ath12k/qmi.c +++ b/drivers/net/wireless/ath/ath12k/qmi.c @@ -9,8 +9,10 @@ #include "qmi.h" #include "core.h" #include "debug.h" +#include "hif.h" #include #include +#include #define SLEEP_CLOCK_SELECT_INTERNAL_BIT 0x02 #define HOST_CSTATE_BIT 0x04 @@ -3371,6 +3373,13 @@ int ath12k_qmi_init_service(struct ath12k_base *ab) ab->qmi.ab = ab; ab->qmi.target_mem_mode = ATH12K_QMI_TARGET_MEM_MODE_DEFAULT; + + ret = ath12k_hif_set_qrtr_endpoint_id(ab); + if (ret) { + ath12k_warn(ab, "failed to set QRTR endpoint ID: %d\n", ret); + ath12k_warn(ab, "only one device per system will be supported\n"); + } + ret = qmi_handle_init(&ab->qmi.handle, ATH12K_QMI_RESP_LEN_MAX, &ath12k_qmi_ops, ath12k_qmi_msg_handlers); if (ret < 0) {