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);