From patchwork Mon Nov 20 12:00:09 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: 119277 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3759340qgn; Mon, 20 Nov 2017 04:03:01 -0800 (PST) X-Google-Smtp-Source: AGs4zMbR+3i2KwqFhDg9ibP3GhpEBYMyOiYvk8KR0CPEOL3Ut4jO6gB/DMCuIEEth0q3bMd3ZAqT X-Received: by 10.200.42.14 with SMTP id k14mr20289710qtk.20.1511179381188; Mon, 20 Nov 2017 04:03:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511179381; cv=none; d=google.com; s=arc-20160816; b=QKq5Joam7nfjg0zhqqCqKEMdpy43EPbIUJmhtqlkSUmu+wkJL4YjYDU5q/Gc0KfQIM KO+D90S/Rrm0cCAXOUjymstwNmC/eufnSN8J/iHG2IqajrDC8oZd60DPZ/gf+sviENbB 8w2+EwHieC+gbTkoU/wXKUvrYR9xGs+gccuS1e0dskPmruuabVLZhvHTFq84RcNkjXJe iuhOd1vtRzfnzFfgGfAdT7rxV75njIwVvq0XIJmHjMPwNok3YgcSMPAxKX/AcSDskU3Z G7yEIMv4Nh589KJMBsAK5MnRhKMw5TLMLrVMXmOUFXsidfqRaB9Bsy2BUWCvA0q7Uw78 +ukA== 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=xL00N116sTtr9L4BuB8IuojUrCl9J35vglTwmyMf8i0=; b=xwRSH6H4vDaG86fGXksTPARjfMDbdIpdBKONyvFxHXnrLW3iOyy5JytzwoLdu+uqZc 3s9YeNm1u4TiMDFRmsdNmQIlCiZwZhbOFOBjIf754059dO5dRvG3t4AdB8sOYRoUiAYq I/P9UNFhMj1fM5j0Sv9Z5feeaC4rc88IGwUaqPT0xVYNFvdux/ESlWfJZQlC3OEzX1qd 0bQyNSOY9lmIexvRWqftxzOZ8TM4dIqlDDxUtq5YOvSWl5TLtioadkxCHzWjCNlE/T0M 1++TnpNzD03gs5LgTF3jirM0dnK5yqCNLKiIRZVGBY/NiNLIistJoq8VIyTXmuwMhOpX uUsg== 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 m4si2428722qkc.328.2017.11.20.04.03.00; Mon, 20 Nov 2017 04:03:01 -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 B8EA860607; Mon, 20 Nov 2017 12:03:00 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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 9CDCE60865; Mon, 20 Nov 2017 12:02:18 +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 9C102605D7; Mon, 20 Nov 2017 12:02:00 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 9632C60607 for ; Mon, 20 Nov 2017 12:00:14 +0000 (UTC) Received: from mxback9o.mail.yandex.net (mxback9o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::23]) by forward100p.mail.yandex.net (Yandex) with ESMTP id EFE145103596 for ; Mon, 20 Nov 2017 15:00:12 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback9o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 2uY4C2SXAC-0CjKEpoj; Mon, 20 Nov 2017 15:00:12 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id JQVU4f902k-0Cr8aplM; Mon, 20 Nov 2017 15:00:12 +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 15:00:09 +0300 Message-Id: <1511179210-31215-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511179210-31215-1-git-send-email-odpbot@yandex.ru> References: <1511179210-31215-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 280 Subject: [lng-odp] [PATCH API-NEXT v2 1/2] 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: ab5a9654088994bd3991d6f6435f8cab6a2cbd65 **/ 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; }