From: Stephen Hemminger <sthem...@microsoft.com>

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 tc/q_rr.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tc/q_rr.c b/tc/q_rr.c
index 843a4faeef41..dcc58ac98ba2 100644
--- a/tc/q_rr.c
+++ b/tc/q_rr.c
@@ -101,13 +101,19 @@ static int rr_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 priomap ", qopt->bands);
+       open_json_array(PRINT_JSON, "priomap");
        for (i = 0; i <= TC_PRIO_MAX; i++)
-               fprintf(f, " %d", qopt->priomap[i]);
+               print_uint(PRINT_ANY, NULL, " %u", qopt->priomap[i]);
+       close_json_array(PRINT_JSON, NULL);
 
-       if (tb[TCA_PRIO_MQ])
-               fprintf(f, " multiqueue: %s ",
-                       rta_getattr_u8(tb[TCA_PRIO_MQ]) ? "on" : "off");
+       if (tb[TCA_PRIO_MQ]) {
+               bool mq = rta_getattr_u8(tb[TCA_PRIO_MQ]);
+
+               print_string(PRINT_FP, NULL, " multiqueue: %s ",
+                            mq ? "on" : "off");
+               print_bool(PRINT_JSON, "multiqueue", NULL, mq);
+       }
 
        return 0;
 }
-- 
2.18.0

Reply via email to