From patchwork Tue Feb 13 14: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: 128243 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4290669ljc; Tue, 13 Feb 2018 06:09:28 -0800 (PST) X-Google-Smtp-Source: AH8x225leg6B3DvptrjrybIJnlLDf9gOTf1g0S/c8k0lc+1/EuvqShWu5B8C05jKsjIw+lmNDVv5 X-Received: by 10.55.94.129 with SMTP id s123mr1955156qkb.222.1518530968338; Tue, 13 Feb 2018 06:09:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518530968; cv=none; d=google.com; s=arc-20160816; b=laMhtmIfhIMVtbdCcHjlZuGSupBaP+tTPJaxo+ZiU5QEEOx+KU8RyB7VjxEf9zHkW9 d5lgyOvWQbLo1K99CxSE53I6KZF9KonLm9yUEtOpRmGjyiE3pAWQoZNaNSMtlb6Kq23P xNRS9En+2HCk+26EWAHJJFEtGLUT5QitEEW9R3kyXh/INn/OZaZb2EqFClxy89x5VRNb 6tgceFmHw586FX5jTTusagujSske1gnvTJzESaR0oA2xbvoN+IkWfJe8urJBNLyM/oXg bRG2+2KhBsRP3Qi6qIDEiHGi4kSNV0LL798nIYwnYUoxGapgNt7MqvRQZp5llAmFv2kB /+gg== 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=RMqdT77TE396ojYTBWnDS2lm3y+7ylvEPzcB2zHomuY=; b=kVEVb+5qgsUVwXhtdvzEo5N1gAg99sEcS2+nIBItuuWQv4iPzlJX5/lpSpWA1yKA44 cHEnjHUnJgx1pXN+pgGsIksB+chLQunqHxkeSRmYYeFKG0oiVI6g6KsaZaXs4cdvXmEW e5yJ9FiwDxu2HWLNtKLaaaurcqqI3uI2AWMIlKWsseppfumnt1LTVzKZMvXALU/Jq648 b3JoyJX5+n1qGriTig8LZmetEeH+FDLH37OL/rWUFyvtcWPgOP1h+cAJ1DDsqjnlfvSW JQWrpiKrx7s6VFJ6894DC0+2pkja7IKxyRnhKjnA0b4PSfmTR7Ttmefc3ZmUde0kgemd w2xA== 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 y64si5725239qke.22.2018.02.13.06.09.27; Tue, 13 Feb 2018 06:09:28 -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 98F0660855; Tue, 13 Feb 2018 14:09:27 +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 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 BAD8E60946; Tue, 13 Feb 2018 14:05:59 +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 2C0A860929; Tue, 13 Feb 2018 14:05:53 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id 7E02A608C1 for ; Tue, 13 Feb 2018 14:02:13 +0000 (UTC) Received: from mxback20j.mail.yandex.net (mxback20j.mail.yandex.net [IPv6:2a02:6b8:0:1619::114]) by forward103o.mail.yandex.net (Yandex) with ESMTP id D66B25883E67 for ; Tue, 13 Feb 2018 17:00:15 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback20j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 6Gcw24KBd9-0FIS46ls; Tue, 13 Feb 2018 17:00:15 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 6Ss5leStGE-0FFWKtqO; Tue, 13 Feb 2018 17:00:15 +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 17:00:07 +0300 Message-Id: <1518530410-18574-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> References: <1518530410-18574-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 472 Subject: [lng-odp] [PATCH v2 4/7] 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: 38d924655e8119f902e986011a477e1ad9094ab6 **/ test/common/test_packet_parser.h | 74 ++++++++++++++++++------------------- test/validation/api/packet/packet.c | 35 +++++++++++++++++- 2 files changed, 71 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 ea7e89b2f..ad5520408 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -60,7 +60,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) \ @@ -2891,6 +2892,37 @@ 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]; + + parse_test_alloc(pkt, test_packet_ipv4_sctp, + sizeof(test_packet_ipv4_sctp)); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_L4; + 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++) { + 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), @@ -2937,6 +2969,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, };