From patchwork Wed Nov 8 14:00:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 118263 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5332720qgn; Wed, 8 Nov 2017 06:06:43 -0800 (PST) X-Google-Smtp-Source: ABhQp+R8KCbEduZP+K/SBVi9XwVDUFTnBkx25HzE4dOnrP4NmKiGVbkSiM0jvgJvxqJh0JKdUlSy X-Received: by 10.129.106.133 with SMTP id f127mr403023ywc.217.1510150003260; Wed, 08 Nov 2017 06:06:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510150003; cv=none; d=google.com; s=arc-20160816; b=Sv3HKCk/B87ojaXGwd8nHrcVezzaeFXu9qNTCskSVa1oV1Yb5E3cyaiJj/jmldkIba Ec4tP3Jw98ct2AuuYhNpLD7pXBOinfFVChqTWaUeuSQ5PtPyoYIG+0dzGY/K+8aR1OUp JXtbtWY4VZviwP44dOfRAkhPmXzZWPgaCWpqGE+6hO/YTRF/eXk3rwR7YPUlCsaxVPUm OqfjKh6IaWO5Y2pPHs5P741XpM1j4ve/pODST4P2rCScNmMh9iaNh0wqTTNGPm7ux4A/ 0/Y4XB4FaW8Vr368qzYPqmdiZ6O3r+Ffsvj/lDyoulNYgeEu2AnkK4uG20vRYTKrleNR Rs0A== 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=nfzw2wP/wBUydwBA8LF+FEXY8FOB88WphMGiERaNZ7o=; b=lyQsFCrAWQGSQYj5lbN+7wazgX8gD+FK2eTfNIljbASJFXvGLrqT6EHZluvxP79ID6 bweg04+23/xJMSK4fzW8cr8L8OwtAeT+vrKXprpIKDA35JfIlIrA8/k4BtaHIKEyckkJ JJCDoW84AycT91jst2CZ8D8+lmRoc83mY/ZrVeD+23nZTKSO5l04bSzrZO//IZkLwL2H 1yI8RPwJELiLXBn19XnQLGQFN+wxqq0Z1kDA+MYl8SXlv4hioqAuVONVMUT8yiPo8qwJ rmuljbcsPRypoZoAh+nINb7HP03o9scgejS9Qe6uonQO5/EnugIyM995G1ZrufgheYyt W4Mw== 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 u132si987490ywa.439.2017.11.08.06.06.42; Wed, 08 Nov 2017 06:06:43 -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 D709F60FFB; Wed, 8 Nov 2017 14:06: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=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED 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 4EF2260BDF; Wed, 8 Nov 2017 14:01: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 D061360D77; Wed, 8 Nov 2017 14:01:29 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id 496DB60AF8 for ; Wed, 8 Nov 2017 14:00:31 +0000 (UTC) Received: from mxback11g.mail.yandex.net (mxback11g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:90]) by forward100o.mail.yandex.net (Yandex) with ESMTP id 0B72E2A21342 for ; Wed, 8 Nov 2017 17:00:30 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback11g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id vzsY7fOPs9-0TLKSP7W; Wed, 08 Nov 2017 17:00:29 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id ABVIw2d5cZ-0T1mCong; Wed, 08 Nov 2017 17:00:29 +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, 8 Nov 2017 17:00:17 +0300 Message-Id: <1510149622-31536-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510149622-31536-1-git-send-email-odpbot@yandex.ru> References: <1510149622-31536-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 273 Subject: [lng-odp] [PATCH API-NEXT v2 1/6] api: packet: add parse functions 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 Application may need help on packet parsing e.g. after decrypt or IP reassembly of a packet. Application specifies from where to start and where to stop parsing. Implementation may be vectorized (more efficient) when multiple packets are parsed together with the same parse requirements. Signed-off-by: Petri Savolainen --- /** Email created from pull request 273 (psavol:next-packet-parse) ** https://github.com/Linaro/odp/pull/273 ** Patch: https://github.com/Linaro/odp/pull/273.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 80af43ecfb926cbcf7f13ae5f91653aaee11ebf3 **/ include/odp/api/spec/packet.h | 115 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 3fc460641..ed1649709 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -72,6 +72,45 @@ extern "C" { */ /** + * Protocol + */ +typedef enum odp_proto_t { + /** No protocol defined */ + ODP_PROTO_NONE = 0, + + /** Ethernet (including VLAN) */ + ODP_PROTO_ETH, + + /** IP version 4 */ + ODP_PROTO_IPV4, + + /** IP version 6 */ + ODP_PROTO_IPV6 + +} odp_proto_t; + +/** + * Protocol layer + */ +typedef enum odp_proto_layer_t { + /** No layers */ + ODP_PROTO_LAYER_NONE = 0, + + /** Layer L2 protocols (Ethernet, VLAN, etc) */ + ODP_PROTO_LAYER_L2, + + /** Layer L3 protocols (IPv4, IPv6, ICMP, IPSEC, etc) */ + ODP_PROTO_LAYER_L3, + + /** Layer L4 protocols (UDP, TCP, SCTP) */ + ODP_PROTO_LAYER_L4, + + /** All layers */ + ODP_PROTO_LAYER_ALL + +} odp_proto_layer_t; + +/** * Packet API data range specifier */ typedef struct odp_packet_data_range { @@ -1140,6 +1179,82 @@ int odp_packet_move_data(odp_packet_t pkt, uint32_t dst_offset, */ /** + * Packet parse parameters + */ +typedef struct odp_packet_parse_param_t { + /** Protocol header at parse starting point. Valid values for this + * field are: ODP_PROTO_ETH, ODP_PROTO_IPV4, ODP_PROTO_IPV6. */ + odp_proto_t proto; + + /** Continue parsing until this layer. Must be the same or higher + * layer than the layer of 'proto'. */ + odp_proto_layer_t layer; + + /** Flags to control payload data checks up to the selected parse + * layer. Checksum checking status can be queried for each packet with + * odp_packet_l3_chksum_status() and odp_packet_l4_chksum_status(). + */ + union { + struct { + /** Check IPv4 header checksum */ + uint32_t ipv4_chksum : 1; + + /** Check UDP checksum */ + uint32_t udp_chksum : 1; + + /** Check TCP checksum */ + uint32_t tcp_chksum : 1; + + } check; + + /** All check bits. This can be used to set/clear all flags. */ + uint32_t all_check; + }; + +} odp_packet_parse_param_t; + +/** + * Parse packet + * + * Parse protocol headers in packet data. Parsing starts at 'offset', which + * is the first header byte of protocol 'param.proto'. Parameter 'param.layer' + * defines the last layer application is interested about. + * Use ODP_PROTO_LAYER_ALL for all layers. The operation sets or resets packet + * metadata for all layers from the layer of 'param.proto' to the application + * defined last layer. Metadata of other layers have undefined values. + * When operation fails, metadata of all protocol layers have undefined values. + * + * @param pkt Packet handle + * @param offset Byte offset into the packet + * @param param Parse parameters. Proto and layer fields must be set. Clear + * all check bits that are not used. + * + * @retval 0 on success + * @retval <0 on failure + */ +int odp_packet_parse(odp_packet_t pkt, uint32_t offset, + const odp_packet_parse_param_t *param); + +/** + * Parse multiple packets + * + * Otherwise like odp_packet_parse(), but parses multiple packets. Packets may + * have unique offsets, but must start with the same protocol. Also, packets are + * parsed up to the same protocol layer. + * + * @param pkt Packet handle array + * @param offset Byte offsets into the packets + * @param num Number of packets and offsets + * @param param Parse parameters. Proto and layer fields must be set. Clear + * all check bits that are not used. + * + * @retval 0 on success + * @retval <0 on failure + */ +int odp_packet_parse_multi(const odp_packet_t pkt[], const uint32_t offset[], + int num, const odp_packet_parse_param_t *param); + +/** * Packet pool * * Returns handle to the packet pool where the packet was allocated from. From patchwork Wed Nov 8 14:00:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 118267 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5339787qgn; Wed, 8 Nov 2017 06:12:09 -0800 (PST) X-Google-Smtp-Source: AGs4zMahrkIuYUpj0fY6jKqzlGQpTGp7k8Wz0b8doCfQ1ssV0f7BndKL2jxAFDjhjPfvwxUZx8Jq X-Received: by 10.55.106.132 with SMTP id f126mr878565qkc.295.1510150329882; Wed, 08 Nov 2017 06:12:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510150329; cv=none; d=google.com; s=arc-20160816; b=CgVhlXF9a3wH6kOsb04+nj8T1mIxCg4M6dGMnXbJhApM4l9+ej+e+6s0JSSsAI8Chf 8t2g5ZH3JXZDgOE+bSE7JvSiBhFFoyNKJZ811omaZHhIJAd8Kc3WXKsdAot80splR7fT KkJKvDZNIpqpWGE+uQowgvfwkgRKe8UdAj9IxR2h+XtARiQ/duR0EMMiYfILlIJ+s3OC YhUYxdMELO3cExRwxK+T7Ft1whBNEkKonnKQK97Ng32vLuAMJitb8VYSq+4K6lzOJzn6 0l3ZMr/xGJw1rYBP9qWQapJk7UdELMdNZDrAJsGswZWdzO5il4EJSRjYs2xMBSbg7hT/ I6wQ== 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=K09LeGF9W6VFaOoUleQzTwrRlypNZmOLg7v6H2+SGYY=; b=afQWDerku9El8xaq+cJfVXsCbNtxkVeo5Q7JuVwfweMX+2Q4akjsWPVTlZOi8jxplO l2npGg25iC5M7wrZzSPHoE5uCw3W74lBQPE/JjhnvvgKM8un0phZqzlu0giNXIpB8zky EswWLaKLm7foIyPtwBFayxIHIRD3Ll/B/xTK5vUqjKv3bVXKzS7nvHoqpJNtSQoScw8v dTZPlTOfkhaeDkH1Kl/WJgDQPQ9ph69dV3XIs89BD/jnBE+TnYmHDeNUpMv2gR3IMMuN RogzqZ/HnmYFE9/Z9R8UB97VfXGjtUaE2bRJMGEwD913o1HPFhWBcofkxU2gvZcrr4xS DV1A== 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 g136si2613102qkg.209.2017.11.08.06.12.09; Wed, 08 Nov 2017 06:12:09 -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 5A8EA61005; Wed, 8 Nov 2017 14:12:09 +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_H3,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED 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 CB7AC60C2E; Wed, 8 Nov 2017 14:03:24 +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 CB83E60CDF; Wed, 8 Nov 2017 14:03:16 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 8E94760C27 for ; Wed, 8 Nov 2017 14:00:36 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 947004302F4F for ; Wed, 8 Nov 2017 17:00:30 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 4kjYrG5MCJ-0Ub4ReSg; Wed, 08 Nov 2017 17:00:30 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id ABVIw2d5cZ-0U1e6hx9; Wed, 08 Nov 2017 17:00:30 +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, 8 Nov 2017 17:00:18 +0300 Message-Id: <1510149622-31536-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510149622-31536-1-git-send-email-odpbot@yandex.ru> References: <1510149622-31536-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 273 Subject: [lng-odp] [PATCH API-NEXT v2 2/6] api: pktio: use common protocol layer enum 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 Use common values between pktio parser layer and packet protocol layer enums. Signed-off-by: Petri Savolainen --- /** Email created from pull request 273 (psavol:next-packet-parse) ** https://github.com/Linaro/odp/pull/273 ** Patch: https://github.com/Linaro/odp/pull/273.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 80af43ecfb926cbcf7f13ae5f91653aaee11ebf3 **/ include/odp/api/spec/packet_io.h | 11 ++++++----- platform/linux-generic/include/odp/api/plat/packet_inlines.h | 4 +++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index 52af646a6..6e4f88100 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -23,6 +23,7 @@ extern "C" { #include #include #include +#include /** @defgroup odp_packet_io ODP PACKET IO * Operations on a packet Input/Output interface. @@ -381,19 +382,19 @@ typedef union odp_pktout_config_opt_t { */ typedef enum odp_pktio_parser_layer_t { /** No layers */ - ODP_PKTIO_PARSER_LAYER_NONE = 0, + ODP_PKTIO_PARSER_LAYER_NONE = ODP_PROTO_LAYER_NONE, /** Layer L2 protocols (Ethernet, VLAN, ARP, etc) */ - ODP_PKTIO_PARSER_LAYER_L2, + ODP_PKTIO_PARSER_LAYER_L2 = ODP_PROTO_LAYER_L2, /** Layer L3 protocols (IPv4, IPv6, ICMP, IPsec, etc) */ - ODP_PKTIO_PARSER_LAYER_L3, + ODP_PKTIO_PARSER_LAYER_L3 = ODP_PROTO_LAYER_L3, /** Layer L4 protocols (UDP, TCP, SCTP) */ - ODP_PKTIO_PARSER_LAYER_L4, + ODP_PKTIO_PARSER_LAYER_L4 = ODP_PROTO_LAYER_L4, /** All layers */ - ODP_PKTIO_PARSER_LAYER_ALL + ODP_PKTIO_PARSER_LAYER_ALL = ODP_PROTO_LAYER_ALL } odp_pktio_parser_layer_t; diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index 1804fa6f2..22f5aca31 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -15,7 +15,9 @@ #include #include -#include +#include +#include +#include #include /** @internal Inline function offsets */ From patchwork Wed Nov 8 14:00:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 118268 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5339823qgn; Wed, 8 Nov 2017 06:12:11 -0800 (PST) X-Google-Smtp-Source: AGs4zMbjsYwwzXIfBRZhgqt3rb2DYzgfHgXNIq3VQcm6yBc45YfMySy1IUZQBqC3OzuWVmtqs5Od X-Received: by 10.200.63.156 with SMTP id d28mr1013239qtk.170.1510150331116; Wed, 08 Nov 2017 06:12:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510150331; cv=none; d=google.com; s=arc-20160816; b=gKyVqSiqgpRfuchPfZ1nEchHyLKK8fqWGar3AgAM5WN+q8lojYu3iKfwu+hOat2VYW oimLMMIc2gwiMKrqXWKrRRT9+MVk7S/pogPVyPToDTT1Yw0B2yZx/FNBBz+S24P0H9rr aSIUXQn5nLAsDOkiBzfANZeKSR17R7UgMkzvYTtImZLUiUBhIeBKkRqo+bjtectnp3m0 Q8d0rvD1hYChFbt1iJxXCeAI0IIn351N7jfcLuUt9XchWXP+Sy5xjhkZx8R0wd8aO+Sg Hxbxp8BjA1xJVnZrBxCGjyYmS2GFgzz3FbJBreln+jmto8JPAT3l1YjBpabkAqBtYZO3 9oVw== 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=yoGeGmTB4fdeqwXUEswwC9tN0krjQDYyVIiG+uz/EkQ=; b=Ipm5VL2NRvDwNQ2r+anE3zOsnel088Vv5EzGu2QzC9IsCKrp4LhegnjIc3AjNbHrDc qqxOV1jjN3kQG+p2cnScge9gNfbGSpmUjJkWFoWEfRAGOl5KyQu1dj74Trem7D1HTZpz lUIGBBdPA8iqW41d/6W/rERktIE43kQVRONJfLss7V1m/QIu6AoL1u2sbPmkqxoEmA+e DciJQGhWKnCgske2gRv3zJjQRQnqZ2N8Y3k0Zx2eW5o0KPYMME3j5sV7ABeWUXjNYBM9 tvKejvTVb7Vrj/9Mq7BwXpOR76KBAXgs9nCIO6mSf6V7GkTMtz+5yYDzvgQwJBkL/PlX /S+g== 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 w21si3920188qtk.212.2017.11.08.06.12.10; Wed, 08 Nov 2017 06:12:11 -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 BBE4061007; Wed, 8 Nov 2017 14:12:10 +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_H3,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED 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 6E67660D37; Wed, 8 Nov 2017 14:03:33 +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 BC81460C2F; Wed, 8 Nov 2017 14:03:24 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 93F2260C2E for ; Wed, 8 Nov 2017 14:00:36 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 13DF343023A2 for ; Wed, 8 Nov 2017 17:00:31 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id LqeyzYPKCi-0VbSvtpM; Wed, 08 Nov 2017 17:00:31 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id ABVIw2d5cZ-0U18o1NB; Wed, 08 Nov 2017 17:00:30 +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, 8 Nov 2017 17:00:19 +0300 Message-Id: <1510149622-31536-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510149622-31536-1-git-send-email-odpbot@yandex.ru> References: <1510149622-31536-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 273 Subject: [lng-odp] [PATCH API-NEXT v2 3/6] api: ipsec: use common protocol layer enum 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 Use common values between ipsec parse and packet protocol layer enums. Signed-off-by: Petri Savolainen --- /** Email created from pull request 273 (psavol:next-packet-parse) ** https://github.com/Linaro/odp/pull/273 ** Patch: https://github.com/Linaro/odp/pull/273.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 80af43ecfb926cbcf7f13ae5f91653aaee11ebf3 **/ include/odp/api/spec/ipsec.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index 26e852fca..4a33af8ea 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -74,19 +74,19 @@ typedef enum odp_ipsec_op_mode_t { */ typedef enum odp_ipsec_proto_layer_t { /** No layers */ - ODP_IPSEC_LAYER_NONE = 0, + ODP_IPSEC_LAYER_NONE = ODP_PROTO_LAYER_NONE, /** Layer L2 protocols (Ethernet, VLAN, etc) */ - ODP_IPSEC_LAYER_L2, + ODP_IPSEC_LAYER_L2 = ODP_PROTO_LAYER_L2, /** Layer L3 protocols (IPv4, IPv6, ICMP, IPSEC, etc) */ - ODP_IPSEC_LAYER_L3, + ODP_IPSEC_LAYER_L3 = ODP_PROTO_LAYER_L3, /** Layer L4 protocols (UDP, TCP, SCTP) */ - ODP_IPSEC_LAYER_L4, + ODP_IPSEC_LAYER_L4 = ODP_PROTO_LAYER_L4, /** All layers */ - ODP_IPSEC_LAYER_ALL + ODP_IPSEC_LAYER_ALL = ODP_PROTO_LAYER_ALL } odp_ipsec_proto_layer_t; From patchwork Wed Nov 8 14:00:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 118264 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5334114qgn; Wed, 8 Nov 2017 06:07:44 -0800 (PST) X-Google-Smtp-Source: ABhQp+S3mRWuQiZip+AfEy9vxXuMBKUh33Iw3NbQics8tsXbLnKqVQQ/P62ZJFDQh3y8sL2KTWad X-Received: by 10.55.77.67 with SMTP id a64mr869159qkb.172.1510150064399; Wed, 08 Nov 2017 06:07:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510150064; cv=none; d=google.com; s=arc-20160816; b=tB9Js332oabBgIdKPMzGbZUe9NB4VkftYgq9TIDL1MrgthKd5gudO1DxGNCyguQSLZ q/E30eo+wonNbBMbsi2JtktE4Q8U/vei5w+S7e52giV1P9VQ4RSYaGms0qLB2k24ijGL Jz8wLiqb3GLIK/ovwajDX4sVczMXX/yCUHi+VHEF26DxNeCXxlvsPAGPQ02L8VcaJVON B+7GAkuF5s7C/bQxHS9B4uLAVwC6Tcklp5V9328orpESITxFr993R6S76lQoyBh3wKxL EF8Gk8llRgWLJ4g9tOp3Dq1zt4tYZZPhGC+cU4gfAeIYNPE++xZzDvm1nqTJie/dSnEH 6eRg== 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=pYuKvgVrnr1NHtVH88yitCAsAM5nvXggDy/qdtu8ZsY=; b=tVj06EX0KC13xCzZ3LeUo80XI4sy/Lp78+BHy3EtLeU5ZnflnikjyZRt9aJjDFDqRO j5sGOqmkwj5w3TRPBozZveFyBns7IGJ9JUt2fGD7c76o2vmB3DRWE5Yd9l/LTQKfaDdZ 8hDFLye6RK1T9miWXXFb3IDA33+cUNJq1OFSzZ94EWv22qku5+NodKkA/W0KrsFJ2TTV iSTltmgm+n2bptlCeSZc/ldVSGDMHfeqeNokh3Qcpkp4mdKSYAV/GfcR8x2A1jdmdw48 CmJpblZX2gWDuvREd0DJro+smV5jZsHy4wmXvacoMEFaF+/kKkj6o2ZaHuQ2hlFDXV5z 3W1g== 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 x40si3893767qtj.258.2017.11.08.06.07.44; Wed, 08 Nov 2017 06:07:44 -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 01DD360BE3; Wed, 8 Nov 2017 14:07:43 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED 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 8B5CB60C8B; Wed, 8 Nov 2017 14:01:40 +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 4233060AF8; Wed, 8 Nov 2017 14:01:32 +0000 (UTC) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [37.140.190.182]) by lists.linaro.org (Postfix) with ESMTPS id 2B66660B4C for ; Wed, 8 Nov 2017 14:00:33 +0000 (UTC) Received: from mxback18j.mail.yandex.net (mxback18j.mail.yandex.net [IPv6:2a02:6b8:0:1619::94]) by forward102o.mail.yandex.net (Yandex) with ESMTP id 964DB5A03637 for ; Wed, 8 Nov 2017 17:00:31 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback18j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id y2oqNvWmus-0VimhM6c; Wed, 08 Nov 2017 17:00:31 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id ABVIw2d5cZ-0V10PuDP; Wed, 08 Nov 2017 17:00:31 +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, 8 Nov 2017 17:00:20 +0300 Message-Id: <1510149622-31536-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510149622-31536-1-git-send-email-odpbot@yandex.ru> References: <1510149622-31536-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 273 Subject: [lng-odp] [PATCH API-NEXT v2 4/6] linux-gen: packet: add parse API 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 Implemented new API functions for packet parsing. Signed-off-by: Petri Savolainen --- /** Email created from pull request 273 (psavol:next-packet-parse) ** https://github.com/Linaro/odp/pull/273 ** Patch: https://github.com/Linaro/odp/pull/273.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 80af43ecfb926cbcf7f13ae5f91653aaee11ebf3 **/ platform/linux-generic/odp_packet.c | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 3b2fac212..c1986f77f 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2252,6 +2252,63 @@ int packet_parse_l3_l4(odp_packet_hdr_t *pkt_hdr, layer, ethtype); } +int odp_packet_parse(odp_packet_t pkt, uint32_t offset, + const odp_packet_parse_param_t *param) +{ + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + void *data; + uint32_t seg_len; + uint32_t packet_len = pkt_hdr->frame_len; + odp_proto_t proto = param->proto; + odp_proto_layer_t layer = param->layer; + int ret; + uint16_t ethtype; + + if (proto == ODP_PROTO_NONE || layer == ODP_PROTO_LAYER_NONE) + return -1; + + data = packet_map(pkt_hdr, offset, &seg_len, NULL); + + if (data == NULL) + return -1; + + packet_parse_reset(pkt_hdr); + + if (proto == ODP_PROTO_ETH) { + ret = packet_parse_common(&pkt_hdr->p, data, packet_len, + seg_len, layer); + + if (ret) + return -1; + } else { + if (proto == ODP_PROTO_IPV4) + ethtype = _ODP_ETHTYPE_IPV4; + else + ethtype = _ODP_ETHTYPE_IPV6; + + ret = packet_parse_common_l3_l4(&pkt_hdr->p, data, offset, + packet_len, seg_len, + layer, ethtype); + + if (ret) + return -1; + } + + return 0; +} + +int odp_packet_parse_multi(const odp_packet_t pkt[], const uint32_t offset[], + int num, const odp_packet_parse_param_t *param) +{ + int i; + + for (i = 0; i < num; i++) + if (odp_packet_parse(pkt[i], offset[i], param)) + return -1; + + return 0; +} + uint64_t odp_packet_to_u64(odp_packet_t hdl) { return _odp_pri(hdl); From patchwork Wed Nov 8 14:00:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 118266 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5336435qgn; Wed, 8 Nov 2017 06:09:29 -0800 (PST) X-Google-Smtp-Source: AGs4zMZcTM9P59kTs/0xhHA3z1giMYSOF7zfeMHaqx2LjuSSb84Gcu42KI8st3ekXGBjingWtU4b X-Received: by 10.237.37.132 with SMTP id x4mr916019qtc.224.1510150169080; Wed, 08 Nov 2017 06:09:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510150169; cv=none; d=google.com; s=arc-20160816; b=vtxL0oEIfm6y2o+m/XFa9szot4bvGi+Jmr3RefbJhuenGqGJ5HNxPbYjz2M7GAdkEE chFF9nnmhOKJlf8w7sRlDfJCZXOOZbTpGVpbJmsoM4M7CxBw4cWtwlASp61uBqhpDjmZ KE45HqSdHDuMmA0qqFnncWXpaApQSoBa3e/6Z1VqgVP74t2uUes75dvLe21Z8yCs7X+v hTkXly400qJDsBE9DZyP7a+KW3rMaSP+n1Oi+Q2SXVwtoIwhCXBRbz8WExVuAK14SlIr Z6rKtRchOVFNl8Flr81s+xQ6RW1i8VfbpkXYy+r4H5noqI8B03GpElBC24iIj+2cFu00 3SYg== 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=JN1WyCvgbzMFYY1ogv66aPii87WOSOw9iJUNTGh6gDc=; b=JXprt3SUr7B8HSMqFFkLqzNPdYqVK+Dt0BLB44+4XLFPMmeHNlhLx4I63bWSB/cOy1 4BmnSlJJgq25A5N8VT4DBiLl6to79vSErzL88Vqwi73gQCmrnrSL1KbZT5SEWpnp1yBQ ULD6WZAFlRS9mEE7VTpdLDTDe7PFg6YIoCwY6PqxxSsowdgWwUujmMJWJBuarit7WUhi P7CtJwj+Oz4JZC4f0R/8jd08dh0wJKV9jg3Wv15DDEdRY0D05xDS/i6FCfj3kVOUeZUX 23qRONnrPvhHgUNJTpZ6FAOytOj8xq/osPAo7uFK668JaGaa86bg2eU7OkYbdZ3WJwD8 NtLQ== 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 v8si3894449qtk.364.2017.11.08.06.09.28; Wed, 08 Nov 2017 06:09:29 -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 A9CF960D6F; Wed, 8 Nov 2017 14:09:28 +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,URIBL_BLOCKED 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 3D3F760FFD; Wed, 8 Nov 2017 14:01:56 +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 128A060F70; Wed, 8 Nov 2017 14:01:42 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id 7E11A60B56 for ; Wed, 8 Nov 2017 14:00:33 +0000 (UTC) Received: from mxback11g.mail.yandex.net (mxback11g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:90]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 2AA6142625 for ; Wed, 8 Nov 2017 17:00:32 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback11g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id PQLf5DPYkH-0WLi2aD2; Wed, 08 Nov 2017 17:00:32 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id ABVIw2d5cZ-0V1mkuIE; Wed, 08 Nov 2017 17:00:31 +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, 8 Nov 2017 17:00:21 +0300 Message-Id: <1510149622-31536-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510149622-31536-1-git-send-email-odpbot@yandex.ru> References: <1510149622-31536-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 273 Subject: [lng-odp] [PATCH API-NEXT v2 5/6] validation: pktio: add parser test packet header 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 Moved parser test packet definitions into a new, common header file. The same test packets can be used in various test suites. Signed-off-by: Petri Savolainen --- /** Email created from pull request 273 (psavol:next-packet-parse) ** https://github.com/Linaro/odp/pull/273 ** Patch: https://github.com/Linaro/odp/pull/273.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 80af43ecfb926cbcf7f13ae5f91653aaee11ebf3 **/ test/common/Makefile.am | 2 +- test/common/test_packet_parser.h | 175 +++++++++++++++++++++++++++++++++++++ test/validation/api/pktio/parser.c | 1 + test/validation/api/pktio/parser.h | 149 ------------------------------- 4 files changed, 177 insertions(+), 150 deletions(-) create mode 100644 test/common/test_packet_parser.h diff --git a/test/common/Makefile.am b/test/common/Makefile.am index a3419e0f5..fbd5d52f4 100644 --- a/test/common/Makefile.am +++ b/test/common/Makefile.am @@ -14,5 +14,5 @@ libthrmask_common_la_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK endif -noinst_HEADERS = test_debug.h +noinst_HEADERS = test_debug.h test_packet_parser.h dist_test_SCRIPTS = run-test.sh diff --git a/test/common/test_packet_parser.h b/test/common/test_packet_parser.h new file mode 100644 index 000000000..918e0ad65 --- /dev/null +++ b/test/common/test_packet_parser.h @@ -0,0 +1,175 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * Test packets for parser tests + */ + +#ifndef TEST_PACKET_PARSER_H_ +#define TEST_PACKET_PARSER_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Test packets without CRC */ + +/** + * 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, + 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x00, 0x00, + 0x09, 0x00, 0x04, 0x00, 0xC0, 0xA8, 0x01, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xA8, + 0x01, 0x02, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, + 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, + 0x0E, 0x0F, 0x10, 0x11 +}; + +/** + * 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, + 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, + 0xF3, 0x7B, 0xC0, 0xA8, 0x01, 0x01, 0xC4, 0xA8, + 0x01, 0x02, 0x00, 0x00, 0xB7, 0xAB, 0x00, 0x01, + 0x00, 0x02, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, + 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, + 0x0E, 0x0F, 0x10, 0x11 +}; + +/** + * 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, + 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x06, + 0xF3, 0x76, 0xC0, 0xA8, 0x01, 0x02, 0xC4, 0xA8, + 0x01, 0x01, 0x04, 0xD2, 0x10, 0xE1, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x50, 0x00, + 0x00, 0x00, 0x0C, 0xCC, 0x00, 0x00, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05 +}; + +/** + * 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, + 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11, + 0xF3, 0x6B, 0xC0, 0xA8, 0x01, 0x02, 0xC4, 0xA8, + 0x01, 0x01, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x1A, + 0x2F, 0x97, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, + 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, + 0x0E, 0x0F, 0x10, 0x11 +}; + +/** + * VLAN IPv4 UDP + * - ID: 23 + */ +static const uint8_t test_packet_vlan_ipv4_udp[] = { + 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x04, 0x00, 0x81, 0x00, 0x00, 0x17, + 0x08, 0x00, 0x45, 0x00, 0x00, 0x2A, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x11, 0xF3, 0x6F, 0xC0, 0xA8, + 0x01, 0x02, 0xC4, 0xA8, 0x01, 0x01, 0x00, 0x3F, + 0x00, 0x3F, 0x00, 0x16, 0x4D, 0xBF, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 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 + */ +static const uint8_t test_packet_vlan_qinq_ipv4_udp[] = { + 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x04, 0x00, 0x88, 0xA8, 0x00, 0x01, + 0x81, 0x00, 0x00, 0x02, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11, + 0xF3, 0x73, 0xC0, 0xA8, 0x01, 0x02, 0xC4, 0xA8, + 0x01, 0x01, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x12, + 0x63, 0xDF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, + 0x06, 0x07, 0x08, 0x09 +}; + +/** + * 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, + 0x00, 0x00, 0x00, 0x08, 0x3A, 0xFF, 0xFE, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x09, 0xFF, 0xFE, 0x00, 0x04, 0x00, 0x35, 0x55, + 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77, + 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, + 0x1B, 0xC2, 0x00, 0x01, 0x00, 0x02 +}; + +/** + * 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, + 0x00, 0x00, 0x00, 0x14, 0x06, 0xFF, 0xFE, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x09, 0xFF, 0xFE, 0x00, 0x04, 0x00, 0x35, 0x55, + 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77, + 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x04, 0xD2, + 0x10, 0xE1, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x02, 0x50, 0x00, 0x00, 0x00, 0x36, 0x37, + 0x00, 0x00 +}; + +/** + * 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, + 0x00, 0x00, 0x00, 0x08, 0x11, 0xFF, 0xFE, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x09, 0xFF, 0xFE, 0x00, 0x04, 0x00, 0x35, 0x55, + 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77, + 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x00, 0x3F, + 0x00, 0x3F, 0x00, 0x08, 0x9B, 0x68 +}; + +/** + * VLAN IPv6 + * - ID: 23 + */ +static const uint8_t test_packet_vlan_ipv6_udp[] = { + 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x04, 0x00, 0x81, 0x00, 0x00, 0x17, + 0x86, 0xDD, 0x60, 0x30, 0x00, 0x00, 0x00, 0x08, + 0x11, 0xFF, 0xFE, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x09, 0xFF, 0xFE, 0x00, + 0x04, 0x00, 0x35, 0x55, 0x55, 0x55, 0x66, 0x66, + 0x66, 0x66, 0x77, 0x77, 0x77, 0x77, 0x88, 0x88, + 0x88, 0x88, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x08, + 0x9B, 0x68 +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/test/validation/api/pktio/parser.c b/test/validation/api/pktio/parser.c index dd293a447..66e726d09 100644 --- a/test/validation/api/pktio/parser.c +++ b/test/validation/api/pktio/parser.c @@ -8,6 +8,7 @@ #include #include +#include #include diff --git a/test/validation/api/pktio/parser.h b/test/validation/api/pktio/parser.h index 5cc2b988c..d95ecca14 100644 --- a/test/validation/api/pktio/parser.h +++ b/test/validation/api/pktio/parser.h @@ -28,153 +28,4 @@ int parser_suite_init(void); /* test arrays: */ extern odp_testinfo_t parser_suite[]; -/* Test packets without CRC */ - -/** - * 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, - 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x00, 0x00, - 0x09, 0x00, 0x04, 0x00, 0xC0, 0xA8, 0x01, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xA8, - 0x01, 0x02, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, - 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, - 0x0E, 0x0F, 0x10, 0x11 -}; - -/** - * 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, - 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, - 0xF3, 0x7B, 0xC0, 0xA8, 0x01, 0x01, 0xC4, 0xA8, - 0x01, 0x02, 0x00, 0x00, 0xB7, 0xAB, 0x00, 0x01, - 0x00, 0x02, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, - 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, - 0x0E, 0x0F, 0x10, 0x11 -}; - -/** - * 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, - 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x06, - 0xF3, 0x76, 0xC0, 0xA8, 0x01, 0x02, 0xC4, 0xA8, - 0x01, 0x01, 0x04, 0xD2, 0x10, 0xE1, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x50, 0x00, - 0x00, 0x00, 0x0C, 0xCC, 0x00, 0x00, 0x00, 0x01, - 0x02, 0x03, 0x04, 0x05 -}; - -/** - * 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, - 0x00, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11, - 0xF3, 0x6B, 0xC0, 0xA8, 0x01, 0x02, 0xC4, 0xA8, - 0x01, 0x01, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x1A, - 0x2F, 0x97, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, - 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, - 0x0E, 0x0F, 0x10, 0x11 -}; - -/** - * VLAN IPv4 UDP - * - ID: 23 - */ -static const uint8_t test_packet_vlan_ipv4_udp[] = { - 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x04, 0x00, 0x81, 0x00, 0x00, 0x17, - 0x08, 0x00, 0x45, 0x00, 0x00, 0x2A, 0x00, 0x00, - 0x00, 0x00, 0x40, 0x11, 0xF3, 0x6F, 0xC0, 0xA8, - 0x01, 0x02, 0xC4, 0xA8, 0x01, 0x01, 0x00, 0x3F, - 0x00, 0x3F, 0x00, 0x16, 0x4D, 0xBF, 0x00, 0x01, - 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, - 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 - */ -static const uint8_t test_packet_vlan_qinq_ipv4_udp[] = { - 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x04, 0x00, 0x88, 0xA8, 0x00, 0x01, - 0x81, 0x00, 0x00, 0x02, 0x08, 0x00, 0x45, 0x00, - 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x40, 0x11, - 0xF3, 0x73, 0xC0, 0xA8, 0x01, 0x02, 0xC4, 0xA8, - 0x01, 0x01, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x12, - 0x63, 0xDF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, - 0x06, 0x07, 0x08, 0x09 -}; - -/** - * 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, - 0x00, 0x00, 0x00, 0x08, 0x3A, 0xFF, 0xFE, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x09, 0xFF, 0xFE, 0x00, 0x04, 0x00, 0x35, 0x55, - 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77, - 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, - 0x1B, 0xC2, 0x00, 0x01, 0x00, 0x02 -}; - -/** - * 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, - 0x00, 0x00, 0x00, 0x14, 0x06, 0xFF, 0xFE, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x09, 0xFF, 0xFE, 0x00, 0x04, 0x00, 0x35, 0x55, - 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77, - 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x04, 0xD2, - 0x10, 0xE1, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x02, 0x50, 0x00, 0x00, 0x00, 0x36, 0x37, - 0x00, 0x00 -}; - -/** - * 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, - 0x00, 0x00, 0x00, 0x08, 0x11, 0xFF, 0xFE, 0x80, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x09, 0xFF, 0xFE, 0x00, 0x04, 0x00, 0x35, 0x55, - 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77, 0x77, - 0x77, 0x77, 0x88, 0x88, 0x88, 0x88, 0x00, 0x3F, - 0x00, 0x3F, 0x00, 0x08, 0x9B, 0x68 -}; - -/** - * VLAN IPv6 - * - ID: 23 - */ -static const uint8_t test_packet_vlan_ipv6_udp[] = { - 0x00, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x04, 0x00, 0x81, 0x00, 0x00, 0x17, - 0x86, 0xDD, 0x60, 0x30, 0x00, 0x00, 0x00, 0x08, - 0x11, 0xFF, 0xFE, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x00, 0x09, 0xFF, 0xFE, 0x00, - 0x04, 0x00, 0x35, 0x55, 0x55, 0x55, 0x66, 0x66, - 0x66, 0x66, 0x77, 0x77, 0x77, 0x77, 0x88, 0x88, - 0x88, 0x88, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x08, - 0x9B, 0x68 -}; - #endif From patchwork Wed Nov 8 14:00:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 118265 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5336192qgn; Wed, 8 Nov 2017 06:09:17 -0800 (PST) X-Google-Smtp-Source: AGs4zMbwG7QsarFkXgYLnArVS0ff+4190R1rqLSp1SJhLBuF/l/R7185bQ4fR4WoaO2QMzj/69aE X-Received: by 10.55.87.199 with SMTP id l190mr937792qkb.30.1510150157172; Wed, 08 Nov 2017 06:09:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510150157; cv=none; d=google.com; s=arc-20160816; b=V+hyFD19ByipxgoEYtKIy1xkUFGaldmKT/bHX2Vu9Mvi50gCu0ut4L9LLQf6kum3Ia tmU/pHhxI67XW6LId8RPOJVcQwwO86aJ01UWN7JGkPhoqSIv+ahCun5whFsCu0gL+68L 3wi/CNDcNwokzYP3SvsweEOL7vE8TRVg9MMwhlGPTFP2FiDozumZDoPzLOuJVnCnqxBF CpwyEIladpJp+kEBKKx1WENhtPvkXZFuAUwxDDPSmQIBvyjzSgrbeP7HqOyfMHNILw0s a8gnv/IbckZRoA2Nwbs0OcIKCF7HtJlcppJa+0kMOYQeXWR2TItrp9EUDTullzZDaAj5 ZWQA== 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=+Iex2ESaJFkSJj7PtRqKJisF1l8klD4H4XZTFSd2gjY=; b=tQhXkL7RD6PTAIzg4BNVJDZ2INFJAmIciVSAz1EhfSdqv/VkWmnHfiMkGmMgm00Rcr LQnUrjXl7WmMqVKT4qaYPuSQceqDpwAqG3OvlP4G8+aDKkieQBZM48XtUWNJ+TmXE/RP jo8SonhQQ29YicXAdXw7lZlfR0PEgpnFejxv4QtMdo0MrlYuf4doSiJ2yIUb/N08qYTA PrX6zKBsmzI0nClxH7uxsD28HfKGdW3qH/MoehHt6RPvQQFOKmb76sz4mlXDXiWDkzX/ XrYhI12bvlLxJnXrPmtugI4SYdOHqq+koNPFlNC0JUu2x79xtoU66H9FlB/v8y9/IYrM 52jw== 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 t29si1936301qkt.343.2017.11.08.06.09.16; Wed, 08 Nov 2017 06:09:17 -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 CECDD60C88; Wed, 8 Nov 2017 14:09:16 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED 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 02DCF60FFF; Wed, 8 Nov 2017 14:01:49 +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 E6D3260D6F; Wed, 8 Nov 2017 14:01:39 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id 3F6E360605 for ; Wed, 8 Nov 2017 14:00:34 +0000 (UTC) Received: from mxback2j.mail.yandex.net (mxback2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10b]) by forward101p.mail.yandex.net (Yandex) with ESMTP id E86596A82E0D for ; Wed, 8 Nov 2017 17:00:32 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id CcbbpO7pTl-0Weqb0QT; Wed, 08 Nov 2017 17:00:32 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id ABVIw2d5cZ-0W1GUCwL; Wed, 08 Nov 2017 17:00:32 +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, 8 Nov 2017 17:00:22 +0300 Message-Id: <1510149622-31536-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510149622-31536-1-git-send-email-odpbot@yandex.ru> References: <1510149622-31536-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 273 Subject: [lng-odp] [PATCH API-NEXT v2 6/6] validation: packet: add parse tests 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 validation tests for the new packet parse APIs. Signed-off-by: Petri Savolainen --- /** Email created from pull request 273 (psavol:next-packet-parse) ** https://github.com/Linaro/odp/pull/273 ** Patch: https://github.com/Linaro/odp/pull/273.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 80af43ecfb926cbcf7f13ae5f91653aaee11ebf3 **/ test/validation/api/packet/packet.c | 197 ++++++++++++++++++++++++++++++++++++ test/validation/api/packet/packet.h | 1 + 2 files changed, 198 insertions(+) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 37550a2f5..6a93c7519 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -10,6 +10,7 @@ #include #include +#include #include "packet.h" /* Reserve some tailroom for tests */ @@ -2390,6 +2391,201 @@ void packet_test_ref(void) odp_packet_free(ref_pkt[1]); } +void packet_test_parse(void) +{ + odp_pool_t pool; + odp_pool_param_t param; + odp_packet_parse_param_t parse; + int ret, num_test_pkt, i; + uint32_t len, max_len; + int num_pkt = 10; + odp_packet_t pkt[num_pkt]; + uint32_t offset[num_pkt]; + uint32_t test_pkt_len[] = {sizeof(test_packet_arp), + sizeof(test_packet_ipv4_icmp), + sizeof(test_packet_ipv4_tcp), + sizeof(test_packet_ipv4_udp), + sizeof(test_packet_vlan_ipv4_udp), + sizeof(test_packet_vlan_qinq_ipv4_udp), + sizeof(test_packet_ipv6_icmp), + sizeof(test_packet_ipv6_tcp), + sizeof(test_packet_ipv6_udp), + sizeof(test_packet_vlan_ipv6_udp) }; + + num_test_pkt = sizeof(test_pkt_len) / sizeof(uint32_t); + max_len = 0; + + for (i = 0; i < num_test_pkt; i++) { + if (max_len < test_pkt_len[i]) + max_len = test_pkt_len[i]; + } + + odp_pool_param_init(¶m); + + param.type = ODP_POOL_PACKET; + param.pkt.seg_len = max_len; + param.pkt.len = max_len; + param.pkt.num = 100; + + pool = odp_pool_create("test_parse_pool", ¶m); + CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + + /* Ethernet/IPv4/UDP */ + len = sizeof(test_packet_ipv4_udp); + ret = odp_packet_alloc_multi(pool, len, pkt, num_pkt); + CU_ASSERT_FATAL(ret == num_pkt); + + for (i = 0; i < num_pkt; i++) { + ret = odp_packet_copy_from_mem(pkt[i], 0, len, + test_packet_ipv4_udp); + CU_ASSERT(ret == 0); + + offset[i] = 0; + } + + parse.proto = ODP_PROTO_ETH; + parse.layer = ODP_PROTO_LAYER_ALL; + parse.all_check = 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) == 0); + + 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_udp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); + + /* IPv4/UDP */ + len = sizeof(test_packet_ipv4_udp); + ret = odp_packet_alloc_multi(pool, len, pkt, num_pkt); + CU_ASSERT_FATAL(ret == num_pkt); + + for (i = 0; i < num_pkt; i++) { + ret = odp_packet_copy_from_mem(pkt[i], 0, len, + test_packet_ipv4_udp); + CU_ASSERT(ret == 0); + + offset[i] = 14; + } + + parse.proto = ODP_PROTO_IPV4; + parse.layer = ODP_PROTO_LAYER_L4; + parse.all_check = 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) == 0); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(odp_packet_has_udp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); + + /* Ethernet/IPv4/TCP */ + len = sizeof(test_packet_ipv4_tcp); + ret = odp_packet_alloc_multi(pool, len, pkt, num_pkt); + CU_ASSERT_FATAL(ret == num_pkt); + + for (i = 0; i < num_pkt; i++) { + ret = odp_packet_copy_from_mem(pkt[i], 0, len, + test_packet_ipv4_tcp); + CU_ASSERT(ret == 0); + + offset[i] = 0; + } + + parse.proto = ODP_PROTO_ETH; + parse.layer = ODP_PROTO_LAYER_L4; + parse.all_check = 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) == 0); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(odp_packet_has_tcp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(!odp_packet_has_udp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); + + /* Ethernet/IPv6/UDP */ + len = sizeof(test_packet_ipv6_udp); + ret = odp_packet_alloc_multi(pool, len, pkt, num_pkt); + CU_ASSERT_FATAL(ret == num_pkt); + + for (i = 0; i < num_pkt; i++) { + ret = odp_packet_copy_from_mem(pkt[i], 0, len, + test_packet_ipv6_udp); + CU_ASSERT(ret == 0); + + offset[i] = 0; + } + + parse.proto = ODP_PROTO_ETH; + parse.layer = ODP_PROTO_LAYER_L4; + parse.all_check = 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) == 0); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(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])); + } + + odp_packet_free_multi(pkt, num_pkt); + + /* Ethernet/IPv6/TCP */ + len = sizeof(test_packet_ipv6_tcp); + ret = odp_packet_alloc_multi(pool, len, pkt, num_pkt); + CU_ASSERT_FATAL(ret == num_pkt); + + for (i = 0; i < num_pkt; i++) { + ret = odp_packet_copy_from_mem(pkt[i], 0, len, + test_packet_ipv6_tcp); + CU_ASSERT(ret == 0); + + offset[i] = 0; + } + + parse.proto = ODP_PROTO_ETH; + parse.layer = ODP_PROTO_LAYER_ALL; + parse.all_check = 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) == 0); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(odp_packet_has_tcp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(!odp_packet_has_udp(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); + + odp_pool_destroy(pool); +} + odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_alloc_free), ODP_TEST_INFO(packet_test_alloc_free_multi), @@ -2420,6 +2616,7 @@ odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_align), ODP_TEST_INFO(packet_test_offset), ODP_TEST_INFO(packet_test_ref), + ODP_TEST_INFO(packet_test_parse), ODP_TEST_INFO_NULL, }; diff --git a/test/validation/api/packet/packet.h b/test/validation/api/packet/packet.h index 783b7a117..4e99679ed 100644 --- a/test/validation/api/packet/packet.h +++ b/test/validation/api/packet/packet.h @@ -39,6 +39,7 @@ void packet_test_extend_ref(void); void packet_test_align(void); void packet_test_offset(void); void packet_test_ref(void); +void packet_test_parse(void); /* test arrays: */ extern odp_testinfo_t packet_suite[];