From: Edward Cree <ecree@solarflare•com>
To: Tom Herbert <tom@herbertland•com>
Cc: Linux Kernel Network Developers <netdev@vger•kernel.org>,
David Miller <davem@davemloft•net>
Subject: Re: Checksum offload queries
Date: Thu, 10 Dec 2015 20:28:22 +0000 [thread overview]
Message-ID: <5669E066.8090703@solarflare.com> (raw)
In-Reply-To: <CALx6S34bg-iRMcTpGd+yw+CV1T7MxpWx+i_AdxXjsfTTnOGK4g@mail.gmail.com>
On 10/12/15 16:26, Tom Herbert wrote:
> It sounds like potentially interesting work. You'll probably want my patches that provider helper functions that allow a driver to verify that it can offload a checksum. We'll have to update those also to allow two checksums.
I have just realised something startling. Assuming the inner protocol uses the ones complement checksum in the way IP, UDP and TCP do, the outer checksum can be computed *without looking at the payload*. Why? Because the ones complement sum of (say) a correctly checksummed UDP datagram is simply the complement of the ones complement sum of the pseudo header. Similarly, the ones complement sum of a correctly checksummed IP header is zero.
Therefore, the outer checksum depends _only_ on the inner and outer pseudo headers and the encapsulation headers. For example, with UDP encapsulated in VXLAN, we have the following packet structure:
ETH IP UDP VXLAN inner-ETH inner-IP inner-UDP PAYLOAD
and the outer checksum equals
~([outer_pseudo] + [UDP] + [VXLAN] + [inner-ETH] + ~[inner_pseudo])
where [] denotes summation, and all addition is ones complement.
This can easily be computed in software, especially as the stack already has ~[inner_pseudo]: it's stored in the inner checksum field to help inner checksum offload.
Have I made a mistake in my ones-complement maths, or is outer checksum offload as unnecessary as IP header checksum offload?
next prev parent reply other threads:[~2015-12-10 20:28 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-07 15:39 Checksum offload queries Edward Cree
2015-12-07 17:29 ` Tom Herbert
2015-12-07 17:52 ` Tom Herbert
2015-12-08 16:03 ` Edward Cree
2015-12-08 16:43 ` Tom Herbert
2015-12-08 18:03 ` Edward Cree
2015-12-08 17:09 ` David Miller
2015-12-08 17:24 ` Edward Cree
2015-12-08 17:28 ` David Miller
2015-12-07 19:38 ` David Miller
2015-12-08 14:42 ` Edward Cree
2015-12-08 17:04 ` Tom Herbert
2015-12-09 1:56 ` Thomas Graf
2015-12-09 16:08 ` Tom Herbert
2015-12-09 22:29 ` Thomas Graf
2015-12-09 22:51 ` Tom Herbert
2015-12-09 23:13 ` Thomas Graf
2015-12-08 17:06 ` David Miller
2015-12-09 12:14 ` Edward Cree
2015-12-09 16:01 ` Tom Herbert
2015-12-09 17:28 ` Edward Cree
2015-12-09 17:31 ` David Laight
2015-12-09 18:00 ` Tom Herbert
2015-12-09 22:21 ` Thomas Graf
2015-12-09 22:42 ` Tom Herbert
2015-12-09 22:44 ` Thomas Graf
2015-12-10 15:49 ` Edward Cree
2015-12-10 16:26 ` Tom Herbert
2015-12-10 20:28 ` Edward Cree [this message]
2015-12-10 21:02 ` Rustad, Mark D
2015-12-14 15:11 ` [RFC PATCH net-next 0/2] Local checksum offload for VXLAN Edward Cree
2015-12-14 15:13 ` [PATCH 1/2] net: udp: local checksum offload for encapsulation Edward Cree
2015-12-14 17:16 ` Tom Herbert
2015-12-15 18:07 ` Edward Cree
2015-12-14 15:13 ` [PATCH 2/2] net: vxlan: enable local checksum offload on HW_CSUM devices Edward Cree
2015-12-11 23:50 ` Checksum offload queries Tom Herbert
2015-12-12 16:41 ` Sowmini Varadhan
2015-12-12 17:24 ` Tom Herbert
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=5669E066.8090703@solarflare.com \
--to=ecree@solarflare$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
--cc=tom@herbertland$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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