[PATCH v11 2/6] mempool: add functions to get extra mempool info

Morten Brørup mb at smartsharesystems.com
Fri May 24 14:20:14 CEST 2024


> From: Paul Szczepanek [mailto:paul.szczepanek at arm.com]
> Sent: Friday, 24 May 2024 10.37
> 
> +size_t rte_mempool_get_obj_alignment(struct rte_mempool *mp)
> +{
> +	if (mp == NULL)
> +		return 0;
> +
> +	if (mp->flags & RTE_MEMPOOL_F_NO_CACHE_ALIGN)
> +		return sizeof(uint64_t);
> +	else
> +		return RTE_MEMPOOL_ALIGN;
> +}

The object alignment depends on the underlying mempool driver. You cannot assume that it is either sizeof(uint64_t) or cache line aligned.

Refer to the calc_mem_size driver operation, which also provides object alignment information:
https://elixir.bootlin.com/dpdk/v24.03/source/lib/mempool/rte_mempool.h#L529

If you need this function, you need to add a new driver operation, and your function above can be the default for this operation, like for the the calc_mem_size driver operation:
https://elixir.bootlin.com/dpdk/v24.03/source/lib/mempool/rte_mempool_ops.c#L120



More information about the dev mailing list