dcb: Support -N to suppress translation to human-readable names
Some DSCP values can be translated to symbolic names. That may not be always desirable. Introduce a command-line option similar to other tools, -N or --Numeric, to suppress this translation. Signed-off-by: Petr Machata <me@pmachata.org> Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
parent
e59876ff55
commit
0aebd32b82
|
|
@ -467,7 +467,8 @@ static void dcb_help(void)
|
||||||
" dcb [ -f | --force ] { -b | --batch } filename [ -n | --netns ] netnsname\n"
|
" dcb [ -f | --force ] { -b | --batch } filename [ -n | --netns ] netnsname\n"
|
||||||
"where OBJECT := { buffer | ets | maxrate | pfc }\n"
|
"where OBJECT := { buffer | ets | maxrate | pfc }\n"
|
||||||
" OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n"
|
" OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n"
|
||||||
" | -p | --pretty | -s | --statistics | -v | --verbose]\n");
|
" | -N | --Numeric | -p | --pretty\n"
|
||||||
|
" | -s | --statistics | -v | --verbose]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dcb_cmd(struct dcb *dcb, int argc, char **argv)
|
static int dcb_cmd(struct dcb *dcb, int argc, char **argv)
|
||||||
|
|
@ -509,6 +510,7 @@ int main(int argc, char **argv)
|
||||||
{ "batch", required_argument, NULL, 'b' },
|
{ "batch", required_argument, NULL, 'b' },
|
||||||
{ "iec", no_argument, NULL, 'i' },
|
{ "iec", no_argument, NULL, 'i' },
|
||||||
{ "json", no_argument, NULL, 'j' },
|
{ "json", no_argument, NULL, 'j' },
|
||||||
|
{ "Numeric", no_argument, NULL, 'N' },
|
||||||
{ "pretty", no_argument, NULL, 'p' },
|
{ "pretty", no_argument, NULL, 'p' },
|
||||||
{ "statistics", no_argument, NULL, 's' },
|
{ "statistics", no_argument, NULL, 's' },
|
||||||
{ "netns", required_argument, NULL, 'n' },
|
{ "netns", required_argument, NULL, 'n' },
|
||||||
|
|
@ -528,7 +530,7 @@ int main(int argc, char **argv)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((opt = getopt_long(argc, argv, "b:fhijn:psvV",
|
while ((opt = getopt_long(argc, argv, "b:fhijn:psvNV",
|
||||||
long_options, NULL)) >= 0) {
|
long_options, NULL)) >= 0) {
|
||||||
|
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
|
@ -545,6 +547,9 @@ int main(int argc, char **argv)
|
||||||
case 'j':
|
case 'j':
|
||||||
dcb->json_output = true;
|
dcb->json_output = true;
|
||||||
break;
|
break;
|
||||||
|
case 'N':
|
||||||
|
dcb->numeric = true;
|
||||||
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
pretty = true;
|
pretty = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ struct dcb {
|
||||||
bool json_output;
|
bool json_output;
|
||||||
bool stats;
|
bool stats;
|
||||||
bool use_iec;
|
bool use_iec;
|
||||||
|
bool numeric;
|
||||||
};
|
};
|
||||||
|
|
||||||
int dcb_parse_mapping(const char *what_key, __u32 key, __u32 max_key,
|
int dcb_parse_mapping(const char *what_key, __u32 key, __u32 max_key,
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,11 @@ the 1000-based ones (K, M, B).
|
||||||
.BR "\-j" , " --json"
|
.BR "\-j" , " --json"
|
||||||
Generate JSON output.
|
Generate JSON output.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.BR "\-N" , " --Numeric"
|
||||||
|
If the subtool in question translates numbers to symbolic names in some way,
|
||||||
|
suppress this translation.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR "\-p" , " --pretty"
|
.BR "\-p" , " --pretty"
|
||||||
When combined with -j generate a pretty JSON output.
|
When combined with -j generate a pretty JSON output.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue