[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190506161840.30919-2-nir.weiner@oracle.com>
Date: Mon, 6 May 2019 19:18:38 +0300
From: Nir Weiner <nir.weiner@...cle.com>
To: netdev@...r.kernel.org
Cc: liran.alon@...cle.com, nir.weiner@...cle.com
Subject: [iproute2 1/3] tc: jsonify htb qdisc parameters
Add json output to htb qdisc parameters.
Fixes: f354fa6aa5ff05dd214a595e5159ef93a6ab1934
Acked-by: John Haxby <john.haxby@...cle.com>
Reviewed-by: Liran Alon <liran.alon@...cle.com>
Signed-off-by: Nir Weiner <nir.weiner@...cle.com>
---
tc/q_htb.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/tc/q_htb.c b/tc/q_htb.c
index 520522266e00..0e0f479d423f 100644
--- a/tc/q_htb.c
+++ b/tc/q_htb.c
@@ -299,16 +299,16 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
RTA_PAYLOAD(tb[TCA_HTB_CEIL64]) >= sizeof(ceil64))
ceil64 = rta_getattr_u64(tb[TCA_HTB_CEIL64]);
- fprintf(f, "rate %s ", sprint_rate(rate64, b1));
+ print_string(PRINT_ANY, "rate", "rate %s ", sprint_rate(rate64, b1));
if (hopt->rate.overhead)
- fprintf(f, "overhead %u ", hopt->rate.overhead);
+ print_uint(PRINT_ANY, "overhead", "overhead %u ", hopt->rate.overhead);
buffer = tc_calc_xmitsize(rate64, hopt->buffer);
- fprintf(f, "ceil %s ", sprint_rate(ceil64, b1));
+ print_string(PRINT_ANY, "ceil", "ceil %s ", sprint_rate(ceil64, b1));
cbuffer = tc_calc_xmitsize(ceil64, hopt->cbuffer);
linklayer = (hopt->rate.linklayer & TC_LINKLAYER_MASK);
if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
- fprintf(f, "linklayer %s ", sprint_linklayer(linklayer, b3));
+ print_string(PRINT_ANY, "linklayer", "linklayer %s ", sprint_linklayer(linklayer, b3));
if (show_details) {
fprintf(f, "burst %s/%u mpu %s ",
sprint_size(buffer, b1),
@@ -320,12 +320,13 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
sprint_size(hopt->ceil.mpu, b2));
fprintf(f, "level %d ", (int)hopt->level);
} else {
- fprintf(f, "burst %s ", sprint_size(buffer, b1));
- fprintf(f, "cburst %s ", sprint_size(cbuffer, b1));
+ print_string(PRINT_ANY, "burst", "burst %s ", sprint_size(buffer, b1));
+ print_string(PRINT_ANY, "cburst", "cburst %s ", sprint_size(cbuffer, b1));
+ }
+ if (show_raw) {
+ print_0xhex(PRINT_ANY, "buffer", "buffer [%08x] ", hopt->buffer);
+ print_0xhex(PRINT_ANY, "cbuffer", "cbuffer [%08x] ", hopt->cbuffer);
}
- if (show_raw)
- fprintf(f, "buffer [%08x] cbuffer [%08x] ",
- hopt->buffer, hopt->cbuffer);
}
if (tb[TCA_HTB_INIT]) {
gopt = RTA_DATA(tb[TCA_HTB_INIT]);
--
2.17.1
Powered by blists - more mailing lists