Subject: Re: [PATCH net-next 3/8] devlink: Extend devlink rate API with traffic classes bandwidth management

From: Jiri Pirko <[email-masked]>
Date: Thu, 14 Nov 2024 10:48:40 +0100

Wed, Nov 13, 2024 at 07:00:28PM CET, [email-masked] wrote:
>From: Carolina Jubran <[email-masked]>
>
>Introduce support for specifying bandwidth proportions between traffic
>classes (TC) in the devlink-rate API. This new option allows users to
>allocate bandwidth across multiple traffic classes in a single command.
>
>This feature provides a more granular control over traffic management,
>especially for scenarios requiring Enhanced Transmission Selection.
>
>Users can now define a specific bandwidth share for each traffic class,
>such as allocating 20% for TC0 (TCP/UDP) and 80% for TC5 (RoCE).
>
>Example:
>DEV=pci/0000:08:00.0
>
>$ devlink port function rate add $DEV/vfs_group tx_share 10Gbit \
>  tx_max 50Gbit tc-bw 0:20 1:0 2:0 3:0 4:0 5:80 6:0 7:0
>
>$ devlink port function rate set $DEV/vfs_group \
>  tc-bw 0:20 1:0 2:0 3:0 4:0 5:10 6:60 7:0
>
>Signed-off-by: Carolina Jubran <[email-masked]>
>Reviewed-by: Cosmin Ratiu <[email-masked]>
>Signed-off-by: Tariq Toukan <[email-masked]>
>---
> Documentation/netlink/specs/devlink.yaml | 50 ++++++++++++++++++++
> include/net/devlink.h                    |  6 +++
> include/uapi/linux/devlink.h             | 10 ++++
> net/devlink/netlink_gen.c                | 21 +++++++--
> net/devlink/netlink_gen.h                |  1 +
> net/devlink/rate.c                       | 60 ++++++++++++++++++++++--
> 6 files changed, 141 insertions(+), 7 deletions(-)
>
>diff --git a/Documentation/netlink/specs/devlink.yaml b/Documentation/netlink/specs/devlink.yaml
>index 09fbb4c03fc8..41fdc2514f69 100644
>--- a/Documentation/netlink/specs/devlink.yaml
>+++ b/Documentation/netlink/specs/devlink.yaml
>@@ -817,6 +817,34 @@ attribute-sets:
>       -
>         name: rate-tx-weight
>         type: u32
>+      -
>+        name: rate-tc-0-bw
>+        type: u32
>+      -
>+        name: rate-tc-1-bw
>+        type: u32
>+      -
>+        name: rate-tc-2-bw
>+        type: u32
>+      -
>+        name: rate-tc-3-bw
>+        type: u32
>+      -
>+        name: rate-tc-4-bw
>+        type: u32
>+      -
>+        name: rate-tc-5-bw
>+        type: u32
>+      -
>+        name: rate-tc-6-bw
>+        type: u32
>+      -
>+        name: rate-tc-7-bw
>+        type: u32

This is very odd to embed index into name of attribute. Please don't do
that. Could you please separate that and have rate-tc-index as a separate
attr?

>+      -
>+        name: rate-tc-bw
>+        type: nest
>+        nested-attributes: dl-rate-tc-bw-values

[...]