On Thu, Oct 15, 2026 at 12:00:52AM +0200, Andrea Mayer wrote:
> On Mon, 12 Oct 2026 16:17:41 +0800
> Hangbin Liu <[email protected]> wrote:
> 
> > [snip]
> > > +static bool seg6_flv8986_enabled(__u32 fops)
> > > +{
> > > + return fops & SEG6_LOCAL_FLV8986_SUPP_OPS;
> > > +}
> > > +
> > > +/* check whether the NEXT-C-SID processing has to be used for the packet,
> > > + * instead of the RFC8986 flavors set for the given SRv6 End* behavior
> > > + * instance.
> > > + *
> > > + * This function returns:
> > > + *  - true, when the packet has to go through the NEXT-C-SID processing;
> > > + *  - false, when NEXT-C-SID is not configured or the packet has to be
> > > + *    processed on the basis of the RFC8986 flavors.
> > > + */
> > > +static bool seg6_use_next_csid(struct sk_buff *skb,
> > > +                        const struct seg6_flavors_info *finfo)
> > > +{
> > > + const struct in6_addr *addr;
> > > + __u32 fops = finfo->flv_ops;
> > > +
> > > + if (!seg6_next_csid_enabled(fops))
> > > +         return false;
> > > +
> > > + addr = &ipv6_hdr(skb)->daddr;
> > > +
> > > + /* NEXT-C-SID and the RFC8986 flavors combine according to the
> > > +  * DA.Argument (see RFC9800, sections 4.1.1 and 4.1.7):
> > > +  *
> > > +  *       DA.Argument   RFC8986 flavors   processing
> > > +  *   (1) != 0          any               NEXT-C-SID only, SL unchanged
> > > +  *   (2) == 0          none              the behavior, e.g. End
> > > +  *   (3) == 0          one or more       the behavior with its flavors,
> > > +  *                                       e.g. End with PSP
> > > +  *
> > > +  * In (2), the packet still goes through the NEXT-C-SID processing,
> > > +  * which runs the behavior (e.g. End) when the DA.Argument is zero.
> > > +  */
> > > + return !seg6_flv8986_enabled(fops) ||
> > > +        !seg6_next_csid_is_arg_zero(addr, finfo);
> > 
> > nit: based on the comment, maybe we can change the order to
> > 
> >     return !seg6_next_csid_is_arg_zero(addr, finfo) ||
> >            !seg6_flv8986_enabled(fops);
> > 
> > No need to change if there is no new version patch.
> > 
> > > +}
> > 
> > [snip]
> 
> Hi Hangbin,
> 
> thanks for the review and for the suggestion. I would prefer to keep
> this order. The table in the comment is meant to describe the cases
> rather than the order of the checks. Since testing the 32-bit flavor
> mask can be cheaper than checking the DA.Argument, I just put the mask
> test first.
> 
> Let me know if you see it differently.

Yes, putting the mask test first makes sense to me.

Thanks
Hangbin

Reply via email to