FEMU  原版 master 7e238cc
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
rte_ring.h 文件参考
#include <stdio.h>
#include <stdint.h>
#include <sys/queue.h>
#include <errno.h>
#include <xmmintrin.h>
#include "rte_atomic_x86.h"
#include "rte_branch_prediction.h"
rte_ring.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  rte_ring_headtail
 
struct  rte_ring
 

宏定义

#define __rte_always_inline   inline
 
#define RTE_RING_MZ_PREFIX   "RG_"
 
#define RTE_NAMESIZE   256
 
#define RING_F_SP_ENQ   0x0001
 
#define RING_F_SC_DEQ   0x0002
 
#define RING_F_EXACT_SZ   0x0004
 
#define RTE_RING_SZ_MASK   (unsigned)(0x0fffffff)
 
#define __IS_SP   1
 
#define __IS_MP   0
 
#define __IS_SC   1
 
#define __IS_MC   0
 
#define ENQUEUE_PTRS(r, ring_start, prod_head, obj_table, n, obj_type)
 
#define DEQUEUE_PTRS(r, ring_start, cons_head, obj_table, n, obj_type)
 

枚举

enum  rte_ring_queue_behavior { RTE_RING_QUEUE_FIXED = 0, RTE_RING_QUEUE_VARIABLE }
 
enum  femu_ring_type { FEMU_RING_TYPE_SP_SC, FEMU_RING_TYPE_MP_SC, FEMU_RING_TYPE_MP_MC }
 

函数

static uint32_t rte_align32pow2 (uint32_t x)
 
ssize_t rte_ring_get_memsize (unsigned count)
 
int rte_ring_init (struct rte_ring *r, const char *name, unsigned count, unsigned flags)
 
struct rte_ringrte_ring_create (const char *name, unsigned count, unsigned flags)
 
void rte_ring_free (struct rte_ring *r)
 
void rte_ring_dump (FILE *f, const struct rte_ring *r)
 
static __rte_always_inline void update_tail (struct rte_ring_headtail *ht, uint32_t old_val, uint32_t new_val, uint32_t single)
 
static __rte_always_inline unsigned int __rte_ring_move_prod_head (struct rte_ring *r, int is_sp, unsigned int n, enum rte_ring_queue_behavior behavior, uint32_t *old_head, uint32_t *new_head, uint32_t *free_entries)
 
static __rte_always_inline unsigned int __rte_ring_do_enqueue (struct rte_ring *r, void *const *obj_table, unsigned int n, enum rte_ring_queue_behavior behavior, int is_sp, unsigned int *free_space)
 
static __rte_always_inline unsigned int __rte_ring_move_cons_head (struct rte_ring *r, int is_sc, unsigned int n, enum rte_ring_queue_behavior behavior, uint32_t *old_head, uint32_t *new_head, uint32_t *entries)
 
static __rte_always_inline unsigned int __rte_ring_do_dequeue (struct rte_ring *r, void **obj_table, unsigned int n, enum rte_ring_queue_behavior behavior, int is_sc, unsigned int *available)
 
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)
 
static unsigned rte_ring_count (const struct rte_ring *r)
 
static unsigned 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)
 
void rte_ring_list_dump (FILE *f)
 
struct rte_ringrte_ring_lookup (const char *name)
 
