From patchwork Fri Aug 10 13:00:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 143922 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3329895ljj; Fri, 10 Aug 2018 06:02:37 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwQQEqK9p+MGWyUDgNoT6quyqQFI30i3FUMY1P/MW49LtMiuRwlJtUiGLg3yYytKIY+2WqG X-Received: by 2002:ac8:2908:: with SMTP id y8-v6mr6276762qty.45.1533906157130; Fri, 10 Aug 2018 06:02:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533906157; cv=none; d=google.com; s=arc-20160816; b=XnM6eNGYgwHjLjQEurOYKnNLADS1po1RfZV3KXLh8GNRxKokx1cII4EYpS8pffdhI2 Ezg6IuyjcCkxtEn4LUiKK+/enrIx055yVGX0Yi/aebTqk1ALxa64wTBHrcLeaf2TO9bj bqNsE9WcwUbWjKD+nZW/Tpl6dpSE+jb1W7gsmqa8dkHeBNWw3Qxt1OUPYHljaFGbAJgA YIL5WPN+Q3PYwWM0avNNyS8y9Nn4tN6Wss1ynI28bWJBertYND461hXjcZ06t2D45rfz wPoXwy8puOvSrg1hrLaP46lFbadoB5tPdrUZc5DdaxSG5qCAT37m+T9Cps6p5ckJw4g1 NaHw== 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=87+vstM6N3ypUu52N1xLn1d1ulFGnchUAZKoCVw12C8=; b=m/vLg640l5+T2UPu6N39bhQ/ttgnWXiQwnTIOl2P/fIz+xSdLKbQ9I/gL+ouaMo8Pv FuhDi88W8kzkBskmQ2FWqgAIKG1oKG6hMYBvs9imZg03cXBIMu034O1agrJsx9z4iy7V bKWn++GYZzCOzbMVEqOvv5+nKHhmDBz8EiU+Rt/HtpqdiamRmt77WtMNtM8hPg+9bMgt wYLYJVLjsnkWi2hS5CkSba20qFeJsbovyzEU2/WJZ0k+h4tYbgQ6llwSdkDHgzLYR35v MLQOsHSsPh21dw5Ym48MINVq6pCOYFYb5V66cDAK+B5wIudsJd3mIrcA9TM2cH3cKVXD Qwtg== 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 h35-v6si4584003qvi.283.2018.08.10.06.02.36; Fri, 10 Aug 2018 06:02:37 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id B0E33609BA; Fri, 10 Aug 2018 13:02:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id E2B2F6085F; Fri, 10 Aug 2018 13:01:00 +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 2493A607C8; Fri, 10 Aug 2018 13:00:44 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id D6111606A6 for ; Fri, 10 Aug 2018 13:00:22 +0000 (UTC) Received: from mxback7g.mail.yandex.net (mxback7g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:168]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 1F201444788B for ; Fri, 10 Aug 2018 16:00:16 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback7g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 2fr0TpzhXH-0A8SoIe0; Fri, 10 Aug 2018 16:00:10 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Vb4aj3S9kE-09iCZCM8; Fri, 10 Aug 2018 16:00:09 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 10 Aug 2018 13:00:04 +0000 Message-Id: <1533906007-732-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533906007-732-1-git-send-email-odpbot@yandex.ru> References: <1533906007-732-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 672 Subject: [lng-odp] [PATCH API-NEXT v1 1/4] api: packet: add parse result call 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 This enables application to read all commonly used packet parser results with a single function call. This may improve performance when multiple results are needed, especially in ABI compatible builds where function inlining is likely disabled. Signed-off-by: Petri Savolainen --- /** Email created from pull request 672 (psavol:next-packet-metadata) ** https://github.com/Linaro/odp/pull/672 ** Patch: https://github.com/Linaro/odp/pull/672.patch ** Base sha: 9b2b5a9695ad66977c964c83691cd2fef4c45b85 ** Merge commit sha: 2f50c6c282fb183ddbc4628815da441de53deea0 **/ include/odp/api/spec/packet.h | 120 ++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 66665e121..fe341bd4f 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1415,6 +1415,126 @@ int odp_packet_parse(odp_packet_t pkt, uint32_t offset, int odp_packet_parse_multi(const odp_packet_t pkt[], const uint32_t offset[], int num, const odp_packet_parse_param_t *param); +/** Parse result flags */ +typedef struct odp_packet_parse_result_flag_t { + /** Flags union */ + union { + /** All flags as a 64 bit word */ + uint64_t all; + + /** Flags as a bitfield struct */ + struct { + /** @see odp_packet_has_error() */ + uint64_t has_error : 1; + /** @see odp_packet_has_l2_error() */ + uint64_t has_l2_error : 1; + /** @see odp_packet_has_l3_error() */ + uint64_t has_l3_error : 1; + /** @see odp_packet_has_l4_error() */ + uint64_t has_l4_error : 1; + /** @see odp_packet_has_l2() */ + uint64_t has_l2 : 1; + /** @see odp_packet_has_l3() */ + uint64_t has_l3 : 1; + /** @see odp_packet_has_l4() */ + uint64_t has_l4 : 1; + /** @see odp_packet_has_eth() */ + uint64_t has_eth : 1; + /** @see odp_packet_has_eth_bcast() */ + uint64_t has_eth_bcast : 1; + /** @see odp_packet_has_eth_mcast() */ + uint64_t has_eth_mcast : 1; + /** @see odp_packet_has_jumbo() */ + uint64_t has_jumbo : 1; + /** @see odp_packet_has_vlan() */ + uint64_t has_vlan : 1; + /** @see odp_packet_has_vlan_qinq() */ + uint64_t has_vlan_qinq : 1; + /** @see odp_packet_has_arp() */ + uint64_t has_arp : 1; + /** @see odp_packet_has_ipv4() */ + uint64_t has_ipv4 : 1; + /** @see odp_packet_has_ipv6() */ + uint64_t has_ipv6 : 1; + /** @see odp_packet_has_ip_bcast() */ + uint64_t has_ip_bcast : 1; + /** @see odp_packet_has_ip_mcast() */ + uint64_t has_ip_mcast : 1; + /** @see odp_packet_has_ipfrag() */ + uint64_t has_ipfrag : 1; + /** @see odp_packet_has_ipopt() */ + uint64_t has_ipopt : 1; + /** @see odp_packet_has_ipsec() */ + uint64_t has_ipsec : 1; + /** @see odp_packet_has_udp() */ + uint64_t has_udp : 1; + /** @see odp_packet_has_tcp() */ + uint64_t has_tcp : 1; + /** @see odp_packet_has_sctp() */ + uint64_t has_sctp : 1; + /** @see odp_packet_has_icmp() */ + uint64_t has_icmp : 1; + }; + }; + +} odp_packet_parse_result_flag_t; + +/** Packet parse results */ +typedef struct odp_packet_parse_result_t { + /** Parse result flags */ + odp_packet_parse_result_flag_t flag; + + /** @see odp_packet_len() */ + uint32_t packet_len; + + /** @see odp_packet_l2_offset() */ + uint32_t l2_offset; + /** @see odp_packet_l3_offset() */ + uint32_t l3_offset; + /** @see odp_packet_l4_offset() */ + uint32_t l4_offset; + + /** @see odp_packet_l3_chksum_status() */ + odp_packet_chksum_status_t l3_chksum_status; + /** @see odp_packet_l4_chksum_status() */ + odp_packet_chksum_status_t l4_chksum_status; + + /** @see odp_packet_l2_type() */ + odp_proto_l2_type_t l2_type; + /** @see odp_packet_l3_type() */ + odp_proto_l3_type_t l3_type; + /** @see odp_packet_l4_type() */ + odp_proto_l4_type_t l4_type; + +} odp_packet_parse_result_t; + +/** + * Read parse results + * + * Read out the most commonly used packet parse results. The same information is + * available through individual function calls, but this call may be more + * efficient when reading multiple results from a packet. + * + * @param pkt Packet handle + * @param[out] result Pointer for parse result output + */ +void odp_packet_parse_result(odp_packet_t pkt, + odp_packet_parse_result_t *result); + +/** + * Read parse results from multiple packets + * + * Otherwise same functionality as odp_packet_parse_result() but handles + * multiple packets. + * + * @param pkt Packet handle array + * @param[out] result Parse result array for output + * @param num Number of packets and results + */ +void odp_packet_parse_result_multi(const odp_packet_t pkt[], + odp_packet_parse_result_t *result[], + int num); + /** * Packet pool * From patchwork Fri Aug 10 13:00:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 143921 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3329432ljj; Fri, 10 Aug 2018 06:02:18 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzNx2V//4yN2HGBLmW3tlmBVmmeI51A1lfy0cF1ZFMUcCZKlhooVve6piNxAnKSqV6gKxcH X-Received: by 2002:a37:e216:: with SMTP id g22-v6mr5726670qki.61.1533906138233; Fri, 10 Aug 2018 06:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533906138; cv=none; d=google.com; s=arc-20160816; b=Du89SbUTQG6NBgMtwikLPccGTHbDn3nY9bztgk6ey6PWnSwWqPKTuyVcjPIgG9n9I9 czmJVFfQLOOMTldWdDQcxpZk74CaVtlsGbl66XMB/o+kHKwj99QvWo99+yJ31o4pwcyT hjI09T3IaHiz58eQkvPYTLVCsefVioL5Z1XyYqIr7qG4K6vYuN8zVilGnWXH0hqWYBBv up5iKuz5gcpeGwGdf7gwHlkhXRKpH3Do8GLDQRxYgi/X0LVoUpGTsUx+c+iF+R01tXSg JzWNDvVLSnkv4x6G+xnyJwHvQ5udc08nEhyAgecR7OblPCiKe05AiHgODLo/5Xp0yTzy /aHg== 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=hsno9vhdLR+uC1aIefH2X22bbWVJLkXiaaQ/xzm819A=; b=em0+xIkUfS8OEzO2mqPIvCxkUwy8j/9jz0o3v+sKF4PQkTJZfexJR2KXJcfeuiyML6 TeUz0Rxs3GOnW3iUoUktBm6JzXmweQP8tinHzn3PuScpUr0m9mEk4f9ZjT8aXwNF8lQv UPwrWFOV5/oBx0NrtNueCqbGXvr5NXwMLjumoikIBAvP9aglFgl61v8oHvpWvuoc5Dk+ uRo+Chq+WaujFrrPYCuvXkzw32XbmzooXEO6ZlqnbPTPc00jnyqT1U8AR/tkmpegpz5d ZnnI2MYXTYS6DATdIzi04n2q57m0g13erNGo6brl8NcOLi+wF5fIAxdTqEO6MpZGAz21 1rRA== 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 r24-v6si8253681qtn.77.2018.08.10.06.02.17; Fri, 10 Aug 2018 06:02:18 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id CAE1360B30; Fri, 10 Aug 2018 13:02:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 9F511606A6; Fri, 10 Aug 2018 13:00:57 +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 0346E60826; Fri, 10 Aug 2018 13:00:44 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id 6F71A607C7 for ; Fri, 10 Aug 2018 13:00:29 +0000 (UTC) Received: from mxback16j.mail.yandex.net (mxback16j.mail.yandex.net [IPv6:2a02:6b8:0:1619::92]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 01826476CF for ; Fri, 10 Aug 2018 16:00:17 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback16j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id adtNM9eh0r-0GvuBR6m; Fri, 10 Aug 2018 16:00:16 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Vb4aj3S9kE-0GiiG843; Fri, 10 Aug 2018 16: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: Fri, 10 Aug 2018 13:00:05 +0000 Message-Id: <1533906007-732-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533906007-732-1-git-send-email-odpbot@yandex.ru> References: <1533906007-732-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 672 Subject: [lng-odp] [PATCH API-NEXT v1 2/4] linux-gen: packet: implement packet result calls 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 Simple implementation of the new packet result calls. Especially, flag copy needs to be optimized by storing flag bits directly into API defined format (packet_parse_result_flag_t) in the packet header. Signed-off-by: Petri Savolainen --- /** Email created from pull request 672 (psavol:next-packet-metadata) ** https://github.com/Linaro/odp/pull/672 ** Patch: https://github.com/Linaro/odp/pull/672.patch ** Base sha: 9b2b5a9695ad66977c964c83691cd2fef4c45b85 ** Merge commit sha: 2f50c6c282fb183ddbc4628815da441de53deea0 **/ platform/linux-generic/odp_packet.c | 53 +++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 11f8bd43d..0a4f49a18 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2731,6 +2731,59 @@ int odp_packet_parse_multi(const odp_packet_t pkt[], const uint32_t offset[], return num; } +void odp_packet_parse_result(odp_packet_t pkt, + odp_packet_parse_result_t *result) +{ + /* TODO: optimize to single word copy when packet header stores bits + * directly into odp_packet_parse_result_flag_t */ + result->flag.all = 0; + result->flag.has_error = odp_packet_has_error(pkt); + result->flag.has_l2_error = odp_packet_has_l2_error(pkt); + result->flag.has_l3_error = odp_packet_has_l3_error(pkt); + result->flag.has_l4_error = odp_packet_has_l4_error(pkt); + result->flag.has_l2 = odp_packet_has_l2(pkt); + result->flag.has_l3 = odp_packet_has_l3(pkt); + result->flag.has_l4 = odp_packet_has_l4(pkt); + result->flag.has_eth = odp_packet_has_eth(pkt); + result->flag.has_eth_bcast = odp_packet_has_eth_bcast(pkt); + result->flag.has_eth_mcast = odp_packet_has_eth_mcast(pkt); + result->flag.has_jumbo = odp_packet_has_jumbo(pkt); + result->flag.has_vlan = odp_packet_has_vlan(pkt); + result->flag.has_vlan_qinq = odp_packet_has_vlan_qinq(pkt); + result->flag.has_arp = odp_packet_has_arp(pkt); + result->flag.has_ipv4 = odp_packet_has_ipv4(pkt); + result->flag.has_ipv6 = odp_packet_has_ipv6(pkt); + result->flag.has_ip_bcast = odp_packet_has_ip_bcast(pkt); + result->flag.has_ip_mcast = odp_packet_has_ip_mcast(pkt); + result->flag.has_ipfrag = odp_packet_has_ipfrag(pkt); + result->flag.has_ipopt = odp_packet_has_ipopt(pkt); + result->flag.has_ipsec = odp_packet_has_ipsec(pkt); + result->flag.has_udp = odp_packet_has_udp(pkt); + result->flag.has_tcp = odp_packet_has_tcp(pkt); + result->flag.has_sctp = odp_packet_has_sctp(pkt); + result->flag.has_icmp = odp_packet_has_icmp(pkt); + + result->packet_len = odp_packet_len(pkt); + result->l2_offset = odp_packet_l2_offset(pkt); + result->l3_offset = odp_packet_l3_offset(pkt); + result->l4_offset = odp_packet_l4_offset(pkt); + result->l3_chksum_status = odp_packet_l3_chksum_status(pkt); + result->l4_chksum_status = odp_packet_l4_chksum_status(pkt); + result->l2_type = odp_packet_l2_type(pkt); + result->l3_type = odp_packet_l3_type(pkt); + result->l4_type = odp_packet_l4_type(pkt); +} + +void odp_packet_parse_result_multi(const odp_packet_t pkt[], + odp_packet_parse_result_t *result[], + int num) +{ + int i; + + for (i = 0; i < num; i++) + odp_packet_parse_result(pkt[i], result[i]); +} + uint64_t odp_packet_to_u64(odp_packet_t hdl) { return _odp_pri(hdl); From patchwork Fri Aug 10 13:00:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 143919 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3327262ljj; Fri, 10 Aug 2018 06:00:54 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzpqSN7ZV6KHy0aKNFEBhbf3lZqu2S0FjykdUc3kQk4a3DIMkfGsBcy6lzPHb+7sr4UYnUe X-Received: by 2002:a37:4fcd:: with SMTP id d196-v6mr5708942qkb.323.1533906054867; Fri, 10 Aug 2018 06:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533906054; cv=none; d=google.com; s=arc-20160816; b=juHmB1H85mcgjNkFiD10ePzlRkLvoyqsXwPHVX/3jnXsfqJ7kp8a+IgOe5NlSwKWeo hEdXRg2IRbq2bPVFY1AdICtq9CYtd0knPIeaT+OwoJ9I29iBV+y9q6wCnsqLWbZi4uts 6sUczwzj83+VkorOpvq1sL0SoM4CmwAHF9Y/R8TEd8r0O1JqLmodT1AxydmDuNfdoAO0 GMUDN6PLfytJg8S/W3BXGktC3sSRQyTxLrFPwaOnEQrkJeC4WiQZbxzvYzXcoi99XQ/E qs+/1ucpD8ylNaI8u7Jag3VguFXyL3/cizenqqFu4M6mRKWV04Ulw/79J7GCmlokKMQk ZP6g== 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=V4iDrSyoNn9AIMQirw8E+StVk7EAvg5Fevy36ycAQ8s=; b=yYMwmzB/3pp5A4EJmH8J4cyTEK4QMNn8K7/x8z/uFRI4O+ueKyeZven9XeFY6KtOa/ 5l48CCY0btLhfTY0fK3gFxo7FT6pIlLXqeqSGIpqZQ0ImjUmdiifddnG3aPRPI0j7AEX mOccY82tHUv5kJMxtuio1Pipw7fX0qNF365+C0I7QAx56zcp+1UK2JjvBgREgKcXW9um v/OeEUvqwCXP4GPhP6V5nqCz+eYabyi5puiXi7/YfsRY607yZECdtzYWqrJJDthdt2V3 RvjZTkQk5yvdQKdhHr1zKDBWU4fMX3UovtzsRrKYzrtUOfeGWIyR+/0ASYD6vScpso2u +Duw== 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 g5-v6si7990316qvb.255.2018.08.10.06.00.54; Fri, 10 Aug 2018 06:00:54 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 7702E60840; Fri, 10 Aug 2018 13:00:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id C24A5606A6; Fri, 10 Aug 2018 13: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 90A9C60828; Fri, 10 Aug 2018 13:00:42 +0000 (UTC) Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [5.45.198.249]) by lists.linaro.org (Postfix) with ESMTPS id 8220A607C8 for ; Fri, 10 Aug 2018 13:00:19 +0000 (UTC) Received: from mxback16j.mail.yandex.net (mxback16j.mail.yandex.net [IPv6:2a02:6b8:0:1619::92]) by forward106j.mail.yandex.net (Yandex) with ESMTP id ED2E8180840B for ; Fri, 10 Aug 2018 16:00:17 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback16j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Ld7eTa4qxq-0HvmoZwm; Fri, 10 Aug 2018 16:00:17 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Vb4aj3S9kE-0HiCLBXH; Fri, 10 Aug 2018 16: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: Fri, 10 Aug 2018 13:00:06 +0000 Message-Id: <1533906007-732-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533906007-732-1-git-send-email-odpbot@yandex.ru> References: <1533906007-732-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 672 Subject: [lng-odp] [PATCH API-NEXT v1 3/4] validation: packet: add num_pkt parameter to parse_test_alloc 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 It's more robust to use a parameter instead of assuming that a fixed number of packets are allocated. Signed-off-by: Petri Savolainen --- /** Email created from pull request 672 (psavol:next-packet-metadata) ** https://github.com/Linaro/odp/pull/672 ** Patch: https://github.com/Linaro/odp/pull/672.patch ** Base sha: 9b2b5a9695ad66977c964c83691cd2fef4c45b85 ** Merge commit sha: 2f50c6c282fb183ddbc4628815da441de53deea0 **/ test/validation/api/packet/packet.c | 47 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index a564c0028..4594260cf 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -2558,10 +2558,9 @@ static int packet_parse_suite_term(void) } static void parse_test_alloc(odp_packet_t pkt[], const uint8_t test_packet[], - uint32_t len) + uint32_t len, int num_pkt) { int ret, i; - int num_pkt = PARSE_TEST_NUM_PKT; ret = odp_packet_alloc_multi(parse_test.pool, len, pkt, num_pkt); CU_ASSERT_FATAL(ret == num_pkt); @@ -2582,7 +2581,7 @@ static void parse_eth_ipv4_udp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv4_udp, - sizeof(test_packet_ipv4_udp)); + sizeof(test_packet_ipv4_udp), num_pkt); for (i = 0; i < num_pkt; i++) { chksum_status = odp_packet_l3_chksum_status(pkt[i]); @@ -2626,7 +2625,7 @@ static void parse_ipv4_udp(void) uint32_t offset[num_pkt]; parse_test_alloc(pkt, test_packet_ipv4_udp, - sizeof(test_packet_ipv4_udp)); + sizeof(test_packet_ipv4_udp), num_pkt); for (i = 0; i < num_pkt; i++) offset[i] = 14; @@ -2662,7 +2661,7 @@ static void parse_eth_ipv4_tcp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv4_tcp, - sizeof(test_packet_ipv4_tcp)); + sizeof(test_packet_ipv4_tcp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2698,7 +2697,7 @@ static void parse_eth_ipv6_udp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv6_udp, - sizeof(test_packet_ipv6_udp)); + sizeof(test_packet_ipv6_udp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2728,7 +2727,7 @@ static void parse_eth_ipv6_tcp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv6_tcp, - sizeof(test_packet_ipv6_tcp)); + sizeof(test_packet_ipv6_tcp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_ALL; @@ -2758,7 +2757,7 @@ static void parse_eth_vlan_ipv4_udp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_vlan_ipv4_udp, - sizeof(test_packet_vlan_ipv4_udp)); + sizeof(test_packet_vlan_ipv4_udp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2789,7 +2788,7 @@ static void parse_eth_vlan_ipv6_udp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_vlan_ipv6_udp, - sizeof(test_packet_vlan_ipv6_udp)); + sizeof(test_packet_vlan_ipv6_udp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2826,7 +2825,7 @@ static void parse_eth_vlan_qinq_ipv4_udp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_vlan_qinq_ipv4_udp, - sizeof(test_packet_vlan_qinq_ipv4_udp)); + sizeof(test_packet_vlan_qinq_ipv4_udp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2858,7 +2857,7 @@ static void parse_eth_arp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_arp, - sizeof(test_packet_arp)); + sizeof(test_packet_arp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2890,7 +2889,7 @@ static void parse_eth_ipv4_icmp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv4_icmp, - sizeof(test_packet_ipv4_icmp)); + sizeof(test_packet_ipv4_icmp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2921,7 +2920,7 @@ static void parse_eth_ipv6_icmp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv6_icmp, - sizeof(test_packet_ipv6_icmp)); + sizeof(test_packet_ipv6_icmp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2952,7 +2951,7 @@ static void parse_eth_ipv4_sctp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv4_sctp, - sizeof(test_packet_ipv4_sctp)); + sizeof(test_packet_ipv4_sctp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -2983,7 +2982,7 @@ static void parse_eth_ipv4_ipsec_ah(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv4_ipsec_ah, - sizeof(test_packet_ipv4_ipsec_ah)); + sizeof(test_packet_ipv4_ipsec_ah), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3014,7 +3013,7 @@ static void parse_eth_ipv4_ipsec_esp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv4_ipsec_esp, - sizeof(test_packet_ipv4_ipsec_esp)); + sizeof(test_packet_ipv4_ipsec_esp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3045,7 +3044,7 @@ static void parse_eth_ipv6_ipsec_ah(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv6_ipsec_ah, - sizeof(test_packet_ipv6_ipsec_ah)); + sizeof(test_packet_ipv6_ipsec_ah), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3082,7 +3081,7 @@ static void parse_eth_ipv6_ipsec_esp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv6_ipsec_esp, - sizeof(test_packet_ipv6_ipsec_esp)); + sizeof(test_packet_ipv6_ipsec_esp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3113,7 +3112,7 @@ static void parse_mcast_eth_ipv4_udp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_mcast_eth_ipv4_udp, - sizeof(test_packet_mcast_eth_ipv4_udp)); + sizeof(test_packet_mcast_eth_ipv4_udp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3147,7 +3146,7 @@ static void parse_bcast_eth_ipv4_udp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_bcast_eth_ipv4_udp, - sizeof(test_packet_bcast_eth_ipv4_udp)); + sizeof(test_packet_bcast_eth_ipv4_udp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3182,7 +3181,7 @@ static void parse_mcast_eth_ipv6_udp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_mcast_eth_ipv6_udp, - sizeof(test_packet_mcast_eth_ipv6_udp)); + sizeof(test_packet_mcast_eth_ipv6_udp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3216,7 +3215,7 @@ static void parse_eth_ipv4_udp_first_frag(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv4_udp_first_frag, - sizeof(test_packet_ipv4_udp_first_frag)); + sizeof(test_packet_ipv4_udp_first_frag), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3248,7 +3247,7 @@ static void parse_eth_ipv4_udp_last_frag(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv4_udp_last_frag, - sizeof(test_packet_ipv4_udp_last_frag)); + sizeof(test_packet_ipv4_udp_last_frag), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; @@ -3280,7 +3279,7 @@ static void parse_eth_ipv4_rr_nop_icmp(void) odp_packet_t pkt[num_pkt]; parse_test_alloc(pkt, test_packet_ipv4_rr_nop_icmp, - sizeof(test_packet_ipv4_rr_nop_icmp)); + sizeof(test_packet_ipv4_rr_nop_icmp), num_pkt); parse.proto = ODP_PROTO_ETH; parse.last_layer = ODP_PROTO_LAYER_L4; From patchwork Fri Aug 10 13:00:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 143920 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3328479ljj; Fri, 10 Aug 2018 06:01:43 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzolqCOf3YCXEbFnvGp0dBzPXM4B15Hzvkfwx5j6yuTLQmSbMoMXZFsfnTn5VzYAhngFjnT X-Received: by 2002:a37:aa4e:: with SMTP id t75-v6mr5894513qke.425.1533906102944; Fri, 10 Aug 2018 06:01:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533906102; cv=none; d=google.com; s=arc-20160816; b=cZ/uxkDoeZFXjhdnQcktugEr6Wz+RVC6QYGNMjuFyN4Ij/cAeGo03mlH8XA5wFXgdC mEwUAI6lAIj5GdFcoA5jkLYIhOfsH2t0Vu68lccrWmiTcI9su+6QPsCoLIdHrnjSUgQq fAKYCHr4QA0gI5A+8MWfzC+Rd+RlXsFu86a99IB98jgRNsyZBwSqEcdVaTqAGwNMYrLM 9KycjQzrQ47HrsCzQ16C2wlETCcszwvEtELah+X3KLzwvkjiW4OIVEs6Z3Heksjq8Y3l bqkna1n1q48WmOqJlXSE7DbLGulJDpjogWlSKg5fc2IegViNXqyxNd31XSXEz9LvBeEB 2hSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=X5DePL18W49ZNr68o7+OYBFN9JZdkZqCZDB5ENFTuEQ=; b=l21lJIpBxAkAliyohIgXwjqzxtTqqa+HoU8Otlh0hElTj/Vk+sHbkt+MlrkpvZ4198 6L4Z1oA6luBJSVhAyt6hukBC9pjCY/ydJGizDdwXKQR5RCGauJouxMmj7G6ITCnUXl7W SwVdarol2x1mUJq1NbRGhemc1hoJAuPeGrBSZrrRSFrf1zLQ3MMyJNivzZJCXRutkSeA 8FKj0DLAewIZ9vEPocj2SaVyR+pYTsMaWXMjckYKOAzLFQugsS9CXQdcWj0vQsJR8k2o LNnw69CNqh8AOKCS0GEyzihTW6aw3fi7KTQlVVMgefoDWFBfaAQfGClUNV5AuFBSJOlH HEWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id k13-v6si2746762qve.159.2018.08.10.06.01.42; Fri, 10 Aug 2018 06:01:42 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 861CA60B53; Fri, 10 Aug 2018 13:01:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 462346080E; Fri, 10 Aug 2018 13:00:52 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id B916E60826; Fri, 10 Aug 2018 13:00:43 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id 139A160833 for ; Fri, 10 Aug 2018 13:00:20 +0000 (UTC) Received: from mxback2g.mail.yandex.net (mxback2g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:163]) by forward100o.mail.yandex.net (Yandex) with ESMTP id B26B42A27DC1 for ; Fri, 10 Aug 2018 16:00:18 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback2g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id khPgOLMBdY-0I9a1G22; Fri, 10 Aug 2018 16:00:18 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Vb4aj3S9kE-0IiKvIIa; Fri, 10 Aug 2018 16:00:18 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 10 Aug 2018 13:00:07 +0000 Message-Id: <1533906007-732-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533906007-732-1-git-send-email-odpbot@yandex.ru> References: <1533906007-732-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 672 Subject: [lng-odp] [PATCH API-NEXT v1 4/4] validation: packet: add parse result test X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Test new parse result functions. Signed-off-by: Petri Savolainen --- /** Email created from pull request 672 (psavol:next-packet-metadata) ** https://github.com/Linaro/odp/pull/672 ** Patch: https://github.com/Linaro/odp/pull/672.patch ** Base sha: 9b2b5a9695ad66977c964c83691cd2fef4c45b85 ** Merge commit sha: 2f50c6c282fb183ddbc4628815da441de53deea0 **/ test/validation/api/packet/packet.c | 109 ++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 4594260cf..29581fc8d 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -3303,6 +3303,114 @@ static void parse_eth_ipv4_rr_nop_icmp(void) odp_packet_free_multi(pkt, num_pkt); } +static void parse_result(void) +{ + odp_packet_parse_param_t parse; + int i; + int num_pkt = PARSE_TEST_NUM_PKT; + odp_packet_t pkt[num_pkt]; + odp_packet_parse_result_t result[num_pkt]; + odp_packet_parse_result_t *result_ptr[num_pkt]; + + /* Ethernet/VLAN/IPv6/UDP */ + parse_test_alloc(pkt, test_packet_vlan_ipv6_udp, + sizeof(test_packet_vlan_ipv6_udp), num_pkt); + + parse.proto = ODP_PROTO_ETH; + parse.last_layer = ODP_PROTO_LAYER_ALL; + parse.chksums.all_chksum = 0; + + CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0); + CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero, + num_pkt - 1, &parse) == (num_pkt - 1)); + + for (i = 0; i < num_pkt; i++) { + result_ptr[i] = &result[i]; + memset(&result[i], 0, sizeof(odp_packet_parse_result_t)); + } + + odp_packet_parse_result(pkt[0], result_ptr[0]); + odp_packet_parse_result_multi(&pkt[1], &result_ptr[1], num_pkt - 1); + + for (i = 0; i < num_pkt; i++) { + CU_ASSERT(odp_packet_has_eth(pkt[i])); + CU_ASSERT(odp_packet_has_vlan(pkt[i])); + CU_ASSERT(odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(odp_packet_has_udp(pkt[i])); + CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT(odp_packet_l2_type(pkt[i]) == ODP_PROTO_L2_TYPE_ETH); + CU_ASSERT(odp_packet_l3_type(pkt[i]) == ODP_PROTO_L3_TYPE_IPV6); + CU_ASSERT(odp_packet_l4_type(pkt[i]) == ODP_PROTO_L4_TYPE_UDP); + + CU_ASSERT(result[i].flag.all != 0); + CU_ASSERT(result[i].flag.has_error == + odp_packet_has_error(pkt[i])); + CU_ASSERT(result[i].flag.has_l2_error == + odp_packet_has_l2_error(pkt[i])); + CU_ASSERT(result[i].flag.has_l3_error == + odp_packet_has_l3_error(pkt[i])); + CU_ASSERT(result[i].flag.has_l4_error == + odp_packet_has_l4_error(pkt[i])); + CU_ASSERT(result[i].flag.has_l2 == + odp_packet_has_l2(pkt[i])); + CU_ASSERT(result[i].flag.has_l3 == + odp_packet_has_l3(pkt[i])); + CU_ASSERT(result[i].flag.has_l4 == + odp_packet_has_l4(pkt[i])); + CU_ASSERT(result[i].flag.has_eth == + odp_packet_has_eth(pkt[i])); + CU_ASSERT(result[i].flag.has_eth_bcast == + odp_packet_has_eth_bcast(pkt[i])); + CU_ASSERT(result[i].flag.has_eth_mcast == + odp_packet_has_eth_mcast(pkt[i])); + CU_ASSERT(result[i].flag.has_jumbo == + odp_packet_has_jumbo(pkt[i])); + CU_ASSERT(result[i].flag.has_vlan == + odp_packet_has_vlan(pkt[i])); + CU_ASSERT(result[i].flag.has_vlan_qinq == + odp_packet_has_vlan_qinq(pkt[i])); + CU_ASSERT(result[i].flag.has_arp == + odp_packet_has_arp(pkt[i])); + CU_ASSERT(result[i].flag.has_ipv4 == + odp_packet_has_ipv4(pkt[i])); + CU_ASSERT(result[i].flag.has_ipv6 == + odp_packet_has_ipv6(pkt[i])); + CU_ASSERT(result[i].flag.has_ip_bcast == + odp_packet_has_ip_bcast(pkt[i])); + CU_ASSERT(result[i].flag.has_ip_mcast == + odp_packet_has_ip_mcast(pkt[i])); + CU_ASSERT(result[i].flag.has_ipfrag == + odp_packet_has_ipfrag(pkt[i])); + CU_ASSERT(result[i].flag.has_ipopt == + odp_packet_has_ipopt(pkt[i])); + CU_ASSERT(result[i].flag.has_ipsec == + odp_packet_has_ipsec(pkt[i])); + CU_ASSERT(result[i].flag.has_udp == + odp_packet_has_udp(pkt[i])); + CU_ASSERT(result[i].flag.has_tcp == + odp_packet_has_tcp(pkt[i])); + CU_ASSERT(result[i].flag.has_sctp == + odp_packet_has_sctp(pkt[i])); + CU_ASSERT(result[i].flag.has_icmp == + odp_packet_has_icmp(pkt[i])); + + CU_ASSERT(result[i].packet_len == odp_packet_len(pkt[i])); + CU_ASSERT(result[i].l2_offset == odp_packet_l2_offset(pkt[i])); + CU_ASSERT(result[i].l3_offset == odp_packet_l3_offset(pkt[i])); + CU_ASSERT(result[i].l4_offset == odp_packet_l4_offset(pkt[i])); + CU_ASSERT(result[i].l3_chksum_status == + odp_packet_l3_chksum_status(pkt[i])); + CU_ASSERT(result[i].l4_chksum_status == + odp_packet_l4_chksum_status(pkt[i])); + CU_ASSERT(result[i].l2_type == odp_packet_l2_type(pkt[i])); + CU_ASSERT(result[i].l3_type == odp_packet_l3_type(pkt[i])); + CU_ASSERT(result[i].l4_type == odp_packet_l4_type(pkt[i])); + } + + odp_packet_free_multi(pkt, num_pkt); +} + odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_alloc_free), ODP_TEST_INFO(packet_test_alloc_free_multi), @@ -3360,6 +3468,7 @@ odp_testinfo_t packet_parse_suite[] = { ODP_TEST_INFO(parse_eth_ipv4_udp_first_frag), ODP_TEST_INFO(parse_eth_ipv4_udp_last_frag), ODP_TEST_INFO(parse_eth_ipv4_rr_nop_icmp), + ODP_TEST_INFO(parse_result), ODP_TEST_INFO_NULL, };