From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH rdma-next 2/2] RDMA/netlink: Export FW version
Date: Tue, 27 Jun 2017 17:06:50 +0300 [thread overview]
Message-ID: <20170627140650.23510-3-leon@kernel.org> (raw)
In-Reply-To: <20170627140650.23510-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Add FW version to the device properties exported
by RDMA netlink, to be used by RDMAtool.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
drivers/infiniband/core/nldev.c | 8 ++++++++
include/uapi/rdma/rdma_netlink.h | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 75416f9f7747..888eadced3bd 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -40,10 +40,14 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
[RDMA_NLDEV_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING,
.len = IB_DEVICE_NAME_MAX - 1},
[RDMA_NLDEV_ATTR_PORT_INDEX] = { .type = NLA_U32 },
+ [RDMA_NLDEV_ATTR_FW_VERSION] = { .type = NLA_NUL_STRING,
+ .len = IB_FW_VERSION_NAME_MAX - 1},
};
static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
{
+ char fw[IB_FW_VERSION_NAME_MAX];
+
if (nla_put_u32(msg, RDMA_NLDEV_ATTR_DEV_INDEX, device->index))
return -EMSGSIZE;
if (nla_put_string(msg, RDMA_NLDEV_ATTR_DEV_NAME, device->name))
@@ -56,6 +60,10 @@ static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
device->attrs.device_cap_flags, 0))
return -EMSGSIZE;
+ ib_get_device_fw_str(device, fw);
+ if (nla_put_string(msg, RDMA_NLDEV_ATTR_FW_VERSION, fw))
+ return -EMSGSIZE;
+
return 0;
}
diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
index 8fc5278d07d6..cfcb2a4224fa 100644
--- a/include/uapi/rdma/rdma_netlink.h
+++ b/include/uapi/rdma/rdma_netlink.h
@@ -262,6 +262,10 @@ enum rdma_nldev_attr {
*/
RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */
+ /*
+ * Devices without FW will return empty string terminated by "\0"
+ */
+ RDMA_NLDEV_ATTR_FW_VERSION, /* string */
RDMA_NLDEV_ATTR_MAX
};
#endif /* _UAPI_RDMA_NETLINK_H */
--
2.13.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-06-27 14:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-27 14:06 [PATCH rdma-next 0/2] Export FW version for RDMAtool Leon Romanovsky
[not found] ` <20170627140650.23510-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-27 14:06 ` [PATCH rdma-next 1/2] RDMA: Simplify get firmware interface Leon Romanovsky
[not found] ` <20170627140650.23510-2-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-27 14:39 ` Steve Wise
2017-06-27 14:06 ` Leon Romanovsky [this message]
[not found] ` <20170627140650.23510-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-27 14:40 ` [PATCH rdma-next 2/2] RDMA/netlink: Export FW version Steve Wise
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=20170627140650.23510-3-leon@kernel.org \
--to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.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