Cong Wang <xiyou.wangc...@gmail.com> writes: > On Wed, May 16, 2018 at 1:29 PM, Toke Høiland-Jørgensen <t...@toke.dk> wrote: >> + if (tb[TCA_CAKE_AUTORATE]) { >> + if (!!nla_get_u32(tb[TCA_CAKE_AUTORATE])) >> + q->rate_flags |= CAKE_FLAG_AUTORATE_INGRESS; >> + else >> + q->rate_flags &= ~CAKE_FLAG_AUTORATE_INGRESS; >> + } >> + >> + if (tb[TCA_CAKE_INGRESS]) { >> + if (!!nla_get_u32(tb[TCA_CAKE_INGRESS])) >> + q->rate_flags |= CAKE_FLAG_INGRESS; >> + else >> + q->rate_flags &= ~CAKE_FLAG_INGRESS; >> + } >> + >> if (tb[TCA_CAKE_MEMORY]) >> q->buffer_config_limit = nla_get_u32(tb[TCA_CAKE_MEMORY]); >> >> @@ -1559,6 +1628,14 @@ static int cake_dump(struct Qdisc *sch, struct >> sk_buff *skb) >> if (nla_put_u32(skb, TCA_CAKE_MEMORY, q->buffer_config_limit)) >> goto nla_put_failure; >> >> + if (nla_put_u32(skb, TCA_CAKE_AUTORATE, >> + !!(q->rate_flags & CAKE_FLAG_AUTORATE_INGRESS))) >> + goto nla_put_failure; >> + >> + if (nla_put_u32(skb, TCA_CAKE_INGRESS, >> + !!(q->rate_flags & CAKE_FLAG_INGRESS))) >> + goto nla_put_failure; >> + > > Why do you want to dump each bit of the rate_flags separately rather than > dumping the whole rate_flags as an integer?
Well, these were added one at a time, each as a new option. Isn't that more or less congruent with how netlink attributes are supposed to be used? -Toke