> From: Konstantin Ananyev [mailto:konstantin.anan...@huawei.com]
> Sent: Friday, 4 July 2025 18.20
> 
> > For TX mbuf fast release offload, I propose to add the mbuf mempool
> > pointer to the ethdev tx queue configuration structure,
> > so the ethdev TX burst operation doesn't need to fetch it from the
> > first mbuf of each burst being fast free'd to the mempool.
> >
> > This modification of the struct rte_eth_txconf, and the requirement
> > to set the mempool pointer if the RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE
> > flag is set, will be an API+ABI change in 25.11.
> > Should it be announced in the 25.07 release notes?
> >
> > Note: We could phase it in softly by letting the ethdev drivers
> > check if the pointer has been set, and fall back to fetching it
> > from mbuf[0] if not.
> >
> > /**
> >  * A structure used to configure a Tx ring of an Ethernet port.
> >  */
> > struct rte_eth_txconf {
> >     struct rte_eth_thresh tx_thresh; /**< Tx ring threshold registers.
> */
> >     uint16_t tx_rs_thresh; /**< Drives the setting of RS bit on TXDs.
> */
> >     uint16_t tx_free_thresh; /**< Start freeing Tx buffers if there
> are
> >                                   less free descriptors than this value. */
> >
> >     uint8_t tx_deferred_start; /**< Do not start queue with
> rte_eth_dev_start(). */
> >     /**
> >      * Per-queue Tx offloads to be set  using RTE_ETH_TX_OFFLOAD_*
> flags.
> >      * Only offloads set on tx_queue_offload_capa or tx_offload_capa
> >      * fields on rte_eth_dev_info structure are allowed to be set.
> >      */
> >     uint64_t offloads;
> >
> > +   /**
> > +    * Per-queue mempool to release the mbufs to; required for
> > +    * RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload.
> > +    */
> > +   struct rte_mempool *mp;
> > +
> 
> Even though I usually recommend to use MBUF_FAST_FREE -
> that's probably a good change.

Correction in your other mail noted: "[...] NOT to use MBUF_FAST_FREE"

> At least people will realize that they have to provide a single mempool
> per TX queue when they enable FAST_FREE flag.
> One naming suggestion I have - can we name it somehow more informative:
> 'fast_free_mp' or so?

I was planning to put information about the field in the comments only, but 
yes, we can name it "fast_free_mp".

> Also, we can update tx_queue_setup() to catch the situation when
> FAST_FREE
> is set but mp is NULL, or visa-versa.

Yes, that was the plan.
(Although I didn't think about the "vice-versa" case, which is also a good 
thing to catch.)

> Again drivers can probably add extra check when debug is enabled, that
> all mbufs are exactly from that mempool.

I recently added the rte_mbuf_raw_free_bulk() function to the mbuf API, to 
emphasize the requirements that drivers must comply to when fast-freeing mbufs. 
And for verification purposes, when conformance testing drivers' fast-free 
implementation.
Drivers should use this mbuf API instead of directly interacting with the 
mempool API when bulk freeing mbufs.

> 
> 
> >     uint64_t reserved_64s[2]; /**< Reserved for future fields */
> >     void *reserved_ptrs[2];   /**< Reserved for future fields */
> > };
> >

Reply via email to