From patchwork Mon Aug 20 10: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: 144559 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3770254ljj; Mon, 20 Aug 2018 03:04:05 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZzuu8ffHqZul2qzdG14T9E/LpITtF6Qnmwi8xZqgySkQRjIbMoaBl8WSYTab0fP9i5xbPN X-Received: by 2002:ac8:2d2e:: with SMTP id n43-v6mr3753592qta.38.1534759445409; Mon, 20 Aug 2018 03:04:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534759445; cv=none; d=google.com; s=arc-20160816; b=jXljus2bMB+rHNbxmy0zys74RaKQ0KNghZC3ybzEIzImuFEGUjIII2T6TzEB/IQDx+ qOlKJL0Nlri1kY3085Wwve4aT6Kr+fz16i9TVWXsjA2+daG2SRrYIWP0eZ+dtpekPX6l ZFtn3xeav07zh8VnmJGPu4dlDfSI9b9PFk6J8rkDB3xLFz1rS1bJZYx+m4fIzMDToE3m iN0CvK/InuR35SqkH7ckUaSYxf50OQkVjZi2kaUv+/mDo4xvpsTY2FfDMUhs4JVv7GPq 1Hr0+Jf/ChP9PLZGOd5QHmPPhiJq1FEMqN1wYhgzAJCBxmKWd5j253sMOxHXBgzJ01cj hPpw== 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=Kk3M+EOIH2X8P1a2bP8RDeR4ENvm0LTA64XYd73thGo=; b=LMdnEd4xeONAJ9Ka6GSI7tNmIxDJxAzmcnLt5jP/FDWwslp0rGz8oS7jkDoQ7Afv4/ iN9kNEXPhXV9Lz9oS2FIoKGAvmar+wRmE4WElulLVBgJR9so7GBmv2M+rPAgj0jjd58R XAnRbB5cX9glICG7LOcP1O52bm+814Lt79lClfxvSjsh11vaBr8+wNtmtuS+r+octoZ1 /REvnCK4ivnkcfGzMZc8dT49Rd7ijl4r0ZBaHa2z3qAg0n+JEkGw0YeJBLz1vDBfLdLp EP2rFrPV2wjvlSdBWNG4yfDQR0Ml5+J7kCkuMGOmA6YT5kLGEBgAS+9J/v3KQ6XfhTjd rusA== 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 l37-v6si2492006qtl.321.2018.08.20.03.04.05; Mon, 20 Aug 2018 03:04:05 -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 0A0626863A; Mon, 20 Aug 2018 10:04:05 +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 755D7685E1; Mon, 20 Aug 2018 10:01:22 +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 0F59568643; Mon, 20 Aug 2018 10:01:15 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 6540A685E1 for ; Mon, 20 Aug 2018 10:00:28 +0000 (UTC) Received: from mxback14j.mail.yandex.net (mxback14j.mail.yandex.net [IPv6:2a02:6b8:0:1619::90]) by forward100p.mail.yandex.net (Yandex) with ESMTP id BA6D75101C91 for ; Mon, 20 Aug 2018 13:00:17 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback14j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id X5TOkwKkSS-0HOaFD9e; Mon, 20 Aug 2018 13:00:17 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id mI7U2yzlYn-0GPuq2ZG; Mon, 20 Aug 2018 13: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: Mon, 20 Aug 2018 10:00:06 +0000 Message-Id: <1534759208-15203-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534759208-15203-1-git-send-email-odpbot@yandex.ru> References: <1534759208-15203-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 672 Subject: [lng-odp] [PATCH API-NEXT v3 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: 2722279b31b075586551801eb2860687ff966ea8 ** Merge commit sha: e76448d8a8f2575ab3a4c445be84d19f055cbf2d **/ 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 7bb93e1e1..0df32d1c8 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2732,6 +2732,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);