DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] eventdev: add bulk type event ring operations
@ 2023-04-03 13:13 Mattias Rönnblom
  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
  0 siblings, 2 replies; 4+ messages in thread
From: Mattias Rönnblom @ 2023-04-03 13:13 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, Peter Nilsson J, Mattias Rönnblom

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-02 10:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-03 13:13 [PATCH 1/2] eventdev: add bulk type event ring operations Mattias Rönnblom
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

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).