netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <tom@herbertland.com>
To: David Laight <David.Laight@aculab.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Yadu Kishore <kyk.segfault@gmail.com>,
	David Miller <davem@davemloft.net>,
	Network Development <netdev@vger.kernel.org>
Subject: Re: [PATCH v2] net: Make skb_segment not to compute checksum if network controller supports checksumming
Date: Sun, 22 Mar 2020 12:53:50 -0700	[thread overview]
Message-ID: <CALx6S342XSFnZqFJ_jMKuAshSg0g-gcj3eSerADvWi14t+gCiw@mail.gmail.com> (raw)
In-Reply-To: <e8b84bcaee634b53bee797aa041824a4@AcuMS.aculab.com>

On Fri, Mar 6, 2020 at 9:12 AM David Laight <David.Laight@aculab.com> wrote:
>
> From: Eric Dumazet
> > Sent: 05 March 2020 17:20
> >
> > On 3/5/20 9:00 AM, David Laight wrote:
> > > From: Willem de Bruijn
> > >> Sent: 05 March 2020 16:07
> > > ..
> > >> It seems do_csum is called because csum_partial_copy executes the
> > >> two operations independently:
> > >>
> > >> __wsum
> > >> csum_partial_copy(const void *src, void *dst, int len, __wsum sum)
> > >> {
> > >>         memcpy(dst, src, len);
> > >>         return csum_partial(dst, len, sum);
> > >> }
> > >
> > > And do_csum() is superbly horrid.
> > > Not the least because it is 32bit on 64bit systems.
> >
> > There are many versions, which one is discussed here ?
> >
> > At least the current one seems to be 64bit optimized.
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5777eaed566a1d63e344d3dd
> > 8f2b5e33be20643e
>
> I was looking at the generic one in $(SRC)/lib/checksum.c.
>
> FWIW I suspect the fastest code on pre sandy bridge 64bit intel cpus
> (where adc is 2 clocks) is to do a normal 'add', shift the carries
> into a 64bit register and do a software 'popcnt' every 512 bytes.
> That may run at 8 bytes/clock + the popcnt.

A while back, I had proposed an optimized x86 checksum function using
unrolled addq a while back https://lwn.net/Articles/679137/. Also,
this tries to optimize from small checksum like over header when doing
skb_postpull_rcsum.

Tom

>
>         David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)

  parent reply	other threads:[~2020-03-22 19:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04  5:55 TCP checksum not offloaded during GSO Yadu Kishore
2020-02-05 21:43 ` Willem de Bruijn
2020-02-21  5:13   ` [PATCH] net: Make skb_segment not to compute checksum if network controller supports checksumming Yadu Kishore
2020-02-23  2:41     ` Willem de Bruijn
2020-02-28  5:24       ` Yadu Kishore
2020-02-28 14:30         ` Willem de Bruijn
2020-02-28 20:01           ` David Miller
2020-03-02  6:51             ` [PATCH v2] " Yadu Kishore
2020-03-02  8:42               ` Yadu Kishore
2020-03-02 15:19                 ` David Laight
2020-03-03  9:15                   ` Yadu Kishore
2020-03-03  9:56                     ` David Laight
2020-03-05  6:32                       ` Yadu Kishore
2020-03-05 16:06                         ` Willem de Bruijn
2020-03-05 17:00                           ` David Laight
2020-03-05 17:19                             ` Eric Dumazet
2020-03-06 17:12                               ` David Laight
2020-03-13  6:36                                 ` Yadu Kishore
2020-03-13 13:57                                   ` Willem de Bruijn
2020-03-13 14:04                                     ` David Laight
2020-03-13 18:05                                   ` David Miller
2020-03-17  8:38                                     ` [PATCH v3] " Yadu Kishore
2020-03-22  3:06                                       ` David Miller
2020-03-22 14:40                                       ` Willem de Bruijn
2020-03-23 20:00                                       ` David Miller
2020-03-22 19:53                                 ` Tom Herbert [this message]
2020-03-23  9:15                                   ` [PATCH v2] " David Laight
2020-02-06 12:13 ` TCP checksum not offloaded during GSO David Laight

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=CALx6S342XSFnZqFJ_jMKuAshSg0g-gcj3eSerADvWi14t+gCiw@mail.gmail.com \
    --to=tom@herbertland.com \
    --cc=David.Laight@aculab.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=kyk.segfault@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).