]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
devlink: introduce pr_out_port_handle helper
authorJiri Pirko <jiri@mellanox.com>
Fri, 15 Apr 2016 07:51:46 +0000 (09:51 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 19 Apr 2016 15:01:05 +0000 (08:01 -0700)
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
devlink/devlink.c

index 39f423aa3804da0550e89b5b99be01940df5e7c8..0904e07fc1fafffeb6c62453dc5349f994882de6 100644 (file)
@@ -523,6 +523,12 @@ static void pr_out_handle(struct nlattr **tb)
                        mnl_attr_get_str(tb[DEVLINK_ATTR_DEV_NAME]));
 }
 
+static void pr_out_port_handle(struct nlattr **tb)
+{
+       pr_out_handle(tb);
+       pr_out("/%d", mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_INDEX]));
+}
+
 static void pr_out_dev(struct nlattr **tb)
 {
        pr_out_handle(tb);
@@ -599,8 +605,8 @@ static void pr_out_port(struct nlattr **tb)
        struct nlattr *pt_attr = tb[DEVLINK_ATTR_PORT_TYPE];
        struct nlattr *dpt_attr = tb[DEVLINK_ATTR_PORT_DESIRED_TYPE];
 
-       pr_out_handle(tb);
-       pr_out("/%d:", mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_INDEX]));
+       pr_out_port_handle(tb);
+       pr_out(":");
        if (pt_attr) {
                uint16_t port_type = mnl_attr_get_u16(pt_attr);