]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
RDMA/netlink: Advertise IB subnet prefix
authorLeon Romanovsky <leonro@mellanox.com>
Wed, 28 Jun 2017 12:05:14 +0000 (15:05 +0300)
committerLeon Romanovsky <leon@kernel.org>
Thu, 10 Aug 2017 10:28:12 +0000 (13:28 +0300)
Add IB subnet prefix to the port properties exported
by RDMA netlink.

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

index f932c2c3fad0ba74844c556448b8aad12b9506d4..7af71d5e52c8653ebf97813669d86d87794541aa 100644 (file)
@@ -44,6 +44,7 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
                                            .len = IB_FW_VERSION_NAME_MAX - 1},
        [RDMA_NLDEV_ATTR_NODE_GUID]     = { .type = NLA_U64 },
        [RDMA_NLDEV_ATTR_SYS_IMAGE_GUID] = { .type = NLA_U64 },
+       [RDMA_NLDEV_ATTR_SUBNET_PREFIX] = { .type = NLA_U64 },
 };
 
 static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
@@ -97,6 +98,10 @@ static int fill_port_info(struct sk_buff *msg,
        if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_CAP_FLAGS,
                              (u64)attr.port_cap_flags, 0))
                return -EMSGSIZE;
+       if (rdma_protocol_ib(device, port) &&
+           nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_SUBNET_PREFIX,
+                             attr.subnet_prefix, 0))
+               return -EMSGSIZE;
 
        return 0;
 }
index fe3a7429e7a19e990e2ea68dbf25263dfef1b3bb..481003182a35d969a4214a679082689e0affbf23 100644 (file)
@@ -279,6 +279,11 @@ enum rdma_nldev_attr {
         */
        RDMA_NLDEV_ATTR_SYS_IMAGE_GUID,         /* u64 */
 
+       /*
+        * Subnet prefix (in host byte order)
+        */
+       RDMA_NLDEV_ATTR_SUBNET_PREFIX,          /* u64 */
+
        RDMA_NLDEV_ATTR_MAX
 };
 #endif /* _UAPI_RDMA_NETLINK_H */