From patchwork Thu Nov 9 11:00:08 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: 118430 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp780684edl; Thu, 9 Nov 2017 03:06:19 -0800 (PST) X-Google-Smtp-Source: AGs4zMbPcC7DLTtR4utXqs4ljgSOsnj1FdL6Xnt+USLGfIZFLM5EZcmIVjH3+sJ480GAdoRsfS/B X-Received: by 10.200.15.136 with SMTP id b8mr150705qtk.64.1510225579056; Thu, 09 Nov 2017 03:06:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510225579; cv=none; d=google.com; s=arc-20160816; b=haptto7Ldh2eOI/Uy8AOkKD/7N2WfODPJ/vO363pZfcFDsuGTIKgoTguQCzRoXFKnO PAxE9nMj5Fk4ef4V2J3XE3mU63sBcfeEal5u58diy4VuH+y9/PrX+61xQhWOa02XLvE1 z/KPQg2+ZYi0lC4uwOICKSLacyJ77NobywIQkLPWGhAgvQe4LCuxD9xIQyd3OeXyURZE gHTF37Q4aLUgb68Y7ixBXGGUX4R5eLVb7ceHwg5Iztp/N0dDSufk9DVjOnvtA4En5pWj YLDmYH1uYnLZUI/FuizhCPK/MCCnw3f7ouGsZYy5ZcB0CMwMNvTwmZXYmY5/ih6R5rTt Duqw== 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=ahXw4dm68zRHWvRC51zpspk0ACbHu0096B5xZLamNaU=; b=xc9yvvs9Ae9n14Dtb2iKp8jW5O21S9PWFn0nyptJEMiSAErNBbFbVGQnBaJe3p+PjV nNDzi6MWaasx7pH1mcxJjDupAX47OBOcZ4oosXTwA1ZIxQdXr9xV7dOmGzcSHqdLgKdq zn0//G1ONNA34jSIeG0TWZIbpDLGL//GfBQ5TjddLV7D6CQshc95knDe9Tt2LfGbE/Gy cJlPZtWAWMXhBh8BEn5Xsr7eTaMrMakmKDdxkq2CWzIoHWROPxYlqOvgLFXv8g8+z1Lh Gmp3pO0Cd3QzB3op8sGD9679kF/Ms7PCh8pdjgpFUHczB6QUGLmwAYigvOMwf0UoF7zg f+fQ== 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 s66si5997853qkd.167.2017.11.09.03.06.18; Thu, 09 Nov 2017 03:06:19 -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 BE8D260BDF; Thu, 9 Nov 2017 11:06:18 +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 C58BC60C97; Thu, 9 Nov 2017 11:01:53 +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 E910760C0F; Thu, 9 Nov 2017 11:01:22 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id AA04260C18 for ; Thu, 9 Nov 2017 11:00:19 +0000 (UTC) Received: from mxback2o.mail.yandex.net (mxback2o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1c]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 395E54302185 for ; Thu, 9 Nov 2017 14:00:15 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback2o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id uKbO6eo1qJ-0EtO5OVb; Thu, 09 Nov 2017 14:00:15 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OkOZyJOXa3-0EY845xK; Thu, 09 Nov 2017 14:00:14 +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: Thu, 9 Nov 2017 14:00:08 +0300 Message-Id: <1510225213-20407-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510225213-20407-1-git-send-email-odpbot@yandex.ru> References: <1510225213-20407-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 273 Subject: [lng-odp] [PATCH API-NEXT v4 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: 0724c6474bb6db484fdbdbb1b14035a33ba9525d **/ include/odp/api/spec/packet.h | 119 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 3fc460641..b3f946fc0 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,86 @@ 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 SCTP checksum */ + uint32_t sctp_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. A successful 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. + * + * @return Number of packets parsed successfully (0 ... num) + * @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 Thu Nov 9 11:00:09 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: 118425 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp775191edl; Thu, 9 Nov 2017 03:01:33 -0800 (PST) X-Google-Smtp-Source: AGs4zMaJdT5Hx7eU/ypDCl3wjY/M/ScSU9MeFqeRPN+fhMl3+QSWzMOc9TmMhLk1nRs3NIpW8mt0 X-Received: by 10.200.39.179 with SMTP id w48mr95174qtw.314.1510225293284; Thu, 09 Nov 2017 03:01:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510225293; cv=none; d=google.com; s=arc-20160816; b=Bcf6sl0ec4cv5WvLL444vLYLIZjF7CDn3eW9keaMA1ZGamC2c5McAMF0KWdbZhY37z Jo2XW8SABhX39jMaT3G8M4w0FKxSdF784zK5luV3DaW6I7HFM4KEVIfVu8E6tKlNYMYL UUDIPpLt2pYNNCg3miTufrQn7eosY+IAZJD/wz0mydwrgCo7ewq3x6Ah4QxKPNMVo8na hbqhqN7QPzPiUz2R6vsqkJgEKuNE0EEYfF+9hI4cAoA3cTrF9aJu/dtZbFCITkj14Wm2 Tq6sXBfY+uDnAwn9JNRi9pTcSQ3pWiSXly3Ts47rkgz+/iieQnIx3KHHL/7T9lCYaUU/ pYFA== 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=fAR91I2BFfk7XJ01yR6pyrMUvWpCZdCtDRZaPxGR2vM=; b=A7raXaS/5dFySlAFRitnaA6t8k/gcIYV9880Ufmz1gvfMjB7W2Lz0+YG1F5UOHjDYv MfuSSdUPNs24e9JFys5X9l3M3JyKYQfIgWnR9ecPIIwGckHp7RnCgMIolfp25unhtPYz qzLiOL6N1jewAYtvZDpwg4z0jylRhNRpYt2Ra6Ymm93Gdhfhf51Bx/eze+4WmEsySNWF E/x1UX/9eU2qpcNQWspGWUHEhFfUOAAaU9pweSxMV0WL/bFAx6HV5O8qa4+sMzpN30Ij ho0k2znGFMAA8KWBRPZ5STLHXIyw3/lc/1AAYdG2qeM6CYfWconeJDybM28DjMyvFmBa WNpg== 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 m123si5749138qkf.78.2017.11.09.03.01.31; Thu, 09 Nov 2017 03:01:33 -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 6EBAC60C18; Thu, 9 Nov 2017 11:01: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=-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 2560260C71; Thu, 9 Nov 2017 11:00:32 +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 8217260C36; Thu, 9 Nov 2017 11:00:23 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 0D8D36038E for ; Thu, 9 Nov 2017 11:00:18 +0000 (UTC) Received: from mxback5o.mail.yandex.net (mxback5o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1f]) by forward105o.mail.yandex.net (Yandex) with ESMTP id ED574444426B for ; Thu, 9 Nov 2017 14:00:15 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback5o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id SU5frAMgp3-0FR0bCMQ; Thu, 09 Nov 2017 14:00:15 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OkOZyJOXa3-0FYSwYfW; Thu, 09 Nov 2017 14: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: Thu, 9 Nov 2017 14:00:09 +0300 Message-Id: <1510225213-20407-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510225213-20407-1-git-send-email-odpbot@yandex.ru> References: <1510225213-20407-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 273 Subject: [lng-odp] [PATCH API-NEXT v4 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: 0724c6474bb6db484fdbdbb1b14035a33ba9525d **/ 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 Thu Nov 9 11:00:10 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: 118426 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp776250edl; Thu, 9 Nov 2017 03:02:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMYQNWdOhRZqt2Z+ybxk76BK+Sf8siXaTUs9YBNQn6gBmojTuqGU7vnwDpT50sMR5P7pYnCw X-Received: by 10.237.62.45 with SMTP id l42mr130140qtf.46.1510225342868; Thu, 09 Nov 2017 03:02:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510225342; cv=none; d=google.com; s=arc-20160816; b=lK6EPQNOFxPJjaECV929W1OGz+vtciQVi0YxpUZiFavlQSrCN8mkUMgUXiz65Ygjz5 1kRrWNVbb5LA6WDplogkgnO9Gsyn+ajN8/ogdx/Z4Y4Scdwc6UwFuioeh4Y++Eh3wVfa pp4X5ZDRmgqrXjxpkt3prB0/926jqXL4ehXWCpEuk+P7ffttyhBlrULV+0gEufBA/XTy XzvYyQ5sc2hiQOSgRiISEjViFu3jaKbchpdtD0iOZIehRlCvFSk1O0nfaY0yOgM/JxGR pSXMFGN25wh2C3ZGZ6Ga3gIVvgXlruwqxOUrOwgl7I5Y7ghjYil8l5mMD24xM6yoLtgU E6Dw== 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=bmIdim0f7slC6lHk/vq8K6aZylL7k0D8ppmadtbYu8Y=; b=t9xUWzg2Sxh0YDLvWxQSPsXFay20Tg/NhlK86v6FsXRfnGb4wjLtjQuo5v+i6EZd9i +K6yx7oSrhcxdfgtCqi+URzcny8SclbQlo/qohShIeG0srODtyCBaiO/BjbYnpbQCSYD DVt8i87XAhRJZzjTQBA5JEfCP53r2Dm2ZcF/IOJG2ELNoElI3PR0aq9weNttNuTeoc0J pXqoxFeUvXcu4bIQ+a8zcAZBUZHL50yhqz44Ys9wVRI0+8WXKQaY+EwrkkEqI9yevXLn 5CB/i+UWWTtSzKx6vaCoN6WDbwG+9BgbpDDfcugXsRPoTfC0nyko5fa8rRUvyAKT+luu NWBA== 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 f2si1540704qkc.404.2017.11.09.03.02.22; Thu, 09 Nov 2017 03:02:22 -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 873F661008; Thu, 9 Nov 2017 11:02:22 +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 770116050D; Thu, 9 Nov 2017 11:00:34 +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 35BA360C90; Thu, 9 Nov 2017 11:00:26 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 644F660690 for ; Thu, 9 Nov 2017 11:00:18 +0000 (UTC) Received: from mxback1g.mail.yandex.net (mxback1g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:162]) by forward103j.mail.yandex.net (Yandex) with ESMTP id 575D634C44BA for ; Thu, 9 Nov 2017 14:00:16 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id xz8JFcqOdP-0Gmqg2rI; Thu, 09 Nov 2017 14:00:16 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OkOZyJOXa3-0FYib1ne; Thu, 09 Nov 2017 14:00:16 +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: Thu, 9 Nov 2017 14:00:10 +0300 Message-Id: <1510225213-20407-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510225213-20407-1-git-send-email-odpbot@yandex.ru> References: <1510225213-20407-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 273 Subject: [lng-odp] [PATCH API-NEXT v4 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: 0724c6474bb6db484fdbdbb1b14035a33ba9525d **/ 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 Thu Nov 9 11:00:11 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: 118427 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp777256edl; Thu, 9 Nov 2017 03:03:11 -0800 (PST) X-Google-Smtp-Source: AGs4zMZQ9C9RTs3T2njCPIlgRTpJ4gc3r2sr8D7WpCgcp9rXyxPd9AmpFB00WHRZkJavVXYBR7Nw X-Received: by 10.55.161.78 with SMTP id k75mr118911qke.158.1510225391635; Thu, 09 Nov 2017 03:03:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510225391; cv=none; d=google.com; s=arc-20160816; b=RXM70ZX1kAvQuwo9bbDDYovVZzEYiOn1j0M+psqjjXc5sSviyXt3UPFl9gooCDf4ko kehz6Mu6GDRucTdrCVqpVFcIPrnCkFclzoHgedX7qRTdbDMXUYGkfJwiG8PSTRqZIu1v xgUlg0McmcwHfugmo2CyTn52tFdXnEyz72RdFrWYE1z67Fzc0T0JoSiuDo3fJjnnykkd tJXoxtOcz4oq4k45nHxGCJb4/WQ3Lwo4vB9U49s4ZAMYqhrq3ZadXhMqgEoJNYK3TACX nMea3I45lmZYnba7jp0Ha9wxeXm5xO5eEwmanmOg4kTilgJ9BXZiSdI0eUCb5lXJBeTO eRFQ== 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=r5KqgbufXYMu80AqfhnegQC4eA91SDe7cDUJm0Kn7jY=; b=lXKLTrOHdZfWRFvYwY0uaUrnE2rdoOOJMxcyG8aPXr4VVDymlm9SCP+KEOgg36uczL /Ct8zEdFnuyPsL6nuk2bUKlhczA8qW3PivhY7poB3mpzEUTF2oGLODOQho+hAiL8z740 Oy/bPCZlx8aAZ5Cygq+ysmFK6cz8E6ZflSOpJN+dNxNjnyn0JtTaIPRvihXCPwLgsKHZ ixPjc89jlCqj88YOcNRqDTMRBMrwaBXRyAtTSLGabg7VJofaPwRV+IggR29tWmiwFrYe ar50M2TqPpaJzkvykcF+ssXA+Bjhv9kiG+rsR9bsiQx80vUf1GQvWl/zVzuzq3ejACNf +jWA== 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 p96si6464856qkp.201.2017.11.09.03.03.11; Thu, 09 Nov 2017 03:03: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 45E6260CB2; Thu, 9 Nov 2017 11:03:11 +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 EA69E60CDF; Thu, 9 Nov 2017 11:00:47 +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 702E360C71; Thu, 9 Nov 2017 11:00:30 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 15ABF6050D for ; Thu, 9 Nov 2017 11:00:18 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward105o.mail.yandex.net (Yandex) with ESMTP id C5DC14444D10 for ; Thu, 9 Nov 2017 14:00:16 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id fIjKk6SIyr-0GEmIAjx; Thu, 09 Nov 2017 14:00:16 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OkOZyJOXa3-0GY4eg0h; Thu, 09 Nov 2017 14:00:16 +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: Thu, 9 Nov 2017 14:00:11 +0300 Message-Id: <1510225213-20407-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510225213-20407-1-git-send-email-odpbot@yandex.ru> References: <1510225213-20407-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 273 Subject: [lng-odp] [PATCH API-NEXT v4 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: 0724c6474bb6db484fdbdbb1b14035a33ba9525d **/ 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..a60a8d087 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 i; + + return num; +} + uint64_t odp_packet_to_u64(odp_packet_t hdl) { return _odp_pri(hdl); From patchwork Thu Nov 9 11:00:12 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: 118428 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp778276edl; Thu, 9 Nov 2017 03:04:07 -0800 (PST) X-Google-Smtp-Source: AGs4zMbI2nL4E5/gjikJu9LizUGoM7FUjBWoYcNUlAkkAoUDKHnfD0RIRES5H1HB4fG6jH+KDSQO X-Received: by 10.237.36.225 with SMTP id u30mr105351qtc.13.1510225446454; Thu, 09 Nov 2017 03:04:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510225446; cv=none; d=google.com; s=arc-20160816; b=I6godrG0EiC3pBewdaiqlrUJaXFqF0wzbO6YwdG/susHAGkItK28OVKLfn83nzwO1J EPlRPC5fulK3ATh1PIZ1XVVeF9ylbiK8EcHYRQyInCGnV9TASX1+lxfFhaJnD5NJTeMo 4xYJxwV4/pZxpZTd1WJ0DpeQnO4utUqM8wzN3Oaga0y340gKgQN8KLTGPD5FBDIfWVvP C9qSLu0yxCyqHwOpdhxBfnfnJMVRNq8CNSQ2TL/aYNbaJVeHFAacOflPXllmyAK1yFHz xCtNAwhCyRCut9toBuBX4bNyr6Rfl/rKPQzI8HtXSogTrO5DoHIpTecPEWxGG60HpFbw e/Gw== 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=3sjaAeXZnSNhPHmAiLoo5Mw5rdCHAg/KBppou4/rrVg=; b=XNGvcRA56GotEEenerRMPMlu1SYUw4lHN1vLRY+EzL+Q8mUZ36dm7xC0Bkc8oqA19b EW4lxq6k0cpVczFfdsWySsf1ixnWT08cg39OggzSmXWmXQa/USLmYvssdhZzq+1Jv5uv 8r7wXgCCTZYxSkkqQmnaxTWxt22jgXDHAn1BIc0jzRADMO7vLVD1PIm3SoE1BdnoUoTJ PwflWPeb5Sea5oB/cpBtfMN4wxyrM0ZECT2cgOR9jgD7F+/MWYGwUR+bYnY1CMFjQlXD GzHBBv9BC4dXQfqHz8orMAvvPLMUQrOjj3F6/71Zw17MT4S/MHMcq2dO78paSzVFL34G ePsg== 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 s123si6106296qkb.247.2017.11.09.03.04.06; Thu, 09 Nov 2017 03:04:06 -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 1FFB060C36; Thu, 9 Nov 2017 11:04:06 +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 80E6760690; Thu, 9 Nov 2017 11:01:35 +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 28B4D60C16; Thu, 9 Nov 2017 11:01:18 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 9C25A60C16 for ; Thu, 9 Nov 2017 11:00:19 +0000 (UTC) Received: from mxback1g.mail.yandex.net (mxback1g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:162]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 6A6125103B92 for ; Thu, 9 Nov 2017 14:00:17 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id d4DKeLOmyp-0Hm4NbfW; Thu, 09 Nov 2017 14:00:17 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OkOZyJOXa3-0GYifmpe; Thu, 09 Nov 2017 14:00:16 +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: Thu, 9 Nov 2017 14:00:12 +0300 Message-Id: <1510225213-20407-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510225213-20407-1-git-send-email-odpbot@yandex.ru> References: <1510225213-20407-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 273 Subject: [lng-odp] [PATCH API-NEXT v4 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: 0724c6474bb6db484fdbdbb1b14035a33ba9525d **/ 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 Thu Nov 9 11:00:13 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: 118429 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp780498edl; Thu, 9 Nov 2017 03:06:07 -0800 (PST) X-Google-Smtp-Source: ABhQp+Rbru1T9pvglZzboa610WzSY2uvrya8W2Wg+BWN5QqxOHVR1BZgjIp2tJctbdeoKp4pjEcI X-Received: by 10.55.217.18 with SMTP id u18mr99454qki.153.1510225567449; Thu, 09 Nov 2017 03:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510225567; cv=none; d=google.com; s=arc-20160816; b=ArL87kPRDH7NJrG8ld4sYekJtlFvXq9n5BHS2SZ/dYZrNrQLwnc7ONB5iNyE3uxa+6 32Hf6UCryRs5fE8zUBYFDozhw3No4qnT49MAf/fQ06DHVZH7sB65lY836Vp9DwjNkYXM NfuDPnuMrXi+AZkid8oSSEaGvQy+ZvAWuymCfIRoNeAEX3ZQ4BntWgmpDeV3e8YX/J8B GUWhzWu0IIGwlmWP/tsp1IORWdJdiii5lk+/bAXCoAJdo+Y3JpCva1aKFKr06v2ARUfR nYa5gsqYB1zXMk1FODgjiBDbWxBCTmvPCYNTt3OxJI4fwo5oBU7h5axSVL8fMWxpH+OJ 4TSQ== 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=vKOxedu4/8bHrKv/jk9BdfA8zQEgVUudGTz7JOHkM1I=; b=iXHLOLKsCkgGSpNS4xwZd5UCOGg26S7panGF7MLLyRmTqKGyyRh3WE2IQJW/HUI8XT GU7ubxTj3yrZosCn01WF/tNz/yHfJ9ShHKVtcqnCKnSGuotgKZSKCrNMV5X1j4BDWrCG CN09jpufQWnNNJ/gnDeL8GfesSXOlBv7ijN4dO1hIQl213x+bcvBTFziOOIm+uYHPbwj mgC452dSWpKZW9FCepltoqRB7glbyh7x0vh9QlfZi41VoSOtpXMdWyvewVaIid0Uaya8 7HUT3qa/x/si1nxYRgeEPBgws5f1mcI9NaJ+MqrnEzp0OiGDVN4qbbfMECN6d1XyEXGa VIAA== 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 b185si6023371qkc.43.2017.11.09.03.06.07; Thu, 09 Nov 2017 03:06:07 -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 E414660BDF; Thu, 9 Nov 2017 11:06:06 +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 2E6C161001; Thu, 9 Nov 2017 11:01:41 +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 8E80A60C0F; Thu, 9 Nov 2017 11:01:20 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id 00CA660C1C for ; Thu, 9 Nov 2017 11:00:20 +0000 (UTC) Received: from mxback1j.mail.yandex.net (mxback1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10a]) by forward104o.mail.yandex.net (Yandex) with ESMTP id 127127035BD for ; Thu, 9 Nov 2017 14:00:18 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id o54GyDIyA8-0H9qfH2f; Thu, 09 Nov 2017 14:00:18 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OkOZyJOXa3-0HYabZX6; Thu, 09 Nov 2017 14:00:17 +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: Thu, 9 Nov 2017 14:00:13 +0300 Message-Id: <1510225213-20407-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510225213-20407-1-git-send-email-odpbot@yandex.ru> References: <1510225213-20407-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 273 Subject: [lng-odp] [PATCH API-NEXT v4 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: 0724c6474bb6db484fdbdbb1b14035a33ba9525d **/ 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..f96347b55 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) == (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_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) == (num_pkt - 1)); + + 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) == (num_pkt - 1)); + + 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) == (num_pkt - 1)); + + 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) == (num_pkt - 1)); + + 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[];