DPDK patches and discussions
 help / color / mirror / Atom feed
From: fengchengwen <fengchengwen@huawei.com>
To: "Morten Brørup" <mb@smartsharesystems.com>,
	thomas@monjalon.net, bruce.richardson@intel.com,
	stephen@networkplumber.org, andrew.rybchenko@oktetlabs.ru
Cc: <dev@dpdk.org>
Subject: Re: RFC: Drop support for undersize packet mbufs
Date: Mon, 18 Aug 2025 18:58:26 +0800	[thread overview]
Message-ID: <d4859ac6-2119-40b5-9e3b-ae88d56dc690@huawei.com> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9FE42@smartserver.smartshare.dk>

On 8/18/2025 4:11 PM, Morten Brørup wrote:
> 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?

Maybe the pktmbuf which extbuf, which the data-room-size is zero when create pktmbuf.
After detach from extbuf, the data_off should be zero instead of RTE_PKTMBUF_HEADROOM.

> 
> 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 10:58 UTC|newest]

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

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=d4859ac6-2119-40b5-9e3b-ae88d56dc690@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.com \
    --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).