devlink: Show devlink port number

Show devlink port number whenever kernel reports that attribute.

An example output for a physical port.
$ devlink port show
pci/0000:06:00.1/65535: type eth netdev eth1_p1 flavour physical port 1

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
Parav Pandit 2019-07-09 12:26:54 -05:00 committed by David Ahern
parent a257456f96
commit 2eb23f3e7a
1 changed files with 6 additions and 0 deletions

View File

@ -2829,6 +2829,12 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb)
pr_out_str(dl, "flavour", port_flavour_name(port_flavour));
}
if (tb[DEVLINK_ATTR_PORT_NUMBER]) {
uint32_t port_number;
port_number = mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_NUMBER]);
pr_out_uint(dl, "port", port_number);
}
if (tb[DEVLINK_ATTR_PORT_SPLIT_GROUP])
pr_out_uint(dl, "split_group",
mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_SPLIT_GROUP]));