RDMA/netlink: Export node_guid and sys_image_guid
authorLeon Romanovsky <leonro@mellanox.com>
Wed, 28 Jun 2017 11:01:37 +0000 (14:01 +0300)
committerLeon Romanovsky <leon@kernel.org>
Thu, 10 Aug 2017 10:28:11 +0000 (13:28 +0300)
Add Node GUID and system image GUID to the device properties
exported by RDMA netlink, to be used by RDMAtool.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/infiniband/core/nldev.c
include/uapi/rdma/rdma_netlink.h

index cdc970ca5a1b741f2a3e27a667700c1c0da6293f..f932c2c3fad0ba74844c556448b8aad12b9506d4 100644 (file)
@@ -42,6 +42,8 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
        [RDMA_NLDEV_ATTR_PORT_INDEX]    = { .type = NLA_U32 },
        [RDMA_NLDEV_ATTR_FW_VERSION]    = { .type = NLA_NUL_STRING,
                                            .len = IB_FW_VERSION_NAME_MAX - 1},
+       [RDMA_NLDEV_ATTR_NODE_GUID]     = { .type = NLA_U64 },
+       [RDMA_NLDEV_ATTR_SYS_IMAGE_GUID] = { .type = NLA_U64 },
 };
 
 static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
@@ -65,6 +67,12 @@ static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
        if (strlen(fw) && nla_put_string(msg, RDMA_NLDEV_ATTR_FW_VERSION, fw))
                return -EMSGSIZE;
 
+       if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_NODE_GUID,
+                             be64_to_cpu(device->node_guid), 0))
+               return -EMSGSIZE;
+       if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_SYS_IMAGE_GUID,
+                             be64_to_cpu(device->attrs.sys_image_guid), 0))
+               return -EMSGSIZE;
        return 0;
 }
 
index 5159858730b09438e5ada89bb97134c7c50dba27..fe3a7429e7a19e990e2ea68dbf25263dfef1b3bb 100644 (file)
@@ -266,6 +266,19 @@ enum rdma_nldev_attr {
         * FW version
         */
        RDMA_NLDEV_ATTR_FW_VERSION,             /* string */
+
+       /*
+        * Node GUID (in host byte order) associated with the RDMA device.
+        */
+       RDMA_NLDEV_ATTR_NODE_GUID,                      /* u64 */
+
+       /*
+        * System image GUID (in host byte order) associated with
+        * this RDMA device and other devices which are part of a
+        * single system.
+        */
+       RDMA_NLDEV_ATTR_SYS_IMAGE_GUID,         /* u64 */
+
        RDMA_NLDEV_ATTR_MAX
 };
 #endif /* _UAPI_RDMA_NETLINK_H */