|
DPDK
1.6.0r2
|
#include <stdint.h>#include <sys/queue.h>#include <errno.h>#include <rte_common.h>#include <rte_memory.h>#include <rte_lcore.h>#include <rte_atomic.h>#include <rte_branch_prediction.h>Data Structures | |
| struct | rte_ring |
| struct | rte_ring::prod |
| struct | rte_ring::cons |
Macros | |
| #define | RTE_RING_NAMESIZE 32 |
| #define | RING_F_SP_ENQ 0x0001 |
| #define | RING_F_SC_DEQ 0x0002 |
| #define | RTE_RING_QUOT_EXCEED (1 << 31) |
| #define | RTE_RING_SZ_MASK (unsigned)(0x0fffffff) |
Functions | |
| struct rte_ring * | rte_ring_create (const char *name, unsigned count, int socket_id, unsigned flags) |
| int | rte_ring_set_water_mark (struct rte_ring *r, unsigned count) |
| void | rte_ring_dump (const struct rte_ring *r) |
| static int | rte_ring_mp_enqueue_bulk (struct rte_ring *r, void *const *obj_table, unsigned n) |
| static int | rte_ring_sp_enqueue_bulk (struct rte_ring *r, void *const *obj_table, unsigned n) |
| static int | rte_ring_enqueue_bulk (struct rte_ring *r, void *const *obj_table, unsigned n) |
| static int | rte_ring_mp_enqueue (struct rte_ring *r, void *obj) |
| static int | rte_ring_sp_enqueue (struct rte_ring *r, void *obj) |
| static int | rte_ring_enqueue (struct rte_ring *r, void *obj) |
| static int | rte_ring_mc_dequeue_bulk (struct rte_ring *r, void **obj_table, unsigned n) |
| static int | rte_ring_sc_dequeue_bulk (struct rte_ring *r, void **obj_table, unsigned n) |
| static int | rte_ring_dequeue_bulk (struct rte_ring *r, void **obj_table, unsigned n) |
| static int | rte_ring_mc_dequeue (struct rte_ring *r, void **obj_p) |
| static int | rte_ring_sc_dequeue (struct rte_ring *r, void **obj_p) |
| static int | rte_ring_dequeue (struct rte_ring *r, void **obj_p) |
| static int | rte_ring_full (const struct rte_ring *r) |
| static int | rte_ring_empty (const struct rte_ring *r) |
| static unsigned | rte_ring_count (const struct rte_ring *r) |
| static unsigned | rte_ring_free_count (const struct rte_ring *r) |
| void | rte_ring_list_dump (void) |
| struct rte_ring * | rte_ring_lookup (const char *name) |
| static int | rte_ring_mp_enqueue_burst (struct rte_ring *r, void *const *obj_table, unsigned n) |
| static int | rte_ring_sp_enqueue_burst (struct rte_ring *r, void *const *obj_table, unsigned n) |
| static int | rte_ring_enqueue_burst (struct rte_ring *r, void *const *obj_table, unsigned n) |
| static int | rte_ring_mc_dequeue_burst (struct rte_ring *r, void **obj_table, unsigned n) |
| static int | rte_ring_sc_dequeue_burst (struct rte_ring *r, void **obj_table, unsigned n) |
| static int | rte_ring_dequeue_burst (struct rte_ring *r, void **obj_table, unsigned n) |
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:
Note: the ring implementation is not preemptable. A lcore must not be interrupted by another task that uses the same ring.
| #define RING_F_SC_DEQ 0x0002 |
The default dequeue is "single-consumer".
| #define RING_F_SP_ENQ 0x0001 |
The default enqueue is "single-producer".
| #define RTE_RING_NAMESIZE 32 |
The maximum length of a ring name.
| #define RTE_RING_QUOT_EXCEED (1 << 31) |
Quota exceed for burst ops
| #define RTE_RING_SZ_MASK (unsigned)(0x0fffffff) |
Ring size mask
|
inlinestatic |
Return the number of entries in a ring.
| r | A pointer to the ring structure. |
|
read |
Create a new ring named name in memory.
This function uses memzone_reserve() to allocate memory. Its size is set to count, which must be a power of two. Water marking is disabled by default. Note that the real usable ring size is count-1 instead of count.
| name | The name of the ring. |
| count | The size of the ring (must be a power of 2). |
| 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:
|
|
inlinestatic |
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).
| r | A pointer to the ring structure. |
| obj_p | A pointer to a void * pointer (object) that will be filled. |
|
inlinestatic |
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).
| 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. |
|
inlinestatic |
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).
| 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. |
| void rte_ring_dump | ( | const struct rte_ring * | r | ) |
Dump the status of the ring to the console.
| r | A pointer to the ring structure. |
|
inlinestatic |
Test if a ring is empty.
| r | A pointer to the ring structure. |
|
inlinestatic |
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).
| r | A pointer to the ring structure. |
| obj | A pointer to the object to be added. |
|
inlinestatic |
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).
| 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. |
|
inlinestatic |
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).
| 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. |
|
inlinestatic |
Return the number of free entries in a ring.
| r | A pointer to the ring structure. |
|
inlinestatic |
Test if a ring is full.
| r | A pointer to the ring structure. |
| void rte_ring_list_dump | ( | void | ) |
Dump the status of all rings on the console
|
read |
Search a ring from its name
| name | The name of the ring. |
|
inlinestatic |
Dequeue one object from a ring (multi-consumers safe).
This function uses a "compare and set" instruction to move the consumer index atomically.
| r | A pointer to the ring structure. |
| obj_p | A pointer to a void * pointer (object) that will be filled. |
|
inlinestatic |
Dequeue several objects from a ring (multi-consumers safe).
This function uses a "compare and set" instruction to move the consumer index atomically.
| 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. |
|
inlinestatic |
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.
| 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. |
|
inlinestatic |
Enqueue one object on a ring (multi-producers safe).
This function uses a "compare and set" instruction to move the producer index atomically.
| r | A pointer to the ring structure. |
| obj | A pointer to the object to be added. |
|
inlinestatic |
Enqueue several objects on the ring (multi-producers safe).
This function uses a "compare and set" instruction to move the producer index atomically.
| 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. |
|
inlinestatic |
Enqueue several objects on the ring (multi-producers safe).
This function uses a "compare and set" instruction to move the producer index atomically.
| 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. |
|
inlinestatic |
Dequeue one object from a ring (NOT multi-consumers safe).
| r | A pointer to the ring structure. |
| obj_p | A pointer to a void * pointer (object) that will be filled. |
|
inlinestatic |
Dequeue several objects from a ring (NOT multi-consumers safe).
| 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. |
|
inlinestatic |
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
| 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. |
| int rte_ring_set_water_mark | ( | struct rte_ring * | r, |
| unsigned | count | ||
| ) |
Change the high water mark.
If count is 0, water marking is disabled. Otherwise, it is set to the count value. The count value must be greater than 0 and less than the ring size.
This function can be called at any time (not necessarily at initialization).
| r | A pointer to the ring structure. |
| count | The new water mark value. |
|
inlinestatic |
Enqueue one object on a ring (NOT multi-producers safe).
| r | A pointer to the ring structure. |
| obj | A pointer to the object to be added. |
|
inlinestatic |
Enqueue several objects on a ring (NOT multi-producers safe).
| 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. |
|
inlinestatic |
Enqueue several objects on a ring (NOT multi-producers safe).
| 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. |
1.8.1.2