netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Documentation/networking: more accurate LCO explanation
@ 2016-05-06 15:57 Shmulik Ladkani
  2016-05-06 16:12 ` Edward Cree
  2016-05-06 16:29 ` Alexander Duyck
  0 siblings, 2 replies; 4+ messages in thread
From: Shmulik Ladkani @ 2016-05-06 15:57 UTC (permalink / raw)
  To: David S . Miller, netdev; +Cc: Edward Cree, shmulik.ladkani

In few places the term "ones-complement sum" was used but the actual
meaning is "the complement of the ones-complement sum".

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
---

 I assume readers interpret the term "ones-complement sum" as the sum
 using one's complement arithmentic, without the final bitwise
 complement of sum's result.
 Hence I added "the complement of" where applicable.

 Documentation/networking/checksum-offloads.txt | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Documentation/networking/checksum-offloads.txt b/Documentation/networking/checksum-offloads.txt
index de2a327766..9567200e1f 100644
--- a/Documentation/networking/checksum-offloads.txt
+++ b/Documentation/networking/checksum-offloads.txt
@@ -69,17 +69,17 @@ LCO: Local Checksum Offload
 LCO is a technique for efficiently computing the outer checksum of an
  encapsulated datagram when the inner checksum is due to be offloaded.
 The ones-complement sum of a correctly checksummed TCP or UDP packet is
- equal to the sum of the pseudo header, because everything else gets
- 'cancelled out' by the checksum field.  This is because the sum was
+ equal to the complement of the sum of the pseudo header, because everything
+ else gets 'cancelled out' by the checksum field.  This is because the sum was
  complemented before being written to the checksum field.
 More generally, this holds in any case where the 'IP-style' ones complement
  checksum is used, and thus any checksum that TX Checksum Offload supports.
 That is, if we have set up TX Checksum Offload with a start/offset pair, we
  know that _after the device has filled in that checksum_, the ones
  complement sum from csum_start to the end of the packet will be equal to
- _whatever value we put in the checksum field beforehand_.  This allows us
- to compute the outer checksum without looking at the payload: we simply
- stop summing when we get to csum_start, then add the 16-bit word at
+ the complement of _whatever value we put in the checksum field beforehand_.
+ This allows us to compute the outer checksum without looking at the payload:
+ we simply stop summing when we get to csum_start, then add the 16-bit word at
  (csum_start + csum_offset).
 Then, when the true inner checksum is filled in (either by hardware or by
  skb_checksum_help()), the outer checksum will become correct by virtue of
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Documentation/networking: more accurate LCO explanation
  2016-05-06 15:57 [PATCH] Documentation/networking: more accurate LCO explanation Shmulik Ladkani
@ 2016-05-06 16:12 ` Edward Cree
  2016-05-06 16:29 ` Alexander Duyck
  1 sibling, 0 replies; 4+ messages in thread
From: Edward Cree @ 2016-05-06 16:12 UTC (permalink / raw)
  To: Shmulik Ladkani, David S . Miller, netdev

On 06/05/16 16:57, Shmulik Ladkani wrote:
> In few places the term "ones-complement sum" was used but the actual
> meaning is "the complement of the ones-complement sum".
>
> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Acked-by: Edward Cree <ecree@solarflare.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Documentation/networking: more accurate LCO explanation
  2016-05-06 15:57 [PATCH] Documentation/networking: more accurate LCO explanation Shmulik Ladkani
  2016-05-06 16:12 ` Edward Cree
@ 2016-05-06 16:29 ` Alexander Duyck
  2016-05-06 16:50   ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Alexander Duyck @ 2016-05-06 16:29 UTC (permalink / raw)
  To: Shmulik Ladkani; +Cc: David S . Miller, Netdev, Edward Cree

On Fri, May 6, 2016 at 8:57 AM, Shmulik Ladkani
<shmulik.ladkani@gmail.com> wrote:
> In few places the term "ones-complement sum" was used but the actual
> meaning is "the complement of the ones-complement sum".

Looks like there might still be a few minor corrections needed.
Comments inline below.

>
> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
> ---
>
>  I assume readers interpret the term "ones-complement sum" as the sum
>  using one's complement arithmentic, without the final bitwise
>  complement of sum's result.
>  Hence I added "the complement of" where applicable.
>
>  Documentation/networking/checksum-offloads.txt | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/networking/checksum-offloads.txt b/Documentation/networking/checksum-offloads.txt
> index de2a327766..9567200e1f 100644
> --- a/Documentation/networking/checksum-offloads.txt
> +++ b/Documentation/networking/checksum-offloads.txt
> @@ -69,17 +69,17 @@ LCO: Local Checksum Offload
>  LCO is a technique for efficiently computing the outer checksum of an
>   encapsulated datagram when the inner checksum is due to be offloaded.
>  The ones-complement sum of a correctly checksummed TCP or UDP packet is
> - equal to the sum of the pseudo header, because everything else gets
> - 'cancelled out' by the checksum field.  This is because the sum was
> + equal to the complement of the sum of the pseudo header, because everything
> + else gets 'cancelled out' by the checksum field.  This is because the sum was
>   complemented before being written to the checksum field.
>  More generally, this holds in any case where the 'IP-style' ones complement
>   checksum is used, and thus any checksum that TX Checksum Offload supports.
>  That is, if we have set up TX Checksum Offload with a start/offset pair, we
>   know that _after the device has filled in that checksum_, the ones
>   complement sum from csum_start to the end of the packet will be equal to
> - _whatever value we put in the checksum field beforehand_.  This allows us
> - to compute the outer checksum without looking at the payload: we simply
> - stop summing when we get to csum_start, then add the 16-bit word at
> + the complement of _whatever value we put in the checksum field beforehand_.

I don't really see the point of using an underscore before and after
that statement.  If it was only one or two words it might work for
emphasis but the statement is large enough that starting it with an
underscore just makes it harder to read.

> + This allows us to compute the outer checksum without looking at the payload:
> + we simply stop summing when we get to csum_start, then add the 16-bit word at
>   (csum_start + csum_offset).

You don't add the 16-bit word you add the compliment of the 16 bit word.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Documentation/networking: more accurate LCO explanation
  2016-05-06 16:29 ` Alexander Duyck
@ 2016-05-06 16:50   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-05-06 16:50 UTC (permalink / raw)
  To: alexander.duyck; +Cc: shmulik.ladkani, netdev, ecree

From: Alexander Duyck <alexander.duyck@gmail.com>
Date: Fri, 6 May 2016 09:29:56 -0700

> I don't really see the point of using an underscore before and after
> that statement.  If it was only one or two words it might work for
> emphasis but the statement is large enough that starting it with an
> underscore just makes it harder to read.

Agreed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-06 16:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-06 15:57 [PATCH] Documentation/networking: more accurate LCO explanation Shmulik Ladkani
2016-05-06 16:12 ` Edward Cree
2016-05-06 16:29 ` Alexander Duyck
2016-05-06 16:50   ` David Miller

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).