[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CCBF46D@AcuExch.aculab.com>
Date: Thu, 7 Jan 2016 17:22:51 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Edward Cree' <ecree@...arflare.com>,
David Miller <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-net-drivers@...arflare.com" <linux-net-drivers@...arflare.com>,
"Tom Herbert" <tom@...bertland.com>
Subject: RE: [PATCH v2 net-next 1/5] net: local checksum offload for
encapsulation
From: Edward Cree
> Sent: 07 January 2016 17:12
> The arithmetic properties of the ones-complement checksum mean that a
> correctly checksummed inner packet, including its checksum, has a ones
> complement sum depending only on whatever value was used to initialise
> the checksum field before checksumming (in the case of TCP and UDP,
> this is the ones complement sum of the pseudo header, complemented).
> Consequently, if we are going to offload the inner checksum with
> CHECKSUM_PARTIAL, we can compute the outer checksum based only on the
> packed data not covered by the inner checksum, and the initial value of
> the inner checksum field.
Isn't it even simpler than that?
The checksum of the inner packet (including its header) is ~0 (ie 0).
So the checksum of the whole packet (for the outer header) is the same
as that of the packet down to the start of the inner header.
David
Powered by blists - more mailing lists