RDMA/netlink: Export node_type
authorLeon Romanovsky <leonro@mellanox.com>
Thu, 29 Jun 2017 13:01:29 +0000 (16:01 +0300)
committerLeon Romanovsky <leon@kernel.org>
Thu, 10 Aug 2017 10:28:14 +0000 (13:28 +0300)
Add ability to get node_type for RDAM netlink users.

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

index 32ccb2b8893374d138d26c55906f1a2efef14bad..474022274e09cd53b87d7942cc70a9cd646e9e7e 100644 (file)
@@ -50,6 +50,7 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
        [RDMA_NLDEV_ATTR_LMC]           = { .type = NLA_U8 },
        [RDMA_NLDEV_ATTR_PORT_STATE]    = { .type = NLA_U8 },
        [RDMA_NLDEV_ATTR_PORT_PHYS_STATE] = { .type = NLA_U8 },
+       [RDMA_NLDEV_ATTR_DEV_NODE_TYPE] = { .type = NLA_U8 },
 };
 
 static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
@@ -79,6 +80,8 @@ static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
        if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_SYS_IMAGE_GUID,
                              be64_to_cpu(device->attrs.sys_image_guid), 0))
                return -EMSGSIZE;
+       if (nla_put_u8(msg, RDMA_NLDEV_ATTR_DEV_NODE_TYPE, device->node_type))
+               return -EMSGSIZE;
        return 0;
 }
 
index c488c3cf361b73dfb4ef5f960ef8184757467402..861440a87e7c50c29b87c94c5ddd6a5691b10be1 100644 (file)
@@ -300,6 +300,8 @@ enum rdma_nldev_attr {
        RDMA_NLDEV_ATTR_PORT_STATE,             /* u8 */
        RDMA_NLDEV_ATTR_PORT_PHYS_STATE,        /* u8 */
 
+       RDMA_NLDEV_ATTR_DEV_NODE_TYPE,          /* u8 */
+
        RDMA_NLDEV_ATTR_MAX
 };
 #endif /* _UAPI_RDMA_NETLINK_H */