From patchwork Mon Apr 3 13:13:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 125723 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 743A5428BE; Mon, 3 Apr 2023 15:19:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 027A740ED7; Mon, 3 Apr 2023 15:19:44 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2048.outbound.protection.outlook.com [40.107.7.48]) by mails.dpdk.org (Postfix) with ESMTP id 36E0340A7E for ; Mon, 3 Apr 2023 15:19:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h5G3OCDwwb889g7reTkTp3sgQRfvqHp9nf7GPRHher5oC4r7EHzrFyTy24P7N+2aiRFhGi/CiM7y+26dEZ+CRWDz2cv9wjRIwpF1K/rV+OzuKx6913LxQoS9ZJ8Acs7EGJiQ5/s6jwOq8Rt4zmK07wkyRSYxX2qZ2ZpthTgaJVn4ZMHviNnCXj5hVTlSTbhEpmyMwoVYIiJRh04CYWdElFaGnpRUkVgDosbfGTusx7qflPaylRU1KRxOsyFXsbsgg+YiWCc2ZcAT7sKMjgMPjobHX4+Cmhiot20yM81u14DvogwO0CZWgV6U2o4Iqe72j3uR70eXPy90XoBT5yHLSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dXLi4Qyv00epwKTna1z8SHTmB80GXEkTae3zeQJbg0g=; b=Vt9Lf2XoJ3X79fb3lL4aMLMH+470ekD1/Dt8/HQkIzo+S3AnBMwksb/2H61Ytj7gFQafMaWDn4Y7Y+P2b2hNUzjPu69hjnf82+WvSbCNSxk2plzXy3tYOPItZ7PdhzHUgSIQXIgZ0dRhTr7m2dxRG7EKVFgnKocM/xtsPm5aYciupP72nwLwyoTSF5TYZ+vq/VS1vWB2T7aDEnDf8tWdC5ohUk0W4KvTCWXapnTyLGjX0lwC7y6qR9MvaC0aXzX4+pjV/T3o8dRAIbk0kY3gZS5pyUH6AMOuaknsU5Gtl1JOdFEMP/xY3A+k4Y2uubjxhLY1Hq95ez0NF2oXht5D+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=dpdk.org smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dXLi4Qyv00epwKTna1z8SHTmB80GXEkTae3zeQJbg0g=; b=Jt8vfEQGN28CkEDSUI7tOnkp8Or/KtOBpUCWJbA97ccJUZ7iLmiiMaqEZLg87l8NtqwaleWxxl3bXEbjlUSHgTjiVRXe5oHjEl8ULJUZaQRXohuYFrOfuFmCGsYT7lTdW5+PzoiKnlrdEDFDve/kjfowUIziDukFRqyZ8nqDjSA= Received: from AS9PR06CA0772.eurprd06.prod.outlook.com (2603:10a6:20b:484::27) by GVXPR07MB9869.eurprd07.prod.outlook.com (2603:10a6:150:121::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.30; Mon, 3 Apr 2023 13:19:40 +0000 Received: from VI1EUR02FT024.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:484:cafe::8e) by AS9PR06CA0772.outlook.office365.com (2603:10a6:20b:484::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22 via Frontend Transport; Mon, 3 Apr 2023 13:19:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by VI1EUR02FT024.mail.protection.outlook.com (10.13.61.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.6222.22 via Frontend Transport; Mon, 3 Apr 2023 13:19:40 +0000 Received: from ESESSMB505.ericsson.se (153.88.183.166) by ESESBMB504.ericsson.se (153.88.183.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 3 Apr 2023 15:19:38 +0200 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.193) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Mon, 3 Apr 2023 15:19:38 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id F1862380061; Mon, 3 Apr 2023 15:19:38 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: Jerin Jacob CC: , Peter Nilsson J , =?utf-8?q?Mattias_R=C3=B6nnblom?= Subject: [PATCH 1/2] eventdev: add bulk type event ring operations Date: Mon, 3 Apr 2023 15:13:45 +0200 Message-ID: <20230403131346.1070133-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1EUR02FT024:EE_|GVXPR07MB9869:EE_ X-MS-Office365-Filtering-Correlation-Id: 2842b66d-99d5-471f-fa64-08db344614be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hoez0b+sn1XoknUPcng3t9n9YmI3P/evysosp3LA51CPC0/CWLrVnw8UoPF7LfiUbkhQDcihCDEZiEDk7OrfDhnYdPorrJdqPqFe5z4atoXIeMR78RS3bnx/4Fm5ExoNvt5zd9s+7NkyprxxpCBIRGOzAAj252ENgzKEpev3vISYWh7nA0Hb8KL5T6qklkVh1jjxUFyTUU5aL71t7GPBiajIS8gMTz/l8EnR6rRBa37r18N/XNpA8p0LeRgtXIduuv27fWzU4ZyqwrPPau+F6EVy6fRejsM1JLJfDOqQ7SHoQk5C0bfXZoypzmIi3NbeeHcyQajBDCN+u5kJ3I9hhyb//Mmf41u1VGOdEgpNT4FTBmAykki843TPOg08Ih+gIkq/3Ecx2cqxowpRHzB+KaLm7lU18nddJy+IOTZlEqTwhqdc2eU0LnYM9IUyfB4uPduBaI6HVZr0L8IwDR/xYhsqgAnBzTeAr2hI65bx8FVDtNw+BYA8W9RBhwL/8kr75eAMYu6axLQcOl9UF4myhwMnh30UzkVVOH4RFpKM6TGaFNjP+ezPDOw8vNoXijOi8jERpkz/Y53uRydXvktIn1IeWUbKftjU+xlJpeoF8ANFZQvpc3SWabRwSDYZXRG7DGIt5EdC1ajc782fNHHkiDG6QnhYT97ao27GvMAKGiyW/+BTozo5QsniagGeS/di8T25LoaJoUl6ixPUMrL5useBNN+g/QLOFD2jxiJhku6ptCn1KZJ6qiU14slIsGE1 X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230028)(4636009)(346002)(136003)(396003)(39860400002)(376002)(451199021)(46966006)(36840700001)(40470700004)(356005)(5660300002)(7636003)(2616005)(47076005)(336012)(83380400001)(82310400005)(54906003)(316002)(478600001)(40480700001)(186003)(6266002)(86362001)(6666004)(107886003)(26005)(1076003)(82740400003)(82960400001)(41300700001)(36860700001)(40460700003)(36756003)(8676002)(4326008)(6916009)(70586007)(70206006)(8936002)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2023 13:19:40.2535 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2842b66d-99d5-471f-fa64-08db344614be X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR02FT024.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR07MB9869 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Introduce bulk enqueue and dequeue operations into the API, to supplement the already-existing burst calls. Signed-off-by: Mattias Rönnblom Acked-by: Jerin Jacob --- lib/eventdev/rte_event_ring.h | 74 +++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/lib/eventdev/rte_event_ring.h b/lib/eventdev/rte_event_ring.h index 7efa64444b..f9cf19ae16 100644 --- a/lib/eventdev/rte_event_ring.h +++ b/lib/eventdev/rte_event_ring.h @@ -67,6 +67,80 @@ rte_event_ring_free_count(const struct rte_event_ring *r) return rte_ring_free_count(&r->r); } + +/** + * Enqueue several objects on a ring. + * + * This function calls the multi-producer or the single-producer + * version depending on the default behavior that was specified at + * ring creation time (see flags). + * + * @param r + * pointer to the event ring + * @param events + * pointer to an array of struct rte_event objects + * @param n + * The number of events in the array to enqueue + * @param free_space + * if non-NULL, returns the amount of space in the ring after the + * enqueue operation has completed + * @return + * the number of objects enqueued, either 0 or n + */ +static __rte_always_inline unsigned int +rte_event_ring_enqueue_bulk(struct rte_event_ring *r, + const struct rte_event *events, + unsigned int n, uint16_t *free_space) +{ + unsigned int num; + uint32_t space; + + num = rte_ring_enqueue_bulk_elem(&r->r, events, + sizeof(struct rte_event), n, + &space); + + if (free_space != NULL) + *free_space = space; + + return num; +} + +/** + * Dequeue a set of events from a ring + * + * Note: this API does not work with pointers to events, rather it copies + * the events themselves to the destination ``events`` buffer. + * + * @param r + * pointer to the event ring + * @param events + * pointer to an array to hold the struct rte_event objects + * @param n + * number of events that can be held in the ``events`` array + * @param available + * if non-null, is updated to indicate the number of events remaining in + * the ring once the dequeue has completed + * @return + * the number of objects dequeued, either 0 or n + */ +static __rte_always_inline unsigned int +rte_event_ring_dequeue_bulk(struct rte_event_ring *r, + struct rte_event *events, + unsigned int n, uint16_t *available) +{ + unsigned int num; + uint32_t remaining; + + num = rte_ring_dequeue_bulk_elem(&r->r, events, + sizeof(struct rte_event), n, + &remaining); + + if (available != NULL) + *available = remaining; + + return num; +} + /** * Enqueue a set of events onto a ring *