dcb: Support PFC, buffer, maxrate objects
Subsystems (2)
PATCH 7/10 dcb: Add -i to enable IEC mode
In reply to Petr MachataAllow switching "dcb" into the ISO/IEC mode of units by passing -i.
--- dcb/dcb.c | 10 +++++++--- dcb/dcb.h | 1 + man/man8/dcb.8 | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-)
dcb/dcb.c +7 -3
@@ -310,8 +310,8 @@ static void dcb_help(void)"Usage: dcb [ OPTIONS ] OBJECT { COMMAND | help }\n" " dcb [ -f | --force ] { -b | --batch } filename [ -N | --Netns ] netnsname\n" "where OBJECT := ets\n" -" OPTIONS := [ -V | --Version | -j | --json | -p | --pretty\n" - " | -s | --statistics | -v | --verbose ]\n"); +" OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n" + " | -p | --pretty | -s | --statistics | -v | --verbose]\n"); }static int dcb_cmd (struct dcb *dcb,int argc,char **argv)
@@ -345,6 +345,7 @@ int main(int argc, char **argv) { "Version", no_argument, NULL, 'V' }, { "force", no_argument, NULL, 'f' }, { "batch", required_argument, NULL, 'b' }, + { "iec", no_argument, NULL, 'i' }, { "json", no_argument, NULL, 'j' }, { "pretty", no_argument, NULL, 'p' }, { "statistics", no_argument, NULL, 's' },
@@ -365,7 +366,7 @@ int main(int argc, char **argv)return EXIT_FAILURE ; } -while ((opt =getopt_long (argc, argv,"b:fhjpsvN:V" , +while ((opt =getopt_long (argc, argv,"b:fhijpsvN:V" , long_options,NULL )) >=0 ) {switch (opt) {
@@ -394,6 +395,9 @@ int main(int argc, char **argv) goto dcb_free; }break ; +case 'i' : + dcb->use_iec = true; +break ;case 'h' :dcb_help ();return 0 ;
dcb/dcb.h +1 -0
@@ -12,6 +12,7 @@ struct dcb {struct mnl_socket *nl;bool json_output;bool stats; +bool use_iec; }; int dcb_parse_mapping(const char *what_key, __u32 key, __u32 max_key,
man/man8/dcb.8 +5 -0
@@ -43,6 +43,11 @@ failure will cause termination of dcb. Don't terminate dcb on errors in batch mode. If there were any errors during execution of the commands, the application return code will be non zero. +.TP +.BR "\-i" , " --iec" +When showing rates, use ISO/IEC 1024-based prefixes (Ki, Mi, Bi) instead of +the 1000-based ones (K, M, B). + .TP .BR "\-j" , " --json" Generate JSON output.
Signature · 1 line
2.25.1
PATCH 5/10 dcb: Add dcb_set_u32(), dcb_set_u64()
In reply to Petr MachataThe DCB buffer object has a settable array of 32-bit quantities, and the maxrate object of 64-bit ones. Adjust dcb_parse_mapping() and related helpers to support 64-bit values in mappings, and add appropriate helpers.
--- dcb/dcb.c | 22 ++++++++++++++++++---- dcb/dcb.h | 8 +++++--- 2 files changed, 23 insertions(+), 7 deletions(-)
dcb/dcb.c +18 -4
@@ -229,8 +229,8 @@ void dcb_print_named_array(const char *json_name, const char *fp_name, }int dcb_parse_mapping (const char *what_key,__u32 key,__u32 max_key, -const char *what_value,__u32 value,__u32 max_value, -void (*set_array)(__u32 index,__u32 value,void *data), +const char *what_value,__u64 value,__u64 max_value, +void (*set_array)(__u32 index,__u64 value,void *data),void *set_array_data) {bool is_all = key == (__u32) -1 ;
@@ -242,7 +242,7 @@ int dcb_parse_mapping(const char *what_key, __u32 key, __u32 max_key, }if (value > max_value) { -fprintf (stderr,"In %s:%s mapping, %s is expected to be 0..%d\n" , +fprintf (stderr,"In %s:%s mapping, %s is expected to be 0..%llu\n" , what_key, what_value, what_value, max_value);return -EINVAL ; }
@@ -257,13 +257,27 @@ int dcb_parse_mapping(const char *what_key, __u32 key, __u32 max_key,return 0 ; } -void dcb_set_u8 (__u32 key,__u32 value,void *data) +void dcb_set_u8 (__u32 key,__u64 value,void *data) {__u8 *array = data; array[key] = value; } +void dcb_set_u32 (__u32 key,__u64 value,void *data) +{ +__u32 *array = data; + + array[key] = value; +} + +void dcb_set_u64 (__u32 key,__u64 value,void *data) +{ +__u64 *array = data; + + array[key] = value; +} + int dcb_cmd_parse_dev(struct dcb *dcb, int argc, char **argv, int (*and_then)(struct dcb *dcb, const char *dev, int argc, char **argv),
dcb/dcb.h +5 -3
@@ -14,15 +14,17 @@ struct dcb { };int dcb_parse_mapping (const char *what_key,__u32 key,__u32 max_key, -const char *what_value,__u32 value,__u32 max_value, -void (*set_array)(__u32 index,__u32 value,void *data), +const char *what_value,__u64 value,__u64 max_value, +void (*set_array)(__u32 index,__u64 value,void *data),void *set_array_data);int dcb_cmd_parse_dev (struct dcb *dcb,int argc,char **argv,int (*and_then)(struct dcb *dcb,const char *dev,int argc,char **argv),void (*help)(void )); -void dcb_set_u8 (__u32 key,__u32 value,void *data); +void dcb_set_u8 (__u32 key,__u64 value,void *data); +void dcb_set_u32 (__u32 key,__u64 value,void *data); +void dcb_set_u64 (__u32 key,__u64 value,void *data);int dcb_get_attribute (struct dcb *dcb,const char *dev,int attr,void *data,size_t data_len);
Signature · 1 line
2.25.1
PATCH 8/10 dcb: Add a subtool for the DCB PFC object
In reply to Petr MachataPFC, for "Priority-based Flow Control", allows configuration of priority lossiness, and related toggles.
Add a dcb subtool to allow showing and tweaking of individual PFC configuration options, and querying statistics. For example:
# dcb pfc show dev eni1np1
pfc-cap 8 macsec-bypass on delay 0
pg-pfc 0:off 1:on 2:off 3:off 4:off 5:off 6:off 7:on
requests 0:0 1:217 2:0 3:0 4:0 5:0 6:0 7:28
indications 0:0 1:179 2:0 3:0 4:0 5:0 6:0 7:18--- dcb/Makefile | 2 +- dcb/dcb.c | 27 ++++- dcb/dcb.h | 6 + dcb/dcb_pfc.c | 286 +++++++++++++++++++++++++++++++++++++++++++++ man/man8/dcb-pfc.8 | 127 ++++++++++++++++++++ man/man8/dcb.8 | 9 +- 6 files changed, 453 insertions(+), 4 deletions(-) create mode 100644 dcb/dcb_pfc.c create mode 100644 man/man8/dcb-pfc.8
dcb/Makefile +1 -1
@@ -5,7 +5,7 @@ TARGETS := ifeq ($(HAVE_MNL),y) -DCBOBJ = dcb.o dcb_ets.o +DCBOBJ = dcb.o dcb_ets.o dcb_pfc.o TARGETS += dcb endif
dcb/dcb.c +26 -1
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ +#include <inttypes.h> #include <stdio.h> #include <linux/dcbnl.h> #include <libmnl/libmnl.h>
@@ -201,6 +202,28 @@ void dcb_print_array_u8(const __u8 *array, size_t size) } } +void dcb_print_array_u64 (const __u64 *array,size_t size) +{ +SPRINT_BUF (b); +size_t i; + +for (i =0 ; i < size; i++) { +snprintf (b,sizeof (b),"%zd:%%" PRIu64" " , i); +print_u64 (PRINT_ANY ,NULL , b, array[i]); + } +} + +void dcb_print_array_on_off (const __u8 *array,size_t size) +{ +SPRINT_BUF (b); +size_t i; + +for (i =0 ; i < size; i++) { +snprintf (b,sizeof (b),"%zd:%%s " , i); +print_on_off (PRINT_ANY ,NULL , b, array[i]); + } +} +void dcb_print_array_kw (const __u8 *array,size_t array_size,const char *const kw[],size_t kw_size) {
@@ -309,7 +332,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 := ets\n" +"where OBJECT := { ets | pfc }\n" " OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n" " | -p | --pretty | -s | --statistics | -v | --verbose]\n" ); }
@@ -321,6 +344,8 @@ static int dcb_cmd(struct dcb *dcb, int argc, char **argv)return 0 ; }else if (matches (*argv,"ets" ) ==0 ) {return dcb_cmd_ets (dcb, argc -1 , argv +1 ); + }else if (matches (*argv,"pfc" ) ==0 ) { +return dcb_cmd_pfc (dcb, argc -1 , argv +1 ); }fprintf (stderr,"Object \"%s\" is unknown\n" , *argv);
dcb/dcb.h +6 -0
@@ -37,6 +37,8 @@ void dcb_print_named_array(const char *json_name, const char *fp_name, const __u8 *array, size_t size, void (*print_array)(const __u8 *, size_t));void dcb_print_array_u8 (const __u8 *array,size_t size); +void dcb_print_array_u64 (const __u64 *array,size_t size); +void dcb_print_array_on_off (const __u8 *array,size_t size);void dcb_print_array_kw (const __u8 *array,size_t array_size,const char *const kw[],size_t kw_size);
@@ -44,4 +46,8 @@ void dcb_print_array_kw(const __u8 *array, size_t array_size,int dcb_cmd_ets (struct dcb *dcb,int argc,char **argv); +/* dcb_pfc.c */ + +int dcb_cmd_pfc (struct dcb *dcb,int argc,char **argv); +#endif /* __DCB_H__ */
dcb/dcb_pfc.c new file +286 -0
286 lines not on this page · raw message
man/man8/dcb-pfc.8 new file +127 -0
127 lines not on this page · raw message
man/man8/dcb.8 +7 -2
@@ -9,7 +9,7 @@ dcb \- show / manipulate DCB (Data Center Bridging) settings .ti -8 .B dcb .RI "[ " OPTIONS " ] " -.B ets +.RB "{ " ets " | " pfc " }" .RI "{ " COMMAND " | " help " }" .sp
@@ -67,6 +67,10 @@ part of the "show" output. .B ets - Configuration of ETS (Enhanced Transmission Selection) +.TP +.B pfc +- Configuration of PFC (Priority-based Flow Control) + .SH COMMANDS A \fICOMMAND\fR specifies the action to perform on the object. The set of
@@ -111,7 +115,8 @@ other values: Exit status is 0 if command was successful or a positive integer upon failure. .SH SEE ALSO -.BR dcb-ets (8) +.BR dcb-ets (8), +.BR dcb-pfc (8) .br .SH REPORTING BUGS
Signature · 1 line
2.25.1
PATCH 10/10 dcb: Add a subtool for the DCB maxrate object
In reply to Petr MachataDCBNL maxrate interfaces are an extension to the 802.1q DCB interfaces and allow configuration of rate with which traffic in a given traffic class is sent.
Add a dcb subtool to allow showing and tweaking of this per-TC maximum rate. For example:
# dcb maxrate show dev eni1np1
tc-maxrate 0:25Gbit 1:25Gbit 2:25Gbit 3:25Gbit 4:25Gbit 5:25Gbit 6:100Gbit 7:25Gbit--- dcb/Makefile | 2 +- dcb/dcb.c | 4 +- dcb/dcb.h | 4 + dcb/dcb_maxrate.c | 182 +++++++++++++++++++++++++++++++++++++++++ man/man8/dcb-maxrate.8 | 94 +++++++++++++++++++++ man/man8/dcb.8 | 7 +- 6 files changed, 290 insertions(+), 3 deletions(-) create mode 100644 dcb/dcb_maxrate.c create mode 100644 man/man8/dcb-maxrate.8
dcb/Makefile +1 -1
@@ -5,7 +5,7 @@ TARGETS := ifeq ($(HAVE_MNL),y) -DCBOBJ = dcb.o dcb_buffer.o dcb_ets.o dcb_pfc.o +DCBOBJ = dcb.o dcb_buffer.o dcb_ets.o dcb_maxrate.o dcb_pfc.o TARGETS += dcb endif
dcb/dcb.c +3 -1
@@ -332,7 +332,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 := { buffer | ets | pfc }\n" +"where OBJECT := { buffer | ets | maxrate | pfc }\n" " OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n" " | -p | --pretty | -s | --statistics | -v | --verbose]\n" ); }
@@ -346,6 +346,8 @@ static int dcb_cmd(struct dcb *dcb, int argc, char **argv)return dcb_cmd_buffer (dcb, argc -1 , argv +1 ); }else if (matches (*argv,"ets" ) ==0 ) {return dcb_cmd_ets (dcb, argc -1 , argv +1 ); + }else if (matches (*argv,"maxrate" ) ==0 ) { +return dcb_cmd_maxrate (dcb, argc -1 , argv +1 ); }else if (matches (*argv,"pfc" ) ==0 ) {return dcb_cmd_pfc (dcb, argc -1 , argv +1 ); }
dcb/dcb.h +4 -0
@@ -50,6 +50,10 @@ int dcb_cmd_buffer(struct dcb *dcb, int argc, char **argv);int dcb_cmd_ets (struct dcb *dcb,int argc,char **argv); +/* dcb_maxrate.c */ + +int dcb_cmd_maxrate (struct dcb *dcb,int argc,char **argv); +/* dcb_pfc.c */ int dcb_cmd_pfc (struct dcb *dcb,int argc,char **argv);
dcb/dcb_maxrate.c new file +182 -0
182 lines not on this page · raw message
man/man8/dcb-maxrate.8 new file +94 -0
94 lines not on this page · raw message
man/man8/dcb.8 +6 -1
@@ -9,7 +9,7 @@ dcb \- show / manipulate DCB (Data Center Bridging) settings .ti -8 .B dcb .RI "[ " OPTIONS " ] " -.RB "{ " buffer " | " ets " | " pfc " }" +.RB "{ " buffer " | " ets " | " maxrate " | " pfc " }" .RI "{ " COMMAND " | " help " }" .sp
@@ -71,6 +71,10 @@ part of the "show" output. .B ets - Configuration of ETS (Enhanced Transmission Selection) +.TP +.B maxrate +- Configuration of per-TC maximum transmit rate + .TP .B pfc - Configuration of PFC (Priority-based Flow Control)
@@ -121,6 +125,7 @@ Exit status is 0 if command was successful or a positive integer upon failure. .SH SEE ALSO .BR dcb-buffer (8), .BR dcb-ets (8), +.BR dcb-maxrate (8), .BR dcb-pfc (8) .br
Signature · 1 line
2.25.1
cover dcb: Support PFC, buffer, maxrate objects
Add support to the dcb tool for the following three DCB objects:
- PFC, for "Priority-based Flow Control", allows configuration of priority lossiness, and related toggles.
- DCBNL buffer interfaces are an extension to the 802.1q DCB interfaces and allow configuration of port headroom buffers.
- DCBNL maxrate interfaces are an extension to the 802.1q DCB interfaces and allow configuration of rate with which traffic in a given traffic class is sent.
Patches #1-#4 fix small issues in the current DCB code and man pages.
Patch #5 adds new helpers to the DCB dispatcher.
Patches #6 and #7 add support for command line arguments -s and -i. These enable, respectively, display of statistical counters, and ISO/IEC mode of rate units.
Patches #8-#10 add the subtools themselves and their man pages.
Petr Machata (10):
dcb: Remove unsupported command line arguments from getopt_long()
dcb: ets: Fix help display for "show" subcommand
dcb: ets: Change the way show parameters are given in synopsis
man: dcb-ets: Remove an unnecessary empty line
dcb: Add dcb_set_u32(), dcb_set_u64()
dcb: Add -s to enable statistics
dcb: Add -i to enable IEC mode
dcb: Add a subtool for the DCB PFC object
dcb: Add a subtool for the DCB buffer object
dcb: Add a subtool for the DCB maxrate object
dcb/Makefile | 2 +- dcb/dcb.c | 66 +++++++++- dcb/dcb.h | 24 +++- dcb/dcb_buffer.c | 235 +++++++++++++++++++++++++++++++++ dcb/dcb_ets.c | 10 +- dcb/dcb_maxrate.c | 182 ++++++++++++++++++++++++++ dcb/dcb_pfc.c | 286 +++++++++++++++++++++++++++++++++++++++++ man/man8/dcb-buffer.8 | 126 ++++++++++++++++++ man/man8/dcb-ets.8 | 14 +- man/man8/dcb-maxrate.8 | 94 ++++++++++++++ man/man8/dcb-pfc.8 | 127 ++++++++++++++++++ man/man8/dcb.8 | 29 ++++- 12 files changed, 1173 insertions(+), 22 deletions(-) create mode 100644 dcb/dcb_buffer.c create mode 100644 dcb/dcb_maxrate.c create mode 100644 dcb/dcb_pfc.c create mode 100644 man/man8/dcb-buffer.8 create mode 100644 man/man8/dcb-maxrate.8 create mode 100644 man/man8/dcb-pfc.8
Signature · 1 line
2.25.1
PATCH 1/10 dcb: Remove unsupported command line arguments from getopt_long()
getopt_long() currently includes "c" and "n" in the short option string. These probably slipped in as a cut'n'paste, and are not actually accepted. Remove them.
--- dcb/dcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
dcb/dcb.c +1 -1
@@ -349,7 +349,7 @@ int main(int argc, char **argv)return EXIT_FAILURE ; } -while ((opt =getopt_long (argc, argv,"b:c::fhjnpvN:V" , +while ((opt =getopt_long (argc, argv,"b:fhjpvN:V" , long_options,NULL )) >=0 ) {switch (opt) {
Signature · 1 line
2.25.1
PATCH 4/10 man: dcb-ets: Remove an unnecessary empty line
In reply to Petr Machata--- man/man8/dcb-ets.8 | 1 - 1 file changed, 1 deletion(-)
man/man8/dcb-ets.8 +0 -1
@@ -61,7 +61,6 @@ the DCB (Data Center Bridging) subsystem .ti -8 .IR PRIO " := { " \fB0\fR " .. " \fB7\fR " }" - .SH DESCRIPTION .B dcb ets
Signature · 1 line
2.25.1
PATCH 9/10 dcb: Add a subtool for the DCB buffer object
In reply to Petr MachataDCBNL buffer interfaces are an extension to the 802.1q DCB interfaces and allow configuration of port headroom buffers.
Add a dcb subtool to allow showing and tweaking of buffer priority mapping and buffer sizes. For example:
# dcb buf show dev eni1np1
prio-buffer 0:0 1:0 2:0 3:3 4:0 5:0 6:6 7:0
buffer-size 0:10000 1:0 2:0 3:70000 4:0 5:0 6:10000 7:0
total-size 221072--- dcb/Makefile | 2 +- dcb/dcb.c | 4 +- dcb/dcb.h | 4 + dcb/dcb_buffer.c | 235 ++++++++++++++++++++++++++++++++++++++++++ man/man8/dcb-buffer.8 | 126 ++++++++++++++++++++++ man/man8/dcb.8 | 7 +- 6 files changed, 375 insertions(+), 3 deletions(-) create mode 100644 dcb/dcb_buffer.c create mode 100644 man/man8/dcb-buffer.8
dcb/Makefile +1 -1
@@ -5,7 +5,7 @@ TARGETS := ifeq ($(HAVE_MNL),y) -DCBOBJ = dcb.o dcb_ets.o dcb_pfc.o +DCBOBJ = dcb.o dcb_buffer.o dcb_ets.o dcb_pfc.o TARGETS += dcb endif
dcb/dcb.c +3 -1
@@ -332,7 +332,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 := { ets | pfc }\n" +"where OBJECT := { buffer | ets | pfc }\n" " OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n" " | -p | --pretty | -s | --statistics | -v | --verbose]\n" ); }
@@ -342,6 +342,8 @@ static int dcb_cmd(struct dcb *dcb, int argc, char **argv)if (!argc ||matches (*argv,"help" ) ==0 ) {dcb_help ();return 0 ; + }else if (matches (*argv,"buffer" ) ==0 ) { +return dcb_cmd_buffer (dcb, argc -1 , argv +1 ); }else if (matches (*argv,"ets" ) ==0 ) {return dcb_cmd_ets (dcb, argc -1 , argv +1 ); }else if (matches (*argv,"pfc" ) ==0 ) {
dcb/dcb.h +4 -0
@@ -42,6 +42,10 @@ void dcb_print_array_on_off(const __u8 *array, size_t size);void dcb_print_array_kw (const __u8 *array,size_t array_size,const char *const kw[],size_t kw_size); +/* dcb_buffer.c */ + +int dcb_cmd_buffer (struct dcb *dcb,int argc,char **argv); +/* dcb_ets.c */ int dcb_cmd_ets (struct dcb *dcb,int argc,char **argv);
dcb/dcb_buffer.c new file +235 -0
235 lines not on this page · raw message
man/man8/dcb-buffer.8 new file +126 -0
126 lines not on this page · raw message
man/man8/dcb.8 +6 -1
@@ -9,7 +9,7 @@ dcb \- show / manipulate DCB (Data Center Bridging) settings .ti -8 .B dcb .RI "[ " OPTIONS " ] " -.RB "{ " ets " | " pfc " }" +.RB "{ " buffer " | " ets " | " pfc " }" .RI "{ " COMMAND " | " help " }" .sp
@@ -63,6 +63,10 @@ part of the "show" output. .SH OBJECTS +.TP +.B buffer +- Configuration of port buffers + .TP .B ets - Configuration of ETS (Enhanced Transmission Selection)
@@ -115,6 +119,7 @@ other values: Exit status is 0 if command was successful or a positive integer upon failure. .SH SEE ALSO +.BR dcb-buffer (8), .BR dcb-ets (8), .BR dcb-pfc (8) .br
Signature · 1 line
2.25.1
PATCH 6/10 dcb: Add -s to enable statistics
In reply to Petr MachataAllow selective display of statistical counters by passing -s.
--- dcb/dcb.c | 9 +++++++-- dcb/dcb.h | 1 + man/man8/dcb.8 | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-)
dcb/dcb.c +7 -2
@@ -310,7 +310,8 @@ static void dcb_help(void)"Usage: dcb [ OPTIONS ] OBJECT { COMMAND | help }\n" " dcb [ -f | --force ] { -b | --batch } filename [ -N | --Netns ] netnsname\n" "where OBJECT := ets\n" - " OPTIONS := [ -V | --Version | -j | --json | -p | --pretty | -v | --verbose ]\n"); +" OPTIONS := [ -V | --Version | -j | --json | -p | --pretty\n" + " | -s | --statistics | -v | --verbose ]\n"); }static int dcb_cmd (struct dcb *dcb,int argc,char **argv)
@@ -346,6 +347,7 @@ int main(int argc, char **argv) { "batch", required_argument, NULL, 'b' }, { "json", no_argument, NULL, 'j' }, { "pretty", no_argument, NULL, 'p' }, + { "statistics", no_argument, NULL, 's' }, { "Netns", required_argument, NULL, 'N' }, { "help", no_argument, NULL, 'h' }, { NULL, 0, NULL, 0 }
@@ -363,7 +365,7 @@ int main(int argc, char **argv)return EXIT_FAILURE ; } -while ((opt =getopt_long (argc, argv,"b:fhjpvN:V" , +while ((opt =getopt_long (argc, argv,"b:fhjpsvN:V" , long_options,NULL )) >=0 ) {switch (opt) {
@@ -383,6 +385,9 @@ int main(int argc, char **argv)case 'p' : pretty = true;break ; +case 's' : + dcb->stats = true; +break ;case 'N' :if (netns_switch (optarg)) { ret =EXIT_FAILURE ;
dcb/dcb.h +1 -0
@@ -11,6 +11,7 @@ struct dcb {char *buf;struct mnl_socket *nl;bool json_output; +bool stats; }; int dcb_parse_mapping(const char *what_key, __u32 key, __u32 max_key,
man/man8/dcb.8 +5 -0
@@ -51,6 +51,11 @@ Generate JSON output. .BR "\-p" , " --pretty" When combined with -j generate a pretty JSON output. +.TP +.BR "\-s" , " --statistics" +If the object in question contains any statistical counters, shown them as +part of the "show" output. + .SH OBJECTS .TP
Signature · 1 line
2.25.1
PATCH 2/10 dcb: ets: Fix help display for "show" subcommand
In reply to Petr Machata"dcb ets show dev X help" currently shows full "ets" help instead of just help for the show command. Fix it.
--- dcb/dcb_ets.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
dcb/dcb_ets.c +2 -2
@@ -370,7 +370,7 @@ static int dcb_cmd_ets_show(struct dcb *dcb, const char *dev, int argc, char **a do { if (matches(*argv, "help") == 0) { - dcb_ets_help(); + dcb_ets_help_show(); return 0; } else if (matches(*argv, "willing") == 0) { dcb_ets_print_willing(&ets);
@@ -404,7 +404,7 @@ static int dcb_cmd_ets_show(struct dcb *dcb, const char *dev, int argc, char **aprint_nl (); }else {fprintf (stderr,"What is \"%s\"?\n" , *argv); -dcb_ets_help (); +dcb_ets_help_show ();return -EINVAL ; }
Signature · 1 line
2.25.1
PATCH 3/10 dcb: ets: Change the way show parameters are given in synopsis
In reply to Petr MachataNone, one, or many parameters can be given on the command line, but the current synopsis allows only none or one. Fix it.
--- dcb/dcb_ets.c | 6 +++--- man/man8/dcb-ets.8 | 13 ++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-)
dcb/dcb_ets.c +3 -3
@@ -32,9 +32,9 @@ static void dcb_ets_help_show(void) {fprintf (stderr,"Usage: dcb ets show dev STRING\n" -" [ willing | ets-cap | cbs | tc-tsa | reco-tc-tsa |\n" -" pg-bw | tc-bw | reco-tc-bw | prio-tc |\n" -" reco-prio-tc ]\n" +" [ willing ] [ ets-cap ] [ cbs ] [ tc-tsa ]\n" +" [ reco-tc-tsa ] [ pg-bw ] [ tc-bw ] [ reco-tc-bw ]\n" +" [ prio-tc ] [ reco-prio-tc ]\n" "\n" ); }
man/man8/dcb-ets.8 +10 -3
@@ -17,9 +17,16 @@ the DCB (Data Center Bridging) subsystem .ti -8 .B dcb ets show dev .RI DEV -.RB "[ { " willing " | " ets-cap " | " cbs " | " tc-tsa " | " reco-tc-tsa -.RB " | " pg-bw " | " tc-bw " | " reco-tc-bw " | " prio-tc -.RB " | " reco-prio-tc " } ]" +.RB "[ " willing " ]" +.RB "[ " ets-cap " ]" +.RB "[ " cbs " ]" +.RB "[ " tc-tsa " ]" +.RB "[ " reco-tc-tsa " ]" +.RB "[ " pg-bw " ]" +.RB "[ " tc-bw " ]" +.RB "[ " reco-tc-bw " ]" +.RB "[ " prio-tc " ]" +.RB "[ " reco-prio-tc " ]" .ti -8 .B dcb ets set dev
Signature · 1 line
2.25.1
David Ahern
AppliedQuoted 14 lines · Petr Machata
Add support to the dcb tool for the following three DCB objects:
- PFC, for "Priority-based Flow Control", allows configuration of priority lossiness, and related toggles.
- DCBNL buffer interfaces are an extension to the 802.1q DCB interfaces and allow configuration of port headroom buffers.
- DCBNL maxrate interfaces are an extension to the 802.1q DCB interfaces and allow configuration of rate with which traffic in a given traffic class is sent.
Patches #1-#4 fix small issues in the current DCB code and man pages.
Quoted 8 lines
Patch #5 adds new helpers to the DCB dispatcher.
Patches #6 and #7 add support for command line arguments -s and -i. These enable, respectively, display of statistical counters, and ISO/IEC mode of rate units.
Patches #8-#10 add the subtools themselves and their man pages.
applied to iproute2-next. Thanks, Petr.