static __rte_always_inline unsigned 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 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 rte_ring_enqueue_burst (struct rte_ring *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
 
static __rte_always_inline unsigned rte_ring_mc_dequeue_burst (struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
 
static __rte_always_inline unsigned rte_ring_sc_dequeue_burst (struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
 
static __rte_always_inline unsigned rte_ring_dequeue_burst (struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
 
struct rte_ringfemu_ring_create (enum femu_ring_type type, size_t count)
 
void femu_ring_free (struct rte_ring *ring)
 
size_t femu_ring_count (struct rte_ring *ring)
 
size_t femu_ring_enqueue (struct rte_ring *ring, void **objs, size_t count)
 
size_t femu_ring_dequeue (struct rte_ring *ring, void **objs, size_t count)
 

详细描述

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. It has the following features:

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

Note: the ring implementation is not preemptable. A lcore must not be interrupted by another task that uses the same ring.

宏定义说明

◆ __IS_MC

#define __IS_MC   0

◆ __IS_MP

#define __IS_MP   0

◆ __IS_SC

#define __IS_SC   1

◆ __IS_SP

#define __IS_SP   1

◆ __rte_always_inline

#define __rte_always_inline   inline

◆ DEQUEUE_PTRS

#define DEQUEUE_PTRS (   r,
  ring_start,
  cons_head,
  obj_table,
  n,
  obj_type 
)
值:
do { \
unsigned int i; \
uint32_t idx = cons_head & (r)->mask; \
const uint32_t size = (r)->size; \
obj_type *ring = (obj_type *)ring_start; \
if (idx + n < size) { \
for (i = 0; i < (n & (~(unsigned)0x3)); i+=4, idx+=4) {\
obj_table[i] = ring[idx]; \
obj_table[i+1] = ring[idx+1]; \
obj_table[i+2] = ring[idx+2]; \
obj_table[i+3] = ring[idx+3]; \
} \
switch (n & 0x3) { \
case 3: \
obj_table[i++] = ring[idx++]; /* fallthrough */ \
case 2: \
obj_table[i++] = ring[idx++]; /* fallthrough */ \
case 1: \
obj_table[i++] = ring[idx++]; \
} \
} else { \
for (i = 0; idx < size; i++, idx++) \
obj_table[i] = ring[idx]; \
for (idx = 0; i < n; i++, idx++) \
obj_table[i] = ring[idx]; \
} \
} while (0)

◆ ENQUEUE_PTRS

#define ENQUEUE_PTRS (   r,
  ring_start,
  prod_head,
  obj_table,
  n,
  obj_type 
)
值:
do { \
unsigned int i; \
const uint32_t size = (r)->size; \
uint32_t idx = prod_head & (r)->mask; \
obj_type *ring = (obj_type *)ring_start; \
if (idx + n < size) { \
for (i = 0; i < (n & ((~(unsigned)0x3))); i+=4, idx+=4) { \
ring[idx] = obj_table[i]; \
ring[idx+1] = obj_table[i+1]; \
ring[idx+2] = obj_table[i+2]; \
ring[idx+3] = obj_table[i+3]; \
} \
switch (n & 0x3) { \
case 3: \
ring[idx++] = obj_table[i++]; /* fallthrough */ \
case 2: \
ring[idx++] = obj_table[i++]; /* fallthrough */ \
case 1: \
ring[idx++] = obj_table[i++]; \
} \
} else { \
for (i = 0; idx < size; i++, idx++)\
ring[idx] = obj_table[i]; \
for (idx = 0; i < n; i++, idx++) \
ring[idx] = obj_table[i]; \
} \
} while (0)

◆ RING_F_EXACT_SZ

#define RING_F_EXACT_SZ   0x0004

Ring is to hold exactly requested number of entries. Without this flag set, the ring size requested must be a power of 2, and the usable space will be that size - 1. With the flag, 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.

◆ RING_F_SC_DEQ

#define RING_F_SC_DEQ   0x0002

The default dequeue is "single-consumer".

◆ RING_F_SP_ENQ

#define RING_F_SP_ENQ   0x0001

The default enqueue is "single-producer".

◆ RTE_NAMESIZE

#define RTE_NAMESIZE   256

◆ RTE_RING_MZ_PREFIX

#define RTE_RING_MZ_PREFIX   "RG_"

◆ RTE_RING_SZ_MASK

#define RTE_RING_SZ_MASK   (unsigned)(0x0fffffff)

Ring size mask

枚举类型说明

◆ femu_ring_type

枚举值
FEMU_RING_TYPE_SP_SC 
FEMU_RING_TYPE_MP_SC 
FEMU_RING_TYPE_MP_MC 

◆ rte_ring_queue_behavior

枚举值
RTE_RING_QUEUE_FIXED 
RTE_RING_QUEUE_VARIABLE 

函数说明

◆ __rte_ring_do_dequeue()

static __rte_always_inline unsigned int __rte_ring_do_dequeue ( struct rte_ring r,
void **  obj_table,
unsigned int  n,
enum rte_ring_queue_behavior  behavior,
int  is_sc,
unsigned int *  available 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ __rte_ring_do_enqueue()

static __rte_always_inline unsigned int __rte_ring_do_enqueue ( struct rte_ring r,
void *const *  obj_table,
unsigned int  n,
enum rte_ring_queue_behavior  behavior,
int  is_sp,
unsigned int *  free_space 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ __rte_ring_move_cons_head()

static __rte_always_inline unsigned int __rte_ring_move_cons_head ( struct rte_ring r,
int  is_sc,
unsigned int  n,
enum rte_ring_queue_behavior  behavior,
uint32_t *  old_head,
uint32_t *  new_head,
uint32_t *  entries 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ __rte_ring_move_prod_head()

static __rte_always_inline unsigned int __rte_ring_move_prod_head ( struct rte_ring r,
int  is_sp,
unsigned int  n,
enum rte_ring_queue_behavior  behavior,
uint32_t *  old_head,
uint32_t *  new_head,
uint32_t *  free_entries 
)
static
函数调用图:
这是这个函数的调用关系图:

◆ femu_ring_count()

size_t femu_ring_count ( struct rte_ring ring)

Get the number of objects in the ring.

参数
ringthe ring.
返回
the number of objects in the ring.
函数调用图:
这是这个函数的调用关系图:

◆ femu_ring_create()

struct rte_ring* femu_ring_create ( enum femu_ring_type  type,
size_t  count 
)

Create a ring.

参数
typeType for the ring. (FEMU_RING_TYPE_SP_SC or FEMU_RING_TYPE_MP_SC).
countSize of the ring in elements.
socket_idSocket ID to allocate memory on, or FEMU_ENV_SOCKET_ID_ANY for any socket.
返回
a pointer to the created ring.
函数调用图:
这是这个函数的调用关系图:

◆ femu_ring_dequeue()

size_t femu_ring_dequeue ( struct rte_ring ring,
void **  objs,
size_t  count 
)

Dequeue count objects from the ring into the array objs.

参数
ringA pointer to the ring.
objsA pointer to the array to be dequeued.
countMaximum number of elements to be dequeued.
返回
the number of objects dequeued which is less than 'count'.
函数调用图:
这是这个函数的调用关系图:

◆ femu_ring_enqueue()

size_t femu_ring_enqueue ( struct rte_ring ring,
void **  objs,
size_t  count 
)

Queue the array of objects (with length count) on the ring.

参数
ringA pointer to the ring.
objsA pointer to the array to be queued.
countLength count of the array of objects.
返回
the number of objects enqueued.
函数调用图:
这是这个函数的调用关系图:

◆ femu_ring_free()

void femu_ring_free ( struct rte_ring ring)

Free the ring.

参数
ringRing to free.
函数调用图:
这是这个函数的调用关系图:

◆ rte_align32pow2()

static uint32_t rte_align32pow2 ( uint32_t  x)
inlinestatic
这是这个函数的调用关系图:

◆ rte_ring_count()

static unsigned rte_ring_count ( const struct rte_ring r)
inlinestatic

Return the number of entries in a ring.

参数
rA pointer to the ring structure.
返回
The number of entries in the ring.
这是这个函数的调用关系图:

◆ rte_ring_create()

struct rte_ring* rte_ring_create ( const char *  name,
unsigned  count,
unsigned  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. Water marking is disabled by default. The real usable ring size is count-1 instead of count to differentiate a free ring from an empty ring.

The ring is added in RTE_TAILQ_RING list.

参数
nameThe name of the ring.
countThe size of the ring (must be a power of 2).
socket_idThe 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.
flagsAn OR of the following:
返回
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 to rte_config structure
  • E_RTE_SECONDARY - function was called from a secondary process instance
  • 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
函数调用图:
这是这个函数的调用关系图:

◆ rte_ring_dequeue()

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

参数
rA pointer to the ring structure.
obj_pA pointer to a void * pointer (object) that will be filled.
返回
  • 0: Success, objects dequeued.
  • -ENOENT: Not enough entries in the ring to dequeue, no object is dequeued.
函数调用图:

◆ rte_ring_dequeue_bulk()

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

参数
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects) that will be filled.
nThe number of objects to dequeue from the ring to the obj_table.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
返回
The number of objects dequeued, either 0 or n
函数调用图:
这是这个函数的调用关系图:

◆ rte_ring_dequeue_burst()

static __rte_always_inline unsigned rte_ring_dequeue_burst ( struct rte_ring r,
void **  obj_table,
unsigned int  n,
unsigned int *  available 
)
static

Dequeue multiple objects from a ring up to a maximum number.

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

参数
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects) that will be filled.
nThe number of objects to dequeue from the ring to the obj_table.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
返回
  • Number of objects dequeued
函数调用图:
这是这个函数的调用关系图:

◆ rte_ring_dump()

void rte_ring_dump ( FILE *  f,
const struct rte_ring r 
)

Dump the status of the ring to a file.

参数
fA pointer to a file for output
rA pointer to the ring structure.
函数调用图:

◆ rte_ring_empty()

static int rte_ring_empty ( const struct rte_ring r)
inlinestatic

Test if a ring is empty.

参数
rA pointer to the ring structure.
返回
  • 1: The ring is empty.
  • 0: The ring is not empty.
函数调用图:
这是这个函数的调用关系图:

◆ rte_ring_enqueue()

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

参数
rA pointer to the ring structure.
objA pointer to the object to be added.
返回
  • 0: Success; objects enqueued.
  • -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
函数调用图:

◆ rte_ring_enqueue_bulk()

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

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

参数
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects).
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
返回
The number of objects enqueued, either 0 or n
函数调用图:
这是这个函数的调用关系图:

◆ rte_ring_enqueue_burst()

static __rte_always_inline unsigned rte_ring_enqueue_burst ( 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).

参数
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects).
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
返回
  • n: Actual number of objects enqueued.
函数调用图:

◆ rte_ring_free()

void rte_ring_free ( struct rte_ring r)

De-allocate all memory used by the ring.

参数
rRing to free
这是这个函数的调用关系图:

◆ rte_ring_free_count()

static unsigned rte_ring_free_count ( const struct rte_ring r)
inlinestatic

Return the number of free entries in a ring.

参数
rA pointer to the ring structure.
返回
The number of free entries in the ring.
函数调用图:
这是这个函数的调用关系图:

◆ rte_ring_full()

static int rte_ring_full ( const struct rte_ring r)
inlinestatic

Test if a ring is full.

参数
rA pointer to the ring structure.
返回
  • 1: The ring is full.
  • 0: The ring is not full.
函数调用图:

◆ rte_ring_get_capacity()

static unsigned int rte_ring_get_capacity ( const struct rte_ring r)
inlinestatic

Return the number of elements which can be stored in the ring.

参数
rA pointer to the ring structure.
返回
The usable size of the ring.

◆ rte_ring_get_memsize()

ssize_t rte_ring_get_memsize ( unsigned  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.

参数
countThe number of elements in the ring (must be a power of 2).
返回
  • The memory size needed for the ring on success.
  • -EINVAL if count is not a power of 2.
这是这个函数的调用关系图:

◆ rte_ring_get_size()

static unsigned int rte_ring_get_size ( const struct rte_ring r)
inlinestatic

Return the size of the ring.

参数
rA pointer to the ring structure.
返回
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().

◆ rte_ring_init()

int rte_ring_init ( struct rte_ring r,
const char *  name,
unsigned  count,
unsigned  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. Water marking is disabled by default. The real usable ring size is count-1 instead of count to differentiate a free ring from an empty ring.

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.

参数
rThe pointer to the ring structure followed by the objects table.
nameThe name of the ring.
countThe number of elements in the ring (must be a power of 2).
flagsAn OR of the following:
返回
0 on success, or a negative value on error.
函数调用图:
这是这个函数的调用关系图:

◆ rte_ring_list_dump()

void rte_ring_list_dump ( FILE *  f)

Dump the status of all rings on the console

参数
fA pointer to a file for output

◆ rte_ring_lookup()

struct rte_ring* rte_ring_lookup ( const char *  name)

Search a ring from its name

参数
nameThe name of the ring.
返回
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.

◆ rte_ring_mc_dequeue()

static __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.

参数
rA pointer to the ring structure.
obj_pA pointer to a void * pointer (object) that will be filled.
返回
  • 0: Success; objects dequeued.
  • -ENOENT: Not enough entries in the ring to dequeue; no object is dequeued.
函数调用图:

◆ rte_ring_mc_dequeue_bulk()

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

Dequeue several objects from a ring (multi-consumers safe).

This function uses a "compare and set" instruction to move the consumer index atomically.

参数
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects) that will be filled.
nThe number of objects to dequeue from the ring to the obj_table.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
返回
The number of objects dequeued, either 0 or n
函数调用图:
这是这个函数的调用关系图:

◆ rte_ring_mc_dequeue_burst()

static __rte_always_inline unsigned rte_ring_mc_dequeue_burst ( struct rte_ring r,
void **  obj_table,
unsigned int  n,
unsigned int *  available 
)
static

Dequeue several objects from a ring (multi-consumers safe). When the request objects are more than the available objects, only dequeue the actual number of objects

This function uses a "compare and set" instruction to move the consumer index atomically.

参数
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects) that will be filled.
nThe number of objects to dequeue from the ring to the obj_table.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
返回
  • n: Actual number of objects dequeued, 0 if ring is empty
函数调用图:

◆ rte_ring_mp_enqueue()

static __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.

参数
rA pointer to the ring structure.
objA pointer to the object to be added.
返回
  • 0: Success; objects enqueued.
  • -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
函数调用图:

◆ rte_ring_mp_enqueue_bulk()

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

Enqueue several objects on the ring (multi-producers safe).

This function uses a "compare and set" instruction to move the producer index atomically.

参数
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects).
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
返回
The number of objects enqueued, either 0 or n
函数调用图:
这是这个函数的调用关系图:

◆ rte_ring_mp_enqueue_burst()

static __rte_always_inline unsigned rte_ring_mp_enqueue_burst ( 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 function uses a "compare and set" instruction to move the producer index atomically.

参数
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects).
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
返回
  • n: Actual number of objects enqueued.
函数调用图:

◆ rte_ring_sc_dequeue()

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

参数
rA pointer to the ring structure.
obj_pA pointer to a void * pointer (object) that will be filled.
返回
  • 0: Success; objects dequeued.
  • -ENOENT: Not enough entries in the ring to dequeue, no object is dequeued.
函数调用图:

◆ rte_ring_sc_dequeue_bulk()

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

Dequeue several objects from a ring (NOT multi-consumers safe).

参数
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects) that will be filled.
nThe number of objects to dequeue from the ring to the obj_table, must be strictly positive.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
返回
The number of objects dequeued, either 0 or n
函数调用图:
这是这个函数的调用关系图:

