rte_event_ring.h(3)
π NAME π
rte_event_ring.h β bestie, it's the event ring header, and it's iconic π
this is page rte_event_ring.h(3) from the Library Functions Manual, and we're gonna go through every single crumb of it, no cap.
β¨ SYNOPSIS β¨
#include <stdint.h>
#include <rte_common.h>
#include <rte_ring.h>
#include <rte_ring_elem.h>
#include 'rte_eventdev.h'
okay so yes, that last include is literally wrapped in single quotes, not angle brackets. That's not me being quirky, that's what the page says. Copy it exactly fr fr π«Ά
π§ Data Structures
struct rte_event_ringβ the main character itself π
π¦ Functions
static __rte_always_inline unsigned int rte_event_ring_count (const
struct rte_event_ring *r)
static __rte_always_inline unsigned int rte_event_ring_free_count (const
struct rte_event_ring *r)
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)
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)
static __rte_always_inline unsigned int rte_event_ring_enqueue_burst
(struct rte_event_ring *r, const struct rte_event *events, unsigned
int n, uint16_t *free_space)
static __rte_always_inline unsigned int rte_event_ring_dequeue_burst
(struct rte_event_ring *r, struct rte_event *events, unsigned int n,
uint16_t *available)
void rte_event_ring_free (struct rte_event_ring *r)
struct rte_event_ring * rte_event_ring_create (const char *name,
unsigned int count, int socket_id, unsigned int flags) __rte_malloc
__rte_dealloc(rte_event_ring_free
struct rte_event_ring struct rte_event_ring * rte_event_ring_lookup
(const char *name)
static unsigned int rte_event_ring_get_size (const struct rte_event_ring
*r)
static unsigned int rte_event_ring_get_capacity (const struct
rte_event_ring *r)
not the __rte_dealloc(rte_event_ring_free with its little unclosed paren at the end π that's verbatim from the page, leave it be bestie, it's doing its best.
π Detailed Description π
RTE Event Ring
Okay so here's the vibe: this gives you a ring implementation for passing rte_event structures from one core to another. That's the whole plot. Core-to-core event passing, slay β¨
Definition in file rte_event_ring.h.
π Function Documentation π
__rte_always_inline unsigned int rte_event_ring_count (const struct rte_event_ring * r) [static]
Returns the number of events in the ring π
Parameters
rβ pointer to the event ring
Returns
- the number of events in the ring
Definition at line 50 of file rte_event_ring.h.
__rte_always_inline unsigned int rte_event_ring_free_count (const struct rte_event_ring * r) [static]
Returns the amount of free space in the ring π¦
Parameters
rβ pointer to the event ring
Returns
- the number of free slots in the ring, i.e. the number of events that can be successfully enqueued before dequeue must be called
Definition at line 65 of file rte_event_ring.h.
__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) [static]
Enqueue several objects on a ring.
The way this one works: it calls the <highlight>multi-producer</highlight> or the <highlight>single-producer</highlight> version depending on the default behavior that was specified at ring creation time (see flags). So it's lowkey just doing what you told it to at birth πΌ
Parameters
rβ pointer to the event ringeventsβ pointer to an array ofstruct rte_eventobjectsnβ The number of events in the array to enqueuefree_spaceβ if non-NULL, returns the amount of space in the ring after the enqueue operation has completed
Returns
- the number of objects enqueued, either
0orn
Definition at line 91 of file rte_event_ring.h.
__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) [static]
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. Bestie, actual events, not lil pointer crumbs. Important π
Parameters
rβ pointer to the event ringeventsβ pointer to an array to hold thestruct rte_eventobjectsnβ number of events that can be held in the events arrayavailableβ if non-null, is updated to indicate the number of events remaining in the ring once the dequeue has completed
Returns
- the number of objects dequeued, either
0orn
Definition at line 127 of file rte_event_ring.h.
__rte_always_inline unsigned int rte_event_ring_enqueue_burst (struct rte_event_ring * r, const struct rte_event * events, unsigned int n, uint16_t * free_space) [static]
Enqueue a set of events onto a ring π₯
Note: this API enqueues by copying the events themselves onto the ring, rather than just placing a pointer to each event onto the ring. This means that statically-allocated events can safely be enqueued by this API. So your static babies are safe, periodt π
Parameters
rβ pointer to the event ringeventsβ pointer to an array ofstruct rte_eventobjectsnβ number of events in the array to enqueuefree_spaceβ if non-null, is updated to indicate the amount of free space in the ring once the enqueue has completed.
Returns
- the number of elements,
n', enqueued to the ring,0 <= n' <= n
Definition at line 165 of file rte_event_ring.h.
__rte_always_inline unsigned int rte_event_ring_dequeue_burst (struct rte_event_ring * r, struct rte_event * events, unsigned int n, uint16_t * available) [static]
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. Same deal as rte_event_ring_dequeue_bulk, iykyk πΈ
Parameters
rβ pointer to the event ringeventsβ pointer to an array to hold thestruct rte_eventobjectsnβ number of events that can be held in the events arrayavailableβ if non-null, is updated to indicate the number of events remaining in the ring once the dequeue has completed
Returns
- the number of elements,
n', dequeued from the ring,0 <= n' <= n
Definition at line 201 of file rte_event_ring.h.
void rte_event_ring_free (struct rte_event_ring * r)
De-allocate all memory used by the ring. Cleanup era π§Ήβ¨
Parameters
rβ Pointer to ring to created withrte_event_ring_create(). IfrisNULL, no operation is performed. So passingNULLis a lil no-op, not a crime π«Ά
struct rte_event_ring * rte_event_ring_create (const char * name, unsigned int count, int socket_id, unsigned int flags)
Create an event ring structure π
This function allocates memory and initializes an event ring inside that memory. It's giving architect energy, building the whole thing from scratch π
Parameters
nameβ name to be given to the ringcountβ the number of elements to be stored in the ring. If the flagRING_F_EXACT_SZis not set, this must be a power of 2, and the actual usable space in the ring will becount - 1entries. If the flagRING_F_EXACT_SZis set, the this can be any value up to the ring size limit- 1, and the usable space will be exactly that requested.socket_idβ Thesocket_idargument is the socket identifier in case of NUMA. The value can beSOCKET_ID_ANYif there is no NUMA constraint for the reserved zone.flagsβ An OR of the following:RING_F_SP_ENQ: If this flag is set, the default behavior when usingrte_ring_enqueue()orrte_ring_enqueue_bulk()is "single-producer". Otherwise, it is "multi-producers".RING_F_SC_DEQ: If this flag is set, the default behavior when usingrte_ring_dequeue()orrte_ring_dequeue_bulk()is "single-consumer". Otherwise, it is "multi-consumers".RING_F_EXACT_SZ: If this flag is set, thecountparameter is to be taken as the exact usable size of the ring, and as such does not need to be a power of 2. The underlying ring memory should be a power-of-2 size greater than thecountvalue.
Returns
On success, the pointer to the new allocated ring. NULL on error with rte_errno set appropriately. Possible errno values include:
E_RTE_NO_CONFIGβ function could not get pointer torte_configstructureE_RTE_SECONDARYβ function was called from a secondary process instanceEINVALβcountprovided is not a power of 2ENOSPCβ the maximum number of memzones has already been allocatedEEXISTβ a memzone with the same name already existsENOMEMβ no appropriate memory area found in which to create memzone
bestie if you seeNULLcome back, checkrte_errnoimmediately, don't just sit there guessing π the answer is right there.
struct rte_event_ring struct rte_event_ring * rte_event_ring_lookup (const char * name)
Search for an event ring based on its name π
Parameters
nameβ The name of the ring.
Returns
The pointer to the ring matching the name, or NULL if not found, with rte_errno set appropriately. Possible rte_errno values include:
ENOENTβ required entry not available to return.
unsigned int rte_event_ring_get_size (const struct rte_event_ring * r) [inline], [static]
Return the size of the event ring. π
Parameters
rβ A pointer to the ring structure.
Returns
The size of the data store used by the ring. NOTE: this is not the same as the usable space in the ring. To query that use rte_ring_get_capacity().
do not, I repeat do NOT, confusesizewith usable space. That's the classic blunder and it will humble you π userte_ring_get_capacity()for capacity, bestie.
Definition at line 328 of file rte_event_ring.h.
unsigned int rte_event_ring_get_capacity (const struct rte_event_ring * r) [inline], [static]
Return the number of elements which can be stored in the event ring. π
Parameters
rβ A pointer to the ring structure.
Returns
The usable size of the ring.
Definition at line 342 of file rte_event_ring.h.
π«Ά Author π«Ά
Generated automatically by Doxygen for DPDK from the source code.
and that's the whole page, bestie, we ate π
β¨ source is DPDK Version 25.11.3, and this was page rte_event_ring.h(3) from the Library Functions Manual β go build something iconic with it, mwah π
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms