mbox series

[iproute2-next,v2,0/8] Introduce new dcb-rewr subcommand

Message ID 20230510-dcb-rewr-v2-0-9f38e688117e@microchip.com (mailing list archive)
Headers show
Series Introduce new dcb-rewr subcommand | expand

Message

Daniel Machon May 25, 2023, 6:10 p.m. UTC
========================================================================               
Introduction:
========================================================================

This series introduces a new DCB subcommand: rewr, which is used to
configure the in-kernel DCB rewrite table [1].

Rewrite support is added as a separate DCB subcommand, rather than an
APP opt-in flag or similar. This goes in line with what we did to dcbnl,
where rewrite is a separate object.  Obviously this requires a bit more
code to implement the new command, but much of the existing dcb-app code
(especially the bookkeeping code) can be reused. In some cases a little
adaptation is needed.

========================================================================
dcb-rewr parameters:
========================================================================

Initially, I have only made support for the prio-pcp and prio-dscp
parameters, as DSCP and PCP  are the only selectors that currently have
a user [2] and to be honest, I am not even sure it makes sense to add
dgram, stream, ethtype rewrite support - At least the rewriter of Sparx5
does not support this. Any input here is much appreciated!

Examples:

Rewrite DSCP to 63 for packets with priority 1
$ dcb rewr add dev eth0 prio-dscp 1:63

Rewrite PCP 7 and DEI to 1 for packets with priority 1
$ dcb rewr add dev eth0 prio-pcp 1:7de

A new manpage has been added, to cover the new dcb-rewr subcommand, and
its parameters. Also I took the liberty to clean up a few things in the
dcb-app manpage.

========================================================================               
Patch overview:
========================================================================

Patch #1 Adds a new field 'attr' to the dcb_app_table struct, which is
         used to distinguish app and rewrite tables.

Patch #2 Modifies existing dcb-app print functions for reuse by
         dcb-rewr.

Patch #3 Modifies existing dcb-app function dcb_app_table_remove_replaced 
         for reuse by dcb-rewr

Patch #4 Modifies existing dcb-app function dcb_app_parse_mapping_cb for
         reuse by dcb-rewr.

Patch #5 Adds the new dcb-rewr subcommand with initial support for
         prio-pcp and prio-dscp rewrite.

Patch #6 Adds the dcb-rewr.8 manpage
Patch #7 Adds references to dcb-apptrust and dcb-rewr in the dcb.8
         manpage.

Patch #8 Cleans up the dcb-app.8 manpage.

[1] https://elixir.bootlin.com/linux/v6.4-rc1/source/net/dcb/dcbnl.c#L181
[2] https://elixir.bootlin.com/linux/v6.4-rc1/source/drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c#L380

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
Changes in v2:
- Got rid of patch #1 that introduced dcb_app.h - expose in individual patches. 
- Changed to callbacks for printing APP and rewrite entries. Also fixed %d to be %u.
- Changed to callbacks for removing replaced table entries for APP and rewrite.
- Changed to callbacks for pushing APP and rewrite entries to the table.
- Got rid of extra spaces in dcb-rewr helps, and reordered some parameters for dcb_parse_mapping.
- Rephrased 'that that' sentence in dcb-app.8 and dcb-rewr.8
- Link to v1: https://lore.kernel.org/r/20230510-dcb-rewr-v1-0-83adc1f93356@microchip.com

---
Daniel Machon (8):
      dcb: app: add new dcbnl attribute field
      dcb: app: modify dcb-app print functions for dcb-rewr reuse
      dcb: app: modify dcb_app_table_remove_replaced() for dcb-rewr reuse
      dcb: app: modify dcb_app_parse_mapping_cb for dcb-rewr reuse
      dcb: rewr: add new dcb-rewr subcommand
      man: dcb-rewr: add new manpage for dcb-rewr
      man: dcb: add additional references under 'SEE ALSO'
      man: dcb-app: clean up a few mistakes

 dcb/Makefile        |   3 +-
 dcb/dcb.c           |   4 +-
 dcb/dcb.h           |  58 +++++++++
 dcb/dcb_app.c       | 167 +++++++++++++-----------
 dcb/dcb_rewr.c      | 355 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 man/man8/dcb-app.8  |  10 +-
 man/man8/dcb-rewr.8 | 206 ++++++++++++++++++++++++++++++
 man/man8/dcb.8      |   4 +-
 8 files changed, 727 insertions(+), 80 deletions(-)
---
base-commit: 9c7bdc9f3328fb3fd5e7b77eb7b86f6c62538143
change-id: 20230510-dcb-rewr-534b7ab637eb

Best regards,