Skip to contentSkip to conversation

rdma: Report device protocol

PATCH Superseded Kamal Heib 2 participants 3 messages May 3, 2023 – May 4, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kamal Heib

author
#0 lore raw

PATCH 1/1 rdma: Report device protocol

Add support for reporting the device protocol.

$ rdma dev
11: mlx5_0: node_type ca proto roce fw 12.28.2006
    node_guid 248a:0703:004b:f094 sys_image_guid 248a:0703:004b:f094
12: mlx5_1: node_type ca proto ib fw 12.28.2006
    node_guid 248a:0703:0049:d4f0 sys_image_guid 248a:0703:0049:d4f0
13: mlx5_2: node_type ca proto ib fw 12.28.2006
    node_guid 248a:0703:0049:d4f1 sys_image_guid 248a:0703:0049:d4f0
17: siw0: node_type rnic proto iw node_guid
    0200:00ff:fe00:0000 sys_image_guid 0200:00ff:fe00:0000
---
 rdma/dev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
rdma/dev.c +11 -0
index c684dde4a56f..04c2a574405c 100644
@@ -189,6 +189,16 @@ 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, "proto", "proto %s ", str);
+}
+
 static int dev_parse_cb(const struct nlmsghdr *nlh, void *data)
 {
 	struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {};
@@ -206,6 +216,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);
Signature · 1 line
2.40.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · Kamal Heib

Add support for reporting the device protocol.

$ rdma dev
11: mlx5_0: node_type ca proto roce fw 12.28.2006
    node_guid 248a:0703:004b:f094 sys_image_guid 248a:0703:004b:f094
12: mlx5_1: node_type ca proto ib fw 12.28.2006
    node_guid 248a:0703:0049:d4f0 sys_image_guid 248a:0703:0049:d4f0
13: mlx5_2: node_type ca proto ib fw 12.28.2006
    node_guid 248a:0703:0049:d4f1 sys_image_guid 248a:0703:0049:d4f0
17: siw0: node_type rnic proto iw node_guid
    0200:00ff:fe00:0000 sys_image_guid 0200:00ff:fe00:0000
---
 rdma/dev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
rdma/dev.c +0 -0
index c684dde4a56f..04c2a574405c 100644
@@ -189,6 +189,16 @@ static void dev_print_node_type(struct rd *rd, struct nlattr **tb)
 			   node_str);

rdma/dev.c static void dev_print_node_type(struct rd *rd, struct nlattr **tb) · line 199

Quoted 10 lines
rdma/dev.c +8 -0
 }
 
+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, "proto", "proto %s ", str);

Please, let's use full word "protocol" and not "proto".

Other than that,

author
#2 lore raw
Quoted 37 lines · Leon Romanovsky
Quoted 23 lines · Kamal Heib

Add support for reporting the device protocol.

$ rdma dev
11: mlx5_0: node_type ca proto roce fw 12.28.2006
     node_guid 248a:0703:004b:f094 sys_image_guid 248a:0703:004b:f094
12: mlx5_1: node_type ca proto ib fw 12.28.2006
     node_guid 248a:0703:0049:d4f0 sys_image_guid 248a:0703:0049:d4f0
13: mlx5_2: node_type ca proto ib fw 12.28.2006
     node_guid 248a:0703:0049:d4f1 sys_image_guid 248a:0703:0049:d4f0
17: siw0: node_type rnic proto iw node_guid
     0200:00ff:fe00:0000 sys_image_guid 0200:00ff:fe00:0000
---
  rdma/dev.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
rdma/dev.c +0 -0
index c684dde4a56f..04c2a574405c 100644
@@ -189,6 +189,16 @@ static void dev_print_node_type(struct rd *rd, struct nlattr **tb)
  			   node_str);

rdma/dev.c static void dev_print_node_type(struct rd *rd, struct nlattr **tb) · line 199

Quoted 10 lines
rdma/dev.c +8 -0
  }
 
+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, "proto", "proto %s ", str);

Please, let's use full word "protocol" and not "proto".

Quoted 3 lines

Other than that,

Thank you for reviewing the patch, I'll fix it in v2.