[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200706114037.519161d0@hermes.lan>
Date: Mon, 6 Jul 2020 11:40:37 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: "YU, Xiangning" <xiangning.yu@...baba-inc.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH iproute2-next] iproute2 Support lockless token bucket
(LTB)
On Tue, 07 Jul 2020 02:08:21 +0800
"YU, Xiangning" <xiangning.yu@...baba-inc.com> wrote:
> +static int ltb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
> +{
> + struct rtattr *tb[TCA_LTB_MAX + 1];
> + struct tc_ltb_opt *lopt;
> + struct tc_ltb_glob *gopt;
> + __u64 rate64, ceil64;
> +
> + SPRINT_BUF(b1);
> + if (opt == NULL)
> + return 0;
> +
> + parse_rtattr_nested(tb, TCA_LTB_MAX, opt);
> +
> + if (tb[TCA_LTB_PARMS]) {
> + lopt = RTA_DATA(tb[TCA_LTB_PARMS]);
> + if (RTA_PAYLOAD(tb[TCA_LTB_PARMS]) < sizeof(*lopt))
> + return -1;
> +
> + fprintf(f, "prio %d ", (int)lopt->prio);
> +
> + rate64 = lopt->rate.rate;
> + if (tb[TCA_LTB_RATE64] &&
> + RTA_PAYLOAD(tb[TCA_LTB_RATE64]) >= sizeof(rate64)) {
> + rate64 = *(__u64 *)RTA_DATA(tb[TCA_LTB_RATE64]);
> + }
> +
> + ceil64 = lopt->ceil.rate;
> + if (tb[TCA_LTB_CEIL64] &&
> + RTA_PAYLOAD(tb[TCA_LTB_CEIL64]) >= sizeof(ceil64))
> + ceil64 = *(__u64 *)RTA_DATA(tb[TCA_LTB_CEIL64]);
> +
> + fprintf(f, "rate %s ", sprint_rate(rate64, b1));
> + fprintf(f, "ceil %s ", sprint_rate(ceil64, b1));
The print function needs to support JSON output like the rest
of the qdisc in current iproute2.
Powered by blists - more mailing lists