aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/nldev.c
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@mellanox.com>2017-06-27 16:58:59 +0300
committerLeon Romanovsky <leon@kernel.org>2017-08-10 13:28:11 +0300
commit8621a7e3c1c22e18385c9ced1647363884ea2aa1 (patch)
treeb4122be4c9efd6639f4ed97e682d64bbb912b434 /drivers/infiniband/core/nldev.c
parentRDMA: Simplify get firmware interface (diff)
downloadlinux-dev-8621a7e3c1c22e18385c9ced1647363884ea2aa1.tar.xz
linux-dev-8621a7e3c1c22e18385c9ced1647363884ea2aa1.zip
RDMA/netlink: Export FW version
Add FW version to the device properties exported by RDMA netlink, to be used by RDMAtool. Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/nldev.c')
-rw-r--r--drivers/infiniband/core/nldev.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 94c1e49074f5..cdc970ca5a1b 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,11 @@ 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);
+ /* Device without FW has strlen(fw) */
+ if (strlen(fw) && nla_put_string(msg, RDMA_NLDEV_ATTR_FW_VERSION, fw))
+ return -EMSGSIZE;
+
return 0;
}