Subject: Re: [PATCH net-next 1/2] nfp: add ethtool flow steering callbacks

From: Simon Horman <[email-masked]>
Date: Mon, 20 Nov 2023 10:52:14 +0000

On Mon, Nov 20, 2023 at 10:18:13AM +0000, Yinjun Zhang wrote:
> On Monday, November 20, 2023 5:43 PM, Simon Horman wrote:
> <...>
> > > +     case TCP_V6_FLOW:
> > > +     case UDP_V6_FLOW:
> > > +     case SCTP_V6_FLOW:
> > > +             for (i = 0; i < 4; i++) {
> > > +                     fs->h_u.tcp_ip6_spec.ip6src[i] = entry->key.sip6[i];
> > > +                     fs->h_u.tcp_ip6_spec.ip6dst[i] = entry->key.dip6[i];
> > > +                     fs->m_u.tcp_ip6_spec.ip6src[i] = entry->msk.sip6[i];
> > > +                     fs->m_u.tcp_ip6_spec.ip6dst[i] = entry->msk.dip6[i];
> > > +             }
> > 
> > I think the above loop can be more succinctly be expressed using a single
> > memcpy(). For which I do see precedence in Intel drivers. Likewise
> > elsewhere in this patch-set.
> > 
> > I don't feel strongly about this, so feel free to take this suggestion,
> > defer it to later, or dismiss it entirely.
> 
> Thanks Simon. Louis did have same suggestion about this part. But
> since we have similar code below:
> ```
> for (i = 0; i < 4; i++) {
> 	entry->msk.sip6[i] = fs->m_u.tcp_ip6_spec.ip6src[i];
> 	entry->msk.dip6[i] = fs->m_u.tcp_ip6_spec.ip6dst[i];
> 	entry->key.sip6[i] = fs->h_u.tcp_ip6_spec.ip6src[i] & entry->msk.sip6[i];
> 	entry->key.dip6[i] = fs->h_u.tcp_ip6_spec.ip6dst[i] & entry->msk.dip6[i];
> }
> ```
> which can not be replaced by `memcpy`, so I decided to leave them as
> they are to keep consistency.
> So if you don't feel strongly and nobody else objects it, I'll leave it.

Hi Yinjun,

thanks for the clarification. I agree that we can leave this
if nobody else objects.

> 
> > 
> > > +             fs->h_u.tcp_ip6_spec.psrc = entry->key.sport;
> > > +             fs->h_u.tcp_ip6_spec.pdst = entry->key.dport;
> > > +             fs->m_u.tcp_ip6_spec.psrc = entry->msk.sport;
> > > +             fs->m_u.tcp_ip6_spec.pdst = entry->msk.dport;
> > > +             break;
> > 
> > ...