From: "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
To: Jerin Jacob <jerinj@marvell.com>
Cc: dev@dpdk.org, "Peter Nilsson J" <peter.j.nilsson@ericsson.com>,
"Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
Subject: [PATCH 1/2] eventdev: add bulk type event ring operations
Date: Mon, 3 Apr 2023 15:13:45 +0200 [thread overview]
Message-ID: <20230403131346.1070133-1-mattias.ronnblom@ericsson.com> (raw)
Introduce bulk enqueue and dequeue operations into the
<rte_event_ring.h> API, to supplement the already-existing burst
calls.
Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
---
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
*
--
2.34.1
next reply other threads:[~2023-04-03 13:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 13:13 Mattias Rönnblom [this message]
2023-04-03 13:13 ` [PATCH 2/2] event/dsw: replace burst with bulk enqueue Mattias Rönnblom
2023-04-04 7:03 ` [PATCH 1/2] eventdev: add bulk type event ring operations Jerin Jacob
2023-05-02 10:32 ` Jerin Jacob
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230403131346.1070133-1-mattias.ronnblom@ericsson.com \
--to=mattias.ronnblom@ericsson.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=peter.j.nilsson@ericsson.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).