From patchwork Fri May 6 17:27:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shmulik Ladkani X-Patchwork-Id: 619377 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3r1dz32mSLz9t3k for ; Sat, 7 May 2016 03:28:15 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=i9NLFIsa; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758581AbcEFR2G (ORCPT ); Fri, 6 May 2016 13:28:06 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34168 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758212AbcEFR2D (ORCPT ); Fri, 6 May 2016 13:28:03 -0400 Received: by mail-wm0-f68.google.com with SMTP id n129so9759398wmn.1 for ; Fri, 06 May 2016 10:28:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=aw4DVkd1oTCtKr4vG17o7NUDLc2YRVJRKbjbugrzidI=; b=i9NLFIsaT2y94s0SsHyP1gyt2YMqJxL5jFegEwTXoo3QGKnzeE/EFHRNTtmzEgfDnM xaUgJlLZMsVC1a9LqoWHJeuzNQiGcFxSVVQWu57wrLvq0UMYHdI+oCr0Ur5YtLnM13nT uZJGv4atYMBrd+7sxpqNHDiasJlzCabu77ss6TXN4rVrsaz/TnqgrTp5rhiuHfQY3M/d bP04UDFnNPmCkfJ8cpSncRoPH568GmOE/WDmqhWcuMTby1r8DpdibF4UxevT1jIlq4hR Qj06i8Oq3PwwYsn0LpZlUpSBJTXTvopD8l7+p02c5gOy+Almn+ZQhG72xCTFKHL0fr/5 vQ9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aw4DVkd1oTCtKr4vG17o7NUDLc2YRVJRKbjbugrzidI=; b=UAx0CLTaDe2bjELiU04T0CJ7gc2TwAvquFox+pwEiKbhtuDuG7vUL5aMlj0Nph5aG0 tolexWu8k2D0D96HJbEXz+bEGnyG2k4yZDT3WOwCPn1ZDtvay/LZ4ZZYJ/VUAoEh5GwG R02RBeeIAlS4H8yJyS+AcMTntVnUk+Uyz4VCRgy3XHrwzAMG57SfXe/nr3kg3uLcBMXD 9ZgDmNbNEFhhYnn6V3ip2fICLaaRcLgDeU/Qh+cObbfle2rqyIU+WT/ydB9rZxoDAkIt 8RiLnG9BXfjjtWepTEgvZXMQuHZPCdWtcWJTMw3C2MeYeLR/RcLwzOxj6J9vikYNvVFB KIqw== X-Gm-Message-State: AOPr4FW+ItzMSqRSrKlHvS77P5MP68eJRg7YVOxxYq2k8bdLSJKrwO9Xr6yUr59kpU3lbw== X-Received: by 10.194.88.201 with SMTP id bi9mr20887283wjb.147.1462555681949; Fri, 06 May 2016 10:28:01 -0700 (PDT) Received: from halley.home ([94.230.86.111]) by smtp.gmail.com with ESMTPSA id m140sm9386914wma.24.2016.05.06.10.28.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 May 2016 10:28:01 -0700 (PDT) From: Shmulik Ladkani To: "David S . Miller" , netdev@vger.kernel.org, Alexander Duyck Cc: Edward Cree , shmulik.ladkani@gmail.com Subject: [PATCH v2] Documentation/networking: more accurate LCO explanation Date: Fri, 6 May 2016 20:27:43 +0300 Message-Id: <1462555663-10216-1-git-send-email-shmulik.ladkani@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In few places the term "ones-complement sum" was used but the actual meaning is "the complement of the ones-complement sum". Also, avoid enclosing long statements with underscore, to ease readability. Signed-off-by: Shmulik Ladkani Acked-by: Edward Cree --- v2: - Fixed one more occurence where "complement of" was missing - Got rid of unreadable underscore wrapped statements Took the liberty having the underscore removal as part of this patch. Let me know if you feel this needs a patch split. Documentation/networking/checksum-offloads.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Documentation/networking/checksum-offloads.txt b/Documentation/networking/checksum-offloads.txt index de2a327766..56e3686124 100644 --- a/Documentation/networking/checksum-offloads.txt +++ b/Documentation/networking/checksum-offloads.txt @@ -69,18 +69,18 @@ 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 + 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 - (csum_start + csum_offset). + 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 complement of + 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 the arithmetic.