From patchwork Wed Feb 7 13:00:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 127185 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp464282ljc; Wed, 7 Feb 2018 05:19:50 -0800 (PST) X-Google-Smtp-Source: AH8x226DWDix/Ug1MA/uwiXa0cNbXeYz56jmqiJxCKz5HZJK06mRK+euhfE/xikbE6Xg4F8Zw3Py X-Received: by 10.55.41.141 with SMTP id p13mr8875981qkp.208.1518009589901; Wed, 07 Feb 2018 05:19:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518009589; cv=none; d=google.com; s=arc-20160816; b=EcriqCBj8g00K0n/p9TbhzyyMh0hyz4n8BZgOivImX12X3FBxK8K/Jtt2qD3008iZr DRWS/6UTq0j9nH5ExIdCW8627SKRfyZRvCeX6O4Q0kr3lAV7sKBi0sGCqNE6AB2x96LZ BN4IjvPA+DCnvJ5Dm7qEU3nCMjYb1d/r+wzcGPlv5Ect7UZdX7lxIRp94KMwhX0URuR/ dk5KO3gEZD1+5kJPQ1KtUJv5PKS+wC4pDxMQNPpcjN05zXIRMo/MChnhForKIUKXhCiu bRZTeMAGCiysJVV/TkJDjUdzjIbYlck+qLHIJvKzEY5Xiv4GJZ+ZG5Rn+jsMGWIuzbKO CPUA== 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=2HTHHXTqyzA1ng/7AyEqXo1eJCGEReeW8a71JPVa55Q=; b=Q5ykQiW3qTMkAe16/gvElhbH6WZt1hnRC9MbrirFTzwdJ0pZ+7ktsBMLnz82VRAJJj 8dz8KEBCfRlsEh1TIoU5JjOu9NdgWPC/ttsAaPmD8i2AZpG/aQBdjjncJhBkCm3TyQ5B V/PY6Xk7KFyxsTLSQWgtvqyWffcvW69BP1kV+gS9uRf1uQDJT5dDuJory1cGDvGLM+95 b8/9p2MGa2tu7g5v0n69+JgG5aE6/RqvIwR6JhTT0usTMlyHKA1nDdeIEaMNA3HLjoK3 L+uYgjlAgBO2GbKTcKQ3iFCD2PRks+308463vpn0enkGAPtRSm0dzyYStYy0hM9NNAM7 GEVA== 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 h129si235736qke.362.2018.02.07.05.19.49; Wed, 07 Feb 2018 05:19:49 -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 6A90B62808; Wed, 7 Feb 2018 13:19:49 +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_H2 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 45E71606D0; Wed, 7 Feb 2018 13:02:38 +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 1A33261701; Wed, 7 Feb 2018 13:00:50 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 07D036087C for ; Wed, 7 Feb 2018 13:00:21 +0000 (UTC) Received: from mxback1o.mail.yandex.net (mxback1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1b]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 900734305D3B for ; Wed, 7 Feb 2018 16:00:16 +0300 (MSK) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id BF9nzewC6i-0G8eLEV3; Wed, 07 Feb 2018 16:00:16 +0300 Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 2XfrietnG0-0GZOOlbq; Wed, 07 Feb 2018 16:00:16 +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: Wed, 7 Feb 2018 16:00:06 +0300 Message-Id: <1518008409-31750-12-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518008409-31750-1-git-send-email-odpbot@yandex.ru> References: <1518008409-31750-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 457 Subject: [lng-odp] [PATCH API-NEXT v3 11/14] validation: switch to using odp_packet_l4_type_set() 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 Use odp_packet_l4_type_set() instead of calling odp_packet_has_*_set(). Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 457 (lumag:packet-types) ** https://github.com/Linaro/odp/pull/457 ** Patch: https://github.com/Linaro/odp/pull/457.patch ** Base sha: e1175d5a69c65bb465022c9f1381c40fdb5c4069 ** Merge commit sha: 86fcf3650d33f5dd82712dda131fb8ca66a3bdf8 **/ .../api/classification/odp_classification_common.c | 4 +- test/validation/api/packet/packet.c | 60 ++++++++++++++++++++-- test/validation/api/traffic_mngr/traffic_mngr.c | 4 +- 3 files changed, 60 insertions(+), 8 deletions(-) diff --git a/test/validation/api/classification/odp_classification_common.c b/test/validation/api/classification/odp_classification_common.c index 191489126..7d6d24162 100644 --- a/test/validation/api/classification/odp_classification_common.c +++ b/test/validation/api/classification/odp_classification_common.c @@ -350,7 +350,7 @@ odp_packet_t create_packet(cls_packet_info_t pkt_info) udp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT); udp->length = odp_cpu_to_be_16(payload_len + ODPH_UDPHDR_LEN); udp->chksum = 0; - odp_packet_has_udp_set(pkt, 1); + odp_packet_l4_type_set(pkt, ODP_PROTO_L4_TYPE_UDP); if (odph_udp_tcp_chksum(pkt, ODPH_CHKSUM_GENERATE, NULL) != 0) { LOG_ERR("odph_udp_tcp_chksum failed\n"); return ODP_PACKET_INVALID; @@ -360,7 +360,7 @@ odp_packet_t create_packet(cls_packet_info_t pkt_info) tcp->dst_port = odp_cpu_to_be_16(CLS_DEFAULT_DPORT); tcp->hl = ODPH_TCPHDR_LEN / 4; tcp->cksm = 0; - odp_packet_has_tcp_set(pkt, 1); + odp_packet_l4_type_set(pkt, ODP_PROTO_L4_TYPE_TCP); if (odph_udp_tcp_chksum(pkt, ODPH_CHKSUM_GENERATE, NULL) != 0) { LOG_ERR("odph_udp_tcp_chksum failed\n"); return ODP_PACKET_INVALID; diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 00228b240..b3174b824 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -1052,10 +1052,6 @@ void packet_test_in_flags(void) TEST_INFLAG(pkt, ipfrag); TEST_INFLAG(pkt, ipopt); TEST_INFLAG(pkt, ipsec); - TEST_INFLAG(pkt, udp); - TEST_INFLAG(pkt, tcp); - TEST_INFLAG(pkt, sctp); - TEST_INFLAG(pkt, icmp); odp_packet_l3_type_set(pkt, ODP_PROTO_L3_TYPE_NONE); CU_ASSERT_EQUAL(odp_packet_l3_type(pkt), ODP_PROTO_L3_TYPE_NONE); @@ -1069,17 +1065,73 @@ void packet_test_in_flags(void) CU_ASSERT(!odp_packet_has_ipv4(pkt)); CU_ASSERT(!odp_packet_has_ipv6(pkt)); + odp_packet_l4_type_set(pkt, ODP_PROTO_L4_TYPE_NONE); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt), ODP_PROTO_L4_TYPE_NONE); + CU_ASSERT(!odp_packet_has_tcp(pkt)); + CU_ASSERT(!odp_packet_has_udp(pkt)); + CU_ASSERT(!odp_packet_has_sctp(pkt)); + CU_ASSERT(!odp_packet_has_icmp(pkt)); + odp_packet_l3_type_set(pkt, ODP_PROTO_L3_TYPE_IPV4); CU_ASSERT_EQUAL(odp_packet_l3_type(pkt), ODP_PROTO_L3_TYPE_IPV4); CU_ASSERT(!odp_packet_has_arp(pkt)); CU_ASSERT(odp_packet_has_ipv4(pkt)); CU_ASSERT(!odp_packet_has_ipv6(pkt)); + odp_packet_l4_type_set(pkt, ODP_PROTO_L4_TYPE_ICMPV4); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt), ODP_PROTO_L4_TYPE_ICMPV4); + CU_ASSERT(!odp_packet_has_tcp(pkt)); + CU_ASSERT(!odp_packet_has_udp(pkt)); + CU_ASSERT(!odp_packet_has_sctp(pkt)); + CU_ASSERT(odp_packet_has_icmp(pkt)); + + odp_packet_l4_type_set(pkt, ODP_PROTO_L4_TYPE_TCP); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt), ODP_PROTO_L4_TYPE_TCP); + CU_ASSERT(odp_packet_has_tcp(pkt)); + CU_ASSERT(!odp_packet_has_udp(pkt)); + CU_ASSERT(!odp_packet_has_sctp(pkt)); + CU_ASSERT(!odp_packet_has_icmp(pkt)); + + odp_packet_l4_type_set(pkt, ODP_PROTO_L4_TYPE_UDP); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt), ODP_PROTO_L4_TYPE_UDP); + CU_ASSERT(!odp_packet_has_tcp(pkt)); + CU_ASSERT(odp_packet_has_udp(pkt)); + CU_ASSERT(!odp_packet_has_sctp(pkt)); + CU_ASSERT(!odp_packet_has_icmp(pkt)); + + odp_packet_l4_type_set(pkt, ODP_PROTO_L4_TYPE_SCTP); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt), ODP_PROTO_L4_TYPE_SCTP); + CU_ASSERT(!odp_packet_has_tcp(pkt)); + CU_ASSERT(!odp_packet_has_udp(pkt)); + CU_ASSERT(odp_packet_has_sctp(pkt)); + CU_ASSERT(!odp_packet_has_icmp(pkt)); + + odp_packet_l4_type_set(pkt, ODP_PROTO_L4_TYPE_AH); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt), ODP_PROTO_L4_TYPE_AH); + CU_ASSERT(!odp_packet_has_tcp(pkt)); + CU_ASSERT(!odp_packet_has_udp(pkt)); + CU_ASSERT(!odp_packet_has_sctp(pkt)); + CU_ASSERT(!odp_packet_has_icmp(pkt)); + + odp_packet_l4_type_set(pkt, ODP_PROTO_L4_TYPE_ESP); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt), ODP_PROTO_L4_TYPE_ESP); + CU_ASSERT(!odp_packet_has_tcp(pkt)); + CU_ASSERT(!odp_packet_has_udp(pkt)); + CU_ASSERT(!odp_packet_has_sctp(pkt)); + CU_ASSERT(!odp_packet_has_icmp(pkt)); + odp_packet_l3_type_set(pkt, ODP_PROTO_L3_TYPE_IPV6); CU_ASSERT_EQUAL(odp_packet_l3_type(pkt), ODP_PROTO_L3_TYPE_IPV6); CU_ASSERT(!odp_packet_has_arp(pkt)); CU_ASSERT(!odp_packet_has_ipv4(pkt)); CU_ASSERT(odp_packet_has_ipv6(pkt)); + + odp_packet_l4_type_set(pkt, ODP_PROTO_L4_TYPE_ICMPV6); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt), ODP_PROTO_L4_TYPE_ICMPV6); + CU_ASSERT(!odp_packet_has_tcp(pkt)); + CU_ASSERT(!odp_packet_has_udp(pkt)); + CU_ASSERT(!odp_packet_has_sctp(pkt)); + CU_ASSERT(odp_packet_has_icmp(pkt)); } void packet_test_error_flags(void) diff --git a/test/validation/api/traffic_mngr/traffic_mngr.c b/test/validation/api/traffic_mngr/traffic_mngr.c index 4b70282b1..c597cffcf 100644 --- a/test/validation/api/traffic_mngr/traffic_mngr.c +++ b/test/validation/api/traffic_mngr/traffic_mngr.c @@ -775,7 +775,7 @@ static odp_packet_t make_pkt(odp_pool_t pkt_pool, if (pkt_info->use_tcp) { /* TCP Header */ - odp_packet_has_tcp_set(odp_pkt, 1); + odp_packet_l4_type_set(odp_pkt, ODP_PROTO_L4_TYPE_TCP); tcp_hdr->src_port = odp_cpu_to_be_16(DEFAULT_TCP_SRC_PORT); tcp_hdr->dst_port = odp_cpu_to_be_16(DEFAULT_TCP_DST_PORT); tcp_hdr->seq_no = odp_cpu_to_be_32(cpu_tcp_seq_num); @@ -790,7 +790,7 @@ static odp_packet_t make_pkt(odp_pool_t pkt_pool, cpu_tcp_seq_num += payload_len; } else { /* UDP Header */ - odp_packet_has_udp_set(odp_pkt, 1); + odp_packet_l4_type_set(odp_pkt, ODP_PROTO_L4_TYPE_UDP); udp_hdr->src_port = odp_cpu_to_be_16(DEFAULT_UDP_SRC_PORT); udp_hdr->dst_port = odp_cpu_to_be_16(DEFAULT_UDP_DST_PORT); udp_hdr->length = odp_cpu_to_be_16(l4_len);