From patchwork Thu Nov 9 12:00:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 118440 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6505219qgn; Thu, 9 Nov 2017 04:07:02 -0800 (PST) X-Google-Smtp-Source: AGs4zMatvN5+YrBU12tAaKuZYIv2MrXgqu99RZncFI76TNf3sDMpA0tN3jwAavXIV+LCy+kZRSk9 X-Received: by 10.55.53.76 with SMTP id c73mr333418qka.147.1510229222287; Thu, 09 Nov 2017 04:07:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510229222; cv=none; d=google.com; s=arc-20160816; b=SoarK0MtxUp3pljwRpvsjBZu8UeRRIA64h+/YGqTdnzN3GABBc5qzIlCTMdUIx4lzv sbPe+RZ1K518TLHBmoZrbRav59lyrqKH3Xk7SnxVdrh3GJtSj/4toUjZzzxf6mdn4AlA 7kQ4rNqfmNHe9pw+9vn4AEadGag0WMPJgYZCgcrSYkTXmNH5toBBEb+Vhlbk8oqRRXCn 8o4cIG86GgV0jIHNo2ifwJE+d5UPv6ZH3QxwvsN1Odsff67UAMoyW6sMXgGJpNUUUYq6 6GNrGP69CSoBVZApKCiqXSru1muU1unVXhfjNfSbkAEOlcXO+Wr0XwCSTueme0dolSuU n1bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=ra9FjLvFahMNqMzvGhRgUZg9V91zO87rrqBJPspLGC0=; b=WnuWRyQezpPsHEED+yAA7nEwdLvsSVDpK1Po9ik/ouQN6QB9KBmsCVG1y5ww3Tkmlh we5E6772l1HDBtHvqpc7LJBIUBeuG04BjMSeObsfxE+l3SFDrCF9+hjXH86sNTSG+c+E GgFFv1b/lZ6NM8FOBf8HTH8d3hdAYikPrbft+GENv5l0NjFsD5imJ+Iq9nvGDSZQaFeM PXI7LauG8RIlm6NjQR/J+uCCHTzXOr9MvqGItLiMUqTc5SAJAwl+Q7Zx9PkGd1IVrnRa w2rBz4aJ2l9LviRiTEZNf7GPrLtb+pfVf/HLFGdzAWu9aEEvD61gg1gmW6pFabTXymKe e/Dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id o13si417148qtg.227.2017.11.09.04.07.02; Thu, 09 Nov 2017 04:07:02 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id E54AF60D3C; Thu, 9 Nov 2017 12:07:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id E060F61001; Thu, 9 Nov 2017 12:02:48 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id AE05560CCA; Thu, 9 Nov 2017 12:02:25 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 0890F61003 for ; Thu, 9 Nov 2017 12:00:33 +0000 (UTC) Received: from mxback1o.mail.yandex.net (mxback1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1b]) by forward101o.mail.yandex.net (Yandex) with ESMTP id D781D134716C for ; Thu, 9 Nov 2017 15:00:31 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 5M4uwkOZiH-0V9eiIRg; Thu, 09 Nov 2017 15:00:31 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id InclDaSPWn-0VnOFb33; Thu, 09 Nov 2017 15:00:31 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 9 Nov 2017 15:00:28 +0300 Message-Id: <1510228830-21766-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510228830-21766-1-git-send-email-odpbot@yandex.ru> References: <1510228830-21766-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 242 Subject: [lng-odp] [PATCH API-NEXT v4 1/3] api: packet: ones complement sum X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Added packet metadata for ones complement sum over packet data. Some NICs calculate the sum during packet input (at least for IP fragments) and store the value into the packet descriptor. This offloads L4 checksum calculation for IP fragments as SW does not need sum all payload data, but just combine pre-calculated sums from packet descriptors and remove extra header fields from the sum. Signed-off-by: Petri Savolainen --- /** Email created from pull request 242 (psavol:next-checksum-metadata) ** https://github.com/Linaro/odp/pull/242 ** Patch: https://github.com/Linaro/odp/pull/242.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 02aa905e6f9d4be66e19ccdb577e40a293be2902 **/ include/odp/api/spec/packet.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index fac7790ba..8e1575600 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1437,6 +1437,26 @@ void odp_packet_l3_chksum_insert(odp_packet_t pkt, int insert); void odp_packet_l4_chksum_insert(odp_packet_t pkt, int insert); /** + * Ones' complement sum of packet data + * + * Returns 16-bit ones' complement sum that was calculated over a portion of + * packet data during a packet processing operation (e.g. packet input or + * IPSEC offload). The data range is output with 'range' parameter, and usually + * includes IP payload (L4 headers and payload). When 'range.length' is zero, + * the sum has not been calculated. In case of odd number of bytes, + * calculation uses a zero byte as padding at the end. The sum may be used as + * part of e.g. UDP/TCP checksum checking, especially with IP fragments. + * + * @param pkt Packet handle + * @param[out] range Data range of the sum (output). The calculation started + * from range.offset and included range.length bytes. When + * range.length is zero, the sum has not been calculated. + * + * @return Ones' complement sum over the data range + */ +uint16_t odp_packet_ones_comp(odp_packet_t pkt, odp_packet_data_range_t *range); + +/** * Packet flow hash value * * Returns the hash generated from the packet header. Use