[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d0ad669c-4203-9987-e625-f2fae4a6b81c@alibaba-inc.com>
Date: Tue, 07 Jul 2020 03:54:38 +0800
From: "YU, Xiangning" <xiangning.yu@...baba-inc.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH iproute2-next] iproute2 Support lockless token bucket
(LTB)
On 7/6/20 11:40 AM, Stephen Hemminger wrote:
> 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.
>
Hi Stephen,
Thank you for pointing this out! While I'm a bit confused about the JSON output. This is a sample output of `tc -j class show` command. Looks like it doesn't display JSON output even for HTB. Am I missing anything?
# ./tc -s -j -p class show dev enp7s0f0
class htb 1:1 root rate 10Gbit ceil 10Gbit burst 13750b cburst 0b
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
lended: 0 borrowed: 0 giants: 0
tokens: 187 ctokens: 15
class htb 1:10 parent 1:1 prio 1 rate 10Gbit ceil 10Gbit burst 13750b cburst 13750b
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
lended: 0 borrowed: 0 giants: 0
tokens: 187 ctokens: 187
Thanks,
- Xiangning
Powered by blists - more mailing lists