All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Tom Herbert <tom@herbertland.com>,
	davem@davemloft.net, netdev@vger.kernel.org
Cc: kernel-team@fb.com
Subject: Re: [PATCH net-next] net: Implement fast csum_partial for x86_64
Date: Mon, 4 Jan 2016 23:17:37 +0100	[thread overview]
Message-ID: <568AEF81.7070404@stressinduktion.org> (raw)
In-Reply-To: <1451863347-1832521-1-git-send-email-tom@herbertland.com>

On 04.01.2016 00:22, Tom Herbert wrote:
> Implement assembly routine for csum_partial for 64 bit x86. This
> primarily speeds up checksum calculation for smaller lengths such as
> those that are present when doing skb_postpull_rcsum when getting
> CHECKSUM_COMPLETE from device or after CHECKSUM_UNNECESSARY
> conversion.
>
> This implementation is similar to csum_partial implemented in
> checksum_32.S, however since we are dealing with 8 bytes at a time
> there are more cases for alignment and small lengths-- for those we
> employ jump tables.
>
> Testing:
>
> Verified correctness by testing arbitrary length buffer filled with
> random data. For each buffer I compared the computed checksum
> using the original algorithm for each possible alignment (0-7 bytes).
>
> Checksum performance:
>
> Isolating old and new implementation for some common cases:
>
>                          Old      New
> Case                    nsecs    nsecs    Improvement
> ---------------------+--------+--------+-----------------------------
> 1400 bytes (0 align)    194.4    176.7      9%    (Big packet)
> 40 bytes (0 align)      10.5     5.7       45%    (Ipv6 hdr common case)
> 8 bytes (4 align)       8.6      7.4       15%    (UDP, VXLAN in IPv4)
> 14 bytes (0 align)      10.4     6.5       37%    (Eth hdr)
> 14 bytes (4 align)      10.8     7.8       27%    (Eth hdr in IPv4)
>
> Signed-off-by: Tom Herbert <tom@herbertland.com>

I verified the implementation through tests and can also see a speed-up 
in almost all cases. Unfortunately _addcarry_u64 intrinsics and __int128 
for letting the compiler use adc instructions generated even worse code 
as the current implementation.

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

Thanks Tom!

  reply	other threads:[~2016-01-04 22:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-03 23:22 [PATCH net-next] net: Implement fast csum_partial for x86_64 Tom Herbert
2016-01-04 22:17 ` Hannes Frederic Sowa [this message]
2016-01-04 22:36 ` Eric Dumazet
2016-01-04 23:34   ` Tom Herbert
2016-01-04 23:51     ` Hannes Frederic Sowa
2016-01-04 23:52     ` Eric Dumazet
2016-01-04 23:58       ` Tom Herbert
2016-01-05  3:01 ` David Miller

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=568AEF81.7070404@stressinduktion.org \
    --to=hannes@stressinduktion.org \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=tom@herbertland.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.