From patchwork Tue Nov 7 15:00:20 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: 118179 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp631248edm; Tue, 7 Nov 2017 07:05:48 -0800 (PST) X-Google-Smtp-Source: ABhQp+RWWwHeZTllzteDyKmqjnaKByZVsZsI80eKtMpwKMSQ5ane1h9/i5W/meBMxKe6wPL5HS1d X-Received: by 10.129.208.10 with SMTP id v10mr12000704ywi.192.1510067148451; Tue, 07 Nov 2017 07:05:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510067148; cv=none; d=google.com; s=arc-20160816; b=uuXOtpbRF0lZf4qGLrWjkRrM0fVRNPzWWdS4/9rSpGU8VWZ4PGtTiD+6jkN4+DLuM0 fYu2+yGekHcQkQapldAr4M6ATMjj+6Vf8NZaocupTZUawMMDcP4d1wdsRZRRKFSAVNjM HQ5uSlF9vR5fTiKnO8XQb9UEt/5SdzyoC5/aUSD5s2/Iv9NDeBBF9A6dGCho8irKWryN Qykd/HdQZv9i9AhgUwkm6Q3BgBu45a2oSLVElwoudsuudhoCQAdgjZ2cz7Q6f3p1H/5p hxCuMWFygCc442ur1EsLkzH2EhMl55Ob6SRhk/LXVZe39Jw+dPgorKCKcdyHJllmFeCh 9FZQ== 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=FDUg7I9GyzstH0lFydMOv/OC3iPsgXwTx2xvU+DOlLM=; b=naO/7818sVnbHXhhvsahZWrVrYGJ6bfzrrBgveI1jwSuhFxFXlrWn8z0YMiw3UVoBF En+Zd1Eyp4lFR5Zt5TFlfW0KIuhHOCannK+DHsQrzihXk8kxAY3jAijbHW7UR1hFW41/ qJiLI3MIo4wjMLluusG55a5s3uOeKfbTGD4wTDk7jgGYPVajuYRHwLvi0CzybMyxAqPB IAuOiAJhULhQ47A7DeApX7cApqMAHlAkgRSCGqV1RwArmKK0Mg+LtTEtYivsHohuvqFt gQyk/uaqBuS3sSdN4RNpbMDlTK91GslhCuEErFB0RtvC4qrwPfo9T5c4JwqGk0qPZlN/ Zk0w== 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 200si310633ywy.508.2017.11.07.07.05.48; Tue, 07 Nov 2017 07:05:48 -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 0BB4F60A79; Tue, 7 Nov 2017 15:05:48 +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 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 28FEA60C6A; Tue, 7 Nov 2017 15:01:17 +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 5BAE560D73; Tue, 7 Nov 2017 15:01:14 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id D541560A79 for ; Tue, 7 Nov 2017 15:00:23 +0000 (UTC) Received: from mxback2g.mail.yandex.net (mxback2g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:163]) by forward103o.mail.yandex.net (Yandex) with ESMTP id B4332588280E for ; Tue, 7 Nov 2017 18:00:22 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback2g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Nn5fEzCsDJ-0MIW7WrX; Tue, 07 Nov 2017 18:00:22 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7O1nyguxgE-0Mv8fm0r; Tue, 07 Nov 2017 18:00:22 +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: Tue, 7 Nov 2017 18:00:20 +0300 Message-Id: <1510066821-31264-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510066821-31264-1-git-send-email-odpbot@yandex.ru> References: <1510066821-31264-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 280 Subject: [lng-odp] [PATCH API-NEXT v1 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. 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: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 93032be4dd8c5d534c9898a54df6cb7977522c80 **/ helper/include/odp/helper/chksum.h | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/helper/include/odp/helper/chksum.h b/helper/include/odp/helper/chksum.h index 1bf950c8b..f8d05236a 100644 --- a/helper/include/odp/helper/chksum.h +++ b/helper/include/odp/helper/chksum.h @@ -44,21 +44,7 @@ typedef enum { */ 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; + return ~odp_chksum_ones_comp16(buffer, len); } /** From patchwork Tue Nov 7 15:00:21 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: 118181 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp632742edm; Tue, 7 Nov 2017 07:07:00 -0800 (PST) X-Google-Smtp-Source: ABhQp+SK8YurLhslsNj3I471gvlTPlXMW8Pk23bt5tMDjNJ5wqMSSCaqgGvH/x0ZW3VNq/dR32Bu X-Received: by 10.37.122.193 with SMTP id v184mr12140805ybc.270.1510067220137; Tue, 07 Nov 2017 07:07:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510067220; cv=none; d=google.com; s=arc-20160816; b=pGuy7qnTSRMQM2cZu2tKEPhr2eyI2ie4eIJJQ6xE3cyXxhndWN5a+fsjMj4LnIZU9A MvwsbFJUwScfVHHISXwsX0gehywZfLCjCzL/oQ6Rtvy/LZ+BAjV2n9NsemCMJNGJ29bS eRzBt/w98Et3HrXWlN4OCuWYjUNSbInNBM70/6SBQN6Si4T1UROd8xSHr1FpTPdGvFox uRVcok4Y9h4hskz0pcA8amuxYV+NjCX4PKCR3EO1Onn+XEOUr5VXssmsot83ieNMr90m uRjAUPsjxPrqkqlqtKaV3wGPtWmtQ6csQQCksoALW6AebOclXjZiSy/AniPXPm75x9oi 2sig== 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=qyQCq/Dhgki2awUdGy8Q6U8uns+IqjYGaQPdRIWoerw=; b=m7wAWfTskIDX6zV9jkq7U/kBJrG6MVTGXrHYZQQ+RFklyC3Jep2tOIuM3dZEBWQRvO 6ASL//aNfrMmqd4lNYLnqQf8tylTdFCLHkjAGKP1eQig7vp5TnL3dNeAHZq9UbcrOezS D++Of1vx5Lyjj2e3m9PkXPLQ2Gza75Wg5t/FTXEthokLjnB1SKLyxsb3MnaVm0hJPnrK TVG79T/sN/Z6iSKFMCCD+FI3T1WS/PRKhgHPKM8F66Vdqg1NoWsExYQk0q2nuFSDKXNO C8euItrZFFQbm/LyIU53OH93f5ozSnkdPz52cYgioszUCPk9C7KtJI34CVWODIT2+GV4 7FZg== 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 z184si7384ywb.372.2017.11.07.07.06.59; Tue, 07 Nov 2017 07:07:00 -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 C32A660C4B; Tue, 7 Nov 2017 15:06:59 +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 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 CF00C60D73; Tue, 7 Nov 2017 15:01:47 +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 E5BCD60FFF; Tue, 7 Nov 2017 15:01:39 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id 023BF60BDF for ; Tue, 7 Nov 2017 15:00:25 +0000 (UTC) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward104o.mail.yandex.net (Yandex) with ESMTP id 4C4F67036FE for ; Tue, 7 Nov 2017 18:00:23 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id x6pYM525J1-0NmaAdc4; Tue, 07 Nov 2017 18:00:23 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7O1nyguxgE-0Mv82aR3; Tue, 07 Nov 2017 18:00:22 +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: Tue, 7 Nov 2017 18:00:21 +0300 Message-Id: <1510066821-31264-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510066821-31264-1-git-send-email-odpbot@yandex.ru> References: <1510066821-31264-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 280 Subject: [lng-odp] [PATCH API-NEXT v1 2/2] linux-gen: ipsec: 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. 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: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 93032be4dd8c5d534c9898a54df6cb7977522c80 **/ platform/linux-generic/odp_ipsec.c | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index e57736c2a..b67cd3158 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -7,6 +7,7 @@ #include "config.h" #include +#include #include @@ -101,34 +102,6 @@ static odp_ipsec_packet_result_t *ipsec_pkt_result(odp_packet_t packet) return &odp_packet_hdr(packet)->ipsec_ctx; } -/** - * Checksum - * - * @param buffer calculate chksum for buffer - * @param len buffer length - * - * @return checksum value in network order - */ -static inline -odp_u16sum_t _odp_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; -} - static inline int _odp_ipv4_csum(odp_packet_t pkt, uint32_t offset, _odp_ipv4hdr_t *ip, @@ -148,7 +121,7 @@ static inline int _odp_ipv4_csum(odp_packet_t pkt, if (odp_unlikely(res < 0)) return res; - *chksum = _odp_chksum(buf, nleft); + *chksum = ~odp_chksum_ones_comp16(buf, nleft); return 0; }