DPDK usage discussions
 help / color / mirror / Atom feed
* mbuf memory layout
@ 2022-02-01 18:16 fwefew 4t4tg
  2022-02-01 18:19 ` Fwd: " fwefew 4t4tg
  0 siblings, 1 reply; 2+ messages in thread
From: fwefew 4t4tg @ 2022-02-01 18:16 UTC (permalink / raw)
  To: users

[-- Attachment #1: Type: text/plain, Size: 2379 bytes --]

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
 |                                |
 |                                |
 |                                |
 +--------------------------------+

[-- Attachment #2: Type: text/html, Size: 4155 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Fwd: mbuf memory layout
  2022-02-01 18:16 mbuf memory layout fwefew 4t4tg
@ 2022-02-01 18:19 ` fwefew 4t4tg
  0 siblings, 0 replies; 2+ messages in thread
From: fwefew 4t4tg @ 2022-02-01 18:19 UTC (permalink / raw)
  To: users

[-- Attachment #1: Type: text/plain, Size: 2716 bytes --]

Darn it - typo: the pointer to the start of the data room in a mbuf was
incorrectly described earlier.
I should have written: rte_pktmbuf_mtod(mbuf, ....); // provide a pointer
to the start of the data room.



From: fwefew 4t4tg <7532yahoo@gmail.com>
Date: Tue, Feb 1, 2022 at 1:16 PM
Subject: mbuf memory layout
To: <users@dpdk.org>


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
 |                                |
 |                                |
 |                                |
 +--------------------------------+

[-- Attachment #2: Type: text/html, Size: 4751 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-01 18:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 18:16 mbuf memory layout fwefew 4t4tg
2022-02-01 18:19 ` Fwd: " fwefew 4t4tg

DPDK usage discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/users/0 users/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 users users/ http://inbox.dpdk.org/users \
		users@dpdk.org
	public-inbox-index users

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.users


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git