From patchwork Mon Nov 20 15:00:12 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: 119289 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3963869qgn; Mon, 20 Nov 2017 07:02:47 -0800 (PST) X-Google-Smtp-Source: AGs4zMZQdB6q+ivvH8SdGlt3t08YyAQ8OgG9Tag500x9GQPUIFt+ggyWhMP7c/eN9lMiHurLaebX X-Received: by 10.200.37.61 with SMTP id 58mr22116118qtm.187.1511190167168; Mon, 20 Nov 2017 07:02:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511190167; cv=none; d=google.com; s=arc-20160816; b=mcx1BxnoeNR9DVqTrrsuKoH0tBXympH0DzwXahZmzKopiUY5wWrcpL2NY/X7VcpQwY 0nTSZo/tLhwdd4qr9O6gspnjFMZe+4beddAshCulvL0hu9Gdgy/144ApnHhe/1jvB/XA qQZjNeMG6J7nGdjWHDXJd5AHbWmQNWzvmzW2BmKnl3S0/Ei+42/EJD7JjSoL4xmONmGH WLh3GdpWBJYiQRvetiTHFKwqYOwbm8Jo/yOnF3UB7WI4dGmqh6yBrf65OLlQm2kpYOQU 0f10IZ7e98iP2Kb4qzjSCtbAMSFrohKIP3lc8U+5KcgUuWPhX1g0nFSfRAVnjFa3Q/nL Psag== 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=XxqpPFsWk3feZhhvn5XtYyV57fhtrLIfecBKCjMZcds=; b=RHS0kX8/kt16HxljDbx9jn5kDP40grYcFyJyvVK6cOahYWx9KRCBkvVazKLH00YMKf fapu9NDLVVbr45Agpgem3VojVv5Sc/82iIBdPIjGxABthq9HDo6ibZ4cckgKOX7cykov HEXejmtZA2/mHp07n7PcMs7hZUInyYgZM9dVjzd4zvJeqzX38iB+xQg9SLwQbc45HznA 9ftuzOqU3kI+lvHbqbcrApzgwQH0Zt0pzl1fULZSal5Jb1xiwlUcDhmx+VZatDLi29cU kwZBmONTbaEse7/C9B5bRaqQmA0n22kbkNV7yowJOi8SDYq/nubDUnRltSYZ3LHSqtya tCzg== 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 144si2626000qki.207.2017.11.20.07.02.46; Mon, 20 Nov 2017 07:02:47 -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 76CE3608E6; Mon, 20 Nov 2017 15:02:46 +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 831216084B; Mon, 20 Nov 2017 15:00:52 +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 5063860695; Mon, 20 Nov 2017 15:00:29 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id B15446038B for ; Mon, 20 Nov 2017 15:00:22 +0000 (UTC) Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward103p.mail.yandex.net (Yandex) with ESMTP id 5BCEB2182D31 for ; Mon, 20 Nov 2017 18:00:21 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id vafllc4jHg-0LreuDMA; Mon, 20 Nov 2017 18:00:21 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id hPBG8CmQZ0-0KBK543e; Mon, 20 Nov 2017 18:00:20 +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: Mon, 20 Nov 2017 18:00:12 +0300 Message-Id: <1511190013-8520-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511190013-8520-1-git-send-email-odpbot@yandex.ru> References: <1511190013-8520-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 280 Subject: [lng-odp] [PATCH API-NEXT v3 2/3] helper: use new odp checksum API 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: Dmitry Eremin-Solenikov Use odp_chksum_ones_comp16 which may be platform-optimized. This removes now unnecessary odph_cksum() function. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 280 (lumag:chksum) ** https://github.com/Linaro/odp/pull/280 ** Patch: https://github.com/Linaro/odp/pull/280.patch ** Base sha: d4b364849c4abb4c71e0c5260e1a793ebb8dc97d ** Merge commit sha: 9fda6f107cef0c4074880995a90b30cbeac27ce8 **/ helper/include/odp/helper/chksum.h | 27 --------------------------- helper/include/odp/helper/ip.h | 2 +- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/helper/include/odp/helper/chksum.h b/helper/include/odp/helper/chksum.h index 1bf950c8b..ed2de91fb 100644 --- a/helper/include/odp/helper/chksum.h +++ b/helper/include/odp/helper/chksum.h @@ -34,33 +34,6 @@ typedef enum { ODPH_CHKSUM_RETURN /**< Don't generate or verify chksum */ } odph_chksum_op_t; -/** - * Checksum - * - * @param buffer calculate chksum for buffer - * @param len buffer length - * - * @return checksum value in network order - */ -static inline odp_u16sum_t odph_chksum(void *buffer, int len) -{ - uint16_t *buf = (uint16_t *)buffer; - uint32_t sum = 0; - uint16_t result; - - for (sum = 0; len > 1; len -= 2) - sum += *buf++; - - if (len == 1) - sum += *(unsigned char *)buf; - - sum = (sum >> 16) + (sum & 0xFFFF); - sum += (sum >> 16); - result = ~sum; - - return (__odp_force odp_u16sum_t) result; -} - /** * General Purpose TCP/UDP checksum function * diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h index c6eb9d767..b96aab280 100644 --- a/helper/include/odp/helper/ip.h +++ b/helper/include/odp/helper/ip.h @@ -125,7 +125,7 @@ static inline int odph_ipv4_csum(odp_packet_t pkt, if (odp_unlikely(res < 0)) return res; - *chksum = odph_chksum(buf, nleft); + *chksum = ~odp_chksum_ones_comp16(buf, nleft); return 0; }