Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: Eric Dumazet <edumazet@google.com>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 2/2] net: optimize skb_postpull_rcsum()
Date: Fri, 3 Dec 2021 18:14:29 +0200	[thread overview]
Message-ID: <20211203161429.htqt4vuzd22rlwkf@skbuf> (raw)
In-Reply-To: <eb25fee06370430d8cd14e25dff5e653@AcuMS.aculab.com>

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?
If you want and if it helps, I can also help you reproduce this locally
using the dsa_loop mockup driver.

  reply	other threads:[~2021-12-03 16:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 20:24 [PATCH net-next 0/2] net: small csum optimizations Eric Dumazet
2021-11-24 20:24 ` [PATCH net-next 1/2] gro: optimize skb_gro_postpull_rcsum() Eric Dumazet
2021-11-24 20:24 ` [PATCH net-next 2/2] net: optimize skb_postpull_rcsum() Eric Dumazet
2021-11-25  9:41   ` David Laight
2021-11-25 13:32     ` Eric Dumazet
2021-11-25 14:29       ` David Laight
2021-12-02 13:10   ` Vladimir Oltean
2021-12-02 14:51     ` Eric Dumazet
2021-12-02 16:29       ` Vladimir Oltean
2021-12-02 19:32         ` Eric Dumazet
2021-12-02 20:37           ` Eric Dumazet
2021-12-02 21:07             ` Vladimir Oltean
2021-12-02 20:40           ` Vladimir Oltean
2021-12-02 20:58             ` Vladimir Oltean
2021-12-02 20:58             ` David Laight
2021-12-02 21:40               ` Vladimir Oltean
2021-12-03 14:51                 ` David Laight
2021-12-03 14:57                 ` David Laight
2021-12-03 16:14                   ` Vladimir Oltean [this message]
2021-12-03 16:30                     ` Eric Dumazet
2021-12-03 16:47                       ` David Laight
2021-12-03 16:58                         ` Eric Dumazet
2021-12-03 17:41                           ` David Laight
2021-12-02 15:06     ` David Laight
2021-12-02 15:22       ` Eric Dumazet
2021-11-26  5:20 ` [PATCH net-next 0/2] net: small csum optimizations 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=20211203161429.htqt4vuzd22rlwkf@skbuf \
    --to=olteanv@gmail.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.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