RDMA/netlink: Provide port state and physical link state
authorLeon Romanovsky <leonro@mellanox.com>
Thu, 29 Jun 2017 10:12:45 +0000 (13:12 +0300)
committerLeon Romanovsky <leon@kernel.org>
Thu, 10 Aug 2017 10:28:13 +0000 (13:28 +0300)
Add port state and physical link state to the users of RDMA netlink.

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

index 11546f87c5dc58947f7e73d7365e06bd880a0a53..32ccb2b8893374d138d26c55906f1a2efef14bad 100644 (file)
@@ -48,6 +48,8 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
        [RDMA_NLDEV_ATTR_LID]           = { .type = NLA_U32 },
        [RDMA_NLDEV_ATTR_SM_LID]        = { .type = NLA_U32 },
        [RDMA_NLDEV_ATTR_LMC]           = { .type = NLA_U8 },
+       [RDMA_NLDEV_ATTR_PORT_STATE]    = { .type = NLA_U8 },
+       [RDMA_NLDEV_ATTR_PORT_PHYS_STATE] = { .type = NLA_U8 },
 };
 
 static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
@@ -113,6 +115,10 @@ static int fill_port_info(struct sk_buff *msg,
                if (nla_put_u8(msg, RDMA_NLDEV_ATTR_LMC, attr.lmc))
                        return -EMSGSIZE;
        }
+       if (nla_put_u8(msg, RDMA_NLDEV_ATTR_PORT_STATE, attr.state))
+               return -EMSGSIZE;
+       if (nla_put_u8(msg, RDMA_NLDEV_ATTR_PORT_PHYS_STATE, attr.phys_state))
+               return -EMSGSIZE;
        return 0;
 }
 
index 035706e6b016e820756ff8c5a7922bbd1d9b8af8..c488c3cf361b73dfb4ef5f960ef8184757467402 100644 (file)
@@ -297,6 +297,9 @@ enum rdma_nldev_attr {
         */
        RDMA_NLDEV_ATTR_LMC,                    /* u8 */
 
+       RDMA_NLDEV_ATTR_PORT_STATE,             /* u8 */
+       RDMA_NLDEV_ATTR_PORT_PHYS_STATE,        /* u8 */
+
        RDMA_NLDEV_ATTR_MAX
 };
 #endif /* _UAPI_RDMA_NETLINK_H */