From mboxrd@z Thu Jan 1 00:00:00 1970 From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= Subject: Re: [PATCH net-next v12 2/7] sch_cake: Add ingress mode Date: Wed, 16 May 2018 23:16:32 +0200 Message-ID: <87lgcjuwr3.fsf@toke.dk> References: <152650253056.25701.10138252969621361651.stgit@alrua-kau> <152650254608.25701.5749607607862123240.stgit@alrua-kau> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Linux Kernel Network Developers , Cake List To: Cong Wang Return-path: Received: from mail.toke.dk ([52.28.52.200]:40325 "EHLO mail.toke.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751155AbeEPVQj (ORCPT ); Wed, 16 May 2018 17:16:39 -0400 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: Cong Wang writes: > On Wed, May 16, 2018 at 1:29 PM, Toke H=C3=B8iland-J=C3=B8rgensen wrote: >> + if (tb[TCA_CAKE_AUTORATE]) { >> + if (!!nla_get_u32(tb[TCA_CAKE_AUTORATE])) >> + q->rate_flags |=3D CAKE_FLAG_AUTORATE_INGRESS; >> + else >> + q->rate_flags &=3D ~CAKE_FLAG_AUTORATE_INGRESS; >> + } >> + >> + if (tb[TCA_CAKE_INGRESS]) { >> + if (!!nla_get_u32(tb[TCA_CAKE_INGRESS])) >> + q->rate_flags |=3D CAKE_FLAG_INGRESS; >> + else >> + q->rate_flags &=3D ~CAKE_FLAG_INGRESS; >> + } >> + >> if (tb[TCA_CAKE_MEMORY]) >> q->buffer_config_limit =3D nla_get_u32(tb[TCA_CAKE_MEMOR= Y]); >> >> @@ -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