[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z2HMr//V3CvIMwxb@debian>
Date: Tue, 17 Dec 2024 20:10:39 +0100
From: Guillaume Nault <gnault@...hat.com>
To: Ido Schimmel <idosch@...dia.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
pabeni@...hat.com, edumazet@...gle.com, dsahern@...nel.org,
donald.hunter@...il.com, horms@...nel.org, rostedt@...dmis.org,
mhiramat@...nel.org, mathieu.desnoyers@...icios.com,
petrm@...dia.com
Subject: Re: [PATCH net-next 3/9] ipv6: fib_rules: Add flow label support
On Tue, Dec 17, 2024 at 05:24:34PM +0200, Ido Schimmel wrote:
> On Tue, Dec 17, 2024 at 02:59:19PM +0100, Guillaume Nault wrote:
> > On Mon, Dec 16, 2024 at 07:11:55PM +0200, Ido Schimmel wrote:
> > > @@ -332,6 +334,9 @@ INDIRECT_CALLABLE_SCOPE int fib6_rule_match(struct fib_rule *rule,
> > > if (r->dscp && r->dscp != ip6_dscp(fl6->flowlabel))
> > > return 0;
> > >
> > > + if ((r->flowlabel ^ flowi6_get_flowlabel(fl6)) & r->flowlabel_mask)
> > > + return 0;
> > > +
> >
> > Personally, I'd find the following form easier to read:
> > + if ((flowi6_get_flowlabel(fl6) & r->flowlabel_mask) != r->flowlabel)
> > + return 0;
>
> The FIB rule code already uses the XOR form for other masked matches
> ('fwmark' for example), so I used it here to be consistent.
>
> > Does GCC produce better code with the xor form?
>
> No big difference.
Ok, thanks. I didn't realise fwmark used the xor form too.
>
> Original:
>
> static inline __be32 flowi6_get_flowlabel(const struct flowi6 *fl6)
> {
> return fl6->flowlabel & IPV6_FLOWLABEL_MASK;
> b85: 81 e2 00 0f ff ff and $0xffff0f00,%edx
> if ((r->flowlabel ^ flowi6_get_flowlabel(fl6)) & r->flowlabel_mask)
> b8b: 33 90 c0 00 00 00 xor 0xc0(%rax),%edx
> b91: 23 90 c4 00 00 00 and 0xc4(%rax),%edx
> return 0;
> b97: 41 b8 00 00 00 00 mov $0x0,%r8d
> if ((r->flowlabel ^ flowi6_get_flowlabel(fl6)) & r->flowlabel_mask)
> b9d: 0f 85 31 ff ff ff jne ad4 <fib6_rule_match+0x34>
>
> Modified:
>
> if ((flowi6_get_flowlabel(fl6) & r->flowlabel_mask) != r->flowlabel)
> b85: 23 90 c4 00 00 00 and 0xc4(%rax),%edx
> return 0;
> b8b: 45 31 c0 xor %r8d,%r8d
> if ((flowi6_get_flowlabel(fl6) & r->flowlabel_mask) != r->flowlabel)
> b8e: 81 e2 00 0f ff ff and $0xffff0f00,%edx
> b94: 3b 90 c0 00 00 00 cmp 0xc0(%rax),%edx
> b9a: 0f 85 34 ff ff ff jne ad4 <fib6_rule_match+0x34>
>
Powered by blists - more mailing lists