From patchwork Wed Feb 7 13:00:02 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: 127174 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp454800ljc; Wed, 7 Feb 2018 05:08:36 -0800 (PST) X-Google-Smtp-Source: AH8x226BvChrPNpx16mObVBqO7WY3V604cBrZsp0wj73pTrrbojOkvsJKnewyx3/mH4LFTpiTr3S X-Received: by 10.55.141.67 with SMTP id p64mr8223075qkd.43.1518008916090; Wed, 07 Feb 2018 05:08:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518008916; cv=none; d=google.com; s=arc-20160816; b=qIpQPQs6sAMagTsa2ETEtl/Jkz1abCMPHQJof6T2JTEgNtiV7WGcV0DEPNQrE8Xgoz tUsl+H5gRMPYYJEozNllHT/Bv1roAsYuPz2GoBgWcrU//O+2fLdlizMA5hCG8oVTsYGf 1N+H49Fws3ex0k4GXD/ACjID8iZF2GkPH3qoXTYqhaAfteELTOylA4Qnuf6+QpGv2Y+c wpaR3QFdvjB/Mj7V9I6B7qwV4VUpADE5hUgWb1/a5MjroOjZIvSQFwcGbA22EzmUWb9v rdcJhbBct86bAk+RwlEEK0z/Nt3MNv/hXpVc/W6BWGOjlVVRCN9vgIHygOyKMupvhQ9R W/Jw== 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=QzS1cYOuH2+GopYYDi5wWbBAXQss5DpgEg2TJAEkYms=; b=zEjVXSAhq2D1H1gkEY+mYx3XFii+G7ZucR92dEF5LE+YwBHH4THPdIOzmHqCh0BZmT NvZFOR+pvV5XB8908lvwd6EwX4/cW9OurvniyzHZuxFP3oBPcFOd3qqrR8AQSKQuXxqk Vz1oiuMNJmSU4n12H1pt6GpOZGEenT+bo4zgTizTGDSGcZ441YJowuxqsoYqhY95AmjD b2uIjePC2F/8cV+fea8RsahGb+vCw8A8iz7rKPO71nRlBQFt0LjpKx3uZFUBJ86kU/Fx JzJC/h+LKFbI8FlUTV9lGEe/njxJQOLlZwSTfu/4PKy6loAExfCHq3Sb6piP3d336CQx 4uWw== 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 j66si1466757qte.65.2018.02.07.05.08.35; Wed, 07 Feb 2018 05:08:36 -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 B60C86279D; Wed, 7 Feb 2018 13:08:35 +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 C24476175C; Wed, 7 Feb 2018 13:01:25 +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 3BDD1616EA; Wed, 7 Feb 2018 13:00:34 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 0E07D60674 for ; Wed, 7 Feb 2018 13:00:16 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 824AF183F2E for ; Wed, 7 Feb 2018 16:00:14 +0300 (MSK) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id xK0s4P1MhE-0Eb40qCU; Wed, 07 Feb 2018 16:00:14 +0300 Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 2XfrietnG0-0DZKHlVV; Wed, 07 Feb 2018 16:00:13 +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:02 +0300 Message-Id: <1518008409-31750-8-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 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: 86fcf3650d33f5dd82712dda131fb8ca66a3bdf8 **/ .../api/classification/odp_classification_common.c | 4 ++-- test/validation/api/packet/packet.c | 27 +++++++++++++++++++--- test/validation/api/traffic_mngr/traffic_mngr.c | 4 ++-- 3 files changed, 28 insertions(+), 7 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..00228b240 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -1047,9 +1047,6 @@ void packet_test_in_flags(void) TEST_INFLAG(pkt, jumbo); 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 +1056,30 @@ 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_arp(pkt)); + CU_ASSERT(!odp_packet_has_ipv4(pkt)); + CU_ASSERT(!odp_packet_has_ipv6(pkt)); + + odp_packet_l3_type_set(pkt, ODP_PROTO_L3_TYPE_ARP); + CU_ASSERT_EQUAL(odp_packet_l3_type(pkt), ODP_PROTO_L3_TYPE_ARP); + CU_ASSERT(odp_packet_has_arp(pkt)); + 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_arp(pkt)); + 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_arp(pkt)); + 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;