mbuf memory layout

fwefew 4t4tg 7532yahoo at gmail.com
Tue Feb 1 19:16:13 CET 2022


I create a mempool thusly with 0 bytes private size and 1024 bytes data
room size:

rte_mempool *pool = rte_pktmbuf_pool_create("test", 1024, 0, 0, 1024, 0);

from which I allocate 1 mbuf.

which of the following three memory layouts best describes mbufs I allocate
from this
pool? I can't tell if it's the 2nd or 3rd one. I believe the first one is
wrong:


 mbuf - RTE_PKTMBUF_HEADROOM not in data room
 +--------------------------------+
 |+------------------------------+|
 ||struct rte_mbuf               ||
 |+------------------------------+|
 ||RTE_PKTMBUF_HEADROOM bytes    ||
 |+------------------------------+| Data room starts here which will hold
 ||1024 bytes of data room size  || L2/3/4 headers and actual payload. A
 |+------------------------------+| pointer to the start of this field is
 |               .                | given by rte_pktmbuf(mbuf, ...)
 |               .                |
 |               .                |
 +--------------------------------+


 mbuf - RTE_PKTMBUF_HEADROOM adds to data room size:
 +--------------------------------+
 |+------------------------------+|
 ||struct rte_mbuf               ||
 |+------------------------------+|Data room starts here which will hold
 ||1024 bytes + RTE_PKTMBUF_HEAD\||L2/3/4 headers and actual payload. A
 ||ROOM bytes                    ||pointer to the start of this field is
 ||                              ||given by rte_pktmbuf(mbuf, ...)
 ||                              ||
 |+------------------------------+|
 |               .                |
 |               .                |
 |               .                |
 +--------------------------------+

 mbuf - RTE_PKTMBUF_HEADROOM included in data room size
 +--------------------------------+
 |+------------------------------+|
 ||struct rte_mbuf               ||
 |+------------------------------+|Data room starts here which will hold
 ||1024 bytes of data room size  ||L2/3/4 headers and actual payload. Since
 ||                              ||data room size was >= RTE_PKTMBUF_HEADROOM
 ||                              ||size the data room size of 1024 was valid
 |+------------------------------+|and that's all that is reserved for the
 |                                |data room
 |                                |
 |                                |
 |                                |
 +--------------------------------+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/users/attachments/20220201/956db8bb/attachment.htm>


More information about the users mailing list