From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C10B6428CB; Tue, 4 Apr 2023 09:04:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5A1BF410FA; Tue, 4 Apr 2023 09:04:20 +0200 (CEST) Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com [209.85.222.50]) by mails.dpdk.org (Postfix) with ESMTP id AED9640EE3 for ; Tue, 4 Apr 2023 09:04:18 +0200 (CEST) Received: by mail-ua1-f50.google.com with SMTP id l23so3775504uac.6 for ; Tue, 04 Apr 2023 00:04:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680591858; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nz05pefzJfOr0mFLX3KhBZRVphx3GMgP3tB+MD3jKbY=; b=PPMdLTGDaQj7NED4cKzrg/rpEcJm/rkDrSar9DMxwy3G63lORgs458SlikVNGQmSJq dZ/tevBmwYozkp5cTvo/gHRJaGZVKbvHDl68cFjc/LByZ35d59W0RYV/GfUEFkYTo/XV djfddajw2Ks9TPSxW7NKNCfE2m1eFpPStGp3I8pTLdb8M/dKKfU3OEiByV3LFU8R3dWe s4C1jstQQSVo12rpcelttg7gGhcH4u1C1pfC8mF5bep55OS6LdBneFsycpgIbISN4A6s eDoj6l2EPKl2GWfbNGfC2+Sc4fUaslrQbNqgfebTKHXDK6M2+M/bWQ3p/wcRbAVHNk4L 6JMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680591858; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nz05pefzJfOr0mFLX3KhBZRVphx3GMgP3tB+MD3jKbY=; b=SC6YBrdpyWRk1Zu4P/kapA+X+E0egYoxYC3ZNsPrysrpSd9t3OaWPgUMWPhpU457k2 QMetTZxSjOJ/K6BQXmBilew31M7Ajmni4EcoR+HJDkYQqxvFbdv+bVkIxAxnTUZspJVC JVWZgCnowS7RwVOmmucuNEISw9dwP6RyQ7iabclvJoAHcyfqkvH2KyE+jWe2AI7YehFF 2hzVQGf5oHnRLVOTnf0Spzc9YwfeUP1FibuL+cI0nLjC9LlBFmoHDcRliIszRNAz+hL0 DZaiEL/qc9/8nyiHXnYtA26dyfyuD0dHAgiX5sV5YY/x1gv2Fjw8uTXWRCwGS6DQyb/+ Na2w== X-Gm-Message-State: AAQBX9dx+VOwX29L6DQPUQ1pk7TbKTecyXq5JEGWDRb8/NEJexEGw5TA bFtpC44JjenOzN1n3jCn2asJ+pl6FwWR8ThRM/A= X-Google-Smtp-Source: AKy350YqN3P5+RgPVtdcXLAWeeGjotBaCZHb0vVOFfg1gzniVUXQYHyrARmUHgyUxK7tdFA8gdHbYZcp8Mruuhrou28= X-Received: by 2002:a9f:3018:0:b0:6cd:2038:4911 with SMTP id h24-20020a9f3018000000b006cd20384911mr1442499uab.1.1680591857948; Tue, 04 Apr 2023 00:04:17 -0700 (PDT) MIME-Version: 1.0 References: <20230403131346.1070133-1-mattias.ronnblom@ericsson.com> In-Reply-To: <20230403131346.1070133-1-mattias.ronnblom@ericsson.com> From: Jerin Jacob Date: Tue, 4 Apr 2023 12:33:51 +0530 Message-ID: Subject: Re: [PATCH 1/2] eventdev: add bulk type event ring operations To: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , "Richardson, Bruce" Cc: Jerin Jacob , dev@dpdk.org, Peter Nilsson J Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Mon, Apr 3, 2023 at 6:49=E2=80=AFPM Mattias R=C3=B6nnblom wrote: > > Introduce bulk enqueue and dequeue operations into the > API, to supplement the already-existing burst > calls. > > Signed-off-by: Mattias R=C3=B6nnblom Looks good to me. As the original author adding @Richardson, Bruce for review. > --- > 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 =3D rte_ring_enqueue_bulk_elem(&r->r, events, > + sizeof(struct rte_event), n, > + &space); > + > + if (free_space !=3D NULL) > + *free_space =3D space; > + > + return num; > +} > + > +/** > + * Dequeue a set of events from a ring > + * > + * Note: this API does not work with pointers to events, rather it copie= s > + * 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 =3D rte_ring_dequeue_bulk_elem(&r->r, events, > + sizeof(struct rte_event), n, > + &remaining); > + > + if (available !=3D NULL) > + *available =3D remaining; > + > + return num; > +} > + > /** > * Enqueue a set of events onto a ring > * > -- > 2.34.1 >