From: Abhinav Jain <jain.abhinav177@gmail.com>
To: jgg@ziepe.ca, leon@kernel.org
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
Abhinav Jain <jain.abhinav177@gmail.com>
Subject: [PATCH] RDMA/core: Publish node GUID with the uevent for ib_device
Date: Sun, 9 Mar 2025 17:57:31 +0000 [thread overview]
Message-ID: <20250309175731.7185-1-jain.abhinav177@gmail.com> (raw)
As per the comment, modify ib_device_uevent to publish the node
GUID alongside device name, upon device state change.
Have compiled the file manually to ensure that it builds. Do not have
a readily available IB hardware to test. Confirmed with checkpatch
that the patch has no errors/warnings.
Signed-off-by: Abhinav Jain <jain.abhinav177@gmail.com>
---
drivers/infiniband/core/device.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 0ded91f056f3..1812038f1a91 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -499,12 +499,17 @@ static void ib_device_release(struct device *device)
static int ib_device_uevent(const struct device *device,
struct kobj_uevent_env *env)
{
- if (add_uevent_var(env, "NAME=%s", dev_name(device)))
+ const struct ib_device *dev =
+ container_of(device, struct ib_device, dev);
+
+ if (add_uevent_var(env, "NAME=%s", dev_name(&dev->dev)))
return -ENOMEM;
- /*
- * It would be nice to pass the node GUID with the event...
- */
+ __be64 node_guid_be = dev->node_guid;
+ u64 node_guid = be64_to_cpu(node_guid_be);
+
+ if (add_uevent_var(env, "NODE_GUID=0x%llx", node_guid))
+ return -ENOMEM;
return 0;
}
--
2.34.1
next reply other threads:[~2025-03-09 17:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-09 17:57 Abhinav Jain [this message]
2025-03-09 19:27 ` Leon Romanovsky
2025-03-10 7:01 ` Abhinav Jain
2025-03-10 10:17 ` Leon Romanovsky
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=20250309175731.7185-1-jain.abhinav177@gmail.com \
--to=jain.abhinav177@gmail.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®