netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nir Weiner <nir.weiner@oracle.com>
To: netdev@vger.kernel.org
Cc: liran.alon@oracle.com, nir.weiner@oracle.com
Subject: [iproute2 1/3] tc: jsonify htb qdisc parameters
Date: Mon,  6 May 2019 19:18:38 +0300	[thread overview]
Message-ID: <20190506161840.30919-2-nir.weiner@oracle.com> (raw)
In-Reply-To: <20190506161840.30919-1-nir.weiner@oracle.com>

Add json output to htb qdisc parameters.

Fixes: f354fa6aa5ff05dd214a595e5159ef93a6ab1934
Acked-by: John Haxby <john.haxby@oracle.com>
Reviewed-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Nir Weiner <nir.weiner@oracle.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


  reply	other threads:[~2019-05-06 16:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 16:18 [iproute2 0/3] Adding json support for showing htb&tbf classes Nir Weiner
2019-05-06 16:18 ` Nir Weiner [this message]
2019-05-06 16:18 ` [iproute2 2/3] tc: jsonify tbf qdisc parameters Nir Weiner
2019-05-17 17:35   ` David Ahern
2019-05-17 17:57     ` Stephen Hemminger
2019-05-06 16:18 ` [iproute2 3/3] tc: jsonify class core Nir Weiner
2019-05-06 16:22 ` [iproute2 0/3] Adding json support for showing htb&tbf classes Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190506161840.30919-2-nir.weiner@oracle.com \
    --to=nir.weiner@oracle.com \
    --cc=liran.alon@oracle.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).