From patchwork Thu Nov 9 12:00:30 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: 118443 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6507626qgn; Thu, 9 Nov 2017 04:09:11 -0800 (PST) X-Google-Smtp-Source: AGs4zMbEn8QWFnNXJyrKpj0Lj7yNgS97h5qAygQheKw/rSYnsK8jjoH5hXz2vu0bBHTX24wxmGoL X-Received: by 10.200.52.118 with SMTP id v51mr353682qtb.266.1510229351411; Thu, 09 Nov 2017 04:09:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510229351; cv=none; d=google.com; s=arc-20160816; b=Cm41mni4QFtrXb7bRNehwht2ND4X+MbIaJ/rqn2v0eF9b1zacg1OhYc24fWu08id1k sW3wtmTZUm26MvEJIkwVVAaiiSTvuNuNG2uEIMvXZ1W9FZEY4vSq8l7S9B7sdfCOaNCW PynRQEsGaozSlwb6IiBk8bFbdWLLTQQvcyjtuRyI0R7q4NxE7n9gnzgWv5vdMGN8u2ux K30KA5snmlQKKWHRafWO0KNS/SJyR2Gs9ZD8/dk0e5mdbVKGIl5Khgz4NPOgvet0zZV+ Y9XR7OVmweyoeg06g+j/oAHwtqHWckbG/cJDEQ2XcfPBc1qOsNnP5ROtH8FsQhgJWPzG 1Pxw== 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=EtCubTEUBIY994DERzl0a+hZ+gS3IshTRsNMNMrD6e4=; b=EATdxwvpxlILJcRlGwPrm6QzC6U0CiqWDSesk8ES5S8qkNo48nRxSK4yvHXX3oXMFi haI/rP/RKHUEEu/af/3JQMCCn3RRYZBT74pC1coAmabHfZdNGCCqiIl9ik7rTx/gKqRD S0f8mCLhf+4yoIiV5ZyjSdcB8ai/wEXlGeNNyNmDAWzSHyDV5MNyQhgdHkuDlvElyWO/ urKvl7h2FjzkMBXWOd5Xmr//47avXRSm6ahKBHPc3sQHM1XHalQ76N3lu9wLJff3YEgP Au/Nm1Z9R9m8RMDg34b2mYKde6hXrx7eTH/IPsuCg6LZ4Plr8J3fzO4Q28PW0ClXxLu3 USgQ== 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 41si3161614qtb.359.2017.11.09.04.09.11; Thu, 09 Nov 2017 04:09:11 -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 1F03C609FD; Thu, 9 Nov 2017 12:09:11 +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 0217061019; Thu, 9 Nov 2017 12:03: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 435D860C1C; Thu, 9 Nov 2017 12:02:30 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 406C861007 for ; Thu, 9 Nov 2017 12:00:34 +0000 (UTC) Received: from mxback5j.mail.yandex.net (mxback5j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10e]) by forward103j.mail.yandex.net (Yandex) with ESMTP id D657634C234F for ; Thu, 9 Nov 2017 15:00:32 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback5j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 8NVVj3UTvl-0Wm8IEQ5; Thu, 09 Nov 2017 15:00:32 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id InclDaSPWn-0WneXvQD; Thu, 09 Nov 2017 15: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: Thu, 9 Nov 2017 15:00:30 +0300 Message-Id: <1510228830-21766-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510228830-21766-1-git-send-email-odpbot@yandex.ru> References: <1510228830-21766-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 242 Subject: [lng-odp] [PATCH API-NEXT v4 3/3] validation: packet: add call 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 function. 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: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 02aa905e6f9d4be66e19ccdb577e40a293be2902 **/ test/validation/api/packet/packet.c | 6 ++++++ test/validation/api/pktio/pktio.c | 25 +++++++++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 37550a2f5..dc99395c5 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -503,6 +503,7 @@ void packet_test_basic_metadata(void) { odp_packet_t pkt = test_packet; odp_time_t ts; + odp_packet_data_range_t range; CU_ASSERT_PTR_NOT_NULL(odp_packet_head(pkt)); CU_ASSERT_PTR_NOT_NULL(odp_packet_data(pkt)); @@ -512,6 +513,11 @@ 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. */ + odp_packet_ones_comp(pkt, &range); + CU_ASSERT(range.length == 0); + 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); diff --git a/test/validation/api/pktio/pktio.c b/test/validation/api/pktio/pktio.c index 720707358..004379cd8 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 */ +static volatile uint64_t test_pktio_dummy_u64; + /** local container for pktio attributes */ typedef struct { const char *name; @@ -661,10 +664,24 @@ 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_data_range_t range; + uint16_t sum; + 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 */ + sum = odp_packet_ones_comp(pkt, &range); + if (range.length > 0) + test_pktio_dummy_u64 += sum; + + /* Dummy read to flow hash in case pktio has set it */ + if (odp_packet_has_flow_hash(pkt)) + test_pktio_dummy_u64 += odp_packet_flow_hash(pkt); + + odp_packet_free(pkt); } }