From patchwork Mon Oct 9 08:00:06 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: 115182 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2274969qgn; Mon, 9 Oct 2017 01:02:24 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAhmyfpSAiLKtZ+qvsF2l/+PQHgw1ADwEdFhg0ogs1D07d9IJaiMYA7aLsulkBxCf8uozBn X-Received: by 10.36.4.67 with SMTP id 64mr12116050itb.94.1507536144905; Mon, 09 Oct 2017 01:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507536144; cv=none; d=google.com; s=arc-20160816; b=Qbv0nUHgUb7oyxkrQU9XNwVTUwUP9AZ/52ZZRcx7vSjeXLZD576D96yngNgDaEiT2e 328qwuIYH4Lo0rYKfNFlYwLcbvKrGpnDBmyXkTymHiJFmrxcoBzQX0Lm3kWL6LKfQ701 iqs3IE2Yht+sJT5i9kvb7fqtD4jQY+HtkxiJWl0D3e2O7pBKU3qSyKeOtrlZS4ZO0vCQ gE2M923+KEYiQlciv98wlBGbk6No3G0KogzOy/MCtDbaxAF08ldMdhZdCRCa68Y78stQ JWSTh9eMQf8aZyXDJr+ikbkel3ZtI5cZt/Ty+gztAxOr3T+8Dj8CdkOayH00/OOPM7EZ aeNQ== 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=rIhqJZIeKamumcAtZdaMvILt0jAy2fzhcN+I0oEWXz8=; b=CJ3k20xhU0HUibCPleQxO/DfH3960pwiRS8rG41/SZ6bfoj5nZT6Qu0NLv5azq18CV 6EqqhLJH71/1oV62uNJ8TtalvD3QgzvJCinnv5yKLK3PsRoxwL3H+vT2wZqwN+PnDpZm 9vZp+KTnEn+3658+UyZgjiVPCJ06c0pwuyq0pUcC6dtlQKr8cC7M3ma0fIaF4pn9jRF+ qQaY1wKMCu6cJeNwvwhv+RkEw/zmeW1x8pUrwp7qbOwX7N+kjz46AXiEtqBHRIj/Mk3v klqs2JX/Gyhf+h4GSa1khVDdYlZAcLU9y55mqg6350RO2liLXbgxVa/bD++LGQrHX9lk +gSg== 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 u16si6544447ite.165.2017.10.09.01.02.24; Mon, 09 Oct 2017 01:02:24 -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 6F53060BF1; Mon, 9 Oct 2017 08:02:24 +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, RCVD_IN_MSPIKE_H4, 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 B1EB160B15; Mon, 9 Oct 2017 08:01:11 +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 DDF7860B1A; Mon, 9 Oct 2017 08:01:08 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 4CB4F60BD7 for ; Mon, 9 Oct 2017 08:00:32 +0000 (UTC) Received: from mxback3j.mail.yandex.net (mxback3j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10c]) by forward100j.mail.yandex.net (Yandex) with ESMTP id D5DC35D81342 for ; Mon, 9 Oct 2017 11:00:30 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback3j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id kLb1ZslV4w-0Us46e06; Mon, 09 Oct 2017 11:00:30 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Hx5vntxKDE-0Ufa9ago; Mon, 09 Oct 2017 11:00:30 +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, 9 Oct 2017 11:00:06 +0300 Message-Id: <1507536007-26802-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507536007-26802-1-git-send-email-odpbot@yandex.ru> References: <1507536007-26802-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 224 Subject: [lng-odp] [PATCH API-NEXT v3 1/2] linux-gen: chksum: correct uninitialized variable bug 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 Initialize left_over variable, so that the pad byte is initialized to zero. Signed-off-by: Petri Savolainen --- /** Email created from pull request 224 (psavol:next-ip-checksum) ** https://github.com/Linaro/odp/pull/224 ** Patch: https://github.com/Linaro/odp/pull/224.patch ** Base sha: bf803098eb1518dfb9e719071256fe22700b8c72 ** Merge commit sha: 947cdf84dbec4659ea3c2059299e6a60d314e438 **/ platform/linux-generic/odp_chksum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_chksum.c b/platform/linux-generic/odp_chksum.c index 349bdaf46..a792971ef 100644 --- a/platform/linux-generic/odp_chksum.c +++ b/platform/linux-generic/odp_chksum.c @@ -22,7 +22,7 @@ uint16_t odp_chksum_ones_comp16(const void *p, uint32_t len) /* Add left-over byte, if any */ if (len > 0) { - uint16_t left_over; + uint16_t left_over = 0; *(uint8_t *)&left_over = *(const uint8_t *)data; sum += left_over; From patchwork Mon Oct 9 08:00:07 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: 115183 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2275623qgn; Mon, 9 Oct 2017 01:03:15 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDrh4TW95jilAzoSZt8JfNNODiVE6c3LCvB1IelFRM880dzFsZMIVm71GjsMAWNr2UkFAC0 X-Received: by 10.36.22.13 with SMTP id a13mr12544444ita.69.1507536194710; Mon, 09 Oct 2017 01:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507536194; cv=none; d=google.com; s=arc-20160816; b=nXqeoOb6c7nSFfrxpmWZHy7ank+q7g8eRAf0et4SC7JaWpZ2EoJS1+2bu2xIKttU8x ZK9jktzOj+uEKgkwIQQEWaQ+wADbFUn9+CR2p2ViErlvDACqiei3IY52QrzTNL3EX5C8 fTUyyqbznAcLuJ875FM6/CvYIQQHvC7DreWqglr5N53nz26/Hnbe3kFHFXuAE8F7/HEY i63Ev2sM4jLtAvcAdI/9MuBQp3ojDL7oLpcPIZ7kovAPwAfGb+rr5TLMTzRKSzhXGR08 UtANNjHh1BhCypmdV34n3YoJSCsk3mqqWoqyUqjVp3RElZE8QV4N81YOaY3gUmIG43TQ +KnA== 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=Y2Wm1kSJpOCHejIaPHzsJoXezkZYSD8FhQAXx8SDAdc=; b=AV9ag8fxb7qnlY47yuR49cidafhg4WpBMOIediM6e2GGus2s5KKr4tQyC2S7aDKPl+ J3szwLXGtf0FIgO57iKPjijYOXcZF+kiXXKch/eC98OvVfDr+fb/o7Mjw6TBrltSVzpn Jfcm2qb7OFhsqRL4Wn3uuUaTOP335BrqFULcSdU5mggjru/hq8oQYlQmBIPg/ndnM7N3 QBMDvAkMrUh83zAKRQuSRGraCHCHnn2w9J+gfG1dyDVG2K5NSXQg74Oqa3UdCvpRTj/d VCbhBH+jesa37I5K6ANVwjV0B2oUeBRHHlviWF1ub+sj455BZ3NlkHl3ER9akv7LKyF1 Oe1w== 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 66si5583599ioy.323.2017.10.09.01.03.14; Mon, 09 Oct 2017 01:03:14 -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 454E560C03; Mon, 9 Oct 2017 08:03:14 +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,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 2106760AF8; Mon, 9 Oct 2017 08:01: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 305A660B25; Mon, 9 Oct 2017 08:01:11 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id 09C3160AC8 for ; Mon, 9 Oct 2017 08:00:34 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward103p.mail.yandex.net (Yandex) with ESMTP id CA47A2183E14 for ; Mon, 9 Oct 2017 11:00:31 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id OK6ZFomYE7-0VvWpipa; Mon, 09 Oct 2017 11:00:31 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Hx5vntxKDE-0UfOTYkR; Mon, 09 Oct 2017 11:00:30 +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, 9 Oct 2017 11:00:07 +0300 Message-Id: <1507536007-26802-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507536007-26802-1-git-send-email-odpbot@yandex.ru> References: <1507536007-26802-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 224 Subject: [lng-odp] [PATCH API-NEXT v3 2/2] validation: chksum: add long UDP packet test 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 test for a 1517 bytes long UDP packet. The checksum is checked using both a single call as well as multiple consecutive calls (to emulate checksumming over fragments). Signed-off-by: Petri Savolainen --- /** Email created from pull request 224 (psavol:next-ip-checksum) ** https://github.com/Linaro/odp/pull/224 ** Patch: https://github.com/Linaro/odp/pull/224.patch ** Base sha: bf803098eb1518dfb9e719071256fe22700b8c72 ** Merge commit sha: 947cdf84dbec4659ea3c2059299e6a60d314e438 **/ test/common_plat/validation/api/chksum/chksum.c | 213 +++++++++++++++++++++++- test/common_plat/validation/api/chksum/chksum.h | 1 + 2 files changed, 212 insertions(+), 2 deletions(-) diff --git a/test/common_plat/validation/api/chksum/chksum.c b/test/common_plat/validation/api/chksum/chksum.c index b05f3bf01..de98b74a0 100644 --- a/test/common_plat/validation/api/chksum/chksum.c +++ b/test/common_plat/validation/api/chksum/chksum.c @@ -14,7 +14,7 @@ #define NUM_UDP 4 #define MAX_UDP_LEN 128 -uint8_t ip_hdr_test_vect[NUM_IP_HDR][IP_HDR_LEN] ODP_ALIGNED(4) = { +static uint8_t ip_hdr_test_vect[NUM_IP_HDR][IP_HDR_LEN] ODP_ALIGNED(4) = { { 0x45, 0x00, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11, 0xAB, 0x33, 0xC0, 0xA8, 0x2C, 0xA2, 0xC0, 0xA8, 0x21, 0x99 }, @@ -38,7 +38,7 @@ struct udp_test_vect_s { uint8_t data[MAX_UDP_LEN]; }; -struct udp_test_vect_s udp_test_vect[NUM_UDP] ODP_ALIGNED(4) = { +static struct udp_test_vect_s udp_test_vect[NUM_UDP] ODP_ALIGNED(4) = { {.len = 38, .data = { 0x00, 0x11, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x1A, 0xFF, 0x3C, @@ -77,6 +77,172 @@ struct udp_test_vect_s udp_test_vect[NUM_UDP] ODP_ALIGNED(4) = { } } }; +/* Correct checksum in network byte order is 0xF3, 0x96 */ +#define UDP_LONG_CHKSUM odp_be_to_cpu_16(0xF396) + +/* Number of padding bytes in the end of the array */ +#define UDP_LONG_PADDING 11 + +/* Long UDP packet with pseudo header. Checksum field is set to zero. + * The array contains padding, so that a possible overrun is more likely + * detected (overrun bytes are not all zeros). */ +static uint8_t udp_test_vect_long[] ODP_ALIGNED(4) = { + 0x00, 0x11, 0x05, 0xED, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x3F, 0x00, 0x3F, 0x05, 0xED, 0x00, 0x00, + 0x0B, 0x2C, 0x9C, 0x06, 0x07, 0xF3, 0x51, 0x05, 0xF7, 0xA7, + 0xF4, 0x24, 0xBB, 0x2F, 0x19, 0xBB, 0x23, 0xB4, 0x99, 0x50, + 0x69, 0x10, 0x34, 0xAD, 0xFF, 0x83, 0x7B, 0x36, 0x8B, 0xA8, + 0xEE, 0x7A, 0x31, 0xA8, 0x61, 0x08, 0x10, 0xAE, 0xA4, 0x84, + 0x0F, 0x9B, 0x62, 0xFA, 0xD9, 0xFA, 0x4A, 0x71, 0x26, 0x36, + 0x6D, 0xC4, 0x3D, 0x0A, 0xE7, 0xAD, 0xB6, 0x3A, 0xC2, 0x23, + 0x85, 0x81, 0x17, 0xE6, 0x34, 0xCA, 0x76, 0x58, 0x70, 0xA3, + 0x88, 0x8E, 0xC7, 0xEE, 0xF3, 0xA7, 0xB0, 0xD9, 0x7E, 0x5C, + 0xCC, 0x11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E, 0xEF, 0xEE, 0xEE, 0xDE, 0xAD, 0xBE, 0xEF +}; + /* Test ones complement sum with IPv4 headers */ void chksum_ones_complement_ip(void) { @@ -106,9 +272,52 @@ void chksum_ones_complement_udp(void) } } +/* Test ones complement sum with a long pseudo UDP packet */ +void chksum_ones_complement_udp_long(void) +{ + int i; + uint16_t sum, res; + uint32_t offset, frag_sum; + uint32_t len = sizeof(udp_test_vect_long) - UDP_LONG_PADDING; + int num_frag = 7; + uint32_t frag_len = len / num_frag; + + /* Checksum all data */ + sum = odp_chksum_ones_comp16(udp_test_vect_long, len); + res = ~sum; + + CU_ASSERT(res == UDP_LONG_CHKSUM); + + /* Checksum data in fragments */ + frag_sum = 0; + offset = 0; + + for (i = 0; i < num_frag; i++) { + if (i == num_frag - 1) + frag_len = len - offset; + + /* Check that test passes 16 bit aligned addresses */ + CU_ASSERT_FATAL((offset % 2) == 0); + + frag_sum += odp_chksum_ones_comp16(&udp_test_vect_long[offset], + frag_len); + + offset += frag_len; + } + + /* Fold 32-bit sum to 16 bits */ + while (frag_sum >> 16) + frag_sum = (frag_sum & 0xffff) + (frag_sum >> 16); + + res = ~frag_sum; + + CU_ASSERT(res == UDP_LONG_CHKSUM); +} + odp_testinfo_t chksum_suite[] = { ODP_TEST_INFO(chksum_ones_complement_ip), ODP_TEST_INFO(chksum_ones_complement_udp), + ODP_TEST_INFO(chksum_ones_complement_udp_long), ODP_TEST_INFO_NULL, }; diff --git a/test/common_plat/validation/api/chksum/chksum.h b/test/common_plat/validation/api/chksum/chksum.h index 886f15c28..50ed66ee9 100644 --- a/test/common_plat/validation/api/chksum/chksum.h +++ b/test/common_plat/validation/api/chksum/chksum.h @@ -12,6 +12,7 @@ /* test functions: */ void chksum_ones_complement_ip(void); void chksum_ones_complement_udp(void); +void chksum_ones_complement_udp_long(void); /* test arrays: */ extern odp_testinfo_t chksum_suite[];