[PATCH v14 1/7] eal: add static per-lcore memory allocation facility
Mattias Rönnblom
hofors at lysator.liu.se
Thu Oct 17 07:38:00 CEST 2024
On 2024-10-16 16:53, Stephen Hemminger wrote:
> On Wed, 16 Oct 2024 15:19:10 +0200
> Mattias Rönnblom <mattias.ronnblom at ericsson.com> wrote:
>
>> +
>> +/**
>> + * 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
>> + * @ref RTE_LCORE_VAR or @ref 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.
>> + *
>> + * @param size
>> + * The size (in bytes) of the variable's per-lcore id value. Must be > 0.
>> + * @param 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 @c RTE_CACHE_LINE_SIZE.
>> + * @return
>> + * The variable's handle, stored in a void pointer value. The value
>> + * is always non-NULL.
>> + */
>> +__rte_experimental
>> +void *
>> +rte_lcore_var_alloc(size_t size, size_t align)
>> + __rte_alloc_size(2);
>
> This is not right, the index is which arg holds the size etc.
> should be:
> __rte_alloc_size(1) __rte_alloc_align(2) __rte_malloc;
Oops. Will fix in v15. Thanks.
More information about the dev
mailing list