From: Stephen Hemminger <sthem...@microsoft.com> Signed-off-by: Stephen Hemminger <step...@networkplumber.org> --- tc/q_codel.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/tc/q_codel.c b/tc/q_codel.c index 8a2a871671cb..de5c514fc49c 100644 --- a/tc/q_codel.c +++ b/tc/q_codel.c @@ -133,7 +133,6 @@ static int codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) unsigned int ecn; unsigned int ce_threshold; - SPRINT_BUF(b1); if (opt == NULL) return 0; @@ -143,28 +142,28 @@ static int codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) if (tb[TCA_CODEL_LIMIT] && RTA_PAYLOAD(tb[TCA_CODEL_LIMIT]) >= sizeof(__u32)) { limit = rta_getattr_u32(tb[TCA_CODEL_LIMIT]); - fprintf(f, "limit %up ", limit); + print_uint(PRINT_ANY, "limit", "limit %up ", limit); } if (tb[TCA_CODEL_TARGET] && RTA_PAYLOAD(tb[TCA_CODEL_TARGET]) >= sizeof(__u32)) { target = rta_getattr_u32(tb[TCA_CODEL_TARGET]); - fprintf(f, "target %s ", sprint_time(target, b1)); + print_time("target", "target %s ", target); } if (tb[TCA_CODEL_CE_THRESHOLD] && RTA_PAYLOAD(tb[TCA_CODEL_CE_THRESHOLD]) >= sizeof(__u32)) { ce_threshold = rta_getattr_u32(tb[TCA_CODEL_CE_THRESHOLD]); - fprintf(f, "ce_threshold %s ", sprint_time(ce_threshold, b1)); + print_time("ce_threshold", "ce_threshold %s ", ce_threshold); } if (tb[TCA_CODEL_INTERVAL] && RTA_PAYLOAD(tb[TCA_CODEL_INTERVAL]) >= sizeof(__u32)) { interval = rta_getattr_u32(tb[TCA_CODEL_INTERVAL]); - fprintf(f, "interval %s ", sprint_time(interval, b1)); + print_time("interval", "interval %s ", interval); } if (tb[TCA_CODEL_ECN] && RTA_PAYLOAD(tb[TCA_CODEL_ECN]) >= sizeof(__u32)) { ecn = rta_getattr_u32(tb[TCA_CODEL_ECN]); if (ecn) - fprintf(f, "ecn "); + print_null(PRINT_ANY, "ecn", "ecn ", NULL); } return 0; @@ -175,8 +174,6 @@ static int codel_print_xstats(struct qdisc_util *qu, FILE *f, { struct tc_codel_xstats _st = {}, *st; - SPRINT_BUF(b1); - if (xstats == NULL) return 0; @@ -186,18 +183,20 @@ static int codel_print_xstats(struct qdisc_util *qu, FILE *f, st = &_st; } - fprintf(f, " count %u lastcount %u ldelay %s", - st->count, st->lastcount, sprint_time(st->ldelay, b1)); + print_uint(PRINT_ANY, "count", " count %u", st->count); + print_uint(PRINT_ANY, "lastcount", " lastcount %u", st->lastcount); + print_time("ldelay", " ldelay %s", st->ldelay); if (st->dropping) - fprintf(f, " dropping"); - if (st->drop_next < 0) - fprintf(f, " drop_next -%s", sprint_time(-st->drop_next, b1)); - else - fprintf(f, " drop_next %s", sprint_time(st->drop_next, b1)); - fprintf(f, "\n maxpacket %u ecn_mark %u drop_overlimit %u", - st->maxpacket, st->ecn_mark, st->drop_overlimit); + print_null(PRINT_ANY, "dropping", " dropping", NULL); + print_time("drop_next", " drop_next %s", st->drop_next); + + print_string(PRINT_FP, NULL, "%s", _SL_); + print_uint(PRINT_ANY, "maxpacket", " maxpacket %u", st->maxpacket); + print_uint(PRINT_ANY, "ecn_mark", "ecn_mark %u", st->ecn_mark); + print_uint(PRINT_ANY, "drop_overlimit", "drop_overlimit %u", + st->drop_overlimit); if (st->ce_mark) - fprintf(f, " ce_mark %u", st->ce_mark); + print_uint(PRINT_ANY, "ce_mark", " ce_mark %u", st->ce_mark); return 0; } -- 2.18.0