[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iKk=DZEbwAeaborF-Q5pE9=Jahc0TP1_wk59s2eqB0o1A@mail.gmail.com>
Date: Fri, 3 Dec 2021 08:30:26 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: Vladimir Oltean <olteanv@...il.com>
Cc: David Laight <David.Laight@...lab.com>,
Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 2/2] net: optimize skb_postpull_rcsum()
On Fri, Dec 3, 2021 at 8:14 AM Vladimir Oltean <olteanv@...il.com> wrote:
>
> On Fri, Dec 03, 2021 at 02:57:04PM +0000, David Laight wrote:
> > From: Vladimir Oltean
> > > Sent: 02 December 2021 21:40
> > ...
> > > >
> > > > Try replacing both ~ with -.
> > > > So replace:
> > > > skb->csum = ~csum_partial(start, len, ~skb->csum);
> > > > with:
> > > > skb->csum = -csum_partial(start, len, -skb->csum);
> > > >
> > > > That should geneate ~0u instead 0 (if I've got my maths right).
> > >
> > > Indeed, replacing both one's complement operations with two's complement
> > > seems to produce correct results (consistent with old code) in all cases
> > > that I am testing with (ICMP, TCP, UDP). Thanks!
> >
> > You need to generate (or persuade Eric to generate) a patch.
> > I don't have the right source tree.
> >
> > Any code that does ~csum_partial() is 'dubious' unless followed
> > by a check for 0.
> > The two's compliment negate save the conditional - provided the
> > offset of 1 can be added in earlier.
> >
> > David
> >
> > -
> > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> > Registration No: 1397386 (Wales)
> >
>
> Eric, could you please send a patch with this change?
Sure, I will do this today, after more testing.
> If you want and if it helps, I can also help you reproduce this locally
> using the dsa_loop mockup driver.
No need, thanks !
Powered by blists - more mailing lists