[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180126192757.27176-3-jakub.kicinski@netronome.com>
Date: Fri, 26 Jan 2018 11:27:57 -0800
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: dsahern@...il.com, stephen@...workplumber.org
Cc: oss-drivers@...ronome.com, netdev@...r.kernel.org,
Quentin Monnet <quentin.monnet@...ronome.com>,
Jakub Kicinski <jakub.kicinski@...ronome.com>
Subject: [PATCH iproute2-next 2/2] tc: prio: JSON-ify prio output
Make JSON output work with prio Qdiscs. This will also make
other qdiscs which reuse the print_qopt work, like mqprio or
pfifo_fast.
Note that there is a double space between "priomap" and first
prio number. Keep this original behaviour.
Signed-off-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
---
tc/q_prio.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tc/q_prio.c b/tc/q_prio.c
index 358cf06cca0a..8ef7cfa260d5 100644
--- a/tc/q_prio.c
+++ b/tc/q_prio.c
@@ -107,13 +107,17 @@ int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
sizeof(*qopt)))
return -1;
- fprintf(f, "bands %u priomap ", qopt->bands);
+ print_uint(PRINT_ANY, "bands", "bands %u ", qopt->bands);
+ open_json_array(PRINT_ANY, "priomap ");
for (i = 0; i <= TC_PRIO_MAX; i++)
- fprintf(f, " %d", qopt->priomap[i]);
+ print_uint(PRINT_ANY, NULL, " %d", qopt->priomap[i]);
+ close_json_array(PRINT_ANY, "");
if (tb[TCA_PRIO_MQ])
- fprintf(f, " multiqueue: %s ",
- rta_getattr_u8(tb[TCA_PRIO_MQ]) ? "on" : "off");
+ print_string(PRINT_FP, NULL, " multiqueue: %s ",
+ rta_getattr_u8(tb[TCA_PRIO_MQ]) ? "on" : "off");
+ print_bool(PRINT_JSON, "multiqueue", NULL,
+ tb[TCA_PRIO_MQ] && rta_getattr_u8(tb[TCA_PRIO_MQ]));
return 0;
}
--
2.15.1
Powered by blists - more mailing lists