Add pcp-prio and new apptrust subcommand
Subsystems (2)
v2 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/
================================================================================
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
Signature · 1 line
2.34.1
PATCH v2 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.
Signature · 1 line
2.34.1
Re: [PATCH iproute2-next v2 1/2] dcb: add new pcp-prio parameter to dcb app
Quoted 22 lines · Daniel Machon
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:1Map PCP 1 and DEI 1 to priority 1
$ dcb app add dev eth0 pcp-prio 1de:1Internally, PCP and DEI is encoded in the protocol field of the
dcb_appstruct. Each combination of PCP and DEI maps to a priority, thus needing a range of 0-15. A well formeddcb_appentry for PCP/DEI prioritization, could look like:struct dcb_app pcp = { .selector = DCB_APP_SEL_PCP, .priority = 7, .protocol = 15 }
Quoted 6 lines
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.cand exposed throughdcb.h.Signed-off-by Daniel Machon <[email protected]>
Re: [PATCH iproute2-next v2 1/2] dcb: add new pcp-prio parameter to dcb app
In reply to Daniel Machondcb/dcb_app.c static int dcb_app_print_key_dscp(__u16 protocol) · line 426
Quoted 8 lines · Daniel Machon
dcb/dcb_app.c +4
-0@@ -344,6 +420,17 @@ static int dcb_app_print_key_dscp(__u16 protocol)return print_uint (PRINT_ANY ,NULL ,"%d:" , protocol); } +static int dcb_app_print_key_pcp (__u16 protocol) +{ +/* Print in numerical form, if protocol value is out-of-range */ +if (protocol >15 ) {
15 is used in a number of places in this patch. What's the significance and can you give it a name that identifies the meaning? i.e., protocol is a u16 why the 15 limit? (and update all places accordingly)
Re: [PATCH iproute2-next v2 1/2] dcb: add new pcp-prio parameter to dcb app
Quoted 5 lines · David Ahern
Quoted 4 lines · Daniel Machon
dcb/dcb_app.c +0
-0@@ -344,6 +420,17 @@ static int dcb_app_print_key_dscp(__u16 protocol)return print_uint (PRINT_ANY ,NULL ,"%d:" , protocol); }
Quoted 8 lines
dcb/dcb_app.c static int dcb_app_print_key_dscp(__u16 protocol) · line 426
Quoted 4 lines
dcb/dcb_app.c +4
-0+static int dcb_app_print_key_pcp (__u16 protocol) +{ +/* Print in numerical form, if protocol value is out-of-range */ +if (protocol >15 ) {15 is used in a number of places in this patch. What's the significance and can you give it a name that identifies the meaning? i.e., protocol is a u16 why the 15 limit? (and update all places accordingly)
In case of PCP, "protocol" is 0..7 for PCP values with DEI=0, and 8..15 for the same values respecively, but with DEI=1. That's fundamentally where the 15 comes from.
Here in particular, it is ARRAY_LENGTH(pcp_names), and I agree, it would be better to express it this way.
Re: [PATCH iproute2-next v2 1/2] dcb: add new pcp-prio parameter to dcb app
Quoted 15 lines · Petr Machata
Quoted 5 lines · David Ahern
Quoted 4 lines · Daniel Machon
dcb/dcb_app.c +0
-0@@ -344,6 +420,17 @@ static int dcb_app_print_key_dscp(__u16 protocol)return print_uint (PRINT_ANY ,NULL ,"%d:" , protocol); }Quoted 7 lines
dcb/dcb_app.c static int dcb_app_print_key_dscp(__u16 protocol) · line 426
Quoted 4 lines
dcb/dcb_app.c +4
-0+static int dcb_app_print_key_pcp (__u16 protocol) +{ +/* Print in numerical form, if protocol value is out-of-range */ +if (protocol >15 ) {15 is used in a number of places in this patch. What's the significance and can you give it a name that identifies the meaning?
Quoted 2 lines
Here in particular, it is
ARRAY_LENGTH(pcp_names), and I agree, it would be better to express it this way.
(protocol >= ARRAY_LENGTH(pcp_names) obviously, not >)
Re: [PATCH iproute2-next v2 1/2] dcb: add new pcp-prio parameter to dcb app
In reply to David AhernQuoted 5 lines · Daniel Machon
Quoted 4 lines
dcb/dcb_app.c +0
-0@@ -344,6 +420,17 @@ static int dcb_app_print_key_dscp(__u16 protocol)return print_uint (PRINT_ANY ,NULL ,"%d:" , protocol); }
Quoted 8 lines
dcb/dcb_app.c static int dcb_app_print_key_dscp(__u16 protocol) · line 426
Quoted 4 lines
dcb/dcb_app.c +4
-0+static int dcb_app_print_key_pcp (__u16 protocol) +{ +/* Print in numerical form, if protocol value is out-of-range */ +if (protocol >15 ) {15 is used in a number of places in this patch. What's the significance and can you give it a name that identifies the meaning? i.e., protocol is a u16 why the 15 limit? (and update all places accordingly)
Hi David,
As Petr pointed out. The value 15 is the maximum number of PCP+DEI values (0-7 for DEI=0 and 8-15 for DEI=1) I will add the suggested change in a new version.
/Daniel
PATCH v2 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
Signature · 1 line
2.34.1
Re: [PATCH iproute2-next v2 2/2] dcb: add new subcommand for apptrust
Quoted 12 lines · Daniel Machon
Add 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 eitherDCB_ATTR_IEEE_APPorDCB_ATTR_DCB_APPattributes, for standard and non-standard selectors, respectively.
Quoted 6 lines
Example:
Trust selectors dscp and pcp, in that order
$ dcb apptrust set dev eth0 order dscp pcpSigned-off-by Daniel Machon <[email protected]>