linux/Documentation/networking/devlink
Carolina Jubran 566e8f108f devlink: Extend devlink rate API with traffic classes bandwidth management
Introduce support for specifying relative bandwidth shares 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 relative bandwidth share for each traffic class.
For example, assigning share values of 20 to TC0 (TCP/UDP) and 80 to TC5
(RoCE) will result in TC0 receiving 20% and TC5 receiving 80% of the
total bandwidth. The actual percentage each class receives depends on
the ratio of its share value to the sum of all shares.

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:20 6:60 7:0

Example usage with ynl:

./tools/net/ynl/cli.py --spec Documentation/netlink/specs/devlink.yaml \
  --do rate-set --json '{
  "bus-name": "pci",
  "dev-name": "0000:08:00.0",
  "port-index": 1,
  "rate-tc-bws": [
    {"rate-tc-index": 0, "rate-tc-bw": 50},
    {"rate-tc-index": 1, "rate-tc-bw": 50},
    {"rate-tc-index": 2, "rate-tc-bw": 0},
    {"rate-tc-index": 3, "rate-tc-bw": 0},
    {"rate-tc-index": 4, "rate-tc-bw": 0},
    {"rate-tc-index": 5, "rate-tc-bw": 0},
    {"rate-tc-index": 6, "rate-tc-bw": 0},
    {"rate-tc-index": 7, "rate-tc-bw": 0}
  ]
}'

./tools/net/ynl/cli.py --spec Documentation/netlink/specs/devlink.yaml \
  --do rate-get --json '{
  "bus-name": "pci",
  "dev-name": "0000:08:00.0",
  "port-index": 1
}'

output for rate-get:
{'bus-name': 'pci',
 'dev-name': '0000:08:00.0',
 'port-index': 1,
 'rate-tc-bws': [{'rate-tc-bw': 50, 'rate-tc-index': 0},
                 {'rate-tc-bw': 50, 'rate-tc-index': 1},
                 {'rate-tc-bw': 0, 'rate-tc-index': 2},
                 {'rate-tc-bw': 0, 'rate-tc-index': 3},
                 {'rate-tc-bw': 0, 'rate-tc-index': 4},
                 {'rate-tc-bw': 0, 'rate-tc-index': 5},
                 {'rate-tc-bw': 0, 'rate-tc-index': 6},
                 {'rate-tc-bw': 0, 'rate-tc-index': 7}],
 'rate-tx-max': 0,
 'rate-tx-priority': 0,
 'rate-tx-share': 0,
 'rate-tx-weight': 0,
 'rate-type': 'leaf'}

Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Link: https://patch.msgid.link/20250629142138.361537-3-mbloch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-07-02 15:39:05 -07:00
..
am65-nuss-cpsw-switch.rst
bnxt.rst bnxt_en: Add devlink support for ENABLE_ROCE nvm parameter 2025-03-18 10:25:22 +01:00
devlink-dpipe.rst
devlink-eswitch-attr.rst Documentation: Add documentation for eswitch attribute 2024-03-28 18:20:08 -07:00
devlink-flash.rst
devlink-health.rst devlink: Update devlink health documentation 2023-02-15 19:15:44 -08:00
devlink-info.rst ixgbe: add .info_get extension specific for E610 devices 2025-04-15 07:36:32 -07:00
devlink-linecard.rst
devlink-params.rst devlink: Add new "enable_phc" generic device param 2025-06-18 18:57:29 -07:00
devlink-port.rst devlink: Extend devlink rate API with traffic classes bandwidth management 2025-07-02 15:39:05 -07:00
devlink-region.rst docs: networking: devlink: capitalise length value 2024-07-08 13:39:07 +01:00
devlink-reload.rst Documentation: devlink: extend reload-reinit description 2023-11-30 12:31:23 +01:00
devlink-resource.rst
devlink-selftests.rst
devlink-trap.rst documentation: networking: devlink: Fix a typo in devlink-trap.rst 2025-05-14 18:51:58 -07:00
etas_es58x.rst Documentation: devlink: add devlink documentation for the etas_es58x driver 2022-12-12 11:39:13 +01:00
hns3.rst net: hns3: add support to query scc version by devlink info 2024-04-12 18:58:46 -07:00
i40e.rst i40e: Align devlink info versions with ice driver and add docs 2023-10-19 09:03:56 -07:00
ice.rst ice: devlink PF MSI-X max and min parameter 2025-02-05 09:02:44 -08:00
index.rst ixgbe: add initial devlink support 2025-04-15 07:36:32 -07:00
ionic.rst
iosm.rst
ixgbe.rst ixgbe: devlink: add devlink region support for E610 2025-04-29 15:13:44 -07:00
mlx4.rst
mlx5.rst net/mlx5: Expose ICM consumption per function 2025-02-12 10:46:17 -08:00
mlxsw.rst
mv88e6xxx.rst
netdevsim.rst docs: netdevsim: fixe typo in netdevsim documentation 2025-07-01 17:38:50 -07:00
nfp.rst nfp: update devlink device info output 2024-04-12 11:40:09 +01:00
octeontx2.rst devlink: Add documentation for OcteonTx2 AF 2024-11-11 14:15:58 -08:00
prestera.rst Documentation: networking: correct spelling 2023-01-31 13:00:47 +01:00
qed.rst
sfc.rst sfc: document devlink flash support 2025-02-11 17:12:17 -08:00
ti-cpsw-switch.rst