From patchwork Thu Aug 24 12:00:08 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: 110897 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp5566666qge; Thu, 24 Aug 2017 05:07:44 -0700 (PDT) X-Received: by 10.55.109.134 with SMTP id i128mr8915731qkc.216.1503576464704; Thu, 24 Aug 2017 05:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503576464; cv=none; d=google.com; s=arc-20160816; b=TFiok4GHQV9XGv8KLA0uZtj8hJhMDAjELd/7OLGiwRopysZT9q1r6PYtmnGlRjo7nM Xev/J7MZOw3LeDff8tiCBn8mg/f9D/pZWElZ2nOMHKTZTUgF6l8/MQEpr2qZ7/JOd6J6 Pla6sJ4jjTclWFUGzm0rHTtdl6wLcPf7per1FvLGGy6mcYg/xu/4WFjVqjCHOuAwTQHF VeViLiIvjW9pnQ+QhjIKugP4j8vBzjBUq87b+uqlvl1ErcjqoL+yHX6D4jfqaNyVearA cQGfjk+dhqHd3HLlR/k8Y1Yi4DsjGEoVXBgcYi86jDXwS4y0v2r+pLb8wKUSZzBbbpmc sATg== 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=48lvi7zSMvW1mu6FzP0LTQFUO37gcqAt0DdFHnIYcyw=; b=ujHc64HASIe/pxDeXYTrYP7YPB2lKrgBSxLMfXnv0RyWwbNIyd/WshEvLQdJyKHFP7 wlNq4F1he9JdlppyY22qlo8WmnMnqJZAjfZPahttbf6cypxZunAONncufxszmGACjECl Gd48bMg0vRoDGFkB+zGx/gP8aBqIMn6S/68O/ySOiAcv1SyEojBt5ngzzDgbdTbmDuOv ZpmIjkwuCprBY9+HjQSzQIVgB0vnPpJiLiPjAi4XBB8Mxt6TKKcoKBmHW2XaK7cTnNUj ktwKHxz6X9zFsxLs1XkTEuIX8VRhwH152Xv1COc7/lyRJixtYdAe8oadaL1OvTAlV0jJ lCIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f67si3948703qkf.521.2017.08.24.05.07.44; Thu, 24 Aug 2017 05:07:44 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 5A03A64490; Thu, 24 Aug 2017 12:07:44 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 4FE06644C6; Thu, 24 Aug 2017 12:02:02 +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 386C264464; Thu, 24 Aug 2017 12:01:34 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 4AC6E6445C for ; Thu, 24 Aug 2017 12:00:31 +0000 (UTC) Received: from mxback8o.mail.yandex.net (mxback8o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::22]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 7754D1341474 for ; Thu, 24 Aug 2017 15:00:24 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback8o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id an0A0pzbGD-0OJmtndj; Thu, 24 Aug 2017 15:00:24 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 1AcxP7MKsj-0OwWFLvO; Thu, 24 Aug 2017 15:00:24 +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, 24 Aug 2017 15:00:08 +0300 Message-Id: <1503576008-15890-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503576008-15890-1-git-send-email-odpbot@yandex.ru> References: <1503576008-15890-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 132 Subject: [lng-odp] [PATCH v5 3/3] helper: chksum: verify odph_ipv4_chksum_*() functions 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 Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 132 (lumag:fix-checksum) ** https://github.com/Linaro/odp/pull/132 ** Patch: https://github.com/Linaro/odp/pull/132.patch ** Base sha: 8705e548f330d23173283fcca62f4afb835a6380 ** Merge commit sha: e256e0810a3feee8b1b91b8d61f21bdfdd339dff **/ helper/test/chksum.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/helper/test/chksum.c b/helper/test/chksum.c index 1beae47f..4a957c32 100644 --- a/helper/test/chksum.c +++ b/helper/test/chksum.c @@ -108,9 +108,17 @@ int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) ODPH_IPV4HDR_LEN); ip->proto = ODPH_IPPROTO_UDP; ip->id = odp_cpu_to_be_16(1); - ip->chksum = 0; odp_packet_has_ipv4_set(test_packet, 1); - odph_ipv4_csum_update(test_packet); + if (odph_ipv4_csum_update(test_packet) < 0) + status = -1; + + if (!odph_ipv4_csum_valid(test_packet)) + status = -1; + + printf("IP chksum = 0x%x\n", odp_be_to_cpu_16(ip->chksum)); + + if (odp_be_to_cpu_16(ip->chksum) != 0x3965) + status = -1; /* udp */ odp_packet_l4_offset_set(test_packet, ODPH_ETHHDR_LEN