]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
rdma: Report device protocol
authorKamal Heib <kheib@redhat.com>
Thu, 4 May 2023 12:09:18 +0000 (08:09 -0400)
committerDavid Ahern <dsahern@kernel.org>
Wed, 10 May 2023 20:13:39 +0000 (14:13 -0600)
Add support for reporting the device protocol.

11: mlx5_0: node_type ca protocol roce fw 12.28.2006
    node_guid 248a:0703:004b:f094 sys_image_guid 248a:0703:004b:f094
12: mlx5_1: node_type ca protocol ib fw 12.28.2006
    node_guid 248a:0703:0049:d4f0 sys_image_guid 248a:0703:0049:d4f0
13: mlx5_2: node_type ca protocol ib fw 12.28.2006
    node_guid 248a:0703:0049:d4f1 sys_image_guid 248a:0703:0049:d4f0
19: siw0: node_type rnic protocol iw node_guid 0200:00ff:fe00:0000
    sys_image_guid 0200:00ff:fe00:0000

Signed-off-by: Kamal Heib <kheib@redhat.com>
Acked-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
rdma/dev.c

index c684dde4a56fbceb1415a5c43216a74dea2aaf7c..f09c33bc9ccdb29a3988e6ddb23be3f7bbbb5259 100644 (file)
@@ -189,6 +189,17 @@ static void dev_print_node_type(struct rd *rd, struct nlattr **tb)
                           node_str);
 }
 
+static void dev_print_dev_proto(struct rd *rd, struct nlattr **tb)
+{
+       const char *str;
+
+       if (!tb[RDMA_NLDEV_ATTR_DEV_PROTOCOL])
+               return;
+
+       str = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_PROTOCOL]);
+       print_color_string(PRINT_ANY, COLOR_NONE, "protocol", "protocol %s ", str);
+}
+
 static int dev_parse_cb(const struct nlmsghdr *nlh, void *data)
 {
        struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {};
@@ -206,6 +217,7 @@ static int dev_parse_cb(const struct nlmsghdr *nlh, void *data)
        print_color_string(PRINT_ANY, COLOR_NONE, "ifname", "%s: ", name);
 
        dev_print_node_type(rd, tb);
+       dev_print_dev_proto(rd, tb);
        dev_print_fw(rd, tb);
        dev_print_node_guid(rd, tb);
        dev_print_sys_image_guid(rd, tb);