From patchwork Tue Feb 13 10:00:09 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: 128207 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4084969ljc; Tue, 13 Feb 2018 02:02:31 -0800 (PST) X-Google-Smtp-Source: AH8x225obhXmI8BC8EKR7Xaizphkb256P9ZdNEPrF9OwI31AjWQSOrwRNJegqf8Z0FO5WAUJu8w4 X-Received: by 10.237.56.99 with SMTP id j90mr1038514qte.334.1518516151485; Tue, 13 Feb 2018 02:02:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518516151; cv=none; d=google.com; s=arc-20160816; b=HD0RsH75bckhAag60nFWX57bB/WVC/m9HgZ3gqvAh+QwCVsRvKluHDgxdv1JoyzxVR 6/xssIDu2DutqE7Z6Lq5P1ooTJyecQ15U8oHwaW/Fo3zl7K4z1fxijLHYGRvBKGyP0ap 6VjDWuciLcyE7LN8l/1AAs12mf1grP4MfvPTIwNruqOLxHvfRpWKcG8Q8mtlZF74XcJ0 GhiJVvhtnu5KBgjdCFlMEaXC41LFfH543eTWEKNXCXteYzVRtL7uiPwqFC9j6yHHiSCw etHN67IEXNK7ss1IZIqfi7uPHYSfl8hfJjCFxaHUS/LucmWqV34/PC9Opfa45K1XjhDD sYPg== 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=FjNjh7FEurX5VY/Z2MCI8l3wZF5skIdKoxfDXm6Vxlg=; b=iFeA2EQ9mfLfSQpMNWt//RHvcQBFPLeyk5M4rVymD2AJL9mJifxg8rQI0xG/2DbLNE epeiVfT/PTtTfVz9SYd++6MZgbM2NuLgzCAPAl2eos99hQybl8I8zkoSzDGnaS8O5r5p 14IDJ8lPUXrGp6vdwIYNMqXRiyO2XN7j9dTy2HGNcgo7hvqoqH/CRJA9wysJzcyUd+2D SXCETfSK18LWET+stsJyQ4dicV6v3P0UM8hWxXxit1kXhaWOztHnaAvWzuDZ3FSc0oUD TZBFr2psdNNgL87KAOqQRmzk8xnBkjsIIy2XBCflGZz0FV1AgKEr8QhNTGMb8g9vwnkO wclA== 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 n59si3265229qtd.443.2018.02.13.02.02.31; Tue, 13 Feb 2018 02:02:31 -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 2594C6179A; Tue, 13 Feb 2018 10:02:31 +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 4816A61514; Tue, 13 Feb 2018 10:00:39 +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 D312D6063B; Tue, 13 Feb 2018 10:00:20 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 84A9E614E1 for ; Tue, 13 Feb 2018 10:00:15 +0000 (UTC) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 1BA565D844E1 for ; Tue, 13 Feb 2018 13:00:14 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id WlTRzkwlOX-0EnKS0Gx; Tue, 13 Feb 2018 13:00:14 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 6ASWNO8Dvc-0DaW3PUO; Tue, 13 Feb 2018 13: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: Tue, 13 Feb 2018 13:00:09 +0300 Message-Id: <1518516009-30109-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518516009-30109-1-git-send-email-odpbot@yandex.ru> References: <1518516009-30109-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 472 Subject: [lng-odp] [PATCH v1 4/4] validation: packet: add IPv4 SCTP parse 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 Added test for IPv4 / SCTP packet with payload data chunk type. Signed-off-by: Petri Savolainen --- /** Email created from pull request 472 (psavol:master-parser-validation) ** https://github.com/Linaro/odp/pull/472 ** Patch: https://github.com/Linaro/odp/pull/472.patch ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847 ** Merge commit sha: aa702da6919f7e56a6ed59d3120233c97590b4f1 **/ test/common/test_packet_parser.h | 74 ++++++++++++++++++------------------- test/validation/api/packet/packet.c | 39 ++++++++++++++++++- 2 files changed, 75 insertions(+), 38 deletions(-) diff --git a/test/common/test_packet_parser.h b/test/common/test_packet_parser.h index 918e0ad65..22c7e6c57 100644 --- a/test/common/test_packet_parser.h +++ b/test/common/test_packet_parser.h @@ -4,12 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -/** - * @file - * - * Test packets for parser tests - */ - #ifndef TEST_PACKET_PARSER_H_ #define TEST_PACKET_PARSER_H_ @@ -21,9 +15,7 @@ extern "C" { /* Test packets without CRC */ -/** - * ARP request - */ +/* ARP request */ static const uint8_t test_packet_arp[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x08, 0x06, 0x00, 0x01, @@ -35,9 +27,7 @@ static const uint8_t test_packet_arp[] = { 0x0E, 0x0F, 0x10, 0x11 }; -/** - * ICMPv4 echo reply - */ +/* ICMPv4 echo reply */ static const uint8_t test_packet_ipv4_icmp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x45, 0x00, @@ -49,9 +39,7 @@ static const uint8_t test_packet_ipv4_icmp[] = { 0x0E, 0x0F, 0x10, 0x11 }; -/** - * IPv4 TCP - */ +/* IPv4 TCP */ static const uint8_t test_packet_ipv4_tcp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x45, 0x00, @@ -63,9 +51,7 @@ static const uint8_t test_packet_ipv4_tcp[] = { 0x02, 0x03, 0x04, 0x05 }; -/** - * IPv4 UDP - */ +/* IPv4 UDP */ static const uint8_t test_packet_ipv4_udp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x45, 0x00, @@ -77,9 +63,8 @@ static const uint8_t test_packet_ipv4_udp[] = { 0x0E, 0x0F, 0x10, 0x11 }; -/** - * VLAN IPv4 UDP - * - ID: 23 +/* VLAN IPv4 UDP + * - type 0x8100, tag 23 */ static const uint8_t test_packet_vlan_ipv4_udp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, @@ -92,10 +77,9 @@ static const uint8_t test_packet_vlan_ipv4_udp[] = { 0x0A, 0x0B, 0x0C, 0x0D }; -/** - * VLAN Q-in-Q IPv4 UDP - * - Outer: Tag Protocol ID 0x88a8, VLAN ID 1 - * - Inner: Tag Protocol ID 0x8100, VLAN ID 2 +/* VLAN Q-in-Q IPv4 UDP + * - Outer: type 0x88a8, tag 1 + * - Inner: type 0x8100, tag 2 */ static const uint8_t test_packet_vlan_qinq_ipv4_udp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, @@ -108,9 +92,7 @@ static const uint8_t test_packet_vlan_qinq_ipv4_udp[] = { 0x06, 0x07, 0x08, 0x09 }; -/** - * ICMPv6 echo request - */ +/* ICMPv6 echo request */ static const uint8_t test_packet_ipv6_icmp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x86, 0xDD, 0x60, 0x30, @@ -122,9 +104,7 @@ static const uint8_t test_packet_ipv6_icmp[] = { 0x1B, 0xC2, 0x00, 0x01, 0x00, 0x02 }; -/** - * IPv6 TCP - */ +/* IPv6 TCP */ static const uint8_t test_packet_ipv6_tcp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x86, 0xDD, 0x60, 0x30, @@ -138,9 +118,7 @@ static const uint8_t test_packet_ipv6_tcp[] = { 0x00, 0x00 }; -/** - * IPv6 UDP - */ +/* IPv6 UDP */ static const uint8_t test_packet_ipv6_udp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x04, 0x00, 0x86, 0xDD, 0x60, 0x30, @@ -152,9 +130,8 @@ static const uint8_t test_packet_ipv6_udp[] = { 0x00, 0x3F, 0x00, 0x08, 0x9B, 0x68 }; -/** - * VLAN IPv6 - * - ID: 23 +/* VLAN IPv6 + * - type 0x8100, tag 23 */ static const uint8_t test_packet_vlan_ipv6_udp[] = { 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, @@ -168,6 +145,29 @@ static const uint8_t test_packet_vlan_ipv6_udp[] = { 0x9B, 0x68 }; +/* IPv4 SCTP + * - chunk type: payload data + */ +static const uint8_t test_packet_ipv4_sctp[] = { + 0x00, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x77, 0x00, 0x01, 0x00, 0x00, 0x40, 0x84, + 0xF8, 0xAE, 0xC0, 0xA8, 0x00, 0x01, 0xC0, 0xA8, + 0x00, 0x02, 0x04, 0xD2, 0x16, 0x2E, 0xDE, 0xAD, + 0xBE, 0xEF, 0x31, 0x44, 0xE3, 0xFE, 0x00, 0x00, + 0x00, 0x57, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x68, + 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6D, 0x79, + 0x20, 0x64, 0x75, 0x6D, 0x6D, 0x79, 0x20, 0x70, + 0x61, 0x79, 0x6C, 0x6F, 0x61, 0x64, 0x20, 0x73, + 0x74, 0x72, 0x69, 0x6E, 0x67, 0x2E, 0x20, 0x54, + 0x68, 0x65, 0x20, 0x6C, 0x65, 0x6E, 0x67, 0x74, + 0x68, 0x20, 0x6F, 0x66, 0x20, 0x74, 0x68, 0x69, + 0x73, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6E, 0x67, + 0x20, 0x69, 0x73, 0x20, 0x37, 0x31, 0x20, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x2E +}; + #ifdef __cplusplus } #endif diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 1ec3585b5..d73010c9c 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -57,7 +57,8 @@ static uint32_t parse_test_pkt_len[] = { sizeof(test_packet_ipv6_icmp), sizeof(test_packet_ipv6_tcp), sizeof(test_packet_ipv6_udp), - sizeof(test_packet_vlan_ipv6_udp) + sizeof(test_packet_vlan_ipv6_udp), + sizeof(test_packet_ipv4_sctp) }; #define packet_compare_offset(pkt1, off1, pkt2, off2, len) \ @@ -2926,6 +2927,41 @@ static void parse_eth_ipv6_icmp(void) odp_packet_free_multi(pkt, num_pkt); } +/* Ethernet/IPv4/SCTP */ +static void parse_eth_ipv4_sctp(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = parse_test.num_pkt; + odp_packet_t pkt[num_pkt]; + uint32_t offset[num_pkt]; + + parse_test_alloc(pkt, test_packet_ipv4_sctp, + sizeof(test_packet_ipv4_sctp)); + + for (i = 0; i < num_pkt; i++) + offset[i] = 0; + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1], + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(odp_packet_has_sctp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT(!odp_packet_has_udp(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), @@ -2972,6 +3008,7 @@ odp_testinfo_t packet_parse_suite[] = { ODP_TEST_INFO(parse_eth_arp), ODP_TEST_INFO(parse_eth_ipv4_icmp), ODP_TEST_INFO(parse_eth_ipv6_icmp), + ODP_TEST_INFO(parse_eth_ipv4_sctp), ODP_TEST_INFO_NULL, };