From patchwork Mon Oct 23 10:00:25 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: 116674 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4461095qgn; Mon, 23 Oct 2017 03:08:53 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QHrNSxTNGSGiiUPwJokCgm3Zqh1I5hWYRvTkAhhKCmOWaTEGiV4LWMN49KyGTnghNC7JZs X-Received: by 10.200.26.216 with SMTP id h24mr18626492qtk.175.1508753332995; Mon, 23 Oct 2017 03:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508753332; cv=none; d=google.com; s=arc-20160816; b=Yufzvut4IO1uGmRziYy7Rg/bFiueMfHtedQ7Xi7YRSRVtlJSQt1a0YYuFHYXeW5kp9 5RLHyxqfaf0/MK8PdGeDgQ3aTJjwGg+XvDlSAbYsRqrJJYIP6bSYhP5BNjbLzsfn9XJF aVrzcRmTEAQSsOVr3f3RG5q+hmZNx6OnYnlcWyk6aZqhNAd7qUhZWXUsPimSzsnEjIPv 5FYSrqsC9QXRyeoAw9qmAebpwbv/H1GanIewfQCXwjkiWC+dSkp7PWQcK95piXL9hA1j lHX0V6AeguTxrI8FIc+g6JSs9p7sois1MPPPPQJPEHL8DW2U2soAZaTr+OO6zdcAIeOQ AGsA== 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=X26cCZsFy6imcqGsD37dA96OQsYmWJZhxV5hFZBez44=; b=BvN6hN0GHo6lmycKHXe7AuVYyrLUFRA1XXbWJ3lrIff2WTbzclPRctDEiVoT5wmd5r 4c/ADmt/gZvVtaeWvpu/rhYmXiDuggEJOc/Ql5u/7PLeMb6rUu0y+5OVuPv5Y6I9ADw9 hDjauKtRg6UFpGjZkmqZoHcDF++J6ns0EnhQ3SML7Kf/XuuvJLQTZk8r8CLMn8WiFsQ7 k58/xnysMDBv5PcZcwCYC6BYV4MQa48MC0+til9SagcVIkVcbfDjmebhu56T19m9ofdu gJMcFs92sxyngwlZzUUeB+LExZIiFMcXmzlG5129Kev/PfZcSH4Ur94g0aWNLaZURGww ZaBQ== 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 q65si2743395qkl.482.2017.10.23.03.08.52; Mon, 23 Oct 2017 03:08:52 -0700 (PDT) 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 A119861D29; Mon, 23 Oct 2017 10:08:52 +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 339AA61C9E; Mon, 23 Oct 2017 10:04:03 +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 C67026185A; Mon, 23 Oct 2017 10:03:56 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 095C761BBA for ; Mon, 23 Oct 2017 10:00:43 +0000 (UTC) Received: from mxback1g.mail.yandex.net (mxback1g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:162]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 90B8D181303 for ; Mon, 23 Oct 2017 13:00:41 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Sh53t6twKm-0fSO5Ush; Mon, 23 Oct 2017 13:00:41 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id AuFEnCuXXk-0fRaZlV8; Mon, 23 Oct 2017 13:00:41 +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, 23 Oct 2017 13:00:25 +0300 Message-Id: <1508752825-12017-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508752825-12017-1-git-send-email-odpbot@yandex.ru> References: <1508752825-12017-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 242 Subject: [lng-odp] [PATCH API-NEXT v2 3/3] validation: packet: add calls to ones complement 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 Call ones complement functions. Actual validation of correctness of the sum is to be done, when an implementation exist which sets the sum on packet input. Signed-off-by: Petri Savolainen --- /** Email created from pull request 242 (psavol:next-checksum-metadata) ** https://github.com/Linaro/odp/pull/242 ** Patch: https://github.com/Linaro/odp/pull/242.patch ** Base sha: ec6510b33e8b96d6d6670efb9dc3c9101baed6c6 ** Merge commit sha: 19351e51472213736d5301c666500b459ccabff7 **/ test/validation/api/packet/packet.c | 13 +++++++++++++ test/validation/api/pktio/pktio.c | 22 ++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 431444cf3..340b81159 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -30,6 +30,9 @@ static odp_bool_t segmentation_supported = true; odp_packet_t test_packet, segmented_test_packet; +/* Dummy global variable to avoid compiler optimizing out API calls */ +uint64_t odp_valid_test_packet_u64; + static struct udata_struct { uint64_t u64; uint32_t u32; @@ -512,6 +515,15 @@ void packet_test_basic_metadata(void) CU_ASSERT(odp_packet_input(pkt) == ODP_PKTIO_INVALID); CU_ASSERT(odp_packet_input_index(pkt) < 0); + /* Packet was not received from a packet IO, shouldn't have ones + * complement calculated. */ + CU_ASSERT(odp_packet_has_ones_comp(pkt) == 0); + + /* Usually odp_packet_ones_comp() is not called here. This ensures that + * the function exists. */ + if (odp_packet_has_ones_comp(pkt)) + odp_valid_test_packet_u64 += odp_packet_ones_comp(pkt); + odp_packet_flow_hash_set(pkt, UINT32_MAX); CU_ASSERT(odp_packet_has_flow_hash(pkt)); CU_ASSERT(odp_packet_flow_hash(pkt) == UINT32_MAX); @@ -1112,6 +1124,7 @@ static void _packet_compare_inflags(odp_packet_t pkt1, odp_packet_t pkt2) COMPARE_HAS_INFLAG(pkt1, pkt2, tcp); COMPARE_HAS_INFLAG(pkt1, pkt2, sctp); COMPARE_HAS_INFLAG(pkt1, pkt2, icmp); + COMPARE_HAS_INFLAG(pkt1, pkt2, ones_comp); COMPARE_HAS_INFLAG(pkt1, pkt2, flow_hash); COMPARE_HAS_INFLAG(pkt1, pkt2, ts); diff --git a/test/validation/api/pktio/pktio.c b/test/validation/api/pktio/pktio.c index 720707358..e3f9ab22a 100644 --- a/test/validation/api/pktio/pktio.c +++ b/test/validation/api/pktio/pktio.c @@ -48,6 +48,9 @@ static int num_ifaces; interface that just become up.*/ static bool wait_for_network; +/* Dummy global variable to avoid compiler optimizing out API calls */ +uint64_t odp_valid_test_pktio_u64; + /** local container for pktio attributes */ typedef struct { const char *name; @@ -661,10 +664,21 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b, CU_ASSERT(num_rx == num_pkts); for (i = 0; i < num_rx; ++i) { - CU_ASSERT_FATAL(rx_pkt[i] != ODP_PACKET_INVALID); - CU_ASSERT(odp_packet_input(rx_pkt[i]) == pktio_b->id); - CU_ASSERT(odp_packet_has_error(rx_pkt[i]) == 0); - odp_packet_free(rx_pkt[i]); + odp_packet_t pkt = rx_pkt[i]; + + CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); + CU_ASSERT(odp_packet_input(pkt) == pktio_b->id); + CU_ASSERT(odp_packet_has_error(pkt) == 0); + + /* Dummy read to ones complement in case pktio has set it */ + if (odp_packet_has_ones_comp(pkt)) + odp_valid_test_pktio_u64 += odp_packet_ones_comp(pkt); + + /* Dummy read to flow hash in case pktio has set it */ + if (odp_packet_has_flow_hash(pkt)) + odp_valid_test_pktio_u64 += odp_packet_flow_hash(pkt); + + odp_packet_free(pkt); } }