On Thu, Sep 18, 2025 at 10:50:11AM +0200, Morten Brørup wrote: > Dear NIC driver maintainers (CC: DPDK Tech Board), > > The DPDK Tech Board has discussed that patch [1] (included in DPDK 25.07) > extended the documented requirements to the RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE > offload. > These changes put additional limitations on applications' use of the > MBUF_FAST_FREE TX offload, and made MBUF_FAST_FREE mutually exclusive with > MULTI_SEGS (which is typically used for jumbo frame support). > The Tech Board discussed that these changes do not reflect the intention of > the MBUF_FAST_FREE TX offload, and wants to fix it. > Mainly, MBUF_FAST_FREE and MULTI_SEGS should not be mutually exclusive. > > The original RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE requirements were: > When set, application must guarantee that > 1) per-queue all mbufs come from the same mempool, and > 2) mbufs have refcnt = 1. > > The patch added the following requirements to the MBUF_FAST_FREE offload, > reflecting rte_pktmbuf_prefree_seg() postconditions: > 3) mbufs are direct, > 4) mbufs have next = NULL and nb_segs = 1. > > Now, the key question is: > Can we roll back to the original two requirements? > Or do the drivers also depend on the third and/or fourth requirements? > > <advertisement> > Drivers freeing mbufs directly to a mempool should use the new > rte_mbuf_raw_free_bulk() instead of rte_mempool_put_bulk(), so the > preconditions for freeing mbufs directly into a mempool are validated in mbuf > debug mode (with RTE_LIBRTE_MBUF_DEBUG enabled). > Similarly, rte_mbuf_raw_alloc_bulk() should be used instead of > rte_mempool_get_bulk(). > </advertisement> > > PS: The feature documentation [2] still reflects the original requirements. > > [1]: > https://github.com/DPDK/dpdk/commit/55624173bacb2becaa67793b71391884876673c1 > [2]: > https://elixir.bootlin.com/dpdk/v25.07/source/doc/guides/nics/features.rst#L125 > > > Venlig hilsen / Kind regards, > -Morten Brørup > I'm a little torn on this question, because I can see benefits for both approaches. Firstly, it would be nice if we made FAST_FREE as accessible for driver use as it was originally, with minimal requirements. However, on looking at the code, I believe that many drivers actually took it to mean that scattered packets couldn't occur in that case either, so the use was incorrect. Similarly, and secondly, if we do have the extra requirements for FAST_FREE, it does mean that any use of it can be very, very minimal and efficient, since we don't need to check anything before freeing the buffers.
Given where we are now, I think keeping the more restrictive definition of FAST_FREE is the way to go - keeping it exclusive with MULTI_SEGS - because it means that we are less likely to have bugs. If we look to change it back, I think we'd have to check all drivers to ensure they are using the flag safely. /Bruce

