rte_stack.h(3)
π rte_stack.h π
okay so bestie, welcome to rte_stack.h(3) β it's in the Library Functions Manual section and it is lowkey the whole reason your pointer stack is about to be iconic. buckle up π
β¨ NAME β¨
rte_stack.h β that's the girl. that's the file. π«Ά
π SYNOPSIS π
first you gotta pull in the whole friend group:
#include <stdalign.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'
π Macros
#define RTE_STACK_NAMESIZE
#define RTE_STACK_F_LF 0x0001
π¦ Functions
struct __rte_aligned (16) rte_stack_lf_head
static __rte_always_inline unsigned int rte_stack_push (struct rte_stack
*s, void *const *obj_table, unsigned int n)
static __rte_always_inline unsigned int rte_stack_pop (struct rte_stack
*s, void **obj_table, unsigned int n)
static __rte_always_inline unsigned int rte_stack_count (struct
rte_stack *s)
static __rte_always_inline unsigned int rte_stack_free_count (struct
rte_stack *s)
struct rte_stack * rte_stack_create (const char *name, unsigned int
count, int socket_id, uint32_t flags)
void rte_stack_free (struct rte_stack *s)
struct rte_stack * rte_stack_lookup (const char *name)
π DETAILED DESCRIPTION π
RTE Stack.
librte_stack hands you an API for configuring and using a bounded stack of pointers. Push and pop are MT-safe, so concurrent access is literally the whole point, and the interface supports pushing and popping multiple pointers at a time. main character energy fr fr π
Definition in file rte_stack.h.
π§ MACRO DEFINITION DOCUMENTATION π§
π #define RTE_STACK_NAMESIZE
Value:
(RTE_MEMZONE_NAMESIZE - \
sizeof(RTE_STACK_MZ_PREFIX) + 1)
the maximum length of a stack name. periodt. β¨
Definition at line 28 of file rte_stack.h.
π #define RTE_STACK_F_LF 0x0001
the stack uses lock-free push and pop functions. heads up bestie β this flag is only supported on x86_64 or arm64 platforms, currently. π«£
Definition at line 89 of file rte_stack.h.
πΈ FUNCTION DOCUMENTATION πΈ
π struct __rte_aligned (16 )
<Stack top<Modification counter for avoiding ABA problem
ngl the ABA problem is the villain here and this counter is the girlboss that stops it π
Definition at line 1 of file rte_stack.h.
π __rte_always_inline unsigned int rte_stack_push (struct rte_stack * s, void *const * obj_table, unsigned int n) [static]
Push several objects on the stack (MT-safe).
Parameters
sβ A pointer to the stack structure.obj_tableβ A pointer to a table ofvoid *pointers (objects).nβ The number of objects to push on the stack from theobj_table.
Returns
Actual number of objects pushed (either 0 or n).
Definition at line 111 of file rte_stack.h.
π __rte_always_inline unsigned int rte_stack_pop (struct rte_stack * s, void ** obj_table, unsigned int n) [static]
Pop several objects from the stack (MT-safe).
Parameters
sβ A pointer to the stack structure.obj_tableβ A pointer to a table ofvoid *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.
π __rte_always_inline unsigned int rte_stack_count (struct rte_stack * s) [static]
Return the number of used entries in a stack.
Parameters
sβ A pointer to the stack structure.
Returns
The number of used entries in the stack.
Definition at line 155 of file rte_stack.h.
π __rte_always_inline unsigned int rte_stack_free_count (struct rte_stack * s) [static]
Return the number of free entries in a stack.
Parameters
sβ A pointer to the stack structure.
Returns
The number of free entries in the stack.
Definition at line 174 of file rte_stack.h.
π struct rte_stack * rte_stack_create (const char * name, unsigned int count, int socket_id, uint32_t flags)
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. π¦
Parameters
nameβ The name of the stack.countβ The size of the stack.socket_idβ Thesocket_idargument is the socket identifier in case of NUMA. The value can beSOCKET_ID_ANYif 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 allocatedEEXIST- a stack with the same name already existsENOMEM- insufficient memory to create the stackENAMETOOLONG- name size exceedsRTE_STACK_NAMESIZEENOTSUP- platform does not support given flags combination.
π void rte_stack_free (struct rte_stack * s)
Free all memory used by the stack.
Parameters
sβ Pointer to stack created withrte_stack_create(). IfsisNULL, no operation is performed.
π struct rte_stack * rte_stack_lookup (const char * name)
Lookup a stack by its name.
Parameters
nameβ 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 namenamenot found.EINVAL-namepointer isNULL.
β AUTHOR β
Generated automatically by Doxygen for DPDK from the source code.
okay and that's the whole page, bestie, you ate π
β¨ this was DPDK Version 25.11.3, rte_stack.h(3), go forth and push and pop responsibly ππ¦π§π
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms