From patchwork Fri Aug 10 13:00:07 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: 143920 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3328479ljj; Fri, 10 Aug 2018 06:01:43 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzolqCOf3YCXEbFnvGp0dBzPXM4B15Hzvkfwx5j6yuTLQmSbMoMXZFsfnTn5VzYAhngFjnT X-Received: by 2002:a37:aa4e:: with SMTP id t75-v6mr5894513qke.425.1533906102944; Fri, 10 Aug 2018 06:01:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533906102; cv=none; d=google.com; s=arc-20160816; b=cZ/uxkDoeZFXjhdnQcktugEr6Wz+RVC6QYGNMjuFyN4Ij/cAeGo03mlH8XA5wFXgdC mEwUAI6lAIj5GdFcoA5jkLYIhOfsH2t0Vu68lccrWmiTcI9su+6QPsCoLIdHrnjSUgQq fAKYCHr4QA0gI5A+8MWfzC+Rd+RlXsFu86a99IB98jgRNsyZBwSqEcdVaTqAGwNMYrLM 9KycjQzrQ47HrsCzQ16C2wlETCcszwvEtELah+X3KLzwvkjiW4OIVEs6Z3Heksjq8Y3l bqkna1n1q48WmOqJlXSE7DbLGulJDpjogWlSKg5fc2IegViNXqyxNd31XSXEz9LvBeEB 2hSw== 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=X5DePL18W49ZNr68o7+OYBFN9JZdkZqCZDB5ENFTuEQ=; b=l21lJIpBxAkAliyohIgXwjqzxtTqqa+HoU8Otlh0hElTj/Vk+sHbkt+MlrkpvZ4198 6L4Z1oA6luBJSVhAyt6hukBC9pjCY/ydJGizDdwXKQR5RCGauJouxMmj7G6ITCnUXl7W SwVdarol2x1mUJq1NbRGhemc1hoJAuPeGrBSZrrRSFrf1zLQ3MMyJNivzZJCXRutkSeA 8FKj0DLAewIZ9vEPocj2SaVyR+pYTsMaWXMjckYKOAzLFQugsS9CXQdcWj0vQsJR8k2o LNnw69CNqh8AOKCS0GEyzihTW6aw3fi7KTQlVVMgefoDWFBfaAQfGClUNV5AuFBSJOlH HEWw== 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 k13-v6si2746762qve.159.2018.08.10.06.01.42; Fri, 10 Aug 2018 06:01:42 -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 861CA60B53; Fri, 10 Aug 2018 13:01:42 +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=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW 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 462346080E; Fri, 10 Aug 2018 13:00:52 +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 B916E60826; Fri, 10 Aug 2018 13:00:43 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id 139A160833 for ; Fri, 10 Aug 2018 13:00:20 +0000 (UTC) Received: from mxback2g.mail.yandex.net (mxback2g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:163]) by forward100o.mail.yandex.net (Yandex) with ESMTP id B26B42A27DC1 for ; Fri, 10 Aug 2018 16:00:18 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback2g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id khPgOLMBdY-0I9a1G22; Fri, 10 Aug 2018 16:00:18 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Vb4aj3S9kE-0IiKvIIa; Fri, 10 Aug 2018 16:00:18 +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, 10 Aug 2018 13:00:07 +0000 Message-Id: <1533906007-732-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533906007-732-1-git-send-email-odpbot@yandex.ru> References: <1533906007-732-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 672 Subject: [lng-odp] [PATCH API-NEXT v1 4/4] validation: packet: add parse result test 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 Test new parse result functions. Signed-off-by: Petri Savolainen --- /** Email created from pull request 672 (psavol:next-packet-metadata) ** https://github.com/Linaro/odp/pull/672 ** Patch: https://github.com/Linaro/odp/pull/672.patch ** Base sha: 9b2b5a9695ad66977c964c83691cd2fef4c45b85 ** Merge commit sha: 2f50c6c282fb183ddbc4628815da441de53deea0 **/ test/validation/api/packet/packet.c | 109 ++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 4594260cf..29581fc8d 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -3303,6 +3303,114 @@ static void parse_eth_ipv4_rr_nop_icmp(void) odp_packet_free_multi(pkt, num_pkt); } +static void parse_result(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + odp_packet_parse_result_t result[num_pkt]; + odp_packet_parse_result_t *result_ptr[num_pkt]; + + /* Ethernet/VLAN/IPv6/UDP */ + parse_test_alloc(pkt, test_packet_vlan_ipv6_udp, + sizeof(test_packet_vlan_ipv6_udp), num_pkt); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_ALL; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + result_ptr[i] = &result[i]; + memset(&result[i], 0, sizeof(odp_packet_parse_result_t)); + } + + odp_packet_parse_result(pkt[0], result_ptr[0]); + odp_packet_parse_result_multi(&pkt[1], &result_ptr[1], num_pkt - 1); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_vlan(pkt[i])); + CU_ASSERT(odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(odp_packet_has_udp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT(odp_packet_l2_type(pkt[i]) == ODP_PROTO_L2_TYPE_ETH); + CU_ASSERT(odp_packet_l3_type(pkt[i]) == ODP_PROTO_L3_TYPE_IPV6); + CU_ASSERT(odp_packet_l4_type(pkt[i]) == ODP_PROTO_L4_TYPE_UDP); + + CU_ASSERT(result[i].flag.all != 0); + CU_ASSERT(result[i].flag.has_error == + odp_packet_has_error(pkt[i])); + CU_ASSERT(result[i].flag.has_l2_error == + odp_packet_has_l2_error(pkt[i])); + CU_ASSERT(result[i].flag.has_l3_error == + odp_packet_has_l3_error(pkt[i])); + CU_ASSERT(result[i].flag.has_l4_error == + odp_packet_has_l4_error(pkt[i])); + CU_ASSERT(result[i].flag.has_l2 == + odp_packet_has_l2(pkt[i])); + CU_ASSERT(result[i].flag.has_l3 == + odp_packet_has_l3(pkt[i])); + CU_ASSERT(result[i].flag.has_l4 == + odp_packet_has_l4(pkt[i])); + CU_ASSERT(result[i].flag.has_eth == + odp_packet_has_eth(pkt[i])); + CU_ASSERT(result[i].flag.has_eth_bcast == + odp_packet_has_eth_bcast(pkt[i])); + CU_ASSERT(result[i].flag.has_eth_mcast == + odp_packet_has_eth_mcast(pkt[i])); + CU_ASSERT(result[i].flag.has_jumbo == + odp_packet_has_jumbo(pkt[i])); + CU_ASSERT(result[i].flag.has_vlan == + odp_packet_has_vlan(pkt[i])); + CU_ASSERT(result[i].flag.has_vlan_qinq == + odp_packet_has_vlan_qinq(pkt[i])); + CU_ASSERT(result[i].flag.has_arp == + odp_packet_has_arp(pkt[i])); + CU_ASSERT(result[i].flag.has_ipv4 == + odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(result[i].flag.has_ipv6 == + odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(result[i].flag.has_ip_bcast == + odp_packet_has_ip_bcast(pkt[i])); + CU_ASSERT(result[i].flag.has_ip_mcast == + odp_packet_has_ip_mcast(pkt[i])); + CU_ASSERT(result[i].flag.has_ipfrag == + odp_packet_has_ipfrag(pkt[i])); + CU_ASSERT(result[i].flag.has_ipopt == + odp_packet_has_ipopt(pkt[i])); + CU_ASSERT(result[i].flag.has_ipsec == + odp_packet_has_ipsec(pkt[i])); + CU_ASSERT(result[i].flag.has_udp == + odp_packet_has_udp(pkt[i])); + CU_ASSERT(result[i].flag.has_tcp == + odp_packet_has_tcp(pkt[i])); + CU_ASSERT(result[i].flag.has_sctp == + odp_packet_has_sctp(pkt[i])); + CU_ASSERT(result[i].flag.has_icmp == + odp_packet_has_icmp(pkt[i])); + + CU_ASSERT(result[i].packet_len == odp_packet_len(pkt[i])); + CU_ASSERT(result[i].l2_offset == odp_packet_l2_offset(pkt[i])); + CU_ASSERT(result[i].l3_offset == odp_packet_l3_offset(pkt[i])); + CU_ASSERT(result[i].l4_offset == odp_packet_l4_offset(pkt[i])); + CU_ASSERT(result[i].l3_chksum_status == + odp_packet_l3_chksum_status(pkt[i])); + CU_ASSERT(result[i].l4_chksum_status == + odp_packet_l4_chksum_status(pkt[i])); + CU_ASSERT(result[i].l2_type == odp_packet_l2_type(pkt[i])); + CU_ASSERT(result[i].l3_type == odp_packet_l3_type(pkt[i])); + CU_ASSERT(result[i].l4_type == odp_packet_l4_type(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_alloc_free), ODP_TEST_INFO(packet_test_alloc_free_multi), @@ -3360,6 +3468,7 @@ odp_testinfo_t packet_parse_suite[] = { ODP_TEST_INFO(parse_eth_ipv4_udp_first_frag), ODP_TEST_INFO(parse_eth_ipv4_udp_last_frag), ODP_TEST_INFO(parse_eth_ipv4_rr_nop_icmp), + ODP_TEST_INFO(parse_result), ODP_TEST_INFO_NULL, };