DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: <thomas@monjalon.net>, <bruce.richardson@intel.com>,
	<stephen@networkplumber.org>, <andrew.rybchenko@oktetlabs.ru>
Cc: <dev@dpdk.org>
Subject: RFC: Drop support for undersize packet mbufs
Date: Mon, 18 Aug 2025 10:11:46 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9FE42@smartserver.smartshare.dk> (raw)

Why does the mbuf library support packet mbufs with smaller data room size than RTE_PKTMBUF_HEADROOM (e.g. [1]), when the Ethdev drivers (e.g. [2]) don't support it?

This goes all the way back to the first public release [3].

It seems crazy exotic, and should be removed for simplicity and a potential performance benefit.
What am I missing here?

Instead, the rte_pktmbuf_pool_create() functions should check that data_room_size >= RTE_PKTMBUF_HEADROOM.


[1]: https://elixir.bootlin.com/dpdk/v25.07/source/lib/mbuf/rte_mbuf.h#L941
static inline void rte_pktmbuf_reset_headroom(struct rte_mbuf *m)
{
	m->data_off = (uint16_t)RTE_MIN((uint16_t)RTE_PKTMBUF_HEADROOM,
					(uint16_t)m->buf_len);
}

[2]: https://elixir.bootlin.com/dpdk/v25.07/source/drivers/net/intel/i40e/i40e_rxtx.c#L609
mb->data_off = RTE_PKTMBUF_HEADROOM;

[3]: https://git.dpdk.org/dpdk/commit/lib/librte_mbuf?id=af75078fece3615088e561357c1e97603e43a5fe
+static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
+{
+	uint32_t buf_ofs;
+
+	m->pkt.next = NULL;
+	m->pkt.pkt_len = 0;
+	m->pkt.l2_len = 0;
+	m->pkt.l3_len = 0;
+	m->pkt.vlan_tci = 0;
+	m->pkt.nb_segs = 1;
+	m->pkt.in_port = 0xff;
+
+	m->ol_flags = 0;
+	buf_ofs = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?
+			RTE_PKTMBUF_HEADROOM : m->buf_len;
+	m->pkt.data = (char*) m->buf_addr + buf_ofs;
+
+	m->pkt.data_len = 0;
+	__rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 1);
+}



Med venlig hilsen / Kind regards,
-Morten Brørup


             reply	other threads:[~2025-08-18  8:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-18  8:11 Morten Brørup [this message]
2025-08-18 10:58 ` fengchengwen

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=98CBD80474FA8B44BF855DF32C47DC35E9FE42@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /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).