]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
devlink: Expose number of port lanes
authorDanielle Ratson <danieller@mellanox.com>
Thu, 30 Jul 2020 14:33:17 +0000 (17:33 +0300)
committerDavid Ahern <dsahern@kernel.org>
Mon, 3 Aug 2020 14:36:52 +0000 (14:36 +0000)
Add a new attribute that indicates the port's number of lanes to devlink port.

Expose the attribute to user space as RO value, for example:

$devlink port show swp1
pci/0000:03:00.0/61: type eth netdev swp1 flavour physical port 1 lanes 1

Signed-off-by: Danielle Ratson <danieller@mellanox.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
devlink/devlink.c

index 7dbe9c7e07a8e5a1f012f9951f3dab92a180aa75..39bc1119c87b81f3e82173e372269c7699edb003 100644 (file)
@@ -581,6 +581,7 @@ static const enum mnl_attr_data_type devlink_policy[DEVLINK_ATTR_MAX + 1] = {
        [DEVLINK_ATTR_PORT_NETDEV_IFINDEX] = MNL_TYPE_U32,
        [DEVLINK_ATTR_PORT_NETDEV_NAME] = MNL_TYPE_NUL_STRING,
        [DEVLINK_ATTR_PORT_IBDEV_NAME] = MNL_TYPE_NUL_STRING,
+       [DEVLINK_ATTR_PORT_LANES] = MNL_TYPE_U32,
        [DEVLINK_ATTR_SB_INDEX] = MNL_TYPE_U32,
        [DEVLINK_ATTR_SB_SIZE] = MNL_TYPE_U32,
        [DEVLINK_ATTR_SB_INGRESS_POOL_COUNT] = MNL_TYPE_U16,
@@ -3423,6 +3424,10 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb)
        if (tb[DEVLINK_ATTR_PORT_SPLIT_GROUP])
                print_uint(PRINT_ANY, "split_group", " split_group %u",
                           mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_SPLIT_GROUP]));
+       if (tb[DEVLINK_ATTR_PORT_LANES])
+               print_uint(PRINT_ANY, "lanes", " lanes %u",
+                          mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_LANES]));
+
        pr_out_port_function(dl, tb);
        pr_out_port_handle_end(dl);
 }