dynamic and variable mbuf size
Dmitry Kozlyuk
dmitry.kozliuk at gmail.com
Fri Mar 15 10:38:24 CET 2024
2024-03-15 08:47 (UTC+0100), Jakob Wieckowski:
> Hello DPDK Users,
>
> I have a question regarding the size of mbufs.
> The mbuf are contained in the mempol and the mempool is a fixed size object.
>
> Could the mbuf be implemented dynamically with a variable size in the
> mempool area ?
>
> In the header of the mbuf you could specify the size of the payload data
> and thus could expand the size of the mbufs.
>
> From my understanding, you just have to keep an eye on the mempool memory
> size so that it doesn't go beyond the limit of the allocated area.
>
> Would this be generally possible?
Hi,
If mbufs could be allocated of any size,
mempool would be a general-purpose allocator,
but there is a tradeoff between generality and performance,
and rte_mempool pursuits the latter.
The size of an mbuf data may only be adjusted,
but only up to the size specified at mempool creation.
There are solutions for some use cases:
- using multiple mempools for objects of different size
- some NICs can split packets allocating segments from different mempools
- mbufs can be chained
- rte_pktmbuf_attach_extbuf() + custom allocator
- "memarea" proposed library [1] (looks very similar to what you describe)
What is you usage scenario?
[1]: http://inbox.dpdk.org/dev/20230720092254.54157-1-fengchengwen@huawei.com/
More information about the users
mailing list