From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9B71DA034E for ; Tue, 1 Feb 2022 19:16:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3753740698; Tue, 1 Feb 2022 19:16:26 +0100 (CET) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mails.dpdk.org (Postfix) with ESMTP id 6A48740691 for ; Tue, 1 Feb 2022 19:16:25 +0100 (CET) Received: by mail-wr1-f41.google.com with SMTP id u15so33688841wrt.3 for ; Tue, 01 Feb 2022 10:16:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=tzQWG9VcgGmC8vufjg/M7Uy6gr3WAZdRTPoKz1TmLi8=; b=GNXZhf8JiFhqMFCxb47vLzc07O5fR6jPePjOWHhj60wJMZsBYj8/06H8v0B61vadDx lRUpHaku8c4jQ31i7rt5oaWvQGICL1Yn5gaMV+Nlbz91piVZTJEcRuoOIyqvrPAoxrft Tr4eIyNpKM1roRuhG2SEql/AQ6UO+2xLqQcnTNISZB3KWzOgnleRRDU6F8qwfrcnOWqH C7R6huwnoj2xt2PyGQyKgaEQOGyGsYtw7p5n2o8yTI1yUoHRjMZuN92FwzK90udIvD1M K7F2LXgEPFrm8aaKhI9ZxLDmFtYSpwDC0EmxqWMODW9i0iSvy4ITm/5Q80uZrzVc+UHI nhKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=tzQWG9VcgGmC8vufjg/M7Uy6gr3WAZdRTPoKz1TmLi8=; b=M6S6AaQCnhjdBRcDZnoib8ATxLWkjGh5ire9j7BDWw5soo2PFij8ai5HfwVJs1TMvk lBqeSu0u6x+4naKg1JouefgNVIJZJj9wW+OSUastfXlIeQpyTvkxM3IpFg1i7OvUtC2i fzo3RDwESVHOt3okn/GeulnZJsLyLzGGL29eJ734ujc81I6RtncBWQSRE30p0DIA97ya rfXd82QtJqoeuqUrLJrPf2vdMkbFd6OAyxPly6/pNDCJ+BMhYUTsYyh/f4b1qr2CLSai kTwQCIVRuqrBNndFgmobqLbtxXabYVj+HJzuQ9y1Y247ej8GmS1dxikAv2jxLN/Ugxdp tbnw== X-Gm-Message-State: AOAM533Imaj2mJ4MjLymi/AG1X265asHhOEkYQs9tB3nG9oShPVK0M7v c8EGk3NCx6JevAuiAP0MCKBzrIYavZ69ZkwWj5Xzj61yTVY= X-Google-Smtp-Source: ABdhPJy+ULRog4ALSN00El+ZXSVK9WlTlRqpKaFUPtkYbuzIvZ1NxjOKHbOLbTZLzQiuIxIpieMz/hFAWvks78jrqoM= X-Received: by 2002:adf:f8c6:: with SMTP id f6mr22554201wrq.290.1643739384735; Tue, 01 Feb 2022 10:16:24 -0800 (PST) MIME-Version: 1.0 From: fwefew 4t4tg <7532yahoo@gmail.com> Date: Tue, 1 Feb 2022 13:16:13 -0500 Message-ID: Subject: mbuf memory layout To: users@dpdk.org Content-Type: multipart/alternative; boundary="000000000000216acb05d6f8e62f" X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org --000000000000216acb05d6f8e62f Content-Type: text/plain; charset="UTF-8" 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 | | | | | | +--------------------------------+ --000000000000216acb05d6f8e62f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I create a mempool thusly with=C2=A00 bytes private size a= nd 1024 bytes data room size:

rte_mempool *pool =3D=C2=A0rte_pktmbuf= _pool_create("test", 1024, 0, 0, 1024, 0);

from which I al= locate 1 mbuf.

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

            =
                                                                =20
 mbuf - RTE_PKTMBUF_HEADROOM not in data room                              =
 =20
 +--------------------------------+                                        =
 =20
 |+------------------------------+|                                        =
 =20
 ||struct rte_mbuf               ||                                        =
 =20
 |+------------------------------+|                                        =
 =20
 ||RTE_PKTMBUF_HEADROOM bytes    ||                                        =
 =20
 |+------------------------------+| Data room starts here which will hold  =
 =20
 ||1024 bytes of data room size  || L2/3/4 headers and actual payload. A   =
 =20
 |+------------------------------+| pointer to the start of this field is  =
 =20
 |               .                | given by rte_pktmbuf(mbuf, ...)        =
 =20
 |               .                |                                        =
 =20
 |               .                |                                        =
 =20
 +--------------------------------+                                        =
 =20
                                                                           =
 =20
                                                                           =
 =20
 mbuf - RTE_PKTMBUF_HEADROOM adds to data room size:                       =
 =20
 +--------------------------------+                                        =
 =20
 |+------------------------------+|                                        =
 =20
 ||struct rte_mbuf               ||                                        =
 =20
 |+------------------------------+|Data room starts here which will hold   =
 =20
 ||1024 bytes + RTE_PKTMBUF_HEAD\||L2/3/4 headers and actual payload. A    =
 =20
 ||ROOM bytes                    ||pointer to the start of this field is   =
 =20
 ||                              ||given by rte_pktmbuf(mbuf, ...)         =
 =20
 ||                              ||                                        =
 =20
 |+------------------------------+|                                        =
 =20
 |               .                |                                        =
 =20
 |               .                |                                        =
 =20
 |               .                |                                        =
 =20
 +--------------------------------+                                        =
 =20
                                                                           =
 =20
 mbuf - RTE_PKTMBUF_HEADROOM included in data room size                    =
 =20
 +--------------------------------+                                        =
 =20
 |+------------------------------+|                                        =
 =20
 ||struct rte_mbuf               ||                                        =
 =20
 |+------------------------------+|Data room starts here which will hold   =
 =20
 ||1024 bytes of data room size  ||L2/3/4 headers and actual payload. Since=
 =20
 ||                              ||data room size was >=3D RTE_PKTMBUF_H=
EADROOM
 ||                              ||size the data room size of 1024 was vali=
d=20
 |+------------------------------+|and that's all that is reserved for =
the  =20
 |                                |data room                               =
 =20
 |                                |                                        =
 =20
 |                                |                                        =
 =20
 |                                |                                        =
 =20
 +--------------------------------+                                        =
  


--000000000000216acb05d6f8e62f--