From patchwork Fri Oct 20 10:00:27 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: 116476 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1506605qgn; Fri, 20 Oct 2017 03:12:56 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QxpOX7ghKIbiHN+sXGWu36BiyfNwL4hC71gBjuwe0wciyuO4sRY+pMtB9pjt+bNUOI0CDa X-Received: by 10.36.138.66 with SMTP id v63mr1704283itd.86.1508494376121; Fri, 20 Oct 2017 03:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508494376; cv=none; d=google.com; s=arc-20160816; b=ygRHlzJ3tZByAgEFQgZ+2ztRb73k8yADiqKrKFLnw+sbHMp+NNF45vCgT3bZYRd//h qJcJJ6+aBjN9StglKuw4GrRJUEMPRKWIKIOVPfENPtBkGFGj+kriduI8K85PXx8I/dZm Df0eMOgpoHJcJWNA4rejHAL2WQyZkuX9O+NA11DTIZd2jJ0HMgshb1UzHcBQjTsVGqZP GNUAj1ngT/2l+IuSo4t/trmSteRBYUtYfyXKoB9HpfIrNyFRcc4HGuvA26/p1UxGc8jF I2NPaKRZbNEP9sJHTLHagYf5gasrdwkBmI2L+C0l7WAiiNAUGBNEopYsoHjubWkRIhVR d0SQ== 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=+zAAOCZXKeBXVLvlk8lR3tCcyo7VogapH8v8IvI+Dq4=; b=pOsi1Sy6AtNuOru2F0QyzEHI+cPLuzQB7XRGXcZFR5Cr6U5fwQX7+BwjeqVVXdJDFT TLpYM1JJYNXVGOlz+z5GeVmAc4uZptkGr6Wuc1WPfEeWi3+s/D8aoaGP0fnbnn9iqq/u jPn6rLQnrwMgZ6Ax2NGzv1BsPe45hfkfRXIOItRDBuo0CgcHa0bz/oq4A8GA9dhB8C6q cGFo+1Vupgw6GYr4TkLuxKO6L+p5EOKXcaXQSVoTZDyJYplrBkAQm2FcB2fBb2gIIN/P lw0sTIPvztyzvUOIUrTgYjMwbEnpLvsC37JqLndxxnSqnYdvOkXFYT9H65tRYsG6ODcY 2fOQ== 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 64si862484its.40.2017.10.20.03.12.55; Fri, 20 Oct 2017 03:12:56 -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 ACE3060B5F; Fri, 20 Oct 2017 10:12:55 +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,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 1FF9960B25; Fri, 20 Oct 2017 10:02:53 +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 078E460C30; Fri, 20 Oct 2017 10:02:44 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 97AD660AC8 for ; Fri, 20 Oct 2017 10:00:34 +0000 (UTC) Received: from mxback14g.mail.yandex.net (mxback14g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:93]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 3EC6A430265A for ; Fri, 20 Oct 2017 13:00:33 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback14g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id SsWUbhOP0c-0XvOPgsq; Fri, 20 Oct 2017 13:00:33 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id mSOqmJENzI-0WmGOIEv; Fri, 20 Oct 2017 13:00:32 +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: Fri, 20 Oct 2017 13:00:27 +0300 Message-Id: <1508493628-25083-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508493628-25083-1-git-send-email-odpbot@yandex.ru> References: <1508493628-25083-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 242 Subject: [lng-odp] [PATCH API-NEXT v1 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: e3108af2f0b58c2ceca422b418439bba5de04b11 ** Merge commit sha: c389b738fd956b2cd0077d9e5425be938179fdb2 **/ test/common_plat/validation/api/packet/packet.c | 13 +++++++++++++ test/common_plat/validation/api/pktio/pktio.c | 22 ++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/test/common_plat/validation/api/packet/packet.c b/test/common_plat/validation/api/packet/packet.c index 6ed790091..58c1a3f09 100644 --- a/test/common_plat/validation/api/packet/packet.c +++ b/test/common_plat/validation/api/packet/packet.c @@ -25,6 +25,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; @@ -493,6 +496,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); @@ -1093,6 +1105,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/common_plat/validation/api/pktio/pktio.c b/test/common_plat/validation/api/pktio/pktio.c index 720707358..e3f9ab22a 100644 --- a/test/common_plat/validation/api/pktio/pktio.c +++ b/test/common_plat/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); } }