All of lore.kernel.org
 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 2/3] tc: jsonify tbf qdisc parameters
Date: Mon,  6 May 2019 19:18:39 +0300	[thread overview]
Message-ID: <20190506161840.30919-3-nir.weiner@oracle.com> (raw)
In-Reply-To: <20190506161840.30919-1-nir.weiner@oracle.com>

Add json output to tbf qdisc parameters.

Acked-by: John Haxby <john.haxby@oracle.com>
Signed-off-by: Nir Weiner <nir.weiner@oracle.com>
Suggested-by: Liran Alon <liran.alon@oracle.com>
---
 tc/q_tbf.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tc/q_tbf.c b/tc/q_tbf.c
index b9465b20d2be..fd824e67e4f2 100644
--- a/tc/q_tbf.c
+++ b/tc/q_tbf.c
@@ -285,32 +285,32 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	if (tb[TCA_TBF_RATE64] &&
 	    RTA_PAYLOAD(tb[TCA_TBF_RATE64]) >= sizeof(rate64))
 		rate64 = rta_getattr_u64(tb[TCA_TBF_RATE64]);
-	fprintf(f, "rate %s ", sprint_rate(rate64, b1));
+	print_string(PRINT_ANY, "rate", "rate %s ", sprint_rate(rate64, b1));
 	buffer = tc_calc_xmitsize(rate64, qopt->buffer);
 	if (show_details) {
 		fprintf(f, "burst %s/%u mpu %s ", sprint_size(buffer, b1),
 			1<<qopt->rate.cell_log, sprint_size(qopt->rate.mpu, b2));
 	} else {
-		fprintf(f, "burst %s ", sprint_size(buffer, b1));
+		print_string(PRINT_ANY, "burst", "burst %s ", sprint_size(buffer, b1));
 	}
 	if (show_raw)
-		fprintf(f, "[%08x] ", qopt->buffer);
+		print_0xhex(PRINT_ANY, "buffer", "[%08x] ", qopt->buffer);
 	prate64 = qopt->peakrate.rate;
 	if (tb[TCA_TBF_PRATE64] &&
 	    RTA_PAYLOAD(tb[TCA_TBF_PRATE64]) >= sizeof(prate64))
 		prate64 = rta_getattr_u64(tb[TCA_TBF_PRATE64]);
 	if (prate64) {
-		fprintf(f, "peakrate %s ", sprint_rate(prate64, b1));
+		print_string(PRINT_ANY, "peakrate", "peakrate %s ", sprint_rate(prate64, b1));
 		if (qopt->mtu || qopt->peakrate.mpu) {
 			mtu = tc_calc_xmitsize(prate64, qopt->mtu);
 			if (show_details) {
 				fprintf(f, "mtu %s/%u mpu %s ", sprint_size(mtu, b1),
 					1<<qopt->peakrate.cell_log, sprint_size(qopt->peakrate.mpu, b2));
 			} else {
-				fprintf(f, "minburst %s ", sprint_size(mtu, b1));
+				print_string(PRINT_ANY, "minburst", "minburst %s ", sprint_size(mtu, b1));
 			}
 			if (show_raw)
-				fprintf(f, "[%08x] ", qopt->mtu);
+				print_0xhex(PRINT_ANY, "mtu", "[%08x] ", qopt->mtu);
 		}
 	}
 
@@ -322,16 +322,16 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 			latency = lat2;
 	}
 	if (latency >= 0.0)
-		fprintf(f, "lat %s ", sprint_time(latency, b1));
+		print_string(PRINT_ANY, "lat", "lat %s ", sprint_time(latency, b1));
 	if (show_raw || latency < 0.0)
-		fprintf(f, "limit %s ", sprint_size(qopt->limit, b1));
+		print_string(PRINT_ANY, "limit", "limit %s ", sprint_size(qopt->limit, b1));
 
 	if (qopt->rate.overhead) {
-		fprintf(f, "overhead %d", qopt->rate.overhead);
+		print_int(PRINT_ANY, "overhead", "overhead %d", qopt->rate.overhead);
 	}
 	linklayer = (qopt->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));
 
 	return 0;
 }
-- 
2.17.1


  parent 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 ` [iproute2 1/3] tc: jsonify htb qdisc parameters Nir Weiner
2019-05-06 16:18 ` Nir Weiner [this message]
2019-05-17 17:35   ` [iproute2 2/3] tc: jsonify tbf " 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-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.