DPDK
19.05.0
|
#include <rte_atomic.h>
#include <rte_compat.h>
#include <rte_debug.h>
#include <rte_errno.h>
#include <rte_memzone.h>
#include <rte_spinlock.h>
#include "rte_stack_std.h"
#include "rte_stack_lf.h"
Go to the source code of this file.
Macros | |
#define | RTE_STACK_NAMESIZE |
#define | RTE_STACK_F_LF 0x0001 |
Functions | |
static __rte_always_inline unsigned int __rte_experimental | rte_stack_push (struct rte_stack *s, void *const *obj_table, unsigned int n) |
static __rte_always_inline unsigned int __rte_experimental | rte_stack_pop (struct rte_stack *s, void **obj_table, unsigned int n) |
static __rte_always_inline unsigned int __rte_experimental | rte_stack_count (struct rte_stack *s) |
static __rte_always_inline unsigned int __rte_experimental | rte_stack_free_count (struct rte_stack *s) |
struct rte_stack *__rte_experimental | rte_stack_create (const char *name, unsigned int count, int socket_id, uint32_t flags) |
void __rte_experimental | rte_stack_free (struct rte_stack *s) |
struct rte_stack *__rte_experimental | rte_stack_lookup (const char *name) |
EXPERIMENTAL: this API may change without prior notice
RTE Stack
librte_stack provides an API for configuration and use of a bounded stack of pointers. Push and pop operations are MT-safe, allowing concurrent access, and the interface supports pushing and popping multiple pointers at a time.
Definition in file rte_stack.h.
#define RTE_STACK_NAMESIZE |
The maximum length of a stack name.
Definition at line 33 of file rte_stack.h.
#define RTE_STACK_F_LF 0x0001 |
The stack uses lock-free push and pop functions. This flag is only supported on x86_64 platforms, currently.
Definition at line 95 of file rte_stack.h.
|
static |
Push several objects on the stack (MT-safe).
s | A pointer to the stack structure. |
obj_table | A pointer to a table of void * pointers (objects). |
n | The number of objects to push on the stack from the obj_table. |
Definition at line 116 of file rte_stack.h.
|
static |
Pop several objects from the stack (MT-safe).
s | A pointer to the stack structure. |
obj_table | A pointer to a table of void * pointers (objects). |
n | The number of objects to pull from the stack. |
Definition at line 143 of file rte_stack.h.
|
static |
Return the number of used entries in a stack.
s | A pointer to the stack structure. |
Definition at line 166 of file rte_stack.h.
|
static |
Return the number of free entries in a stack.
s | A pointer to the stack structure. |
Definition at line 188 of file rte_stack.h.
|
read |
Create a new stack named name in memory.
This function uses memzone_reserve()
to allocate memory for a stack of size count. The behavior of the stack is controlled by the flags.
name | The name of the stack. |
count | The size of the stack. |
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:
|
void __rte_experimental rte_stack_free | ( | struct rte_stack * | s | ) |
Free all memory used by the stack.
s | Stack to free |
|
read |
Lookup a stack by its name.
name | The name of the stack. |