Add pcp-prio and new apptrust subcommand
Subsystems (2)
v4 cover Add pcp-prio and new apptrust subcommand
This patch series makes use of the newly introduced [1] DCB_APP_SEL_PCP selector, for PCP/DEI prioritization, and DCB_ATTR_IEEE_APP_TRUST attribute for configuring per-selector trust and trust-order.
========================================================================
New parameter "pcp-prio" to existing "app" subcommand:
========================================================================
A new pcp-prio parameter has been added to the app subcommand, which can be used to classify traffic based on PCP and DEI from the VLAN header. PCP and DEI is specified in a combination of numerical and symbolic form, where 'de' (drop-eligible) means DEI=1 and 'nd' (not-drop-eligible) means DEI=0.
Map PCP 1 and DEI 0 to priority 1
$ dcb app add dev eth0 pcp-prio 1nd:1
Map PCP 1 and DEI 1 to priority 1
$ dcb app add dev eth0 pcp-prio 1de:1
========================================================================
New apptrust subcommand for configuring per-selector trust and trust order:
========================================================================
This new command currently has a single parameter, which lets you specify an ordered list of trusted selectors. The microchip sparx5 driver is already enabled to offload said list of trusted selectors. The new command has been given the name apptrust, to indicate that the trust covers APP table selectors only. I found that 'apptrust' was better than plain 'trust' as the latter does not indicate the scope of what is to be trusted.
Example:
Trust selectors dscp and pcp, in that order:
$ dcb apptrust set dev eth0 order dscp pcp
Trust selectors ethtype, stream-port and pcp, in that order
$ dcb apptrust set dev eth0 order ethtype stream-port pcp
Show the trust order
$ dcb apptrust show dev eth0 order order: ethtype stream-port pcp
A concern was raised here [2], that 'apptrust' would not work well with matches(), so instead strcmp() has been used to match for the new subcommand, as suggested here [3]. Same goes with pcp-prio parameter for dcb app.
The man page for dcb_app has been extended to cover the new pcp-prio parameter, and a new man page for dcb_apptrust has been created.
[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/
[3] https://lore.kernel.org/netdev/Y0fP+9C0tE7P2xyK@shredder/
================================================================================
v3-> v4:
- Remove print warning in dcb_app_print_key_pcp()
- Add Petr's Reviewed-By tag
v2 -> v3:
- Add macro for maximum pcp/dei value.
v1 -> v2:
- Modified dcb_cmd_apptrust_set() to allow multiple consecutive parameters.
- Added dcb_apptrust_print() to print everything in case of no argument.
- Renamed pcp keys 0-7 to 0nd-7nd.
- Renamed selector names in dcb-apptrust to reflect names used in dcb-app.
- Updated dcb-app manpage to reflect new selector names, and removed part about hardware offload.
- Updated dcb-apptrust manpage to reflect new selector names, and modified the description of the 'order' parameter.
- Replaced uses of parse_one_of() with loops, for new 1nd:1 semantics to be parsed correctly, and not printing an error if selector was not found in list.
Daniel Machon (2):
dcb: add new pcp-prio parameter to dcb app
dcb: add new subcommand for apptrust
dcb/Makefile | 3 +- dcb/dcb.c | 4 +- dcb/dcb.h | 7 + dcb/dcb_app.c | 138 +++++++++++++++++- dcb/dcb_apptrust.c | 307 ++++++++++++++++++++++++++++++++++++++++ man/man8/dcb-app.8 | 32 +++++ man/man8/dcb-apptrust.8 | 109 ++++++++++++++ 7 files changed, 592 insertions(+), 8 deletions(-) create mode 100644 dcb/dcb_apptrust.c create mode 100644 man/man8/dcb-apptrust.8
--
2.34.1
PATCH v4 1/2 dcb: add new pcp-prio parameter to dcb app
Add new pcp-prio parameter to the app subcommand, which can be used to classify traffic based on PCP and DEI from the VLAN header. PCP and DEI is specified in a combination of numerical and symbolic form, where 'de' (drop-eligible) means DEI=1 and 'nd' (not-drop-eligible) means DEI=0.
Map PCP 1 and DEI 0 to priority 1
$ dcb app add dev eth0 pcp-prio 1nd:1
Map PCP 1 and DEI 1 to priority 1
$ dcb app add dev eth0 pcp-prio 1de:1
Internally, PCP and DEI is encoded in the protocol field of the dcb_app struct. Each combination of PCP and DEI maps to a priority, thus needing a range of 0-15. A well formed dcb_app entry for PCP/DEI prioritization, could look like:
struct dcb_app pcp = {
.selector = DCB_APP_SEL_PCP,
.priority = 7,
.protocol = 15
}For mapping PCP=7 and DEI=1 to Prio=7.
Also, three helper functions for translating between std and non-std APP selectors, have been added to dcb_app.c and exposed through dcb.h.
--- dcb/dcb.h | 3 + dcb/dcb_app.c | 138 +++++++++++++++++++++++++++++++++++++++++++-- man/man8/dcb-app.8 | 32 +++++++++++ 3 files changed, 167 insertions(+), 6 deletions(-)
dcb/dcb.h +3 -0
@@ -57,6 +57,9 @@ void dcb_print_array_kw(const __u8 *array, size_t array_size,/* dcb_app.c */ int dcb_cmd_app (struct dcb *dcb,int argc,char **argv); +enum ieee_attrs_app dcb_app_attr_type_get (__u8 selector); +bool dcb_app_attr_type_validate (enum ieee_attrs_app type); +bool dcb_app_selector_validate (enum ieee_attrs_app type,__u8 selector);/* dcb_buffer.c */
dcb/dcb_app.c +132 -6
244 lines not on this page · raw message
man/man8/dcb-app.8 +32 -0
@@ -23,6 +23,7 @@ the DCB (Data Center Bridging) subsystem .RB "[ " dgram-port-prio " ]" .RB "[ " port-prio " ]" .RB "[ " dscp-prio " ]" +.RB "[ " pcp-prio " ]" .ti -8 .B dcb ets " { " add " | " del " | " replace " } " dev
@@ -33,6 +34,7 @@ the DCB (Data Center Bridging) subsystem .RB "[ " dgram-port-prio " " \fIPORT-MAP\fB " ]" .RB "[ " port-prio " " \fIPORT-MAP\fB " ]" .RB "[ " dscp-prio " " \fIDSCP-MAP\fB " ]" +.RB "[ " pcp-prio " " \fIPCP-MAP\fB " ]" .ti -8 .IR PRIO-LIST " := [ " PRIO-LIST " ] " PRIO
@@ -55,6 +57,12 @@ the DCB (Data Center Bridging) subsystem .ti -8 .IR DSCP-MAPPING " := { " DSCP " | " \fBall " }" \fB:\fIPRIO\fR +.ti -8 +.IR PCP-MAP " := [ " PCP-MAP " ] " PCP-MAPPING + +.ti -8 +.IR PCP-MAPPING " := " PCP\fB:\fIPRIO\fR + .ti -8 .IR ET " := { " \fB0x600\fR " .. " \fB0xffff\fR " }"
@@ -64,6 +72,9 @@ the DCB (Data Center Bridging) subsystem .ti -8 .IR DSCP " := { " \fB0\fR " .. " \fB63\fR " }" +.ti -8 +.IR PCP " := { " \fB0(nd/de)\fR " .. " \fB7(nd/de)\fR " }" + .ti -8 .IR PRIO " := { " \fB0\fR " .. " \fB7\fR " }"
@@ -182,6 +193,17 @@ command line option .B -N turns the show translation off. +.TP +.B pcp-prio \fIPCP-MAP +\fIPCP-MAP\fR uses the array parameter syntax, see +.BR dcb (8) +for details. Keys are PCP/DEI. Values are priorities assigned to traffic with +matching PCP/DEI. PCP/DEI values are written as a combination of numeric- and +symbolic values, to accommodate for both. PCP always in numerical form e.g +0 .. 7 and DEI in symbolic form e.g 'de' (drop-eligible), indicating that the +DEI bit is 1 or 'nd' (not-drop-eligible), indicating that the DEI bit is 0. +In combination 2de:1 translates to a mapping of PCP=2 and DEI=1 to priority 1. + .SH EXAMPLE & USAGE Prioritize traffic with DSCP 0 to priority 0, 24 to 3 and 48 to 6:
@@ -221,6 +243,16 @@ Flush all DSCP rules: .br (nothing) +Add a rule to map traffic with PCP 1 and DEI 0 to priority 1 and PCP 2 and DEI 1 +to priority 2: + +.P +# dcb app add dev eth0 pcp-prio 1nd:1 2de:2 +.br +# dcb app show dev eth0 pcp-prio +.br +pcp-prio 1nd:1 2de:2 + .SH EXIT STATUS Exit status is 0 if command was successful or a positive integer upon failure.
--
2.34.1
PATCH v4 2/2 dcb: add new subcommand for apptrust
In reply to Daniel MachonAdd new apptrust subcommand for the dcbnl apptrust extension object.
The apptrust command lets you specify a consecutive ordered list of trusted selectors, which can be used by drivers to determine which selectors are eligible (trusted) for packet prioritization, and in which order.
Selectors are sent in a new nested attribute:DCB_ATTR_IEEE_APP_TRUST_TABLE. The nest contains trusted selectors encapsulated in either DCB_ATTR_IEEE_APP or DCB_ATTR_DCB_APP attributes, for standard and non-standard selectors, respectively.
Example:
Trust selectors dscp and pcp, in that order
$ dcb apptrust set dev eth0 order dscp pcp
--- dcb/Makefile | 3 +- dcb/dcb.c | 4 +- dcb/dcb.h | 4 + dcb/dcb_apptrust.c | 307 ++++++++++++++++++++++++++++++++++++++++ man/man8/dcb-apptrust.8 | 109 ++++++++++++++ 5 files changed, 425 insertions(+), 2 deletions(-) create mode 100644 dcb/dcb_apptrust.c create mode 100644 man/man8/dcb-apptrust.8
dcb/Makefile +2 -1
@@ -7,7 +7,8 @@ DCBOBJ = dcb.o \ dcb_dcbx.o \ dcb_ets.o \ dcb_maxrate.o \ - dcb_pfc.o + dcb_pfc.o \ + dcb_apptrust.o TARGETS += dcb LDLIBS += -lm
dcb/dcb.c +3 -1
@@ -470,7 +470,7 @@ static void dcb_help(void)fprintf (stderr,"Usage: dcb [ OPTIONS ] OBJECT { COMMAND | help }\n" " dcb [ -f | --force ] { -b | --batch } filename [ -n | --netns ] netnsname\n" -"where OBJECT := { app | buffer | dcbx | ets | maxrate | pfc }\n" +"where OBJECT := { app | apptrust | buffer | dcbx | ets | maxrate | pfc }\n" " OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n" " | -N | --Numeric | -p | --pretty\n" " | -s | --statistics | -v | --verbose]\n" );
@@ -483,6 +483,8 @@ static int dcb_cmd(struct dcb *dcb, int argc, char **argv)return 0 ; }else if (matches (*argv,"app" ) ==0 ) {return dcb_cmd_app (dcb, argc -1 , argv +1 ); + }else if (strcmp (*argv,"apptrust" ) ==0 ) { +return dcb_cmd_apptrust (dcb, argc -1 , argv +1 ); }else if (matches (*argv,"buffer" ) ==0 ) {return dcb_cmd_buffer (dcb, argc -1 , argv +1 ); }else if (matches (*argv,"dcbx" ) ==0 ) {
dcb/dcb.h +4 -0
@@ -61,6 +61,10 @@ enum ieee_attrs_app dcb_app_attr_type_get(__u8 selector);bool dcb_app_attr_type_validate (enum ieee_attrs_app type);bool dcb_app_selector_validate (enum ieee_attrs_app type,__u8 selector); +/* dcb_apptrust.c */ + +int dcb_cmd_apptrust (struct dcb *dcb,int argc,char **argv); +/* dcb_buffer.c */ int dcb_cmd_buffer (struct dcb *dcb,int argc,char **argv);
dcb/dcb_apptrust.c new file +307 -0
307 lines not on this page · raw message
man/man8/dcb-apptrust.8 new file +109 -0
109 lines not on this page · raw message
--
2.34.1
David Ahern
AppliedQuoted 93 lines · Daniel Machon
This patch series makes use of the newly introduced [1]
DCB_APP_SEL_PCPselector, for PCP/DEI prioritization, andDCB_ATTR_IEEE_APP_TRUSTattribute for configuring per-selector trust and trust-order.========================================================================
New parameter "pcp-prio" to existing "app" subcommand:
========================================================================A new pcp-prio parameter has been added to the app subcommand, which can be used to classify traffic based on PCP and DEI from the VLAN header. PCP and DEI is specified in a combination of numerical and symbolic form, where 'de' (drop-eligible) means DEI=1 and 'nd' (not-drop-eligible) means DEI=0.
Map PCP 1 and DEI 0 to priority 1
$ dcb app add dev eth0 pcp-prio 1nd:1Map PCP 1 and DEI 1 to priority 1
$ dcb app add dev eth0 pcp-prio 1de:1========================================================================
New apptrust subcommand for configuring per-selector trust and trust order:
========================================================================This new command currently has a single parameter, which lets you specify an ordered list of trusted selectors. The microchip sparx5 driver is already enabled to offload said list of trusted selectors. The new command has been given the name apptrust, to indicate that the trust covers APP table selectors only. I found that 'apptrust' was better than plain 'trust' as the latter does not indicate the scope of what is to be trusted.
Example:
Trust selectors dscp and pcp, in that order:
$ dcb apptrust set dev eth0 order dscp pcpTrust selectors ethtype, stream-port and pcp, in that order
$ dcb apptrust set dev eth0 order ethtype stream-port pcpShow the trust order
$ dcb apptrust show dev eth0 order order: ethtype stream-port pcpA concern was raised here [2], that 'apptrust' would not work well with
matches(), so insteadstrcmp()has been used to match for the new subcommand, as suggested here [3]. Same goes with pcp-prio parameter for dcb app.The man page for
dcb_apphas been extended to cover the new pcp-prio parameter, and a new man page fordcb_apptrusthas been created.[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/
[3] https://lore.kernel.org/netdev/Y0fP+9C0tE7P2xyK@shredder/================================================================================
v3-> v4:
- Remove print warning indcb_app_print_key_pcp()
- Add Petr's Reviewed-By tagv2 -> v3:
- Add macro for maximum pcp/dei value.v1 -> v2:
- Modifieddcb_cmd_apptrust_set()to allow multiple consecutive parameters.
- Addeddcb_apptrust_print()to print everything in case of no argument.
- Renamed pcp keys 0-7 to 0nd-7nd.
- Renamed selector names in dcb-apptrust to reflect names used in dcb-app.
- Updated dcb-app manpage to reflect new selector names, and removed part about hardware offload.
- Updated dcb-apptrust manpage to reflect new selector names, and modified the description of the 'order' parameter.
- Replaced uses ofparse_one_of()with loops, for new 1nd:1 semantics to be parsed correctly, and not printing an error if selector was not found in list.Daniel Machon (2):
dcb: add new pcp-prio parameter to dcb app
dcb: add new subcommand for apptrustdcb/Makefile | 3 +- dcb/dcb.c | 4 +- dcb/dcb.h | 7 + dcb/dcb_app.c | 138 +++++++++++++++++- dcb/dcb_apptrust.c | 307 ++++++++++++++++++++++++++++++++++++++++ man/man8/dcb-app.8 | 32 +++++ man/man8/dcb-apptrust.8 | 109 ++++++++++++++ 7 files changed, 592 insertions(+), 8 deletions(-) create mode 100644 dcb/dcb_apptrust.c create mode 100644 man/man8/dcb-apptrust.8
Quoted 3 lines
--
2.34.1
applied to iproute2-next