[PATCH v3 3/5] ethdev: mark mbufs in burst functions
Morten Brørup
mb at smartsharesystems.com
Thu Oct 2 09:44:43 CEST 2025
> From: Thomas Monjalon [mailto:thomas at monjalon.net]
> Sent: Wednesday, 1 October 2025 01.25
>
> From: Shani Peretz <shperetz at nvidia.com>
>
> Mark the Rx/Tx steps in mbufs for debugging.
> It has no performance impact if mbuf history is disabled (by default).
>
> Signed-off-by: Shani Peretz <shperetz at nvidia.com>
> ---
> lib/ethdev/rte_ethdev.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index d23c143eed..8a9683c5e9 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -6336,6 +6336,8 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t
> queue_id,
>
> nb_rx = p->rx_pkt_burst(qd, rx_pkts, nb_pkts);
>
> + rte_mbuf_history_mark_bulk(rx_pkts, nb_rx,
> RTE_MBUF_HISTORY_OP_RX);
> +
> #ifdef RTE_ETHDEV_RXTX_CALLBACKS
> {
> void *cb;
> @@ -6688,8 +6690,19 @@ rte_eth_tx_burst(uint16_t port_id, uint16_t
> queue_id,
> }
> #endif
>
> +#if RTE_MBUF_HISTORY_DEBUG
> + uint16_t requested_pkts = nb_pkts;
> + rte_mbuf_history_mark_bulk(tx_pkts, nb_pkts,
> RTE_MBUF_HISTORY_OP_TX);
> +#endif
I think the compiler is clever enough to optimize away this if rte_mbuf_history_mark_bulk() does nothing. So you can omit the "#if RTE_MBUF_HISTORY_DEBUG". Also below.
> +
> nb_pkts = p->tx_pkt_burst(qd, tx_pkts, nb_pkts);
>
> +#if RTE_MBUF_HISTORY_DEBUG
> + if (requested_pkts > nb_pkts)
> + rte_mbuf_history_mark_bulk(tx_pkts + nb_pkts,
> + requested_pkts - nb_pkts,
> RTE_MBUF_HISTORY_OP_BUSY_TX);
> +#endif
> +
> rte_ethdev_trace_tx_burst(port_id, queue_id, (void **)tx_pkts,
> nb_pkts);
> return nb_pkts;
> }
> @@ -6785,6 +6798,8 @@ rte_eth_tx_prepare(uint16_t port_id, uint16_t
> queue_id,
> }
> #endif
>
> + rte_mbuf_history_mark_bulk(tx_pkts, nb_pkts,
> RTE_MBUF_HISTORY_OP_PREP_TX);
> +
> return p->tx_pkt_prepare(qd, tx_pkts, nb_pkts);
> }
>
> --
> 2.51.0
More information about the dev
mailing list