Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
rte_lcore_var.h(3)		     DPDK		    rte_lcore_var.h(3)

NAME
       rte_lcore_var.h

SYNOPSIS
       #include	<stddef.h>
       #include	<stdalign.h>
       #include	<rte_common.h>
       #include	<rte_config.h>
       #include	<rte_debug.h>
       #include	<rte_lcore.h>

   Macros
       #define RTE_LCORE_VAR_HANDLE_TYPE(type)	    type *
       #define RTE_LCORE_VAR_HANDLE(type,  name)
	    RTE_LCORE_VAR_HANDLE_TYPE(type) name
       #define RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(handle,  size,  align)	handle
	   = rte_lcore_var_alloc(size, align)
       #define RTE_LCORE_VAR_ALLOC_SIZE(handle,	 size)
		RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(handle, size, 0)
       #define RTE_LCORE_VAR_ALLOC(handle)
       #define RTE_LCORE_VAR_INIT_SIZE_ALIGN(name,  size,  align)
       #define RTE_LCORE_VAR_INIT_SIZE(name,  size)
	      RTE_LCORE_VAR_INIT_SIZE_ALIGN(name, size,	0)
       #define RTE_LCORE_VAR_INIT(name)
       #define RTE_LCORE_VAR_LCORE(lcore_id,  handle)
	    ((typeof(handle))rte_lcore_var_lcore(lcore_id, handle))
       #define RTE_LCORE_VAR(handle)	  RTE_LCORE_VAR_LCORE(rte_lcore_id(),
	   handle)
       #define RTE_LCORE_VAR_FOREACH(lcore_id,	value,	handle)

   Functions
       static void * rte_lcore_var_lcore (unsigned int lcore_id, void *handle)
       __rte_experimental void * rte_lcore_var_alloc (size_t size, size_t
	   align) __rte_alloc_size(1) __rte_alloc_align(2)

Detailed Description
       Lcore variables

       This API	provides a mechanism to	create and access per-lcore id
       variables in a space- and cycle-efficient manner.

       Please refer to the lcore variables' programmer's guide for an overview
       of this API and its implementation.

       EXPERIMENTAL: this API may change, or be	removed, without prior notice.

       Definition in file rte_lcore_var.h.

