diff mbox series

[iproute2-next,2/3] devlink: Expose number of port lanes

Message ID 20200712080413.15435-3-danieller@mellanox.com
State Changes Requested
Delegated to: stephen hemminger
Headers show
Series Expose port attributes | expand

Commit Message

Danielle Ratson July 12, 2020, 8:04 a.m. UTC
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>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 devlink/devlink.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Ido Schimmel July 12, 2020, 8:14 a.m. UTC | #1
On Sun, Jul 12, 2020 at 11:04:12AM +0300, Danielle Ratson wrote:
> 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>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  devlink/devlink.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/devlink/devlink.c b/devlink/devlink.c
> index 535c98d1..4aeb9f34 100644
> --- a/devlink/devlink.c
> +++ b/devlink/devlink.c
> @@ -3398,6 +3398,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])

I think you need to update 'devlink_policy' with the new attributes

> +		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);
>  }
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 535c98d1..4aeb9f34 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -3398,6 +3398,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);
 }