> From: Stephen Hemminger [mailto:step...@networkplumber.org]
> Sent: Thursday, 26 June 2025 16.06
> 
> On Tue, 24 Jun 2025 18:14:16 +0000
> Morten Brørup <m...@smartsharesystems.com> wrote:
> 
> > Added fast mbuf release, re-using the existing mbuf pool pointer
> > in the queue structure.
> >
> > Signed-off-by: Morten Brørup <m...@smartsharesystems.com>
> 
> Makes sense.
> 
> > ---
> >  drivers/net/null/rte_eth_null.c | 30 +++++++++++++++++++++++++++---
> >  1 file changed, 27 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/null/rte_eth_null.c
> b/drivers/net/null/rte_eth_null.c
> > index 8a9b74a03b..12c0d8d1ff 100644
> > --- a/drivers/net/null/rte_eth_null.c
> > +++ b/drivers/net/null/rte_eth_null.c
> > @@ -34,6 +34,17 @@ struct pmd_internals;
> >  struct null_queue {
> >     struct pmd_internals *internals;
> >
> > +   /**
> > +    * For RX queue:
> > +    *  Mempool to allocate mbufs from.
> > +    *
> > +    * For TX queue:
> > +    *  Mempool to free mbufs to, if fast release of mbufs is enabled.
> > +    *  UINTPTR_MAX if the mempool for fast release of mbufs has not
> yet been detected.
> > +    *  NULL if fast release of mbufs is not enabled.
> > +    *
> > +    *  @see RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE
> > +    */
> >     struct rte_mempool *mb_pool;
> 
> Do all drivers to it this way?

No, I think most drivers have separate structures for rx and tx queues. This 
driver doesn't so I'm reusing the existing mempool pointer.
Also, they don't cache the mempool pointer, but look at mbuf[0].pool at every 
burst; so their tx queue structure doesn't have a mempool pointer field.
And they check an offload flag (either the bit in the raw offload field, or a 
shadow variable for the relevant offload flag), instead of checking the mempool 
pointer.

Other drivers can be improved, and I have submitted an optimization patch for 
the i40e driver with some of the things I do in this patch:
https://inbox.dpdk.org/dev/20250624061238.89259-1...@smartsharesystems.com/

> Is it documented in ethdev?

The RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE flag is documented.
How to implement it in the drivers is not.

-Morten

Reply via email to