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.
  • -EINVAL if count is 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, unless RING_F_EXACT_SZ is set in flags).
  • 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 using rte_ring_enqueue() or rte_ring_enqueue_bulk() is "single-producer".
      • RING_F_MP_RTS_ENQ: If this flag is set, the default behavior when using rte_ring_enqueue() or rte_ring_enqueue_bulk() is "multi-producer RTS mode".
      • RING_F_MP_HTS_ENQ: If this flag is set, the default behavior when using rte_ring_enqueue() or rte_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 using rte_ring_dequeue() or rte_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 using rte_ring_dequeue() or rte_ring_dequeue_bulk() is "multi-consumer RTS mode".
      • RING_F_MC_HTS_DEQ: If this flag is set, the default behavior when using rte_ring_dequeue() or rte_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.

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. If NULL then, 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, unless RING_F_EXACT_SZ is set in flags).
  • socket_id โ€” The socket_id argument is the socket identifier in case of NUMA. The value can be SOCKET_ID_ANY if 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 using rte_ring_enqueue() or rte_ring_enqueue_bulk() is "single-producer".
      • RING_F_MP_RTS_ENQ: If this flag is set, the default behavior when using rte_ring_enqueue() or rte_ring_enqueue_bulk() is "multi-producer RTS mode".
      • RING_F_MP_HTS_ENQ: If this flag is set, the default behavior when using rte_ring_enqueue() or rte_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 using rte_ring_dequeue() or rte_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 using rte_ring_dequeue() or rte_ring_dequeue_bulk() is "multi-consumer RTS mode".
      • RING_F_MC_HTS_DEQ: If this flag is set, the default behavior when using rte_ring_dequeue() or rte_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 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 to rte_config structure
  • EINVAL โ€” count provided is not a power of 2
  • ENOSPC โ€” the maximum number of memzones has already been allocated
  • EEXIST โ€” a memzone with the same name already exists
  • ENOMEM โ€” 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 output
  • r โ€” 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 output
  • prefix โ€” a string to prefix each output line with
  • r โ€” 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 of void * pointers (objects).
  • n โ€” the number of objects to add in the ring from the obj_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 of void * pointers (objects).
  • n โ€” the number of objects to add in the ring from the obj_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 of void * pointers (objects).
  • n โ€” the number of objects to add in the ring from the obj_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 of void * pointers (objects) that will be filled.
  • n โ€” the number of objects to dequeue from the ring to the obj_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 of void * pointers (objects) that will be filled.
  • n โ€” the number of objects to dequeue from the ring to the obj_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 of void * pointers (objects) that will be filled.
  • n โ€” the number of objects to dequeue from the ring to the obj_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 a void * 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 a void * 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 a void * 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 NULL if it's not found, with rte_errno set appropriately. Possible rte_errno values 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 of void * pointers (objects).
  • n โ€” the number of objects to add in the ring from the obj_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 of void * pointers (objects).
  • n โ€” the number of objects to add in the ring from the obj_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 of void * pointers (objects).
  • n โ€” the number of objects to add in the ring from the obj_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 of void * pointers (objects) that will be filled.
  • n โ€” the number of objects to dequeue from the ring to the obj_table.
  • available โ€” if non-NULL, returns the number of remaining ring entries after the dequeue has finished.

Returns

  • n: actual number of objects dequeued, 0 if 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 of void * pointers (objects) that will be filled.
  • n โ€” the number of objects to dequeue from the ring to the obj_table.
  • available โ€” if non-NULL, returns the number of remaining ring entries after the dequeue has finished.

Returns

  • n: actual number of objects dequeued, 0 if 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 of void * pointers (objects) that will be filled.
  • n โ€” the number of objects to dequeue from the ring to the obj_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