[Cake] [PATCH net-next v12 2/7] sch_cake: Add ingress mode

Cong Wang xiyou.wangcong at gmail.com
Wed May 16 17:09:00 EDT 2018


On Wed, May 16, 2018 at 1:29 PM, Toke Høiland-Jørgensen <toke at 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?


More information about the Cake mailing list