Macro Definition Documentation
   #define RTE_LCORE_VAR_HANDLE_TYPE(type)	type *
       Given the lcore variable	type, produces the type	of the lcore variable
       handle.

       Definition at line 37 of	file rte_lcore_var.h.

   #define RTE_LCORE_VAR_HANDLE(type, name)
	 RTE_LCORE_VAR_HANDLE_TYPE(type) name
       Define an lcore variable	handle.

       This macro defines a variable which is used as a	handle to access the
       various instances of a per-lcore	id variable.

       This macro clarifies that the declaration is an lcore handle, not a
       regular pointer.

       Add static as a prefix in case the lcore	variable is only to be
       accessed	from a particular translation unit.

       Definition at line 52 of	file rte_lcore_var.h.

   #define RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(handle, size,	align)	    handle =
       rte_lcore_var_alloc(size, align)
       Allocate	space for an lcore variable, and initialize its	handle.

       The values of the lcore variable	are initialized	to zero.

       Definition at line 60 of	file rte_lcore_var.h.

   #define RTE_LCORE_VAR_ALLOC_SIZE(handle, size)
	RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(handle, size, 0)
       Allocate	space for an lcore variable, and initialize its	handle,	with
       values aligned for any type of object.

       The values of the lcore variable	are initialized	to zero.

       Definition at line 69 of	file rte_lcore_var.h.

   #define RTE_LCORE_VAR_ALLOC(handle)
       Value:.PP
	   RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(handle, sizeof(*(handle)),   \
			      alignof(typeof(*(handle))))
       Allocate	space for an lcore variable of the size	and alignment
       requirements suggested by the handle pointer type, and initialize its
       handle.

       The values of the lcore variable	are initialized	to zero.

       Definition at line 78 of	file rte_lcore_var.h.

   #define RTE_LCORE_VAR_INIT_SIZE_ALIGN(name, size, align)
       Value:.PP
	   RTE_INIT(rte_lcore_var_init_	## name)	       \
	   {				   \
	       RTE_LCORE_VAR_ALLOC_SIZE_ALIGN(name, size, align);  \
	   }
       Allocate	an explicitly-sized, explicitly-aligned	lcore variable by
       means of	a RTE_INIT constructor.

       The values of the lcore variable	are initialized	to zero.

       Definition at line 88 of	file rte_lcore_var.h.

   #define RTE_LCORE_VAR_INIT_SIZE(name, size)
	   RTE_LCORE_VAR_INIT_SIZE_ALIGN(name, size, 0)
       Allocate	an explicitly-sized lcore variable by means of a RTE_INIT
       constructor.

       The values of the lcore variable	are initialized	to zero.

       Definition at line 100 of file rte_lcore_var.h.

   #define RTE_LCORE_VAR_INIT(name)
       Value:.PP
	   RTE_INIT(rte_lcore_var_init_	## name)	       \
	   {				   \
	       RTE_LCORE_VAR_ALLOC(name);	       \
	   }
       Allocate	an lcore variable by means of a	RTE_INIT constructor.

       The values of the lcore variable	are initialized	to zero.

       Definition at line 108 of file rte_lcore_var.h.

   #define RTE_LCORE_VAR_LCORE(lcore_id, handle)
	 ((typeof(handle))rte_lcore_var_lcore(lcore_id,	handle))
       Get pointer to lcore variable instance with the specified lcore id.

       Parameters
	   lcore_id The	lcore id specifying which of the RTE_MAX_LCORE value
	   instances should be accessed. The lcore id need not be valid	(e.g.,
	   may be LCORE_ID_ANY), but in	such a case, the pointer is also not
	   valid (and thus should not be dereferenced).
	   handle The lcore variable handle.

       Definition at line 145 of file rte_lcore_var.h.

   #define RTE_LCORE_VAR(handle)      RTE_LCORE_VAR_LCORE(rte_lcore_id(),
       handle)
       Get pointer to lcore variable instance of the current thread.

       May only	be used	by EAL threads and registered non-EAL threads.

       Definition at line 153 of file rte_lcore_var.h.

   #define RTE_LCORE_VAR_FOREACH(lcore_id, value, handle)
       Value:.PP
	   for ((lcore_id) =			   \
		    (((value) =	RTE_LCORE_VAR_LCORE(0, handle)), 0); \
		(lcore_id) < RTE_MAX_LCORE;		   \
		(lcore_id)++, (value) =	RTE_LCORE_VAR_LCORE(lcore_id, \
					  handle))
       Iterate over each lcore id's value for an lcore variable.

       Parameters
	   lcore_id An unsigned	int variable successively set to the lcore id
	   of every valid lcore	id (up to RTE_MAX_LCORE).
	   value A pointer variable successively set to	point to lcore
	   variable value instance of the current lcore	id being processed.
	   handle The lcore variable handle.

       Definition at line 168 of file rte_lcore_var.h.

Function Documentation
   static void * rte_lcore_var_lcore (unsigned int lcore_id, void * handle)
       [inline],  [static]
       Get void	pointer	to lcore variable instance with	the specified lcore
       id.

       Parameters
	   lcore_id The	lcore id specifying which of the RTE_MAX_LCORE value
	   instances should be accessed. The lcore id need not be valid	(e.g.,
	   may be LCORE_ID_ANY), but in	such a case, the pointer is also not
	   valid (and thus should not be dereferenced).
	   handle The lcore variable handle.

       Definition at line 127 of file rte_lcore_var.h.

   __rte_experimental void * rte_lcore_var_alloc (size_t size, size_t align)
       Allocate	space in the per-lcore id buffers for an lcore variable.

       The pointer returned is only an opaque identifier of the	variable. To
       get an actual pointer to	a particular instance of the variable, use
       RTE_LCORE_VAR or	RTE_LCORE_VAR_LCORE.

       The lcore variable values' memory is set	to zero.

       The allocation is always	successful, barring a fatal exhaustion of the
       per-lcore id buffer space.

       rte_lcore_var_alloc() is	not multi-thread safe.

       The allocated memory cannot be freed.

       Parameters
	   size	The size (in bytes) of the variable's per-lcore	id value. Must
	   be >	0.
	   align If 0, the values will be suitably aligned for any kind	of
	   type	(i.e., alignof(max_align_t)). Otherwise, the values will be
	   aligned on a	multiple of align, which must be a power of 2 and
	   equal or less than RTE_CACHE_LINE_SIZE.

       Returns
	   The variable's handle, stored in a void pointer value. The value is
	   always non-NULL.

Author
       Generated automatically by Doxygen for DPDK from	the source code.

Version	25.11.0			Thu Jun	11 2026		    rte_lcore_var.h(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=RTE_LCORE_VAR_ALLOC&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help