static__rte_always_inlineunsignedintrte_stack_push(structrte_stack*s,void*const*obj_table,unsignedintn)[static]
Push several objects on the stack (MT-safe).
Parameterss 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.
Returns
Actual number of objects pushed (either 0 or n).
Definition at line 111 of file rte_stack.h.
static__rte_always_inlineunsignedintrte_stack_pop(structrte_stack*s,void**obj_table,unsignedintn)[static]
Pop several objects from the stack (MT-safe).
Parameterss 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.
Returns
Actual number of objects popped (either 0 or n).
Definition at line 135 of file rte_stack.h.
static__rte_always_inlineunsignedintrte_stack_count(structrte_stack*s)[static]
Return the number of used entries in a stack.
Parameterss A pointer to the stack structure.
Returns
The number of used entries in the stack.
Definition at line 155 of file rte_stack.h.
static__rte_always_inlineunsignedintrte_stack_free_count(structrte_stack*s)[static]
Return the number of free entries in a stack.
Parameterss A pointer to the stack structure.
Returns
The number of free entries in the stack.
Definition at line 174 of file rte_stack.h.
structrte_stack*rte_stack_create(constchar*name,unsignedintcount,intsocket_id,uint32_tflags)
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.
Parametersname 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:
• RTE_STACK_F_LF: If this flag is set, the stack uses lock-free variants of the push and pop
functions. Otherwise, it achieves thread-safety using a lock.
Returns
On success, the pointer to the new allocated stack. NULL on error with rte_errno set appropriately.
Possible errno values include:
• ENOSPC - the maximum number of memzones has already been allocated
• EEXIST - a stack with the same name already exists
• ENOMEM - insufficient memory to create the stack
• ENAMETOOLONG - name size exceeds RTE_STACK_NAMESIZE
• ENOTSUP - platform does not support given flags combination.
voidrte_stack_free(structrte_stack*s)
Free all memory used by the stack.
Parameterss Pointer to stack created with rte_stack_create(). If s is NULL, no operation is performed.
structrte_stack*rte_stack_lookup(constchar*name)
Lookup a stack by its name.
Parametersname The name of the stack.
Returns
The pointer to the stack matching the name, or NULL if not found, with rte_errno set appropriately.
Possible rte_errno values include:
• ENOENT - Stack with name name not found.
• EINVAL - name pointer is NULL.