From patchwork Fri Dec 1 14:59:56 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: 120339 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1251079qgn; Fri, 1 Dec 2017 07:04:06 -0800 (PST) X-Google-Smtp-Source: AGs4zMavE0nWVDAxtkUs2A6501fqt97CeyGGai7hlB6lxEWiLcYa24xjPghnpPz2w3yrlk8rNAJK X-Received: by 10.200.25.227 with SMTP id s32mr8716037qtk.307.1512140645953; Fri, 01 Dec 2017 07:04:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140645; cv=none; d=google.com; s=arc-20160816; b=FN1QRwrkbvQug88VvifF+6vfHpFPB/H1T4woWtpJ/nE2s1F9sUad2x3junHDyqaDEp VBTPp3t1q8UMHIwlgsoAZyFMVD0mSLE3aZxdQgaxG5wwF38/62xhjBf9XvOtcVmtLmSg pCJo9ubXaYsVCHzNRwqjan0RRvEa9o1MjvErX5b9oAAwn1wzvBskHtN5wjFN0/MiSbhT uuM9cUs1oeyV2dRne/4zBKMljHdycnaW7EiU22Zq3mx8qHqJIaNbPVSqBkpdotSTu5/Y c6/02+9s7jG8VfcyuboR+7bcs/Gq0Od39ugpVKhczbw9ofdAfJaNcjVyAd0EwKbjnJlX eboQ== 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=1+nw+dkaHJohcruj9DAd6IpDnT4WcrQF51StpjjSKIY=; b=WOwEKenHjjlo5JH1av1s4BXTLS2XVi+XczK3lYUCNzZ312vyJjT7hKDy8vyHYWomp3 /qwRg2D9FQ4FjnKOjak1NQWcsholswWC0FOtzj7H0lN28vNerDUSlidpZ28nSj6+dYq7 cUjt7Yas21FxBfZdO8yN99BBmC7uTJ+dDcalboFhHfYh0avYpKzNQpRsHcg5DQe0VwAi rfNacvdoDIzEVLjZxdlFC+9FsTMyBujJUr4jW9ThQ4/DMvYpfNtfps/LitkPe9grW/bu RS6TU85FjPNnAwWVQMSZ/yCuH6iInMtZyjzvQmpqR7w7DLuB3djYtFL080dBmXPzS18a iJZA== 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 i44si5783306qtf.172.2017.12.01.07.04.05; Fri, 01 Dec 2017 07:04:05 -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 0A6116097D; Fri, 1 Dec 2017 15: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=-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 3285C6098B; Fri, 1 Dec 2017 15:00:49 +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 207136097B; Fri, 1 Dec 2017 15:00:22 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 33A936086F for ; Fri, 1 Dec 2017 15:00:16 +0000 (UTC) Received: from mxback19j.mail.yandex.net (mxback19j.mail.yandex.net [IPv6:2a02:6b8:0:1619::95]) by forward104p.mail.yandex.net (Yandex) with ESMTP id A8B85183560 for ; Fri, 1 Dec 2017 18:00:14 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback19j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id UAAnPnvDqL-0EgiiSJX; Fri, 01 Dec 2017 18:00:14 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0Eeaa8DT; Fri, 01 Dec 2017 18: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: Fri, 1 Dec 2017 17:59:56 +0300 Message-Id: <1512140407-13534-2-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 1/12] api: event: add free multiple 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 efficient to free multiple events with a single call than with separate calls. 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 **/ include/odp/api/spec/event.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/odp/api/spec/event.h b/include/odp/api/spec/event.h index f924973f0..7e895c315 100644 --- a/include/odp/api/spec/event.h +++ b/include/odp/api/spec/event.h @@ -149,6 +149,28 @@ uint64_t odp_event_to_u64(odp_event_t hdl); */ void odp_event_free(odp_event_t event); +/** + * Free multiple events + * + * Otherwise like odp_event_free(), but frees multiple events to their + * originating pools. + * + * @param event Array of event handles + * @param num Number of events to free + */ +void odp_event_free_multi(const odp_event_t event[], int num); + +/** + * Free multiple events to the same pool + * + * Otherwise like odp_event_free_multi(), but all events must be from the + * same originating pool. + * + * @param event Array of event handles + * @param num Number of events to free + */ +void odp_event_free_sp(const odp_event_t event[], int num); + /** * @} */ From patchwork Fri Dec 1 14:59:57 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: 120336 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1246773qgn; Fri, 1 Dec 2017 07:01:24 -0800 (PST) X-Google-Smtp-Source: AGs4zMZuduOyvHixl6MxldhD5eD4bbM1tj5DHdtHGiz2qvoAnePVvaQ1g7qFetwrfk6KjfSoot2f X-Received: by 10.55.44.71 with SMTP id s68mr7766297qkh.37.1512140484606; Fri, 01 Dec 2017 07:01:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140484; cv=none; d=google.com; s=arc-20160816; b=krG1Afi562qFzpoodo8PppYGxJ9tDqCGF3mv3jJ7pGYgpQMRLTv4QSOqXVHjrUEefT mdx2FKxiQLFHyQFoe/OQiviJk53viKaH6oZpdOgXgOZe1Twve+r7K6I025qKNOLrs770 60Eyo6N0F6um/YbnS0+CuXaHe6hKXVBbvkBEq2VAn32eaTmiAMnuiFV+Xcq6WxxRBcFv I7gSuqYat4rKfrAU5YsZngDEjzfe8zPvt0I/j1h67EpBnPPVEJiwHG9Ifal1dlN44zQO h78tucFtB7jXz1oKdzzTiNOPWe98x4VLMdwHTz51SMOmn66YC+Kg7Ja517shUlsST+ge QaAg== 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=IwzDp3tHUwbiempT4Fk6qVkcR8G8HM9w56Zs+1uPTj0=; b=I+Faepg7YUGJmyH0QwkBQ4KxNvDpO9lNeLEvg7dRg6s/ntmKU1BNbAPgCugljgH23Q EJwIhmnnmQBcXqlXut6jTSO4k1nbThiIL/5sYspuLirkddpUO1sv4Qup/LsD19IZkmv3 Nlu21srxf21Jog0ww6pcDXMwN+A+igz0T/s4P5Igcle+HiwSrYAmJ3EQBwtcxf+Z35aC ZXQtsawz7oBV2nFDp5DWNSKQf1opNXLJRrxKtVRP09obDkBzk6VkrvzqwnmGGIiDB1Wn KZavqME2qh6mt6/QR0KftslX3tlIU9ZfeOLQWjw7NxWSVPLUhVtUWBLSYVnWPvSxb5Ve SKMA== 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 x3si4316554qtf.197.2017.12.01.07.01.24; Fri, 01 Dec 2017 07:01:24 -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 43DCF60976; Fri, 1 Dec 2017 15:01:24 +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 38A2E60841; Fri, 1 Dec 2017 15:00:26 +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 531BF60977; Fri, 1 Dec 2017 15:00:19 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id C73C060950 for ; Fri, 1 Dec 2017 15:00:16 +0000 (UTC) Received: from mxback1j.mail.yandex.net (mxback1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10a]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 5C768186139 for ; Fri, 1 Dec 2017 18:00:15 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id V7indTvc9Z-0F94Tr7S; Fri, 01 Dec 2017 18:00:15 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0Ee4qxit; Fri, 01 Dec 2017 18: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: Fri, 1 Dec 2017 17:59:57 +0300 Message-Id: <1512140407-13534-3-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 2/12] linux-gen: event: free multiple 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 Simple implementation of the new functions. 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_event.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index 66bc11fe4..2b0a7cddc 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -60,6 +60,19 @@ void odp_event_free(odp_event_t event) } } +void odp_event_free_multi(const odp_event_t event[], int num) +{ + int i; + + for (i = 0; i < num; i++) + odp_event_free(event[i]); +} + +void odp_event_free_sp(const odp_event_t event[], int num) +{ + odp_event_free_multi(event, num); +} + uint64_t odp_event_to_u64(odp_event_t hdl) { return _odp_pri(hdl); From patchwork Fri Dec 1 14:59:58 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: 120337 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1248132qgn; Fri, 1 Dec 2017 07:02:14 -0800 (PST) X-Google-Smtp-Source: AGs4zMYtpIRefNvJcqQ6wSZ+obTSW6F9sgD3FBMlIHh7PAqn7IX31yFSMD+oyC8EUGpzNcFww4Br X-Received: by 10.55.79.15 with SMTP id d15mr7713361qkb.5.1512140534548; Fri, 01 Dec 2017 07:02:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140534; cv=none; d=google.com; s=arc-20160816; b=JZi33miVtDxI51/3h3dwjGlmFGlD2a+l3jUC5rOM8KB0ciuVhKA1ulhfz2bY3uF1ZV e2VvxqJaFXJqfRBEi8a/q3c7G3Cb8u+UZ9FyocwNTl1lBet6fN84gjPh7qmT8eNVm0PB +vgcBUghdeU8DfCFFNymxn5ASiCSC4QamFYkKocYzESJtM7oHtsGA63xCrIPB+FJgM9r mkrZq4CiDWEanUDvsfa3Dwa4/KMO9/j/lQgxfeJa9pHx+ojW1WXWFDBZLZnakGZHPn/Y HV8uYltEJh8Croh6lQzp3VX1QY6iKnfz8KZQzo/9Wh+nui2qpQZqMV/CW7lW6J8pAJ5t Rouw== 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=IXMZrhYNdt0WHl5gyXnt7Wr+yeX40pzMzxpooNv0pXY=; b=q2PVzvLZFdWdNzZgjno9Bi0egSKtn7vnElgVO52hST4h9B/0qwTzAmOE2X5VZA7mZo /2SDLBNzLhxJOD5a35yAC3ZSuKL6AZSRo9MPLpYG0qUHfJYlsqf4tsHpeCeIDIg/YXyP znsnO88Seddgk13UjHf8QnaCdThJkZctO6SHS73w2T5lyyeGJYKIcDfMzP+xYaDzmMl+ SRX60mkVbBqSBpZNkc9EDZo58Ee4DJw3eEtiwhD8ST31g5qbbJisGNxxvgmqjQB7e7Gh sv1GTeLvfMXymaVh3k85U7qA/AzLUWBQPbYUT1fhITGfX1jmQ+yu2HqCin4w0TKq9o/a sXcg== 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 v90si1392074qkv.258.2017.12.01.07.02.14; Fri, 01 Dec 2017 07:02:14 -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 E0CEC609F8; Fri, 1 Dec 2017 15:02:13 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, 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 9913F6086F; Fri, 1 Dec 2017 15:00:36 +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 D54996097A; Fri, 1 Dec 2017 15:00:19 +0000 (UTC) Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [5.45.198.249]) by lists.linaro.org (Postfix) with ESMTPS id B6B6560750 for ; Fri, 1 Dec 2017 15:00:17 +0000 (UTC) Received: from mxback4o.mail.yandex.net (mxback4o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1e]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 486471805D28 for ; Fri, 1 Dec 2017 18:00:16 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback4o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id SUINj2NHIF-0GvCgGME; Fri, 01 Dec 2017 18:00:16 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0FeefUgk; Fri, 01 Dec 2017 18: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: Fri, 1 Dec 2017 17:59:58 +0300 Message-Id: <1512140407-13534-4-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 3/12] validation: event: add event test suite 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 suite for event API tests. Test event types, free and free multiple event functions. 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 **/ test/m4/configure.m4 | 1 + test/validation/api/Makefile.am | 2 + test/validation/api/event/.gitignore | 1 + test/validation/api/event/Makefile.am | 5 + test/validation/api/event/event.c | 274 +++++++++++++++++++++++++++++++++ test/validation/api/event/event.h | 12 ++ test/validation/api/event/event_main.c | 13 ++ 7 files changed, 308 insertions(+) create mode 100644 test/validation/api/event/.gitignore create mode 100644 test/validation/api/event/Makefile.am create mode 100644 test/validation/api/event/event.c create mode 100644 test/validation/api/event/event.h create mode 100644 test/validation/api/event/event_main.c diff --git a/test/m4/configure.m4 b/test/m4/configure.m4 index ef6096e87..dd07839ff 100644 --- a/test/m4/configure.m4 +++ b/test/m4/configure.m4 @@ -15,6 +15,7 @@ AC_CONFIG_FILES([test/Makefile test/validation/api/cpumask/Makefile test/validation/api/crypto/Makefile test/validation/api/errno/Makefile + test/validation/api/event/Makefile test/validation/api/hash/Makefile test/validation/api/init/Makefile test/validation/api/ipsec/Makefile diff --git a/test/validation/api/Makefile.am b/test/validation/api/Makefile.am index be3fb63e4..0503e092e 100644 --- a/test/validation/api/Makefile.am +++ b/test/validation/api/Makefile.am @@ -6,6 +6,7 @@ ODP_MODULES = atomic \ cpumask \ crypto \ errno \ + event \ hash \ init \ ipsec \ @@ -38,6 +39,7 @@ TESTS = \ cpumask/cpumask_main$(EXEEXT) \ crypto/crypto_main$(EXEEXT) \ errno/errno_main$(EXEEXT) \ + event/event_main$(EXEEXT) \ hash/hash_main$(EXEEXT) \ init/init_main_ok$(EXEEXT) \ init/init_main_abort$(EXEEXT) \ diff --git a/test/validation/api/event/.gitignore b/test/validation/api/event/.gitignore new file mode 100644 index 000000000..05d34d7c8 --- /dev/null +++ b/test/validation/api/event/.gitignore @@ -0,0 +1 @@ +event_main diff --git a/test/validation/api/event/Makefile.am b/test/validation/api/event/Makefile.am new file mode 100644 index 000000000..be4764b58 --- /dev/null +++ b/test/validation/api/event/Makefile.am @@ -0,0 +1,5 @@ +include ../Makefile.inc + +test_PROGRAMS = event_main +event_main_SOURCES = event_main.c event.c event.h +event_main_LDADD = $(LIBCUNIT_COMMON) $(LIBODP) diff --git a/test/validation/api/event/event.c b/test/validation/api/event/event.c new file mode 100644 index 000000000..fc048c1d4 --- /dev/null +++ b/test/validation/api/event/event.c @@ -0,0 +1,274 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "config.h" +#include +#include +#include "event.h" + +#define NUM_EVENTS 100 +#define EVENT_SIZE 100 +#define EVENT_BURST 10 + +static void event_test_free(void) +{ + odp_pool_t pool; + odp_pool_param_t pool_param; + int i; + odp_buffer_t buf; + odp_packet_t pkt; + odp_timeout_t tmo; + odp_event_subtype_t subtype; + odp_event_t event[EVENT_BURST]; + + /* Buffer events */ + odp_pool_param_init(&pool_param); + pool_param.buf.num = NUM_EVENTS; + pool_param.buf.size = EVENT_SIZE; + pool_param.type = ODP_POOL_BUFFER; + + pool = odp_pool_create("event_free", &pool_param); + CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + + for (i = 0; i < EVENT_BURST; i++) { + buf = odp_buffer_alloc(pool); + CU_ASSERT_FATAL(buf != ODP_BUFFER_INVALID); + event[i] = odp_buffer_to_event(buf); + CU_ASSERT(odp_event_type(event[i]) == ODP_EVENT_BUFFER); + CU_ASSERT(odp_event_subtype(event[i]) == ODP_EVENT_NO_SUBTYPE); + CU_ASSERT(odp_event_types(event[i], &subtype) == + ODP_EVENT_BUFFER); + CU_ASSERT(subtype == ODP_EVENT_NO_SUBTYPE); + } + + for (i = 0; i < EVENT_BURST; i++) + odp_event_free(event[i]); + + CU_ASSERT(odp_pool_destroy(pool) == 0); + + /* Packet events */ + odp_pool_param_init(&pool_param); + pool_param.pkt.num = NUM_EVENTS; + pool_param.pkt.len = EVENT_SIZE; + pool_param.type = ODP_POOL_PACKET; + + pool = odp_pool_create("event_free", &pool_param); + CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + + for (i = 0; i < EVENT_BURST; i++) { + pkt = odp_packet_alloc(pool, EVENT_SIZE); + CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); + event[i] = odp_packet_to_event(pkt); + CU_ASSERT(odp_event_type(event[i]) == ODP_EVENT_PACKET); + CU_ASSERT(odp_event_subtype(event[i]) == + ODP_EVENT_PACKET_BASIC); + CU_ASSERT(odp_event_types(event[i], &subtype) == + ODP_EVENT_PACKET); + CU_ASSERT(subtype == ODP_EVENT_PACKET_BASIC); + } + + for (i = 0; i < EVENT_BURST; i++) + odp_event_free(event[i]); + + CU_ASSERT(odp_pool_destroy(pool) == 0); + + /* Timeout events */ + odp_pool_param_init(&pool_param); + pool_param.tmo.num = NUM_EVENTS; + pool_param.type = ODP_POOL_TIMEOUT; + + pool = odp_pool_create("event_free", &pool_param); + CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + + for (i = 0; i < EVENT_BURST; i++) { + tmo = odp_timeout_alloc(pool); + CU_ASSERT_FATAL(tmo != ODP_TIMEOUT_INVALID); + event[i] = odp_timeout_to_event(tmo); + CU_ASSERT(odp_event_type(event[i]) == ODP_EVENT_TIMEOUT); + CU_ASSERT(odp_event_subtype(event[i]) == ODP_EVENT_NO_SUBTYPE); + CU_ASSERT(odp_event_types(event[i], &subtype) == + ODP_EVENT_TIMEOUT); + CU_ASSERT(subtype == ODP_EVENT_NO_SUBTYPE); + } + + for (i = 0; i < EVENT_BURST; i++) + odp_event_free(event[i]); + + CU_ASSERT(odp_pool_destroy(pool) == 0); +} + +static void event_test_free_multi(void) +{ + odp_pool_t pool; + odp_pool_param_t pool_param; + int i, j; + odp_buffer_t buf; + odp_packet_t pkt; + odp_timeout_t tmo; + odp_event_t event[EVENT_BURST]; + + /* Buffer events */ + odp_pool_param_init(&pool_param); + pool_param.buf.num = NUM_EVENTS; + pool_param.buf.size = EVENT_SIZE; + pool_param.type = ODP_POOL_BUFFER; + + pool = odp_pool_create("event_free", &pool_param); + CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + + for (j = 0; j < 2; j++) { + for (i = 0; i < EVENT_BURST; i++) { + buf = odp_buffer_alloc(pool); + CU_ASSERT_FATAL(buf != ODP_BUFFER_INVALID); + event[i] = odp_buffer_to_event(buf); + } + + if (j == 0) + odp_event_free_multi(event, EVENT_BURST); + else + odp_event_free_sp(event, EVENT_BURST); + } + + CU_ASSERT(odp_pool_destroy(pool) == 0); + + /* Packet events */ + odp_pool_param_init(&pool_param); + pool_param.pkt.num = NUM_EVENTS; + pool_param.pkt.len = EVENT_SIZE; + pool_param.type = ODP_POOL_PACKET; + + pool = odp_pool_create("event_free", &pool_param); + CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + + for (j = 0; j < 2; j++) { + for (i = 0; i < EVENT_BURST; i++) { + pkt = odp_packet_alloc(pool, EVENT_SIZE); + CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); + event[i] = odp_packet_to_event(pkt); + } + + if (j == 0) + odp_event_free_multi(event, EVENT_BURST); + else + odp_event_free_sp(event, EVENT_BURST); + } + + CU_ASSERT(odp_pool_destroy(pool) == 0); + + /* Timeout events */ + odp_pool_param_init(&pool_param); + pool_param.tmo.num = NUM_EVENTS; + pool_param.type = ODP_POOL_TIMEOUT; + + pool = odp_pool_create("event_free", &pool_param); + CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + + for (j = 0; j < 2; j++) { + for (i = 0; i < EVENT_BURST; i++) { + tmo = odp_timeout_alloc(pool); + CU_ASSERT_FATAL(tmo != ODP_TIMEOUT_INVALID); + event[i] = odp_timeout_to_event(tmo); + } + + if (j == 0) + odp_event_free_multi(event, EVENT_BURST); + else + odp_event_free_sp(event, EVENT_BURST); + } + + CU_ASSERT(odp_pool_destroy(pool) == 0); +} + +static void event_test_free_multi_mixed(void) +{ + odp_pool_t pool1, pool2, pool3; + odp_pool_param_t pool_param; + int i, j; + odp_buffer_t buf; + odp_packet_t pkt; + odp_timeout_t tmo; + odp_event_t event[3 * EVENT_BURST]; + + /* Buffer events */ + odp_pool_param_init(&pool_param); + pool_param.buf.num = NUM_EVENTS; + pool_param.buf.size = EVENT_SIZE; + pool_param.type = ODP_POOL_BUFFER; + + pool1 = odp_pool_create("event_free1", &pool_param); + CU_ASSERT_FATAL(pool1 != ODP_POOL_INVALID); + + /* Packet events */ + odp_pool_param_init(&pool_param); + pool_param.pkt.num = NUM_EVENTS; + pool_param.pkt.len = EVENT_SIZE; + pool_param.type = ODP_POOL_PACKET; + + pool2 = odp_pool_create("event_free2", &pool_param); + CU_ASSERT_FATAL(pool2 != ODP_POOL_INVALID); + + /* Timeout events */ + odp_pool_param_init(&pool_param); + pool_param.tmo.num = NUM_EVENTS; + pool_param.type = ODP_POOL_TIMEOUT; + + pool3 = odp_pool_create("event_free3", &pool_param); + CU_ASSERT_FATAL(pool3 != ODP_POOL_INVALID); + + for (j = 0; j < 2; j++) { + for (i = 0; i < 3 * EVENT_BURST;) { + buf = odp_buffer_alloc(pool1); + CU_ASSERT_FATAL(buf != ODP_BUFFER_INVALID); + event[i] = odp_buffer_to_event(buf); + i++; + pkt = odp_packet_alloc(pool2, EVENT_SIZE); + CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); + event[i] = odp_packet_to_event(pkt); + i++; + tmo = odp_timeout_alloc(pool3); + CU_ASSERT_FATAL(tmo != ODP_TIMEOUT_INVALID); + event[i] = odp_timeout_to_event(tmo); + i++; + } + + if (j == 0) + odp_event_free_multi(event, 3 * EVENT_BURST); + else + odp_event_free_sp(event, 3 * EVENT_BURST); + } + + CU_ASSERT(odp_pool_destroy(pool1) == 0); + CU_ASSERT(odp_pool_destroy(pool2) == 0); + CU_ASSERT(odp_pool_destroy(pool3) == 0); +} + +odp_testinfo_t event_suite[] = { + ODP_TEST_INFO(event_test_free), + ODP_TEST_INFO(event_test_free_multi), + ODP_TEST_INFO(event_test_free_multi_mixed), + ODP_TEST_INFO_NULL, +}; + +odp_suiteinfo_t event_suites[] = { + {"Event", NULL, NULL, event_suite}, + ODP_SUITE_INFO_NULL, +}; + +int event_main(int argc, char *argv[]) +{ + int ret; + + /* parse common options: */ + if (odp_cunit_parse_options(argc, argv)) + return -1; + + ret = odp_cunit_register(event_suites); + + if (ret == 0) + ret = odp_cunit_run(); + + return ret; +} diff --git a/test/validation/api/event/event.h b/test/validation/api/event/event.h new file mode 100644 index 000000000..1d2b6e695 --- /dev/null +++ b/test/validation/api/event/event.h @@ -0,0 +1,12 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _ODP_TEST_EVENT_H_ +#define _ODP_TEST_EVENT_H_ + +int event_main(int argc, char *argv[]); + +#endif diff --git a/test/validation/api/event/event_main.c b/test/validation/api/event/event_main.c new file mode 100644 index 000000000..3fbefdb81 --- /dev/null +++ b/test/validation/api/event/event_main.c @@ -0,0 +1,13 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "config.h" +#include "event.h" + +int main(int argc, char *argv[]) +{ + return event_main(argc, argv); +} From patchwork Fri Dec 1 14:59:59 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: 120338 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1249987qgn; Fri, 1 Dec 2017 07:03:26 -0800 (PST) X-Google-Smtp-Source: AGs4zMaq276uMgULnTWSZ26e8tQZq+Pe3Jw2Ht938ws+BqXJM+09vE6UzUQ+xnl7T/av8O4JEous X-Received: by 10.200.18.9 with SMTP id x9mr9060630qti.211.1512140605960; Fri, 01 Dec 2017 07:03:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140605; cv=none; d=google.com; s=arc-20160816; b=RvrphhCKpqD68q9sXK/TlzosVg0PKb7yHYJgEdVTnsfQICt2KR2ggBI74crWqhcC6q s91hQLfv1tC6dcsl5KzbrQczUMznj+2hkCtuWpckoHgoB/XkO9sX+qJLIlynEtIsk/CJ Eg6vG9znSa1a9Qi7acIlkfE42oKH3rDtZiQpTw0p7zRozg6pwMKxf/ZXHzUDoj8mnaE1 ZtoXqMZ0pDnhnLTBXmy6MT32JCtg2B10sJFQiQHT1ckj/kXODrMYi6JLjt+MToDMVc8U 6M9zN3S04rOA48uT1JWZITiKKAv/bZj0Y1qAAAkZiZiIO4Q0sNp2imM+aEsP4jh8984t xlcQ== 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=Qi1wSvmD9HtH3tRn5RF/tSpLRgDLX2ZvRssHcr3VKXg=; b=PCjYdDRzncAscjQQB9l5j3w22zGJ590UNY1pJ9U3nuqbN0BzLU7B7yYrZbUhpCxKlb KLERudIaNxJ7Tn0mNCKOXOsNoKCzEECqRXIZnS5q4EeNy1lduYY9mPYcCKYqSny0yo8L Bm1ySQTNo+kbYXtvlU3ep5I3rJZm2C3kWN0br/Z14lxYW+4jidshBotiCASULw0i5air PfraLO5fbuqHt9pQcVcC4Nc17EyXibTcf5aiGIhXOkbgX7KVDgzJ+IcVmA8reJ7w3HCj 2qrlRXoxvpLJiAqkIHpWC7dzsl9kMSnaxdn5RfmaizXZFZpynRVLe7txvdKuW8EsZYai AvFg== 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 b10si6815388qtg.386.2017.12.01.07.03.24; Fri, 01 Dec 2017 07:03:25 -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 AB45960991; Fri, 1 Dec 2017 15:03:24 +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 D40BF60977; Fri, 1 Dec 2017 15:00:43 +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 BBD916096D; Fri, 1 Dec 2017 15:00:21 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id 60E606096D for ; Fri, 1 Dec 2017 15:00:18 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward104j.mail.yandex.net (Yandex) with ESMTP id F38F245908 for ; Fri, 1 Dec 2017 18:00:16 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id oyY14pG4vO-0Gkepmt2; Fri, 01 Dec 2017 18:00:16 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0Ge8nItR; Fri, 01 Dec 2017 18: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, 1 Dec 2017 17:59:59 +0300 Message-Id: <1512140407-13534-5-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 4/12] api: packet: multi converts and single pool free 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 multi versions for better throughput. Convert multiple packets/events with a single call. Free multiple packets into the same originating pool. 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 **/ include/odp/api/spec/packet.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index b897c9d3c..619098868 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -204,6 +204,17 @@ void odp_packet_free(odp_packet_t pkt); */ void odp_packet_free_multi(const odp_packet_t pkt[], int num); +/** + * Free multiple packets to the same pool + * + * Otherwise like odp_packet_free_multi(), but all packets must be from the + * same originating pool. + * + * @param pkt Array of packet handles + * @param num Number of packets to free + */ +void odp_packet_free_sp(const odp_packet_t pkt[], int num); + /** * Reset packet * @@ -235,6 +246,18 @@ int odp_packet_reset(odp_packet_t pkt, uint32_t len); */ odp_packet_t odp_packet_from_event(odp_event_t ev); +/** + * Convert multiple packet events to packet handles + * + * All events must be of type ODP_EVENT_PACKET. + * + * @param[out] pkt Packet handle array for output + * @param ev Array of event handles to convert + * @param num Number of packets and events + */ +void odp_packet_from_event_multi(odp_packet_t pkt[], const odp_event_t ev[], + int num); + /** * Convert packet handle to event * @@ -244,6 +267,16 @@ odp_packet_t odp_packet_from_event(odp_event_t ev); */ odp_event_t odp_packet_to_event(odp_packet_t pkt); +/** + * Convert multiple packet handles to events + * + * @param pkt Array of packet handles to convert + * @param[out] ev Event handle array for output + * @param num Number of packets and events + */ +void odp_packet_to_event_multi(const odp_packet_t pkt[], odp_event_t ev[], + int num); + /* * * Pointers and lengths From patchwork Fri Dec 1 15:00:00 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: 120342 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1255023qgn; Fri, 1 Dec 2017 07:06:45 -0800 (PST) X-Google-Smtp-Source: AGs4zMa3sGcQOMhr+xz4w9DTGQyJwffZXEsHUH4aXX8/ICBTaiGLkPudIvmt0I0jYDC9yDWzA8WQ X-Received: by 10.55.33.13 with SMTP id h13mr8302848qkh.176.1512140805151; Fri, 01 Dec 2017 07:06:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140805; cv=none; d=google.com; s=arc-20160816; b=Runn04Z0zr7l1OkPvmVbvdd26u5I7HE0nwLO2XdzH6ZvlT2rPACPasDJ80/pTEy7fh mzag/4JnFQOP65OQOmqDmVTBcqYTgN/k+J0hKlGNhaL6ObnxwYoOcRIkkiKOz26EEdBr yeAmWTOOSNKVpg2ge646Wo6t0EaZVL1ktUl9/Ia89n5PgZMrasNuxSl0+zbuVDa8ExvQ Rd2O8Mr5RXfRk+3iuxzO8WctCoEUxhsEJPckHmHdsQ4uNldeuDo/Nq3GY94u8pQX6Ea7 E0tlD59ZzMcV6URgqHM5XMqtKvDghWa0baqsdQlsOTsUiJei2DBKVCbUSCSJ/tiEb/ro Aggw== 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=EGPZ3lToKnU976TNYD+xTws4tHoBhfHiZ5ZQLccHgPA=; b=G5OAQX6PGhLHvJPOjb2HlBxJvWNkLWMcFc4IFs77qxz/WrWJZW7CeYZkvKlMMQ5aDG TgDJIDHRDKDLlymWbUChmgNVIn5oFJSd38CIdp0LQJYcJa/UJ2QxdZ7cwXZGmMZbUOMv sInIUJItnMC190I+ZEMMq5BDfIc0AQS6sqgHqGKq8TGAspbHMsTSPlQKpM8LKfTSeNdn OOmYNQA7lw3AThE3+/HMercuE4dq7ipT+0Xy0ycwk/Ksjum0eJSz8GTlEJYBC7dCUCx9 FQtCASJXExFbmphWfPWNzet8Vu+64+vyXOxV0I9YV4jp98mGXL9QXLWd/Grj3uM/TgPb 7Ftw== 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 l75si4713961qke.56.2017.12.01.07.06.44; Fri, 01 Dec 2017 07:06:45 -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 BEBAB60982; Fri, 1 Dec 2017 15:06:44 +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 79346609C0; Fri, 1 Dec 2017 15:01:02 +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 B195060988; Fri, 1 Dec 2017 15:00:26 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id 956A360970 for ; Fri, 1 Dec 2017 15:00:18 +0000 (UTC) Received: from mxback4j.mail.yandex.net (mxback4j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10d]) by forward100o.mail.yandex.net (Yandex) with ESMTP id 806E62A25ECE for ; Fri, 1 Dec 2017 18:00:17 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback4j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 55LQcmL7gI-0HLaX2ps; Fri, 01 Dec 2017 18:00:17 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0He8DH1g; Fri, 01 Dec 2017 18: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, 1 Dec 2017 18:00:00 +0300 Message-Id: <1512140407-13534-6-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 5/12] linux-gen: packet: multi converts and single pool free 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 implement of the new multi convert and single pool free functions. 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 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index bdcb482fa..cdcb62d21 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -912,6 +912,11 @@ void odp_packet_free_multi(const odp_packet_t pkt[], int num) packet_free_multi(buf_hdr, num - num_freed); } +void odp_packet_free_sp(const odp_packet_t pkt[], int num) +{ + odp_packet_free_multi(pkt, num); +} + int odp_packet_reset(odp_packet_t pkt, uint32_t len) { odp_packet_hdr_t *const pkt_hdr = packet_hdr(pkt); @@ -944,6 +949,24 @@ odp_event_t odp_packet_to_event(odp_packet_t pkt) return (odp_event_t)buffer_handle(packet_hdr(pkt)); } +void odp_packet_from_event_multi(odp_packet_t pkt[], const odp_event_t ev[], + int num) +{ + int i; + + for (i = 0; i < num; i++) + pkt[i] = odp_packet_from_event(ev[i]); +} + +void odp_packet_to_event_multi(const odp_packet_t pkt[], odp_event_t ev[], + int num) +{ + int i; + + for (i = 0; i < num; i++) + ev[i] = odp_packet_to_event(pkt[i]); +} + /* * * Pointers and lengths From patchwork Fri Dec 1 15:00:01 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: 120340 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1253083qgn; Fri, 1 Dec 2017 07:05:25 -0800 (PST) X-Google-Smtp-Source: AGs4zMY3vjRHNy9pmoqqzgDb8f9yVdeT5n6fLGH+Fvy8BK1cYLGrFMODJJB5gdWgOjyhrq5Dpl5r X-Received: by 10.55.149.196 with SMTP id x187mr7534151qkd.51.1512140725459; Fri, 01 Dec 2017 07:05:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140725; cv=none; d=google.com; s=arc-20160816; b=bkVHAtl/+28HXyKKpQa0EP2vRihXJ5Y/4iTG03FoXEL/y9DxXmH0Oq3Aj6aYE9K2Pb 0HGkMVvr4EpX/M36krCi2gKaUvg86Wc8/duIkLtwhr4rnwY+xOY2FddQZH7H9jfH4tB4 JUyAjOhtBjik37pNy94NaVkzWxwQwCrxLmK6VVi1ny2tzE6tj9xOzJ4Zt6OVz4mLmt8f JZAagDlmwOvURi/zdGjk0zkygxw785P7J+6mhlUe3lWz3SE3x/X65CA0xyTeGo9LQ0vh 5PMx6/6xLSXatUhofEwP0/DrzkAJZzmax1b8jzMRCsigiR5X1JJ9ChIQYe9Ir/1S0KdB ZkwQ== 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=jiiooJagx77z7auSS0Xkr0u88g/4Y6gnyKV1ehiioxY=; b=zatM5i/cjSn3gak8WcWF4ydbrfzntyqBw9S7z42HEQbGL2duNCvuGY4+IgjHrhu1Gg o1wmi6M2H2D++/GK3OwOHuFzt5pD2hie/LkocnH7+L1jzVuMeaTlFiJ5JWiMx8dYze5B N2FvKOAgasRUzpDThntIq3B+LsS1FooK+xqrTOqQPyZOEQH2N4ru8YkDmFOZZtwCq8L9 TlVC5SCYPKu9fOsL1sSFysMkDhpdXmA0dUaaW5WyPiTe3YgEIUhjx9bTRF+ZMa9QfNEt YkdDsSbMgOxa6LY/5xcpxiS1QdK2eJVw1v0viTVsiBvGE8vESGsG7NKVKeysDc8Oqol3 YbaQ== 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 g35si7025876qtc.110.2017.12.01.07.05.23; Fri, 01 Dec 2017 07:05:25 -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 89A2160988; Fri, 1 Dec 2017 15:05:23 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, 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 EB5F060999; Fri, 1 Dec 2017 15:00:55 +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 05DBE60973; Fri, 1 Dec 2017 15:00:25 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id 4922260974 for ; Fri, 1 Dec 2017 15:00:19 +0000 (UTC) Received: from mxback1o.mail.yandex.net (mxback1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1b]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 3FF1C46177 for ; Fri, 1 Dec 2017 18:00:18 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id wolaXanFOn-0ICiMr3K; Fri, 01 Dec 2017 18:00:18 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0HeiwI3u; Fri, 01 Dec 2017 18: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, 1 Dec 2017 18:00:01 +0300 Message-Id: <1512140407-13534-7-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 6/12] validation: packet: multi converts and single pool free 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 tests for the new multi convert and single pool free functions. 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 **/ test/validation/api/packet/packet.c | 85 ++++++++++++++++++++++++++++++++----- test/validation/api/packet/packet.h | 1 + 2 files changed, 75 insertions(+), 11 deletions(-) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index ce4d66c0b..e8e664e4a 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -396,6 +396,50 @@ void packet_test_alloc_free_multi(void) CU_ASSERT(odp_pool_destroy(pool[1]) == 0); } +void packet_test_free_sp(void) +{ + const int num_pkt = 10; + odp_pool_t pool; + int i, ret; + odp_packet_t packet[num_pkt]; + odp_pool_param_t params; + odp_pool_capability_t capa; + uint32_t len = packet_len; + + CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0); + + if (capa.pkt.max_len < len) + len = capa.pkt.max_len; + + odp_pool_param_init(¶ms); + + params.type = ODP_POOL_PACKET; + params.pkt.len = len; + params.pkt.num = num_pkt; + + pool = odp_pool_create("packet_pool_free_sp", ¶ms); + CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + + ret = packet_alloc_multi(pool, len, packet, num_pkt); + CU_ASSERT_FATAL(ret == num_pkt); + for (i = 0; i < num_pkt; i++) { + CU_ASSERT_FATAL(packet[i] != ODP_PACKET_INVALID); + CU_ASSERT(odp_packet_len(packet[i]) == len); + } + odp_packet_free_sp(packet, num_pkt); + + /* Check that all the packets were returned back to the pool */ + ret = packet_alloc_multi(pool, len, packet, num_pkt); + CU_ASSERT_FATAL(ret == num_pkt); + for (i = 0; i < num_pkt; i++) { + CU_ASSERT_FATAL(packet[i] != ODP_PACKET_INVALID); + CU_ASSERT(odp_packet_len(packet[i]) == len); + } + odp_packet_free_sp(packet, num_pkt); + + CU_ASSERT(odp_pool_destroy(pool) == 0); +} + void packet_test_alloc_segmented(void) { const int num = 5; @@ -481,23 +525,41 @@ void packet_test_alloc_segmented(void) void packet_test_event_conversion(void) { - odp_packet_t pkt = test_packet; + odp_packet_t pkt0 = test_packet; + odp_packet_t pkt1 = segmented_test_packet; odp_packet_t tmp_pkt; - odp_event_t ev; + odp_event_t event; odp_event_subtype_t subtype; - - ev = odp_packet_to_event(pkt); - CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); - CU_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); - CU_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_BASIC); - CU_ASSERT(odp_event_types(ev, &subtype) == + odp_packet_t pkt[2] = {pkt0, pkt1}; + odp_event_t ev[2]; + int i; + + event = odp_packet_to_event(pkt0); + CU_ASSERT_FATAL(event != ODP_EVENT_INVALID); + CU_ASSERT(odp_event_type(event) == ODP_EVENT_PACKET); + CU_ASSERT(odp_event_subtype(event) == ODP_EVENT_PACKET_BASIC); + CU_ASSERT(odp_event_types(event, &subtype) == ODP_EVENT_PACKET); CU_ASSERT(subtype == ODP_EVENT_PACKET_BASIC); - tmp_pkt = odp_packet_from_event(ev); + tmp_pkt = odp_packet_from_event(event); CU_ASSERT_FATAL(tmp_pkt != ODP_PACKET_INVALID); - CU_ASSERT(tmp_pkt == pkt); - packet_compare_data(tmp_pkt, pkt); + CU_ASSERT(tmp_pkt == pkt0); + packet_compare_data(tmp_pkt, pkt0); + + odp_packet_to_event_multi(pkt, ev, 2); + + for (i = 0; i < 2; i++) { + CU_ASSERT_FATAL(ev[i] != ODP_EVENT_INVALID); + CU_ASSERT(odp_event_type(ev[i]) == ODP_EVENT_PACKET); + CU_ASSERT(odp_event_subtype(ev[i]) == ODP_EVENT_PACKET_BASIC); + } + + odp_packet_from_event_multi(pkt, ev, 2); + CU_ASSERT(pkt[0] == pkt0); + CU_ASSERT(pkt[1] == pkt1); + packet_compare_data(pkt[0], pkt0); + packet_compare_data(pkt[1], pkt1); } void packet_test_basic_metadata(void) @@ -2595,6 +2657,7 @@ void packet_test_parse(void) odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_alloc_free), ODP_TEST_INFO(packet_test_alloc_free_multi), + ODP_TEST_INFO(packet_test_free_sp), ODP_TEST_INFO(packet_test_alloc_segmented), ODP_TEST_INFO(packet_test_basic_metadata), ODP_TEST_INFO(packet_test_debug), diff --git a/test/validation/api/packet/packet.h b/test/validation/api/packet/packet.h index 4e99679ed..1d9947afa 100644 --- a/test/validation/api/packet/packet.h +++ b/test/validation/api/packet/packet.h @@ -12,6 +12,7 @@ /* test functions: */ void packet_test_alloc_free(void); void packet_test_alloc_free_multi(void); +void packet_test_free_sp(void); void packet_test_alloc_segmented(void); void packet_test_event_conversion(void); void packet_test_basic_metadata(void); From patchwork Fri Dec 1 15:00:02 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: 120341 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1254112qgn; Fri, 1 Dec 2017 07:06:07 -0800 (PST) X-Google-Smtp-Source: AGs4zMbi5P8AiCSpENJzIILmlEMzY3ZQvRtF63uqGL3NWBGzYCBidxC3Ywln+t+FyIskB/cDwlN5 X-Received: by 10.200.38.74 with SMTP id v10mr9153059qtv.316.1512140767197; Fri, 01 Dec 2017 07:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140767; cv=none; d=google.com; s=arc-20160816; b=kt7akONHVMYKDh+RD830w31hJqW2grEEoqtDu7Hur7kObvSN2XnYyXJ2laO4THQXCs 6dX4/b0ZDHynYpQgx8PgqetaXz4CwcKFUB/XGGyMUNdsP5swk02AW3+PGbZ84PaYAqGQ T+ytJFioWZKl30aVn2f8vPW41aE7p09GfzxLUkINDW7ENWRzf2TN6ZraDVRWMYuVllPV lrUsn/6jzO+szVjcFPPeV53MujevU1oGNRPN/Ot1E1hKvMvl3PQKjVdQAog5cP2V6wEt Ll/tDkyfm0rBTOaGJc6+6ep/lnewITPkWHHG2vt9x78SBWyPKsSRjBTpkpS1lQtQDGbg PiGA== 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=9YTfA3OfKzEKwdM900R+FFCfMF5SCw2J2/4R1gi9ugk=; b=R+CkYEHRwQnEbDbGCiJfN8cKEA65N4sY6x/86QHJDRxQJ/zvhjxK2pFtzARYuFLgDd ZzcAuf7M66lpe++OHTzbUWJ84x/zytMr7v7A4jNW57oEpBFVHOLkw86AMnSI+t1Gpzfn 3z0xG/+7NjbVnP+iA8EwbpAKq4GQpxrSW5oX+VuvVs55FAYFFOr6P75Hmc01uW3UUZky UnswOBhxF5HqC6AxpZCwv2NhXmEHYKLweMfGbAgw7+k8kAOcshhdJ5GX/R0xN0UhzusS kQPOeH3/eNxcCbBX8qggOsWk+MJeTz/VWXKWGVFzw2uqYuRpaz5PC/X0eT93N8k/Ia7K B86Q== 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 i23si3613372qti.155.2017.12.01.07.06.06; Fri, 01 Dec 2017 07: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 A82446098D; Fri, 1 Dec 2017 15: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 2AC72609B0; Fri, 1 Dec 2017 15: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 E956860973; Fri, 1 Dec 2017 15:00:25 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 4D66B60750 for ; Fri, 1 Dec 2017 15:00:20 +0000 (UTC) Received: from mxback1o.mail.yandex.net (mxback1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1b]) by forward102p.mail.yandex.net (Yandex) with ESMTP id D1A8E4305B35 for ; Fri, 1 Dec 2017 18:00:18 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id TnkoLFTfeD-0IC0XC3p; Fri, 01 Dec 2017 18:00:18 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0IemiEns; Fri, 01 Dec 2017 18: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, 1 Dec 2017 18:00:02 +0300 Message-Id: <1512140407-13534-8-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 7/12] api: event: event type multi 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 functions allows application to check event type of multiple events with single call e.g. after receiving those from odp_schedule_multi(). Performance is optimized when application can pass a burst of packets (or other events) from one API call to another. 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 **/ include/odp/api/spec/event.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/odp/api/spec/event.h b/include/odp/api/spec/event.h index 7e895c315..e5edaacc9 100644 --- a/include/odp/api/spec/event.h +++ b/include/odp/api/spec/event.h @@ -125,6 +125,22 @@ odp_event_subtype_t odp_event_subtype(odp_event_t event); odp_event_type_t odp_event_types(odp_event_t event, odp_event_subtype_t *subtype); +/** + * Event type of multiple events + * + * Returns the number of first events in the array which have the same event + * type. Outputs the event type of those events. + * + * @param event Array of event handles + * @param num Number of events (> 0) + * @param[out] type Event type pointer for output + * + * @return Number of first events (1 ... num) with the same event type + * (includes event[0]) + */ +int odp_event_type_multi(const odp_event_t event[], int num, + odp_event_type_t *type); + /** * Get printable value for an odp_event_t * From patchwork Fri Dec 1 15:00:03 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: 120344 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1255947qgn; Fri, 1 Dec 2017 07:07:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMank4XmTXR1o5BTaH+ROrQ4v6C8yWnHz+Ex8W2ZsTUGYmZbk3PktETEDGqWQNbCIC6WS/fw X-Received: by 10.55.26.160 with SMTP id l32mr8339565qkh.281.1512140842700; Fri, 01 Dec 2017 07:07:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140842; cv=none; d=google.com; s=arc-20160816; b=LUDz/swPgP9hDB1ok3IplfmuWcEd81TV4cREQJA+3tAcEap4TaR0+i6kSFyoCYu5wJ HA9i3g3E5Th0pQoZHaGgj4EoIq0EFLJsTuohsBgwawIT6ky8UuFJr7TBDZ5etvB7AA/Z FGCozqait85TLv+62bEEYwSPq3iouFIv2sZRV05mwNoKvIX3bohJDH9d9D8D3j78ruoa OfYWur0wj5ipNlBRunwFJc7kgLQBKnOYuEIGd2/GjFIFyfR2VSyYosjbm7bH+ottq3mG owQcNy+rLJs8Ur3qwPtimOy7tr3XYWUjbP6rrBTP6jES0ZAZJZehQW+dXi6OE+BMOJ1z B4Iw== 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=tf8mp1RdOLF4AATb/02DxOEW3Ewtpez7j+Jyjfp3DrM=; b=YYjVra/8jYijSjsbyAs4XCw74+j/yAtlvynwOlCpv+7hZ1+gr6qUkEx18Ouh4aGTiP sYk9qVtF46Uj6Edliy86rFcYJqXZk1pqcLx+PFQ+YDq8bUBNU13LVRNCB1A0iv5CvTgj se59wvmmh7NYrLk1IbKoxZvZyNF2lv0rWRGi6AjroV7NPCOzbMiPzcziLyCB/aqA7/ku s+RZH8LYiw/H7inwUjTdVbLqZx/d1zyOPcu5DOPBpf3otwobCGvv95y1muPvS1BpcBod 9uSRhCNFULgMZ9HjG8aJOlkr6VwYB/mRlAn/RGQBrN87zqJ4Ut1eIQwuupxO7rSBuodM V/4A== 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 v14si5146765qkl.389.2017.12.01.07.07.22; Fri, 01 Dec 2017 07:07: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 6048C60983; Fri, 1 Dec 2017 15:07: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=-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 B6BE2609A6; Fri, 1 Dec 2017 15:01:04 +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 6A65260970; Fri, 1 Dec 2017 15:00:27 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id F2CDE60977 for ; Fri, 1 Dec 2017 15:00:20 +0000 (UTC) Received: from mxback3g.mail.yandex.net (mxback3g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:164]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 7DA865102320 for ; Fri, 1 Dec 2017 18:00:19 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback3g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id QeoKMZKoJ4-0JkKABdl; Fri, 01 Dec 2017 18:00:19 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0IeiLRqj; Fri, 01 Dec 2017 18: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, 1 Dec 2017 18:00:03 +0300 Message-Id: <1512140407-13534-9-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 8/12] linux-gen: event: implement type multi 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 type multi 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_event.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index 2b0a7cddc..1c4ab5c1b 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -37,6 +37,22 @@ odp_event_type_t odp_event_types(odp_event_t event, return _odp_buffer_event_type(buf); } +int odp_event_type_multi(const odp_event_t event[], int num, + odp_event_type_t *type_out) +{ + int i; + odp_event_type_t type = odp_event_type(event[0]); + + for (i = 1; i < num; i++) { + if (odp_event_type(event[i]) != type) + break; + } + + *type_out = type; + + return i; +} + void odp_event_free(odp_event_t event) { switch (odp_event_type(event)) { From patchwork Fri Dec 1 15:00:04 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: 120345 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1256132qgn; Fri, 1 Dec 2017 07:07:30 -0800 (PST) X-Google-Smtp-Source: AGs4zMYHUCHP7EbxKX8L9f2WBcM27IBtmGZ4Te2TLMw4GCJtIkT/Ivu2YlJehrHFkIV9mNpKFxut X-Received: by 10.55.4.136 with SMTP id 130mr7803568qke.203.1512140850247; Fri, 01 Dec 2017 07:07:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140850; cv=none; d=google.com; s=arc-20160816; b=KBPKwuJRw9hM6HxsU2iMEFOM/jE3ywT5j+p8+RreiNHLFGLIndGQLXsHvCTBZI3d0h rWzSij3eBQe6H3+5P7WkDJT4ywKqF28ime7Lr0cjl5fN4pLdJ5Bt0FEeVgj9NTCXXt4k JZWl4+13DJtwZwo3Chp1jfwSRiYzkpXTw0tDbEsrs3YLYXh7bJtNZWzlzD4TF3xZ+ipC R6+SLjGXHqh6+if1KkdRWZExztbFInVnRTdBfGB1UsE5ekcpd9Nn4YmY8uzFwbPfy4gE fiWQZDj7I0Wag/wnUgn3DFxXjVs0rDoHJd/3gHI8Bg1Wwa/fnj8pknEjuKyjYzcY3Z6s JaCw== 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=3+5NdwmU0ENI+zuoMapVJHbkBGLSXm9tVrMfgcYtrok=; b=HsLayfqeJHFjZJaxbCYPVw8qHlrb2y4TS1/GnW1hLP/dcN53DJJeDlko8PsB/UaYNu zkuuz9c9p0Qw0ZjZZEV+/yvEsFICcZH3mmzat+xMkAMf9F5/cOuiZ7VRlOlbnI8pux1w KgETL6fVbZseRCGqTRR2sIGx9q3E+ADJQ0GtTs/089UZcykwikVv75AFdDg2wO8h8fP6 w+V2GSKKkVXYuR0M1LwfSx5srktEqUuwu9niWRv8rLMdMTE2FvSmu7JHgGiZJvZEO+u7 DVgwAC2ooaP62twb7mt9bjJc8q8BhPp95RU6U69WPDxRuHymK7Ek03yYkRy6f3Rd2zDR 4u4w== 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 u5si2554139qki.259.2017.12.01.07.07.29; Fri, 01 Dec 2017 07:07:30 -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 DA6D76098E; Fri, 1 Dec 2017 15:07:29 +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 19892609C4; Fri, 1 Dec 2017 15:01:08 +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 CFBF760970; Fri, 1 Dec 2017 15:00:28 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id 7776F6097A for ; Fri, 1 Dec 2017 15:00:21 +0000 (UTC) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 16CDA782218 for ; Fri, 1 Dec 2017 18:00:20 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id H9Ag5RyeSR-0K4uSYCN; Fri, 01 Dec 2017 18:00:20 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0JeCv66Y; Fri, 01 Dec 2017 18:00:19 +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:04 +0300 Message-Id: <1512140407-13534-10-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 9/12] validation: event: type multi 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 the new event type multi 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 **/ test/validation/api/event/event.c | 104 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/test/validation/api/event/event.c b/test/validation/api/event/event.c index fc048c1d4..901fe6ed2 100644 --- a/test/validation/api/event/event.c +++ b/test/validation/api/event/event.c @@ -245,10 +245,114 @@ static void event_test_free_multi_mixed(void) CU_ASSERT(odp_pool_destroy(pool3) == 0); } +#define NUM_TYPE_TEST 6 + +static void type_test_init(odp_pool_t *buf_pool, odp_pool_t *pkt_pool, + odp_event_t buf_event[], + odp_event_t pkt_event[], + odp_event_t event[]) +{ + odp_pool_t pool1, pool2; + odp_pool_param_t pool_param; + int i; + odp_buffer_t buf; + odp_packet_t pkt; + + /* Buffer events */ + odp_pool_param_init(&pool_param); + pool_param.buf.num = NUM_EVENTS; + pool_param.buf.size = EVENT_SIZE; + pool_param.type = ODP_POOL_BUFFER; + + pool1 = odp_pool_create("event_type_buf", &pool_param); + CU_ASSERT_FATAL(pool1 != ODP_POOL_INVALID); + + for (i = 0; i < NUM_TYPE_TEST; i++) { + buf = odp_buffer_alloc(pool1); + CU_ASSERT_FATAL(buf != ODP_BUFFER_INVALID); + buf_event[i] = odp_buffer_to_event(buf); + } + + /* Packet events */ + odp_pool_param_init(&pool_param); + pool_param.pkt.num = NUM_EVENTS; + pool_param.pkt.len = EVENT_SIZE; + pool_param.type = ODP_POOL_PACKET; + + pool2 = odp_pool_create("event_type_pkt", &pool_param); + CU_ASSERT_FATAL(pool2 != ODP_POOL_INVALID); + + for (i = 0; i < NUM_TYPE_TEST; i++) { + pkt = odp_packet_alloc(pool2, EVENT_SIZE); + CU_ASSERT_FATAL(pkt != ODP_PACKET_INVALID); + pkt_event[i] = odp_packet_to_event(pkt); + } + + /* 1 buf, 1 pkt, 2 buf, 2 pkt, 3 buf, 3 pkt */ + event[0] = buf_event[0]; + event[1] = pkt_event[0]; + event[2] = buf_event[1]; + event[3] = buf_event[2]; + event[4] = pkt_event[1]; + event[5] = pkt_event[2]; + event[6] = buf_event[3]; + event[7] = buf_event[4]; + event[8] = buf_event[5]; + event[9] = pkt_event[3]; + event[10] = pkt_event[4]; + event[11] = pkt_event[5]; + + *buf_pool = pool1; + *pkt_pool = pool2; +} + +static void event_test_type_multi(void) +{ + odp_pool_t buf_pool, pkt_pool; + odp_event_type_t type; + int num; + odp_event_t buf_event[NUM_TYPE_TEST]; + odp_event_t pkt_event[NUM_TYPE_TEST]; + odp_event_t event[2 * NUM_TYPE_TEST]; + + type_test_init(&buf_pool, &pkt_pool, buf_event, pkt_event, event); + + num = odp_event_type_multi(&event[0], 12, &type); + CU_ASSERT(num == 1); + CU_ASSERT(type == ODP_EVENT_BUFFER); + + num = odp_event_type_multi(&event[1], 11, &type); + CU_ASSERT(num == 1); + CU_ASSERT(type == ODP_EVENT_PACKET); + + num = odp_event_type_multi(&event[2], 10, &type); + CU_ASSERT(num == 2); + CU_ASSERT(type == ODP_EVENT_BUFFER); + + num = odp_event_type_multi(&event[4], 8, &type); + CU_ASSERT(num == 2); + CU_ASSERT(type == ODP_EVENT_PACKET); + + num = odp_event_type_multi(&event[6], 6, &type); + CU_ASSERT(num == 3); + CU_ASSERT(type == ODP_EVENT_BUFFER); + + num = odp_event_type_multi(&event[9], 3, &type); + CU_ASSERT(num == 3); + CU_ASSERT(type == ODP_EVENT_PACKET); + + odp_event_free_multi(buf_event, NUM_TYPE_TEST); + odp_event_free_multi(pkt_event, NUM_TYPE_TEST); + + CU_ASSERT(odp_pool_destroy(buf_pool) == 0); + CU_ASSERT(odp_pool_destroy(pkt_pool) == 0); +} + odp_testinfo_t event_suite[] = { ODP_TEST_INFO(event_test_free), ODP_TEST_INFO(event_test_free_multi), ODP_TEST_INFO(event_test_free_multi_mixed), + ODP_TEST_INFO(event_test_type_multi), ODP_TEST_INFO_NULL, }; From patchwork Fri Dec 1 15:00:05 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: 120348 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1257596qgn; Fri, 1 Dec 2017 07:08:34 -0800 (PST) X-Google-Smtp-Source: AGs4zMY7Ph9lqA0rwcBTXCdk7fZFOPo4iW9SvMDAfL7ZXQD254t1v7RQ6SeEm2GsvTirjc65+M/S X-Received: by 10.55.141.195 with SMTP id p186mr8315336qkd.313.1512140914415; Fri, 01 Dec 2017 07:08:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140914; cv=none; d=google.com; s=arc-20160816; b=FMjiHK8Nm/J2oVlK/tVwXyGYJL+HrVGM51TzZ9MxGRJhKcxNdAcO3qtLHD367mVKjv rUAvKCQKCgfSGaWoy5wop2+s9FBWdqdqT/F1Cf+sIUhfb+4Kh4B+gY4v6nErcuu9TeVy RKuO+/3rX+zGLAr/v14M/zzjgnO86DLxqeAkhbp2bywyNSMAUMrqWvA9FevbxH1F7jd+ NdaWA/RDU8j36H28cMRK/1PUNx480+HSMnTY62OI7qrOas+en/0oXY5iZTgmiBJb0+yg ozptmJGrtyEgurF6qQwfT0wvH3Jz/acYIpYYTMBPXf+YW7mj3r9aCj2qGZyLcdB1yfab abWw== 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=Hj/S8VxvyXqNoeYHzFx4KynwmU8X60s4+L+vLhO3g8M=; b=nK6ATeJ5Q8E4wbYU4l5rquspoOGG5lL63+FaDW+u+mqDXoM0F9wsnS6R44FTB56Dm8 07SAfXD526vAW4byUzbAAtn+iuqbPBlCgrRNi/Wv5vWU2juj+G1PBm17mE+34y3UayIl tYmHH0mfWR/UXMN4u078mJ90JeA8y+hddRE+vD+V8khy54AEfFfPDMomvDYxCSPCCUcz h/VUN7yq3POl+uogCaLCQNeTNnKFFsEG4yXu+fay1IiI6jL4xtcW7ysYppFM/J63kX99 klhBGzQZC28a5gsOVoRw+Z6z58OYJfSIni5pO29n+DsooUf7Zqz9muNBraXYE+9Fwuo4 6oVg== 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 i11si2466099qtc.438.2017.12.01.07.08.34; Fri, 01 Dec 2017 07:08:34 -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 0CE676098B; Fri, 1 Dec 2017 15:08:34 +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 A76D4609D8; Fri, 1 Dec 2017 15:01:16 +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 F23EA604C8; Fri, 1 Dec 2017 15:00:34 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 5026D6096D for ; Fri, 1 Dec 2017 15:00:22 +0000 (UTC) Received: from mxback10g.mail.yandex.net (mxback10g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:171]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 9DF9E2D86B51 for ; Fri, 1 Dec 2017 18:00:20 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback10g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id vw2Sikdgh8-0KbKmNst; Fri, 01 Dec 2017 18:00:20 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0Ke8kmHx; 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:05 +0300 Message-Id: <1512140407-13534-11-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 10/12] api: event: filter and convert packets 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 call optimizes into a single call the common case of first checking that events are packets and then converting those to packet handles. while (1) { num = odp_schedule_multi(NULL, 0, event, max_num); if (num <= 0) continue; num_pkt = odp_event_filter_packet(event, packet, remain, num); packet_foo(packet, num_pkt); other_foo(remain, num - num_pkt); ... } 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 **/ include/odp/api/spec/event.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/include/odp/api/spec/event.h b/include/odp/api/spec/event.h index e5edaacc9..2228c596f 100644 --- a/include/odp/api/spec/event.h +++ b/include/odp/api/spec/event.h @@ -19,12 +19,13 @@ extern "C" { #endif +#include + /** @defgroup odp_event ODP EVENT * Operations on an event. * @{ */ - /** * @typedef odp_event_t * ODP event @@ -141,6 +142,27 @@ odp_event_type_t odp_event_types(odp_event_t event, int odp_event_type_multi(const odp_event_t event[], int num, odp_event_type_t *type); +/** + * Filter and convert packet events + * + * Checks event type of all input events, converts all packet events and outputs + * packet handles. Returns the number packet handles outputted. Outputs the + * remaining, non-packet event handles to 'remain' array. Handles are outputted + * to both arrays in the same order those are stored in 'event' array. Both + * output arrays must fit 'num' elements. + * + * @param event Array of event handles + * @param[out] packet Packet handle array for output + * @param[out] remain Event handle array for output of remaining, non-packet + * events + * @param num Number of events (> 0) + * + * @return Number of packets outputted (0 ... num) + */ +int odp_event_filter_packet(const odp_event_t event[], + odp_packet_t packet[], + odp_event_t remain[], int num); + /** * Get printable value for an odp_event_t * 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 From patchwork Fri Dec 1 15:00:07 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: 120349 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1258267qgn; Fri, 1 Dec 2017 07:09:01 -0800 (PST) X-Google-Smtp-Source: AGs4zMa16DYswhXrZdttDPhgBog+1fgCHbr1wVEwRTh58RA4sXIDxs8NjpPnT01dXtsj3KqjHPsp X-Received: by 10.55.139.129 with SMTP id n123mr7510374qkd.177.1512140940709; Fri, 01 Dec 2017 07:09:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512140940; cv=none; d=google.com; s=arc-20160816; b=d6MNwGbMNEbWDiAsdjfsu1jEu3XuCP32M3fQ4mQ3SAwDrXk0+iRhE9G3cUgvJ4x0xo QHxvgppUX6sLF5aYB7kF/LKsWGPNAM99InLaMpmoKaYDwiEkCi9e1B9X+zv9rQQsAefb CCI9gM6AaxRLWHkB43CFhttJ57lyiT9fAEwy6zy6R8S696jlU5grnvtxzJCQqlSY5v4I PJmzrWxtGq44TFC5PkFOj6Zk/X+UYIOEhz5QBafMb9a8/4PJrLt6PASHYa5oguGZXTDy qutQyaRq1gxRRBGjnfnyk0QjhR+iTrnj5XpkCCzsm9a+zPPiSRdmcFmjooWk81D+72T1 hmGw== 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=stbkojVCPvc76GJXEkBu0YkXBusAEhKho6oQc7vATjg=; b=dpickVYoZ9bRqivqYRDrOmYNoP9soFJd2cO+MwN+/+lN1Wnhh/H66NYAbMxf601s04 qvHDjXl4yJcwkw4HBwbFc4CA7nb/DlQWpKVnE9h3P3XVkThAOGaniuMWfzrBSrzl48fj dcBFRW/mSIAtDPnN9ldb4P065ts9mBM6pSMU2c67+0W5tGL4f5coZkHKMeJq9cZQsOGj CiMKEdsoDv7B3m561wXCqHJxk/HwYndFmimg0lHkWtjgwHy16NHDQTeOv5iwoqzTDsM7 SoBLAx8iKshPpoXlLdKU5msSOAWb2HlM4cjE6EMePX6xckyQl3XI/DwqxpsI9o1FdZoO htIQ== 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 g64si2792410qtd.88.2017.12.01.07.09.00; Fri, 01 Dec 2017 07:09:00 -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 4546660982; Fri, 1 Dec 2017 15:09:00 +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 3481860981; Fri, 1 Dec 2017 15:01:33 +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 4E002609F2; Fri, 1 Dec 2017 15:01:25 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id CC15F6097C for ; Fri, 1 Dec 2017 15:00:22 +0000 (UTC) Received: from mxback1o.mail.yandex.net (mxback1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1b]) by forward102p.mail.yandex.net (Yandex) with ESMTP id BFD6B4305697 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 mxback1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id GxSNpdP5qL-0LCieu4o; Fri, 01 Dec 2017 18:00:21 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id I6qrBsStkX-0LeKPCq4; Fri, 01 Dec 2017 18:00:21 +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:07 +0300 Message-Id: <1512140407-13534-13-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 12/12] validation: event: filter packet 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 the new filter packet 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 **/ test/validation/api/event/event.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/test/validation/api/event/event.c b/test/validation/api/event/event.c index 901fe6ed2..5add99c32 100644 --- a/test/validation/api/event/event.c +++ b/test/validation/api/event/event.c @@ -348,11 +348,50 @@ static void event_test_type_multi(void) CU_ASSERT(odp_pool_destroy(pkt_pool) == 0); } +static void event_test_filter_packet(void) +{ + odp_pool_t buf_pool, pkt_pool; + int i, num_pkt, num_rem; + int num = 2 * NUM_TYPE_TEST; + odp_event_t buf_event[NUM_TYPE_TEST]; + odp_event_t pkt_event[NUM_TYPE_TEST]; + odp_event_t event[num]; + odp_packet_t packet[num]; + odp_event_t remain[num]; + + type_test_init(&buf_pool, &pkt_pool, buf_event, pkt_event, event); + + for (i = 0; i < num; i++) { + packet[i] = ODP_PACKET_INVALID; + remain[i] = ODP_EVENT_INVALID; + } + + num_pkt = odp_event_filter_packet(event, packet, remain, num); + CU_ASSERT(num_pkt == NUM_TYPE_TEST); + + for (i = 0; i < num_pkt; i++) + CU_ASSERT(packet[i] != ODP_PACKET_INVALID); + + num_rem = num - num_pkt; + CU_ASSERT(num_rem == NUM_TYPE_TEST); + + for (i = 0; i < num_rem; i++) { + CU_ASSERT(remain[i] != ODP_EVENT_INVALID); + CU_ASSERT(odp_event_type(remain[i]) == ODP_EVENT_BUFFER); + } + + odp_event_free_multi(event, num); + + CU_ASSERT(odp_pool_destroy(buf_pool) == 0); + CU_ASSERT(odp_pool_destroy(pkt_pool) == 0); +} + odp_testinfo_t event_suite[] = { ODP_TEST_INFO(event_test_free), ODP_TEST_INFO(event_test_free_multi), ODP_TEST_INFO(event_test_free_multi_mixed), ODP_TEST_INFO(event_test_type_multi), + ODP_TEST_INFO(event_test_filter_packet), ODP_TEST_INFO_NULL, };