diff mbox series

[v2,iproute2-next,07/31] tc/red: use new JSON helpers

Message ID 20180710210558.20278-8-stephen@networkplumber.org
State Changes Requested, archived
Delegated to: David Ahern
Headers show
Series tc use JSON in all qdisc | expand

Commit Message

Stephen Hemminger July 10, 2018, 9:05 p.m. UTC
From: Stephen Hemminger <sthemmin@microsoft.com>

Now have simplier way to print size.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 tc/q_red.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/tc/q_red.c b/tc/q_red.c
index 49fd4ac80513..9e4124befdb7 100644
--- a/tc/q_red.c
+++ b/tc/q_red.c
@@ -163,10 +163,6 @@  static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	struct tc_red_qopt *qopt;
 	__u32 max_P = 0;
 
-	SPRINT_BUF(b1);
-	SPRINT_BUF(b2);
-	SPRINT_BUF(b3);
-
 	if (opt == NULL)
 		return 0;
 
@@ -182,12 +178,9 @@  static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	    RTA_PAYLOAD(tb[TCA_RED_MAX_P]) >= sizeof(__u32))
 		max_P = rta_getattr_u32(tb[TCA_RED_MAX_P]);
 
-	print_uint(PRINT_JSON, "limit", NULL, qopt->limit);
-	print_string(PRINT_FP, NULL, "limit %s ", sprint_size(qopt->limit, b1));
-	print_uint(PRINT_JSON, "min", NULL, qopt->qth_min);
-	print_string(PRINT_FP, NULL, "min %s ", sprint_size(qopt->qth_min, b2));
-	print_uint(PRINT_JSON, "max", NULL, qopt->qth_max);
-	print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
+	print_size("limit", "limit %s ", qopt->limit);
+	print_size("min", "min %s ", qopt->qth_min);
+	print_size("max", "max %s ", qopt->qth_max);
 
 	if (qopt->flags & TC_RED_ECN)
 		print_bool(PRINT_ANY, "ecn", "ecn ", true);