◆ rte_ring_sc_dequeue_burst()

static __rte_always_inline unsigned rte_ring_sc_dequeue_burst ( struct rte_ring r,
void **  obj_table,
unsigned int  n,
unsigned int *  available 
)
static

Dequeue several objects from a ring (NOT multi-consumers safe).When the request objects are more than the available objects, only dequeue the actual number of objects

参数
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects) that will be filled.
nThe number of objects to dequeue from the ring to the obj_table.
availableIf non-NULL, returns the number of remaining ring entries after the dequeue has finished.
返回
  • n: Actual number of objects dequeued, 0 if ring is empty
函数调用图:

◆ rte_ring_sp_enqueue()

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

参数
rA pointer to the ring structure.
objA pointer to the object to be added.
返回
  • 0: Success; objects enqueued.
  • -ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
函数调用图:

◆ rte_ring_sp_enqueue_bulk()

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

Enqueue several objects on a ring (NOT multi-producers safe).

参数
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects).
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
返回
The number of objects enqueued, either 0 or n
函数调用图:
这是这个函数的调用关系图:

◆ rte_ring_sp_enqueue_burst()

static __rte_always_inline unsigned rte_ring_sp_enqueue_burst ( 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).

参数
rA pointer to the ring structure.
obj_tableA pointer to a table of void * pointers (objects).
nThe number of objects to add in the ring from the obj_table.
free_spaceif non-NULL, returns the amount of space in the ring after the enqueue operation has finished.
返回
  • n: Actual number of objects enqueued.
函数调用图:

◆ update_tail()

static __rte_always_inline void update_tail ( struct rte_ring_headtail ht,
uint32_t  old_val,
uint32_t  new_val,
uint32_t  single 
)
static
这是这个函数的调用关系图: