mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
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>
This commit is contained in:
parent
9abb0d1bbd
commit
8621a7e3c1
@ -40,10 +40,14 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
|
|||||||
[RDMA_NLDEV_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING,
|
[RDMA_NLDEV_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING,
|
||||||
.len = IB_DEVICE_NAME_MAX - 1},
|
.len = IB_DEVICE_NAME_MAX - 1},
|
||||||
[RDMA_NLDEV_ATTR_PORT_INDEX] = { .type = NLA_U32 },
|
[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)
|
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))
|
if (nla_put_u32(msg, RDMA_NLDEV_ATTR_DEV_INDEX, device->index))
|
||||||
return -EMSGSIZE;
|
return -EMSGSIZE;
|
||||||
if (nla_put_string(msg, RDMA_NLDEV_ATTR_DEV_NAME, device->name))
|
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))
|
device->attrs.device_cap_flags, 0))
|
||||||
return -EMSGSIZE;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +262,10 @@ enum rdma_nldev_attr {
|
|||||||
*/
|
*/
|
||||||
RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */
|
RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FW version
|
||||||
|
*/
|
||||||
|
RDMA_NLDEV_ATTR_FW_VERSION, /* string */
|
||||||
RDMA_NLDEV_ATTR_MAX
|
RDMA_NLDEV_ATTR_MAX
|
||||||
};
|
};
|
||||||
#endif /* _UAPI_RDMA_NETLINK_H */
|
#endif /* _UAPI_RDMA_NETLINK_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user