From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: "Nicolson Ken (ニコルソン ケン)" <ken.nicolson@jp.panasonic.com>
Cc: "users@dpdk.org" <users@dpdk.org>
Subject: Re: mbuf data is 1400 bytes but the most common (?) use, Ethernet II frames, allow for 1518 bytes
Date: Wed, 4 Oct 2023 10:19:39 +0300 [thread overview]
Message-ID: <20231004101939.3d65dfca@sovereign> (raw)
In-Reply-To: <TYAPR01MB63783D1668F3140BB5D2674DBCCBA@TYAPR01MB6378.jpnprd01.prod.outlook.com>
Hi Ken,
2023-10-04 06:52 (UTC+0000), Nicolson Ken (ニコルソン ケン):
> Looking at sending Ethernet packets over a DPDK connection, I see that an
> Ethernet Type II frame has 1518 max, but mbuf's data block is 1400 bytes.
rte_mbuf has no fixed-length "data block", so there is no limitation of 1400.
Buffer size is usually configured when creating a packet mempool.
Typically (rte_mbuf_core.h):
/**
* Some NICs need at least 2KB buffer to RX standard Ethernet frame without
* splitting it into multiple segments.
* So, for mbufs that planned to be involved into RX/TX, the recommended
* minimal buffer length is 2KB + RTE_PKTMBUF_HEADROOM.
*/
#define RTE_MBUF_DEFAULT_DATAROOM 2048
#define RTE_MBUF_DEFAULT_BUF_SIZE \
(RTE_MBUF_DEFAULT_DATAROOM + RTE_PKTMBUF_HEADROOM)
> Is this what the headroom and tailroom are for?
It is for prepending headers/trailers without copying the packet into a new
buffer, that is, it is used to change the packet efficiently.
Sometimes some headers still need to be moved, but not the entire frame.
Documentation shows how headroom, dataroom, tailroom, and buffer are related:
https://doc.dpdk.org/guides/prog_guide/mbuf_lib.html
> I see example code that uses the headroom for the MAC Header, but what is
> the preferred way of copying a 1518 Ethernet packet into an mbuf? Should I
> use rte_pktmbuf_append() to reserve the extra bytes, or is there a better
> way?
Is the question still relevant given the explanations above?
next prev parent reply other threads:[~2023-10-04 7:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 6:52 Nicolson Ken (ニコルソン ケン)
2023-10-04 7:19 ` Dmitry Kozlyuk [this message]
2023-10-05 2:28 ` Nicolson Ken (ニコルソン ケン)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231004101939.3d65dfca@sovereign \
--to=dmitry.kozliuk@gmail.com \
--cc=ken.nicolson@jp.panasonic.com \
--cc=users@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).