From patchwork Fri Dec 1 15:00:06 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: 120346 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1256814qgn; Fri, 1 Dec 2017 07:07:59 -0800 (PST) X-Google-Smtp-Source: AGs4zMbesIgqWpdcpOgFq6Q75nPLjr6/+unY+KiXzhxu4pa2ZbDrq2QOUNDyqgGUuXvjazdaTVCA X-Received: by 10.55.204.205 with SMTP id n74mr8498909qkl.25.1512140879099; Fri, 01 Dec 2017 07:07:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140879; cv=none; d=google.com; s=arc-20160816; b=cMUxV4OFyIiVvxGhih5gHiRk25NarLTRJiMbriLGDauZqhfXR6YMW46/mGpdqdgRbz 7FR8u30HxwNJEnR6Q+PtxrpA/GaSDZi8fA0DO+v+WZo5tqq7Jr0+ObgeAyT8aTBJQ/Yk eMdAbYuzaeEn1qyeLaQE6mM8EWBLDj2gwh7Oo8E3TjCE5RIuNoOuGrWC83/CxFJXT247 AK7zbQR4GAkcpC4XIHM9ywtcq5QIQpCrFmjoPXQsw1uKPstp8gz1uIk2E6wL8SToR1RQ /CzrAttqter3ffSurPiw/OuIM85/BBj/zB8IkUZAFfj5bTCfJzbjq7pdcUd24hkZ5Myz FqRA== 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=qPHJ+86vozoOH4GwMSkCgb6oD8gok/cGaz5cUnFvuPs=; b=wSdz6/GhIbaK6jmGTXInuN+/OmFAQXEdoV7iCdXSiKNV4n5XoVv4zS1Oclln67nB21 xd627wrIX/3RbuGn9nHXzLdQLjizWnfMHhSbAHhOIAxA7nf3h9uJyzzeftqanPhJ0jx/ spfNdH9RJqJx+QXONzjdNixb2bveQ47xzWQKHB23boZwtNog/giAu54C8HnmozNQRTk/ JAhfV7daj7wB3Xd34lIogYRKVL67xO0UxetGqQBa26noOtIZAN5HUyiy4iFKBxBPiit7 f1Nyk5qmrqIShEr4H6zN/L3Stu3UrJMWwuSAxdQUyL/S3+olg32RZAcbrviOpglVOddx CwEg== 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 o190si6900053qke.283.2017.12.01.07.07.54; Fri, 01 Dec 2017 07:07:59 -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 9B8576098D; Fri, 1 Dec 2017 15:07: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=-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 65198609D1; Fri, 1 Dec 2017 15:01:14 +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 9CBBD604C8; Fri, 1 Dec 2017 15:00:29 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 2881D6086F for ; Fri, 1 Dec 2017 15:00:22 +0000 (UTC) Received: from mxback5j.mail.yandex.net (mxback5j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10e]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 2089A181326 for ; Fri, 1 Dec 2017 18:00:21 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback5j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id oP79vFTCqY-0LcGCp9I; Fri, 01 Dec 2017 18:00:21 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0KeCBl2R; Fri, 01 Dec 2017 18:00:20 +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, 1 Dec 2017 18:00:06 +0300 Message-Id: <1512140407-13534-12-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512140407-13534-1-git-send-email-odpbot@yandex.ru> References: <1512140407-13534-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 318 Subject: [lng-odp] [PATCH API-NEXT v1 11/12] linux-gen: packet: implement event filter packet 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 event filter packets function. Signed-off-by: Petri Savolainen --- /** Email created from pull request 318 (psavol:next-multi-apis) ** https://github.com/Linaro/odp/pull/318 ** Patch: https://github.com/Linaro/odp/pull/318.patch ** Base sha: bdb7cbf620ada8682c89b5ae5a97cb84f16c0ed0 ** Merge commit sha: aee2bcc574d2a8efdfcecc3b8e681ce391119798 **/ platform/linux-generic/odp_packet.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index cdcb62d21..222fa8c85 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -967,6 +967,27 @@ void odp_packet_to_event_multi(const odp_packet_t pkt[], odp_event_t ev[], ev[i] = odp_packet_to_event(pkt[i]); } +int odp_event_filter_packet(const odp_event_t event[], + odp_packet_t packet[], + odp_event_t remain[], int num) +{ + int i; + int num_pkt = 0; + int num_rem = 0; + + for (i = 0; i < num; i++) { + if (odp_event_type(event[i]) == ODP_EVENT_PACKET) { + packet[num_pkt] = odp_packet_from_event(event[i]); + num_pkt++; + } else { + remain[num_rem] = event[i]; + num_rem++; + } + } + + return num_pkt; +} + /* * * Pointers and lengths