* RFC: Drop support for undersize packet mbufs
@ 2025-08-18 8:11 Morten Brørup
2025-08-18 10:58 ` fengchengwen
0 siblings, 1 reply; 2+ messages in thread
From: Morten Brørup @ 2025-08-18 8:11 UTC (permalink / raw)
To: thomas, bruce.richardson, stephen, andrew.rybchenko; +Cc: dev
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: RFC: Drop support for undersize packet mbufs
2025-08-18 8:11 RFC: Drop support for undersize packet mbufs Morten Brørup
@ 2025-08-18 10:58 ` fengchengwen
0 siblings, 0 replies; 2+ messages in thread
From: fengchengwen @ 2025-08-18 10:58 UTC (permalink / raw)
To: Morten Brørup, thomas, bruce.richardson, stephen, andrew.rybchenko
Cc: dev
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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-18 10:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-18 8:11 RFC: Drop support for undersize packet mbufs Morten Brørup
2025-08-18 10:58 ` fengchengwen
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).