[dpdk-users] mempool metadata stored in private data section

Filip Janiszewski contact at filipjaniszewski.com
Wed Aug 15 11:45:49 CEST 2018


Hi,

I'm using rte_mempool_create_empty (followed by
rte_mempool_populate_default) to create a pool of buffers that have to
be used by the application, along with the buffers I need to have a
small set of meta information, so that when the user request an objects
(rte_mempool_get) it gets back the buffer + the meta data.

>From the documentation it seems that I could use the "private_data_size"
field while creating the pool, but the description is not very clear to
me: "The size of the private data appended after the mempool structure.
This is useful for storing some private data after the mempool
structure, as is done for rte_mbuf_pool for example."

Are those private data stored after each mempool object? It's legal then
do something like this: ((char*)buf_ptr + elt_size) to access the
private section of the buffer? (Assuming buf_ptr is the pointer returned
by rte_mempool_get, void*.).

>From the code in rte_mempool.c I see that:

.
 /*<
 * reserve a memory zone for this mempool: private data is<
 * cache-aligned<
 */<
 data_size = (private_data_size +<
 MEMPOOL_ALIGN_MASK) & (~RTE_MEMPOOL_ALIGN_MASK);
.

so it looks like that chunk of private data is just a big common buffer
allocated along with the whole mempool, the objects within the pool do
not have any private data by themselves.

How can I add some private data to each object of the mempool? (I know
the simpler solution would be to increase elt_size to cover the
requirement of the meta data I want to add, but what's the purpose of
private_data then??)

Thanks

-- 
BR, Filip
+48 666 369 823


More information about the users mailing list