netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guillaume Nault <gnault@redhat.com>
To: Ido Schimmel <idosch@nvidia.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, dsahern@kernel.org,
	donald.hunter@gmail.com, horms@kernel.org, rostedt@goodmis.org,
	mhiramat@kernel.org, mathieu.desnoyers@efficios.com,
	petrm@nvidia.com
Subject: Re: [PATCH net-next 3/9] ipv6: fib_rules: Add flow label support
Date: Tue, 17 Dec 2024 20:10:39 +0100	[thread overview]
Message-ID: <Z2HMr//V3CvIMwxb@debian> (raw)
In-Reply-To: <Z2GXsiHPjUDGl6TU@shredder>

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>
> 


  reply	other threads:[~2024-12-17 19:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16 17:11 [PATCH net-next 0/9] net: fib_rules: Add flow label selector support Ido Schimmel
2024-12-16 17:11 ` [PATCH net-next 1/9] net: fib_rules: Add flow label selector attributes Ido Schimmel
2024-12-16 17:11 ` [PATCH net-next 2/9] ipv4: fib_rules: Reject flow label attributes Ido Schimmel
2024-12-16 17:11 ` [PATCH net-next 3/9] ipv6: fib_rules: Add flow label support Ido Schimmel
2024-12-17 13:59   ` Guillaume Nault
2024-12-17 15:24     ` Ido Schimmel
2024-12-17 19:10       ` Guillaume Nault [this message]
2024-12-19  3:05   ` Jakub Kicinski
2024-12-19  8:17     ` Ido Schimmel
2024-12-16 17:11 ` [PATCH net-next 4/9] net: fib_rules: Enable flow label selector usage Ido Schimmel
2024-12-16 17:11 ` [PATCH net-next 5/9] netlink: specs: Add FIB rule flow label attributes Ido Schimmel
2024-12-16 17:11 ` [PATCH net-next 6/9] ipv6: Add flow label to route get requests Ido Schimmel
2024-12-16 17:11 ` [PATCH net-next 7/9] netlink: specs: Add route flow label attribute Ido Schimmel
2024-12-16 17:12 ` [PATCH net-next 8/9] tracing: ipv6: Add flow label to fib6_table_lookup tracepoint Ido Schimmel
2024-12-16 17:12 ` [PATCH net-next 9/9] selftests: fib_rule_tests: Add flow label selector match tests Ido Schimmel
2024-12-16 17:16 ` [PATCH net-next 0/9] net: fib_rules: Add flow label selector support Ido Schimmel
2024-12-17 14:00 ` Guillaume Nault
2024-12-19 15:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z2HMr//V3CvIMwxb@debian \
    --to=gnault@redhat.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).