Hi Stephen,
Le jeu. 5 mars 2026 à 18:57, Stephen Hemminger
<[email protected]> a écrit :
>
> On Thu, 5 Mar 2026 17:55:39 +0100
> David Marchand <[email protected]> wrote:
>
> > > Please fix the free bulk bug on Transmit and revise
> >
> > As I replied in other thread, I see no bug on usage of free bulk (not
> > the raw helper).
>
> There is no requirement that all packets in one tx burst come from the
> same mempool. And free_bulk assumes that all packets in the array
> can go back to the mempool of the first element.
rte_pktmbuf_free_bulk() handles mbufs from different mempools
correctly. It was specifically designed for this, see 0f824df6f8c5
("mbuf: add bulk free function").
It uses an internal helper __rte_pktmbuf_free_seg_via_array() that
batches consecutive mbufs from the same pool, and flushes via
rte_mempool_put_bulk() when the pool changes:
if (*nb_pending == pending_sz ||
(*nb_pending > 0 && m->pool != pending[0]->pool)) {
rte_mempool_put_bulk(pending[0]->pool,
(void **)pending, *nb_pending);
*nb_pending = 0;
}
pending[(*nb_pending)++] = m;
It also walks m->next for multi-segment packets.
Perhaps you are thinking of rte_mbuf_raw_free_bulk(), which does
assume a single mempool and is only safe to use when
RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE is set.
See for example i40e_tx_free_bufs() which guards
rte_mbuf_raw_free_bulk() behind a MBUF_FAST_FREE check.
Regards,
Maxime