From patchwork Wed Feb 7 11:00:01 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: 127150 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp359243ljc; Wed, 7 Feb 2018 03:06:58 -0800 (PST) X-Google-Smtp-Source: AH8x224HFu5VFf9juhQmdMYuWJxpxbzkMD0k8uj82qSTsb1xSZFw/Ob0Ng5B/cA3IUX1muR+w7vd X-Received: by 10.200.15.164 with SMTP id b33mr8538039qtk.301.1518001618025; Wed, 07 Feb 2018 03:06:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518001618; cv=none; d=google.com; s=arc-20160816; b=TF8SCe+92qhEIKLcktI2QMePc8h1h9xR95/dp8BbRcTiIfe1wLh5+BOYd+Y6llc3hy Cl/y126fCOeQWuf3BniXyf0e5zN/VjpgoyeZHnVXwo1fpSJ/UGJ987022URShcl9v+AD HvNlRzZN1mRqbveOqCR7XIBBC+pSX89MKlK4QpZ2ea4NfHRHjJsQHI6EHDc5PYXLXnFN bjIDZxeiBCrVn8WELgJarcDwuaGmtu9nHpkcPFK717Hu4WrCA6kFmMATbtpQIZzsoSaL kH2XfltNNLbCCxTFlDnlOJPz9VWPKgrBHjAEks4TQtdQd7EzWwZ136OlaqK+uvANyxZD GpiQ== 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=vnx8EJ6Uj4orV3gceAyaOnw4g72Dkauz/LXpfm2KrKc=; b=l5rTsHTE4AxyDQXig2SsOcf7j7zOj3XfxdirXLOu1Qm0QUxmT1yJP9yErR3hCBdNRQ xHFgIjUd/QXwgNSFGK7NtodpQ79ok51v5JSPVPecnGaCkkVwvjlf6485DXrPzWTrpdhT HFsdnJki3N1XDfS4iaqLiUtunaHrnnUvI8K5KFudJMTwGmhq+w3q/04RkwDs/Lq2QZa6 yVhFHdCJ9aLUmjPSDj1JOvqoJyLbAC9y7m4TI6iQBeJ++LwdI9aSTx3DxmdPSdbrt2O/ zmTHYK0yawymCcjD6WTu0+Oauys7gu5vGFrIMphfdWoEOGY66eGcnMeLaZ/I82x6gTv4 ryCA== 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 y190si1217966qkd.8.2018.02.07.03.06.57; Wed, 07 Feb 2018 03:06:58 -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 A1E3761767; Wed, 7 Feb 2018 11:06:57 +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 5936F62779; Wed, 7 Feb 2018 11:02:42 +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 DE8F861811; Wed, 7 Feb 2018 11:02:28 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id 75025617A3 for ; Wed, 7 Feb 2018 11:01:22 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward101j.mail.yandex.net (Yandex) with ESMTP id ABE581242F97 for ; Wed, 7 Feb 2018 14:01:20 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id CgrMNIE3ry-1Kdm0O03; Wed, 07 Feb 2018 14:01:20 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id LVw23zZMqp-1EVuSQga; Wed, 07 Feb 2018 14:01:14 +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 14:00:01 +0300 Message-Id: <1518001208-29529-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518001208-29529-1-git-send-email-odpbot@yandex.ru> References: <1518001208-29529-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 457 Subject: [lng-odp] [PATCH API-NEXT v1 7/14] validation: switch to using odp_packet_l3_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_l3_type_set() instead of calling odp_packet_has_ipv4_set() or odp_packet_has_ipv6_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: 802ddfc5ea6f47a8935993bf6f8c1675a4c94930 **/ .../api/classification/odp_classification_common.c | 4 ++-- test/validation/api/packet/packet.c | 17 +++++++++++++++-- test/validation/api/traffic_mngr/traffic_mngr.c | 4 ++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/test/validation/api/classification/odp_classification_common.c b/test/validation/api/classification/odp_classification_common.c index 7b54ef157..191489126 100644 --- a/test/validation/api/classification/odp_classification_common.c +++ b/test/validation/api/classification/odp_classification_common.c @@ -321,10 +321,10 @@ odp_packet_t create_packet(cls_packet_info_t pkt_info) ip->proto = next_hdr; ip->tot_len = odp_cpu_to_be_16(l3_len); ip->ttl = DEFAULT_TTL; - odp_packet_has_ipv4_set(pkt, 1); + odp_packet_l3_type_set(pkt, ODP_PROTO_L3_TYPE_IPV4); } else { /* ipv6 */ - odp_packet_has_ipv6_set(pkt, 1); + odp_packet_l3_type_set(pkt, ODP_PROTO_L3_TYPE_IPV6); ipv6 = (odph_ipv6hdr_t *)odp_packet_l3_ptr(pkt, NULL); version = ODPH_IPV6 << ODPH_IPV6HDR_VERSION_SHIFT; tc = DEFAULT_TOS << ODPH_IPV6HDR_TC_SHIFT; diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index f829d0cb1..6771100cd 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -1048,8 +1048,6 @@ void packet_test_in_flags(void) TEST_INFLAG(pkt, vlan); TEST_INFLAG(pkt, vlan_qinq); TEST_INFLAG(pkt, arp); - TEST_INFLAG(pkt, ipv4); - TEST_INFLAG(pkt, ipv6); TEST_INFLAG(pkt, ip_bcast); TEST_INFLAG(pkt, ip_mcast); TEST_INFLAG(pkt, ipfrag); @@ -1059,6 +1057,21 @@ void packet_test_in_flags(void) 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); + CU_ASSERT(!odp_packet_has_ipv4(pkt)); + CU_ASSERT(!odp_packet_has_ipv6(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_ipv4(pkt)); + CU_ASSERT(!odp_packet_has_ipv6(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_ipv4(pkt)); + CU_ASSERT(odp_packet_has_ipv6(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 d11fa0542..4b70282b1 100644 --- a/test/validation/api/traffic_mngr/traffic_mngr.c +++ b/test/validation/api/traffic_mngr/traffic_mngr.c @@ -739,7 +739,7 @@ static odp_packet_t make_pkt(odp_pool_t pkt_pool, odp_packet_l3_offset_set(odp_pkt, l3_offset); if (pkt_info->use_ipv6) { /* IPv6 Header */ - odp_packet_has_ipv6_set(odp_pkt, 1); + odp_packet_l3_type_set(odp_pkt, ODP_PROTO_L3_TYPE_IPV6); version = ODPH_IPV6 << ODPH_IPV6HDR_VERSION_SHIFT; tc = pkt_info->ip_tos << ODPH_IPV6HDR_TC_SHIFT; flow = unique_id << ODPH_IPV6HDR_FLOW_LABEL_SHIFT; @@ -754,7 +754,7 @@ static odp_packet_t make_pkt(odp_pool_t pkt_pool, memcpy(ipv6_hdr->dst_addr, IPV6_DST_ADDR, ODPH_IPV6ADDR_LEN); } else { /* IPv4 Header */ - odp_packet_has_ipv4_set(odp_pkt, 1); + odp_packet_l3_type_set(odp_pkt, ODP_PROTO_L3_TYPE_IPV4); ipv4_hdr = (odph_ipv4hdr_t *)(buf + l3_offset); ipv4_hdr->ver_ihl = (ODPH_IPV4 << 4) | ODPH_IPV4HDR_IHL_MIN; ipv4_hdr->tos = pkt_info->ip_tos;