From: Mihai Moldovan <ionic@ionic.de>
To: linux-arm-msm@vger.kernel.org, Manivannan Sadhasivam <mani@kernel.org>
Cc: Denis Kenzior <denkenz@gmail.com>,
Eric Dumazet <edumazet@google.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemb@google.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH v4 11/11] net: qrtr: mhi: Report endpoint id in sysfs
Date: Mon, 28 Jul 2025 18:45:28 +0200 [thread overview]
Message-ID: <462b6599fc713e8ee0950f08a5a176f12eb74555.1753720935.git.ionic@ionic.de> (raw)
In-Reply-To: <cover.1753720934.git.ionic@ionic.de>
From: Denis Kenzior <denkenz@gmail.com>
Add a read-only 'endpoint' sysfs entry that contains the qrtr endpoint
identifier assigned to this mhi device. Can be used to direct / receive
qrtr traffic only from a particular MHI device.
Signed-off-by: Denis Kenzior <denkenz@gmail.com>
Reviewed-by: Marcel Holtmann <marcel@holtmann.org>
Reviewed-by: Andy Gross <agross@kernel.org>
Signed-off-by: Mihai Moldovan <ionic@ionic.de>
---
v4:
- no changes
- Link to v3: https://msgid.link/e1f5b82cd25b2ac433b1bd7e83e22604e6b24f03.1753313000.git.ionic@ionic.de
v3:
- rebase against current master
- Link to v2: https://msgid.link/1a49dec96d5c2c5258c9df935d8c9381793d4ddd.1752947108.git.ionic@ionic.de
v2:
- rebase against current master
- use %u formatter instead of %d when printing endpoint id (u32) as
per review comment
- Link to v1: https://msgid.link/20241018181842.1368394-11-denkenz@gmail.com
---
net/qrtr/mhi.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/net/qrtr/mhi.c b/net/qrtr/mhi.c
index 69f53625a049..9a23c888e234 100644
--- a/net/qrtr/mhi.c
+++ b/net/qrtr/mhi.c
@@ -72,6 +72,16 @@ static int qcom_mhi_qrtr_send(struct qrtr_endpoint *ep, struct sk_buff *skb)
return rc;
}
+static ssize_t endpoint_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct qrtr_mhi_dev *qdev = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%u\n", qdev->ep.id);
+}
+
+static DEVICE_ATTR_RO(endpoint);
+
static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev,
const struct mhi_device_id *id)
{
@@ -91,6 +101,9 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev,
if (rc)
return rc;
+ if (device_create_file(&mhi_dev->dev, &dev_attr_endpoint) < 0)
+ dev_err(qdev->dev, "Failed to create endpoint attribute\n");
+
/* start channels */
rc = mhi_prepare_for_transfer_autoqueue(mhi_dev);
if (rc) {
@@ -107,6 +120,7 @@ static void qcom_mhi_qrtr_remove(struct mhi_device *mhi_dev)
{
struct qrtr_mhi_dev *qdev = dev_get_drvdata(&mhi_dev->dev);
+ device_remove_file(&mhi_dev->dev, &dev_attr_endpoint);
qrtr_endpoint_unregister(&qdev->ep);
mhi_unprepare_from_transfer(mhi_dev);
dev_set_drvdata(&mhi_dev->dev, NULL);
--
2.50.0
next prev parent reply other threads:[~2025-07-28 16:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 16:45 [PATCH v4 00/11] QRTR Multi-endpoint support Mihai Moldovan
2025-07-28 16:45 ` [PATCH v4 01/11] net: qrtr: ns: validate msglen before ctrl_pkt use Mihai Moldovan
2025-07-28 16:45 ` [PATCH v4 02/11] net: qrtr: allocate and track endpoint ids Mihai Moldovan
2025-07-28 16:45 ` [PATCH v4 03/11] net: qrtr: fit node ID + port number combination into unsigned long Mihai Moldovan
2025-07-28 16:45 ` [PATCH v4 04/11] net: qrtr: support identical node ids Mihai Moldovan
2025-07-28 16:45 ` [PATCH v4 05/11] net: qrtr: Report sender endpoint in aux data Mihai Moldovan
2025-07-28 16:45 ` [PATCH v4 06/11] net: qrtr: Report endpoint for locally generated messages Mihai Moldovan
2025-07-28 16:45 ` [PATCH v4 07/11] net: qrtr: Allow sendmsg to target an endpoint Mihai Moldovan
2025-07-28 16:45 ` [PATCH v4 08/11] net: qrtr: allow socket endpoint binding Mihai Moldovan
2025-07-28 16:45 ` [PATCH v4 09/11] net: qrtr: Drop remote {NEW|DEL}_LOOKUP messages Mihai Moldovan
2025-07-28 16:45 ` [PATCH v4 10/11] net: qrtr: ns: support multiple endpoints Mihai Moldovan
2025-07-28 16:45 ` Mihai Moldovan [this message]
2025-07-31 0:57 ` [PATCH v4 00/11] QRTR Multi-endpoint support Jakub Kicinski
2025-07-31 5:47 ` Mihai Moldovan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=462b6599fc713e8ee0950f08a5a176f12eb74555.1753720935.git.ionic@ionic.de \
--to=ionic@ionic.de \
--cc=davem@davemloft.net \
--cc=denkenz@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mani@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.