rte_ring.h(3)
๐ rte_ring.h ๐
hii bestie ๐ซถ welcome to the RTE Ring page, torn straight out of the Library Functions Manual. This is part 1 of 3, so buckle up โ more is coming, don't you dare close the tab ๐
โจ NAME โจ
rte_ring.h โ the header for the RTE Ring, aka the Ring Manager: a fixed-size queue that's really just a table of pointers, with head and tail pointers getting updated atomically so everybody can access it at the same time. It's giving lockless. It's giving iconic. ๐
๐ SYNOPSIS ๐
#include <rte_common.h>
#include <rte_ring_core.h>
#include <rte_ring_elem.h>
๐ง Functions ๐ง
ssize_t rte_ring_get_memsize (unsigned int count)
int rte_ring_init (struct rte_ring *r, const char *name, unsigned int count, unsigned int flags)
void rte_ring_free (struct rte_ring *r)
struct rte_ring * rte_ring_create (const char *name, unsigned int count, int socket_id, unsigned int flags) __rte_malloc __rte_dealloc(rte_ring_free
struct rte_ring void rte_ring_dump (FILE *f, const struct rte_ring *r)
__rte_experimental void rte_ring_headtail_dump (FILE *f, const char *prefix, const struct rte_ring_headtail *r)
static __rte_always_inline unsigned int rte_ring_mp_enqueue_bulk (struct rte_ring *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
static __rte_always_inline unsigned int rte_ring_sp_enqueue_bulk (struct rte_ring *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
static __rte_always_inline unsigned int rte_ring_enqueue_bulk (struct rte_ring *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
static __rte_always_inline int rte_ring_mp_enqueue (struct rte_ring *r, void *obj)
static __rte_always_inline int rte_ring_sp_enqueue (struct rte_ring *r, void *obj)
static __rte_always_inline int rte_ring_enqueue (struct rte_ring *r, void *obj)
static __rte_always_inline unsigned int rte_ring_mc_dequeue_bulk (struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
static __rte_always_inline unsigned int rte_ring_sc_dequeue_bulk (struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
static __rte_always_inline unsigned int rte_ring_dequeue_bulk (struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
static __rte_always_inline int rte_ring_mc_dequeue (struct rte_ring *r, void **obj_p)
static __rte_always_inline int rte_ring_sc_dequeue (struct rte_ring *r, void **obj_p)
static __rte_always_inline int rte_ring_dequeue (struct rte_ring *r, void **obj_p)
void rte_ring_reset (struct rte_ring *r)
static unsigned int rte_ring_count (const struct rte_ring *r)
static unsigned int rte_ring_free_count (const struct rte_ring *r)
static int rte_ring_full (const struct rte_ring *r)
static int rte_ring_empty (const struct rte_ring *r)
static unsigned int rte_ring_get_size (const struct rte_ring *r)
static unsigned int rte_ring_get_capacity (const struct rte_ring *r)
static enum rte_ring_sync_type rte_ring_get_prod_sync_type (const struct rte_ring *r)
static int rte_ring_is_prod_single (const struct rte_ring *r)
static enum rte_ring_sync_type rte_ring_get_cons_sync_type (const struct rte_ring *r)
static int rte_ring_is_cons_single (const struct rte_ring *r)
void rte_ring_list_dump (FILE *f)
struct rte_ring * rte_ring_lookup (const char *name)
static __rte_always_inline unsigned int rte_ring_mp_enqueue_burst (struct rte_ring *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
static __rte_always_inline unsigned int rte_ring_sp_enqueue_burst (struct rte_ring *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
static __rte_always_inline unsigned int rte_ring_enqueue_burst (struct rte_ring *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
static __rte_always_inline unsigned int rte_ring_mc_dequeue_burst (struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
static __rte_always_inline unsigned int rte_ring_sc_dequeue_burst (struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
static __rte_always_inline unsigned int rte_ring_dequeue_burst (struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
๐ฆ Detailed Description ๐ฆ
๐ RTE Ring ๐
The Ring Manager is a fixed-size queue, implemented as a table of pointers. Head and tail pointers are modified atomically, allowing concurrent access to it. The way it has the following features, no cap:
- FIFO (First In First Out) ๐
- Maximum size is fixed; the pointers are stored in a table.
- Lockless implementation. ๐โจ
- Multi- or single-consumer dequeue.
- Multi- or single-producer enqueue.
- Bulk dequeue.
- Bulk enqueue.
- Ability to select different sync modes for producer/consumer.
- Dequeue start/finish (depending on consumer sync modes).
- Enqueue start/finish (depending on producer sync mode).
โ ๏ธ Note: the ring implementation is not preemptible. Refer to Programmer's guide/Environment Abstraction Layer/Multiple pthread/Known Issues/rte_ring for more information. Like, actually go read it bestie, don't skip ๐
Definition in file rte_ring.h.
๐ธ Function Documentation ๐ธ
๐ ssize_t rte_ring_get_memsize (unsigned int count)
Calculate the memory size needed for a ring ๐งฎโจ
This function returns the number of bytes needed for a ring, given the number of elements in it. This value is the sum of the size of the structure rte_ring and the size of the memory needed by the objects pointers. The value is aligned to a cache line size.
Parameters
countโ The number of elements in the ring (must be a power of 2).
Returns
- The memory size needed for the ring on success.
-EINVALifcountis not a power of 2. ๐ญ
๐ int rte_ring_init (struct rte_ring * r, const char * name, unsigned int count, unsigned int flags)
Initialize a ring structure โจ
Initialize a ring structure in memory pointed by "r". The size of the memory area must be large enough to store the ring structure and the object table. It is advised to use rte_ring_get_memsize() to get the appropriate size. ๐
The ring size is set to count, which must be a power of two. The real usable ring size is count-1 instead of count to differentiate a full ring from an empty ring. iykyk.
The ring is not added in RTE_TAILQ_RING global list. Indeed, the memory given by the caller may not be shareable among dpdk processes.
Parameters
rโ The pointer to the ring structure followed by the objects table.nameโ The name of the ring.countโ The number of elements in the ring (must be a power of 2, unlessRING_F_EXACT_SZis set inflags).flagsโ An OR of the following:- One of mutually exclusive flags that define producer behavior:
RING_F_SP_ENQ: If this flag is set, the default behavior when usingrte_ring_enqueue()orrte_ring_enqueue_bulk()is"single-producer".RING_F_MP_RTS_ENQ: If this flag is set, the default behavior when usingrte_ring_enqueue()orrte_ring_enqueue_bulk()is"multi-producer RTS mode".RING_F_MP_HTS_ENQ: If this flag is set, the default behavior when usingrte_ring_enqueue()orrte_ring_enqueue_bulk()is"multi-producer HTS mode". If none of these flags is set, then default"multi-producer"behavior is selected.
- One of mutually exclusive flags that define consumer behavior:
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_MC_RTS_DEQ: If this flag is set, the default behavior when usingrte_ring_dequeue()orrte_ring_dequeue_bulk()is"multi-consumer RTS mode".RING_F_MC_HTS_DEQ: If this flag is set, the default behavior when usingrte_ring_dequeue()orrte_ring_dequeue_bulk()is"multi-consumer HTS mode". If none of these flags is set, then default"multi-consumer"behavior is selected.
RING_F_EXACT_SZ: If this flag is set, the ring will hold exactly the requested number of entries, and the requested size will be rounded up to the next power of two, but the usable space will be exactly that requested. Worst case, if a power-of-2 size is requested, half the ring space will be wasted. Without this flag set, the ring size requested must be a power of 2, and the usable space will be that size - 1.
- One of mutually exclusive flags that define producer behavior:
Returns
0 on success, or a negative value on error. ๐ญ
๐ void rte_ring_free (struct rte_ring * r)
De-allocate all memory used by the ring ๐๏ธโจ
Parameters
rโ Ring to free. IfNULLthen, the function does nothing. (chill, it's not gonna crash on you ๐ )
๐ struct rte_ring * rte_ring_create (const char * name, unsigned int count, int socket_id, unsigned int flags)
Create a new ring named name in memory ๐
This function uses memzone_reserve() to allocate memory. Then it calls rte_ring_init() to initialize an empty ring.
The new ring size is set to count, which must be a power of two. The real usable ring size is count-1 instead of count to differentiate a full ring from an empty ring.
The ring is added in RTE_TAILQ_RING list. ๐
Parameters
nameโ The name of the ring.countโ The size of the ring (must be a power of 2, unlessRING_F_EXACT_SZis set inflags).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:- One of mutually exclusive flags that define producer behavior:
RING_F_SP_ENQ: If this flag is set, the default behavior when usingrte_ring_enqueue()orrte_ring_enqueue_bulk()is"single-producer".RING_F_MP_RTS_ENQ: If this flag is set, the default behavior when usingrte_ring_enqueue()orrte_ring_enqueue_bulk()is"multi-producer RTS mode".RING_F_MP_HTS_ENQ: If this flag is set, the default behavior when usingrte_ring_enqueue()orrte_ring_enqueue_bulk()is"multi-producer HTS mode". If none of these flags is set, then default"multi-producer"behavior is selected.
- One of mutually exclusive flags that define consumer behavior:
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_MC_RTS_DEQ: If this flag is set, the default behavior when usingrte_ring_dequeue()orrte_ring_dequeue_bulk()is"multi-consumer RTS mode".RING_F_MC_HTS_DEQ: If this flag is set, the default behavior when usingrte_ring_dequeue()orrte_ring_dequeue_bulk()is"multi-consumer HTS mode". If none of these flags is set, then default"multi-consumer"behavior is selected.
- One of mutually exclusive flags that define producer behavior:
RING_F_EXACT_SZ: if this flag is set, the ring holds exactly the number of entries you asked for ๐ฏ โ the requested size gets rounded up to the next power of two, but the usable space stays exactly what you requested. Worst case tho? If you request a power-of-2 size, half the ring space is wasted ๐ญ. Without this flag set, the ring size you request has to be a power of 2, and the usable space will be that size minus 1.
Returns
On success you get the pointer to the brand 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_configstructureEINVALโ count provided 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
struct rte_ring โ void rte_ring_dump (FILE * f, const struct rte_ring * r)
Dump the status of the ring to a file ๐.
Parameters
fโ a pointer to a file for outputrโ a pointer to the ring structure.
__rte_experimental void rte_ring_headtail_dump (FILE * f, const char * prefix, const struct rte_ring_headtail * r)
โ ๏ธ Warning! EXPERIMENTAL: this API may change without prior notice ๐.
Dump the status of a headtail to a file.
Parameters
fโ a pointer to a file for outputprefixโ a string to prefix each output line withrโ a pointer to a ring headtail structure.
__rte_always_inline unsigned int rte_ring_mp_enqueue_bulk (struct rte_ring * r, void *const * obj_table, unsigned int n, unsigned int * free_space) [static]
Enqueue several objects on the ring (multi-producers safe ๐ฏ๐ฏ).
This one uses a "compare and set" instruction to move the producer index atomically โจ.
Parameters
rโ a pointer to the ring structure.obj_tableโ a pointer to a table ofvoid *pointers (objects).nโ the number of objects to add in the ring from theobj_table.free_spaceโ if non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
The number of objects enqueued, either 0 or n.
Definition at line 246 of file rte_ring.h.
__rte_always_inline unsigned int rte_ring_sp_enqueue_bulk (struct rte_ring * r, void *const * obj_table, unsigned int n, unsigned int * free_space) [static]
Enqueue several objects on a ring (NOT multi-producers safe ๐ฌ โ single producer only bestie).
Parameters
rโ a pointer to the ring structure.obj_tableโ a pointer to a table ofvoid *pointers (objects).nโ the number of objects to add in the ring from theobj_table.free_spaceโ if non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
The number of objects enqueued, either 0 or n.
Definition at line 269 of file rte_ring.h.
__rte_always_inline unsigned int rte_ring_enqueue_bulk (struct rte_ring * r, void *const * obj_table, unsigned int n, unsigned int * free_space) [static]
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).
Parameters
rโ a pointer to the ring structure.obj_tableโ a pointer to a table ofvoid *pointers (objects).nโ the number of objects to add in the ring from theobj_table.free_spaceโ if non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
The number of objects enqueued, either 0 or n.
Definition at line 296 of file rte_ring.h.
__rte_always_inline int rte_ring_mp_enqueue (struct rte_ring * r, void * obj) [static]
Enqueue one object on a ring (multi-producers safe โจ).
This function uses a "compare and set" instruction to move the producer index atomically.
Parameters
rโ a pointer to the ring structure.objโ a pointer to the object to be added.
Returns
0: Success; objects enqueued. ๐-ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued. ๐ญ
Definition at line 318 of file rte_ring.h.
__rte_always_inline int rte_ring_sp_enqueue (struct rte_ring * r, void * obj) [static]
Enqueue one object on a ring (NOT multi-producers safe ๐ซ๐ฏ).
Parameters
rโ a pointer to the ring structure.objโ a pointer to the object to be added.
Returns
0: Success; objects enqueued.-ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
Definition at line 335 of file rte_ring.h.
__rte_always_inline int rte_ring_enqueue (struct rte_ring * r, void * obj) [static]
Enqueue one object on a ring ๐.
This function calls the multi-producer or the single-producer version, depending on the default behaviour that was specified at ring creation time (see flags).
Parameters
rโ a pointer to the ring structure.objโ a pointer to the object to be added.
Returns
0: Success; objects enqueued.-ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
Definition at line 356 of file rte_ring.h.
__rte_always_inline unsigned int rte_ring_mc_dequeue_bulk (struct rte_ring * r, void ** obj_table, unsigned int n, unsigned int * available) [static]
Dequeue several objects from a ring (multi-consumers safe ๐ฏ๐ฏ we love to see it).
This function uses a "compare and set" instruction to move the consumer index atomically.
Parameters
rโ a pointer to the ring structure.obj_tableโ a pointer to a table ofvoid *pointers (objects) that will be filled.nโ the number of objects to dequeue from the ring to theobj_table.availableโ if non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
The number of objects dequeued, either 0 or n.
Definition at line 380 of file rte_ring.h.
__rte_always_inline unsigned int rte_ring_sc_dequeue_bulk (struct rte_ring * r, void ** obj_table, unsigned int n, unsigned int * available) [static]
Dequeue several objects from a ring (NOT multi-consumers safe ๐).
Parameters
rโ a pointer to the ring structure.obj_tableโ a pointer to a table ofvoid *pointers (objects) that will be filled.nโ the number of objects to dequeue from the ring to theobj_table, must be strictly positive โญ.availableโ if non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
The number of objects dequeued, either 0 or n.
Definition at line 404 of file rte_ring.h.
__rte_always_inline unsigned int rte_ring_dequeue_bulk (struct rte_ring * r, void ** obj_table, unsigned int n, unsigned int * available) [static]
Dequeue several objects from a ring ๐.
This function calls the multi-consumers or the single-consumer version, depending on the default behaviour that was specified at ring creation time (see flags).
Parameters
rโ a pointer to the ring structure.obj_tableโ a pointer to a table ofvoid *pointers (objects) that will be filled.nโ the number of objects to dequeue from the ring to theobj_table.availableโ if non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
The number of objects dequeued, either 0 or n.
Definition at line 431 of file rte_ring.h.
__rte_always_inline int rte_ring_mc_dequeue (struct rte_ring * r, void ** obj_p) [static]
Dequeue one object from a ring (multi-consumers safe ๐ ).
This function uses a "compare and set" instruction to move the consumer index atomically.
Parameters
rโ a pointer to the ring structure.obj_pโ a pointer to avoid *pointer (object) that will be filled.
Returns
0: Success; objects dequeued. โจ-ENOENT: Not enough entries in the ring to dequeue; no object is dequeued.
Definition at line 454 of file rte_ring.h.
__rte_always_inline int rte_ring_sc_dequeue (struct rte_ring * r, void ** obj_p) [static]
Dequeue one object from a ring (NOT multi-consumers safe ๐ซ๐ฏ).
Parameters
rโ a pointer to the ring structure.obj_pโ a pointer to avoid *pointer (object) that will be filled.
Returns
0: Success; objects dequeued.-ENOENT: Not enough entries in the ring to dequeue, no object is dequeued.
Definition at line 472 of file rte_ring.h.
__rte_always_inline int rte_ring_dequeue (struct rte_ring * r, void ** obj_p) [static]
Dequeue one object from a ring ๐.
This function calls the multi-consumers or the single-consumer version depending on the default behaviour that was specified at ring creation time (see flags).
Parameters
rโ a pointer to the ring structure.obj_pโ a pointer to avoid *pointer (object) that will be filled.
Returns
0: Success, objects dequeued.-ENOENT: Not enough entries in the ring to dequeue, no object is dequeued.
Definition at line 494 of file rte_ring.h.
void rte_ring_reset (struct rte_ring * r)
Flush a ring ๐ฟ.
This function flush all the elements in a ring.
โ ๏ธ Warning! Make sure the ring is not in use while calling this function. Fr fr. No cap. If something else is touching it you're gonna have a bad time ๐ญ.
Parameters
rโ a pointer to the ring structure.
unsigned int rte_ring_count (const struct rte_ring * r) [inline], [static]
Return the number of entries in a ring ๐ข.
Parameters
rโ a pointer to the ring structure.
Returns
The number of entries in the ring.
Definition at line 522 of file rte_ring.h.
unsigned int rte_ring_free_count (const struct rte_ring * r) [inline], [static]
Return the number of free entries in a ring ๐๏ธ.
Parameters
rโ a pointer to the ring structure.
Returns
The number of free entries in the ring.
Definition at line 539 of file rte_ring.h.
int rte_ring_full (const struct rte_ring * r) [inline], [static]
Test if a ring is full ๐ต.
Parameters
rโ a pointer to the ring structure.
Returns
1: The ring is full.0: The ring is not full.
Definition at line 554 of file rte_ring.h.
int rte_ring_empty (const struct rte_ring * r) [inline], [static]
Test if a ring is empty ๐ซ.
Parameters
rโ a pointer to the ring structure.
Returns
1: The ring is empty.0: The ring is not empty.
Definition at line 569 of file rte_ring.h.
unsigned int rte_ring_get_size (const struct rte_ring * r) [inline], [static]
Return the size of the 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, bestie, do not get it twisted ๐ if you wanna know that one you gotta call rte_ring_get_capacity() instead โจ
๐ Definition at line 587 of file rte_ring.h.
๐ธ rte_ring_get_capacity()
unsigned int rte_ring_get_capacity (const struct rte_ring * r) [inline], [static]
Returns the number of elements that can actually be stored in the ring ๐
Parameters
rโ a pointer to the ring structure.
Returns
- The usable size of the ring. That's the number you actually want, periodt ๐
๐ Definition at line 601 of file rte_ring.h.
๐ซ rte_ring_get_prod_sync_type()
enum rte_ring_sync_type rte_ring_get_prod_sync_type (const struct rte_ring * r) [inline], [static]
Tells you which sync type the producer side of the ring is using ๐ฆ
Parameters
rโ a pointer to the ring structure.
Returns
- Producer sync type value.
๐ Definition at line 615 of file rte_ring.h.
๐ rte_ring_is_prod_single()
int rte_ring_is_prod_single (const struct rte_ring * r) [inline], [static]
Checks whether this ring is a single-producer situation ๐
Parameters
rโ a pointer to the ring structure.
Returns
- true if the ring is SP, zero otherwise.
๐ Definition at line 629 of file rte_ring.h.
๐ rte_ring_get_cons_sync_type()
enum rte_ring_sync_type rte_ring_get_cons_sync_type (const struct rte_ring * r) [inline], [static]
Same energy as above, but for the consumer side. Returns the sync type the consumer is using in the ring ๐
Parameters
rโ a pointer to the ring structure.
Returns
- Consumer sync type value.
๐ Definition at line 643 of file rte_ring.h.
โจ rte_ring_is_cons_single()
int rte_ring_is_cons_single (const struct rte_ring * r) [inline], [static]
Checks whether this ring is single-consumer coded ๐ง
Parameters
rโ a pointer to the ring structure.
Returns
- true if the ring is SC, zero otherwise.
๐ Definition at line 657 of file rte_ring.h.
๐ rte_ring_list_dump()
void rte_ring_list_dump (FILE * f)
Dumps the status of all the rings straight to the console. Full photo dump of the whole ring roster ๐ธ
Parameters
fโ a pointer to a file for output.
๐ rte_ring_lookup()
struct rte_ring * rte_ring_lookup (const char * name)
Searches for a ring by its name, like a lil find-my-friend moment ๐ซถ
Parameters
nameโ the name of the ring.
Returns
- The pointer to the ring matching the name, or
NULLif it's not found, withrte_errnoset appropriately. Possiblerte_errnovalues include:ENOENTโ required entry not available to return.
๐ฅ rte_ring_mp_enqueue_burst()
__rte_always_inline unsigned int rte_ring_mp_enqueue_burst (struct rte_ring * r, void *const * obj_table, unsigned int n, unsigned int * free_space) [static]
Enqueues several objects onto the ring (multi-producers safe โ ). This one uses a "compare and set" instruction to move the producer index atomically, so yes it's doing the most, on purpose ๐ฅ
Parameters
rโ a pointer to the ring structure.obj_tableโ a pointer to a table ofvoid *pointers (objects).nโ the number of objects to add in the ring from theobj_table.free_spaceโ if non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
n: actual number of objects enqueued.
๐ Definition at line 701 of file rte_ring.h.
๐ฆ rte_ring_sp_enqueue_burst()
__rte_always_inline unsigned int rte_ring_sp_enqueue_burst (struct rte_ring * r, void *const * obj_table, unsigned int n, unsigned int * free_space) [static]
Enqueues several objects onto a ring, but NOT multi-producers safe ๐ don't come crying to me if you ignore that bestie.
Parameters
rโ a pointer to the ring structure.obj_tableโ a pointer to a table ofvoid *pointers (objects).nโ the number of objects to add in the ring from theobj_table.free_spaceโ if non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
n: actual number of objects enqueued.
๐ Definition at line 724 of file rte_ring.h.
๐ rte_ring_enqueue_burst()
__rte_always_inline unsigned int rte_ring_enqueue_burst (struct rte_ring * r, void *const * obj_table, unsigned int n, unsigned int * free_space) [static]
Enqueues several objects onto a ring โจ This one is the chill picker function: it calls the multi-producer or the single-producer version depending on the default behavior that was specified at ring creation time (see flags). It literally reads the vibe you set up earlier ๐
Parameters
rโ a pointer to the ring structure.obj_tableโ a pointer to a table ofvoid *pointers (objects).nโ the number of objects to add in the ring from theobj_table.free_spaceโ if non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
Returns
n: actual number of objects enqueued.
๐ Definition at line 751 of file rte_ring.h.
๐ rte_ring_mc_dequeue_burst()
__rte_always_inline unsigned int rte_ring_mc_dequeue_burst (struct rte_ring * r, void ** obj_table, unsigned int n, unsigned int * available) [static]
Dequeues several objects from a ring (multi-consumers safe โ ). When the requested objects are more than the available objects, it only dequeues the actual number of objects โ no overpromising, no cap ๐งข This function uses a "compare and set" instruction to move the consumer index atomically.
Parameters
rโ a pointer to the ring structure.obj_tableโ a pointer to a table ofvoid *pointers (objects) that will be filled.nโ the number of objects to dequeue from the ring to theobj_table.availableโ if non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
n: actual number of objects dequeued,0if the ring is empty.
๐ Definition at line 779 of file rte_ring.h.
๐ rte_ring_sc_dequeue_burst()
__rte_always_inline unsigned int rte_ring_sc_dequeue_burst (struct rte_ring * r, void ** obj_table, unsigned int n, unsigned int * available) [static]
Dequeues several objects from a ring, NOT multi-consumers safe ๐จ and when the requested objects are more than the available objects, it only dequeues the actual number of objects. Same deal as before, just without the multi-consumer safety net fr fr.
Parameters
rโ a pointer to the ring structure.obj_tableโ a pointer to a table ofvoid *pointers (objects) that will be filled.nโ the number of objects to dequeue from the ring to theobj_table.availableโ if non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
n: actual number of objects dequeued,0if the ring is empty.
๐ Definition at line 804 of file rte_ring.h.
๐ rte_ring_dequeue_burst()
__rte_always_inline unsigned int rte_ring_dequeue_burst (struct rte_ring * r, void ** obj_table, unsigned int n, unsigned int * available) [static]
Dequeues multiple objects from a ring, up to a maximum number ๐ซถ This is the delegator one: it calls the multi-consumers or the single-consumer version, depending on the default behaviour that was specified at ring creation time (see flags). Iconic, adaptive, unbothered ๐
Parameters
rโ a pointer to the ring structure.obj_tableโ a pointer to a table ofvoid *pointers (objects) that will be filled.nโ the number of objects to dequeue from the ring to theobj_table.availableโ if non-NULL, returns the number of remaining ring entries after the dequeue has finished.
Returns
- Number of objects dequeued.
๐ Definition at line 831 of file rte_ring.h.
๐ Author
Generated automatically by Doxygen for DPDK from the source code. Yes bestie, the robot wrote this one, not me, but the sparkle translation? All me ๐
That's a wrap on part 3, and honestly? We ate. Source: DPDK, Version 25.11.3, page rte_ring.h(3). Go forth and ring responsibly, 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