[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eb25fee06370430d8cd14e25dff5e653@AcuMS.aculab.com>
Date: Fri, 3 Dec 2021 14:57:04 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Vladimir Oltean' <olteanv@...il.com>
CC: Eric Dumazet <edumazet@...gle.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()
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)
Powered by blists - more mailing lists