[dpdk-users] manually construct mbuf

Stephen Hemminger stephen at networkplumber.org
Thu Mar 16 17:09:23 CET 2017

On Thu, 16 Mar 2017 03:41:14 +0000
"Wiles, Keith" <keith.wiles at intel.com> wrote:

> > On Mar 16, 2017, at 11:28 AM, Mike Shang <mshang5 at gmail.com> wrote:
> > 
> > Is it possible to construct mbuf manually instead getting one from
> > mempool ? I've got a situation that needs to handle a relatively small
> > number of jumbo frames, we keep a mempool of objects of regular size and
> > wanted to construct mbuf ourselves for jumbo frames as one segment using
> > rte_malloc. I have searched the dpdk source code a bit but can't find such
> > use case. Is it doable with dpdk ? Or it's recommended to keep a separate
> > mempool for objects of larger size ?  
> You could try to construct your own mbuf, but when the system attempts to free the mbuf you would need to build a lot more then just the mbuf as the mempool pointer is hiding in the data/mbuf and it expects to point to a valid mempool.
> What I would do is just allocate a couple jumbo mbuf in a new mempool allocation and use those mbufs when you want to send jumbo frames. Trying to create a special mbuf is not going to super simple, just create a new mempool with N number of mbufs.

Or teach your code how to use chained multi-segment mbuf's. That is the right way to handle larger data
without having to pin down large chunks of memory.

More information about the users mailing list