diff mbox series

[iproute2-next,v2,5/7] dcb: Support -N to suppress translation to human-readable names

Message ID a13a33ef1e4d38a3175187ae8c284238dc37ff11.1609544200.git.me@pmachata.org (mailing list archive)
State New, archived
Delegated to: David Ahern
Headers show
Series dcb: Support APP, DCBX objects | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Petr Machata Jan. 2, 2021, 12:03 a.m. UTC
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>
---

Notes:
    v2:
    - Make it -N / --Numeric instead of -n / --no-nice-names
    - Rename the flag from no_nice_names to numeric as well

 dcb/dcb.c      | 9 +++++++--
 dcb/dcb.h      | 1 +
 man/man8/dcb.8 | 5 +++++
 3 files changed, 13 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/dcb/dcb.c b/dcb/dcb.c
index 89f9b0ec7ef9..cc5103da84a8 100644
--- a/dcb/dcb.c
+++ b/dcb/dcb.c
@@ -467,7 +467,8 @@  static void dcb_help(void)
 		"       dcb [ -f | --force ] { -b | --batch } filename [ -n | --netns ] netnsname\n"
 		"where  OBJECT := { buffer | ets | maxrate | pfc }\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)
@@ -509,6 +510,7 @@  int main(int argc, char **argv)
 		{ "batch",		required_argument,	NULL, 'b' },
 		{ "iec",		no_argument,		NULL, 'i' },
 		{ "json",		no_argument,		NULL, 'j' },
+		{ "Numeric",		no_argument,		NULL, 'N' },
 		{ "pretty",		no_argument,		NULL, 'p' },
 		{ "statistics",		no_argument,		NULL, 's' },
 		{ "netns",		required_argument,	NULL, 'n' },
@@ -528,7 +530,7 @@  int main(int argc, char **argv)
 		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) {
 
 		switch (opt) {
@@ -545,6 +547,9 @@  int main(int argc, char **argv)
 		case 'j':
 			dcb->json_output = true;
 			break;
+		case 'N':
+			dcb->numeric = true;
+			break;
 		case 'p':
 			pretty = true;
 			break;
diff --git a/dcb/dcb.h b/dcb/dcb.h
index 8c7327a43588..37657c594a78 100644
--- a/dcb/dcb.h
+++ b/dcb/dcb.h
@@ -14,6 +14,7 @@  struct dcb {
 	bool json_output;
 	bool stats;
 	bool use_iec;
+	bool numeric;
 };
 
 int dcb_parse_mapping(const char *what_key, __u32 key, __u32 max_key,
diff --git a/man/man8/dcb.8 b/man/man8/dcb.8
index 7293bb303577..1e161eb37a58 100644
--- a/man/man8/dcb.8
+++ b/man/man8/dcb.8
@@ -59,6 +59,11 @@  the 1000-based ones (K, M, B).
 .BR "\-j" , " --json"
 Generate JSON output.
 
+.TP
+.BR "\-N" , " --Numeric"
+If the subtool in question translates numbers to symbolic names in some way,
+suppress this translation.
+
 .TP
 .BR "\-p" , " --pretty"
 When combined with -j generate a pretty JSON output.