ethdev: TX mbuf fast release optimization
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;
+
uint64_t reserved_64s[2]; /**< Reserved for future fields */ void *reserved_ptrs[2]; /**< Reserved for future fields */ };
Quoted 31 lines · Morten Brørup
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 theRTE_ETH_TX_OFFLOAD_MBUF_FAST_FREEflag 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.
*/
structrte_eth_txconf{
structrte_eth_threshtx_thresh; /**< Tx ring threshold registers. */uint16_ttx_rs_thresh; /**< Drives the setting of RS bit on TXDs. */uint16_ttx_free_thresh; /**< Start freeing Tx buffers if there are
less free descriptors than this value. */
uint8_ttx_deferred_start; /**< Do not start queue withrte_eth_dev_start(). */ /**
* Per-queue Tx offloads to be set using RTE_ETH_TX_OFFLOAD_* flags.
* Only offloads set ontx_queue_offload_capaortx_offload_capa
* fields onrte_eth_dev_infostructure are allowed to be set.
*/
uint64_toffloads;
Review
Quoted 6 lines
(quoted diff) +6
-0+ /** + * Per-queue mempool to release the mbufs to; required for + * RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload. + */ + struct rte_mempool *mp; +
Is this really best put in the txconf struct? Would it not be better just stored in the queue structure on free or Tx of the first packet? That would make it not change the ABI.
/Bruce
Quoted 40 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 3 July 2025 16.14Quoted 14 lines · Morten Brørup
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 theRTE_ETH_TX_OFFLOAD_MBUF_FAST_FREEflag 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.
Quoted 5 lines
/**
* A structure used to configure a Tx ring of an Ethernet port. */
structrte_eth_txconf{
structrte_eth_threshtx_thresh; /**< Tx ring threshold registers.*/
Quoted 1 line
uint16_ttx_rs_thresh; /**< Drives the setting of RS bit on TXDs.*/
Quoted 1 line
uint16_ttx_free_thresh; /**< Start freeing Tx buffers if thereare
Quoted 3 lines
less free descriptors than this value. */
uint8_ttx_deferred_start; /**< Do not start queue with
rte_eth_dev_start(). */Quoted 2 lines
/** * Per-queue Tx offloads to be set using RTE_ETH_TX_OFFLOAD_*flags.
Quoted 5 lines
* 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;
Quoted 12 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ /** + * Per-queue mempool to release the mbufs to; required for + * RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload. + */ + struct rte_mempool *mp; +Is this really best put in the txconf struct? Would it not be better just
stored in the queue structure on free or Tx of the first packet? That would
make it not change the ABI.
It seems natural to me to specify the mempool at configuration time, because it is a configuration parameter.
The txconf struct seemed like the best place to put it.
Fetching it from the first mbuf of each burst at runtime, and possibly caching it, seems like a workaround for the missing configuration parameter.
If backwards ABI compatibility is important, we can modify the struct as follows:
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;
+ #ifdef RTE_ARCH_32
+ uint32_t reserved_32s[1]; /**< Reserved for future fields */
+ #endif
- uint64_t reserved_64s[2]; /**< Reserved for future fields */
+ uint64_t reserved_64s[1]; /**< Reserved for future fields */
void *reserved_ptrs[2]; /**< Reserved for future fields */
};
Quoted 53 lines · Morten Brørup
Quoted 40 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 3 July 2025 16.14Quoted 14 lines · Morten Brørup
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 theRTE_ETH_TX_OFFLOAD_MBUF_FAST_FREEflag 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.
Quoted 5 lines
/**
* A structure used to configure a Tx ring of an Ethernet port. */
structrte_eth_txconf{
structrte_eth_threshtx_thresh; /**< Tx ring threshold registers.*/
Quoted 1 line
uint16_ttx_rs_thresh; /**< Drives the setting of RS bit on TXDs.*/
Quoted 1 line
uint16_ttx_free_thresh; /**< Start freeing Tx buffers if thereare
Quoted 3 lines
less free descriptors than this value. */
uint8_ttx_deferred_start; /**< Do not start queue with
rte_eth_dev_start(). */Quoted 2 lines
/** * Per-queue Tx offloads to be set using RTE_ETH_TX_OFFLOAD_*flags.
Quoted 5 lines
* 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;Quoted 12 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ /** + * Per-queue mempool to release the mbufs to; required for + * RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload. + */ + struct rte_mempool *mp; +Is this really best put in the txconf struct? Would it not be better just
stored in the queue structure on free or Tx of the first packet? That would
make it not change the ABI.
Quoted 6 lines
It seems natural to me to specify the mempool at configuration time, because it is a configuration parameter.
The txconf struct seemed like the best place to put it.Fetching it from the first mbuf of each burst at runtime, and possibly caching it, seems like a workaround for the missing configuration parameter.
Not suggesting from each burst, just the first mbuf seen. One time only.
/Bruce
Quoted 72 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 3 July 2025 17.21Quoted 5 lines · Morten Brørup
Quoted 5 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 3 July 2025 16.14Quoted 1 line · Morten Brørup
For TX mbuf fast release offload, I propose to add the mbuf
mempool
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
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 therequirement
Quoted 1 line
Quoted 1 line
Quoted 1 line
to set the mempool pointer if the
RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREEQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
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.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
/**
* A structure used to configure a Tx ring of an Ethernet port. */
structrte_eth_txconf{
structrte_eth_threshtx_thresh; /**< Tx ring thresholdregisters.
Quoted 2 lines
Quoted 2 lines
*/
Quoted 1 line
uint16_ttx_rs_thresh; /**< Drives the setting of RS bit onTXDs.
Quoted 2 lines
Quoted 2 lines
*/
Quoted 1 line
uint16_ttx_free_thresh; /**< Start freeing Tx buffers ifthere
Quoted 2 lines
Quoted 2 lines
are
Quoted 1 line
less free descriptors than this
value. */
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
uint8_ttx_deferred_start; /**< Do not start queue with
rte_eth_dev_start(). */Quoted 2 lines
/** * Per-queue Tx offloads to be set usingRTE_ETH_TX_OFFLOAD_*
Quoted 2 lines
Quoted 2 lines
flags.
Quoted 1 line
* Only offloads set on
tx_queue_offload_capaor
tx_offload_capaQuoted 1 line
Quoted 1 line
Quoted 1 line
* fields on
rte_eth_dev_infostructure are allowed to beset.
Quoted 13 lines
Quoted 13 lines
Review
Quoted 9 lines
*/ uint64_t offloads;(quoted diff) +6
-0+ /** + * Per-queue mempool to release the mbufs to; required for + * RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload. + */ + struct rte_mempool *mp; +Is this really best put in the txconf struct? Would it not be better just
stored in the queue structure on free or Tx of the first packet?That
Quoted 7 lines
Quoted 2 lines
would
make it not change the ABI.It seems natural to me to specify the mempool at configuration time, because it is a configuration parameter.
The txconf struct seemed like the best place to put it.
Quoted 5 lines
Quoted 1 line
Fetching it from the first mbuf of each burst at runtime, and possibly
caching it, seems like a workaround for the missing configuration parameter.
Quoted 1 line
Not suggesting from each burst, just the first mbuf seen. One time only.
That's what I meant by "possibly caching it". :-)
The check for the one-time cache update still takes up code space in the per-burst fast path. (Although very little.)
But I still prefer providing configuration information at configuration time, rather than snooping it at runtime.
Quoted 2 lines
/Bruce
Quoted 76 lines · Morten Brørup
Quoted 76 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 3 July 2025 17.21Quoted 5 lines · Morten Brørup
Quoted 5 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 3 July 2025 16.14Quoted 1 line · Morten Brørup
For TX mbuf fast release offload, I propose to add the mbuf
mempool
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
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 therequirement
Quoted 1 line
Quoted 1 line
Quoted 1 line
to set the mempool pointer if the
RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREEQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
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.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
/**
* A structure used to configure a Tx ring of an Ethernet port. */
structrte_eth_txconf{
structrte_eth_threshtx_thresh; /**< Tx ring thresholdregisters.
Quoted 2 lines
Quoted 2 lines
*/
Quoted 1 line
uint16_ttx_rs_thresh; /**< Drives the setting of RS bit onTXDs.
Quoted 2 lines
Quoted 2 lines
*/
Quoted 1 line
uint16_ttx_free_thresh; /**< Start freeing Tx buffers ifthere
Quoted 2 lines
Quoted 2 lines
are
Quoted 1 line
less free descriptors than this
value. */
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
uint8_ttx_deferred_start; /**< Do not start queue with
rte_eth_dev_start(). */Quoted 2 lines
/** * Per-queue Tx offloads to be set usingRTE_ETH_TX_OFFLOAD_*
Quoted 2 lines
Quoted 2 lines
flags.
Quoted 1 line
* Only offloads set on
tx_queue_offload_capaor
tx_offload_capaQuoted 1 line
Quoted 1 line
Quoted 1 line
* fields on
rte_eth_dev_infostructure are allowed to beset.
Quoted 13 lines
Quoted 13 lines
Review
Quoted 9 lines
*/ uint64_t offloads;(quoted diff) +6
-0+ /** + * Per-queue mempool to release the mbufs to; required for + * RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload. + */ + struct rte_mempool *mp; +Is this really best put in the txconf struct? Would it not be better just
stored in the queue structure on free or Tx of the first packet?That
Quoted 8 lines
Quoted 2 lines
would
make it not change the ABI.It seems natural to me to specify the mempool at configuration time, because it is a configuration parameter.
The txconf struct seemed like the best place to put it.Fetching it from the first mbuf of each burst at runtime, and possibly
caching it, seems like a workaround for the missing configuration parameter.
Quoted 1 line
Quoted 8 lines
Quoted 1 line
Not suggesting from each burst, just the first mbuf seen. One time only.
That's what I meant by "possibly caching it". :-)
The check for the one-time cache update still takes up code space in the per-burst fast path. (Although very little.)
But I still prefer providing configuration information at configuration time, rather than snooping it at runtime.
Ok, but then are we mandating that all existing apps now are required to pass in a mempool value on Tx queue config? I'm concerned about how many apps that may affect. On the other hand, if it is optional, does that not slow down the fastpath more having to check for this optional value?
/Bruce
Quoted 95 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 3 July 2025 17.36Quoted 4 lines · Morten Brørup
Quoted 4 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 3 July 2025 17.21On Thu, Jul 03, 2025 at 05:12:46PM +0200, Morten Brørup wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 3 July 2025 16.14Quoted 1 line · Morten Brørup
For TX mbuf fast release offload, I propose to add the mbuf
mempool
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
pointer to the ethdev tx queue configuration structure, so the ethdev TX burst operation doesn't need to fetch it from
the
Quoted 10 lines
Quoted 10 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
first mbuf of each burst being fast free'd to the mempool.
This modification of the struct
rte_eth_txconf, and therequirement
Quoted 1 line
Quoted 1 line
Quoted 1 line
to set the mempool pointer if the
RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREEQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
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
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
check if the pointer has been set, and fall back to fetching
it
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
from mbuf[0] if not.
/**
* A structure used to configure a Tx ring of an Ethernetport.
Quoted 27 lines
Quoted 27 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
*/
structrte_eth_txconf{
structrte_eth_threshtx_thresh; /**< Tx ring thresholdregisters.
Quoted 2 lines
Quoted 2 lines
*/
Quoted 1 line
uint16_ttx_rs_thresh; /**< Drives the setting of RS bit onTXDs.
Quoted 2 lines
Quoted 2 lines
*/
Quoted 1 line
uint16_ttx_free_thresh; /**< Start freeing Tx buffers ifthere
Quoted 2 lines
Quoted 2 lines
are
Quoted 1 line
less free descriptors than this
value. */
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
uint8_ttx_deferred_start; /**< Do not start queue with
rte_eth_dev_start(). */Quoted 2 lines
/** * Per-queue Tx offloads to be set usingRTE_ETH_TX_OFFLOAD_*
Quoted 2 lines
Quoted 2 lines
flags.
Quoted 1 line
* Only offloads set on
tx_queue_offload_capaor
tx_offload_capaQuoted 1 line
Quoted 1 line
Quoted 1 line
* fields on
rte_eth_dev_infostructure are allowed to beset.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
*/ uint64_t offloads;Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ /** + * Per-queue mempool to release the mbufs to; required for + * RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload. + */ + struct rte_mempool *mp; +Is this really best put in the txconf struct? Would it not be
better
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
just
stored in the queue structure on free or Tx of the first packet?That
Quoted 4 lines
Quoted 2 lines
would
make it not change the ABI.It seems natural to me to specify the mempool at configuration
time,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
because it is a configuration parameter.
The txconf struct seemed like the best place to put it.Fetching it from the first mbuf of each burst at runtime, and
possibly
Quoted 4 lines
Quoted 4 lines
caching it, seems like a workaround for the missing configuration parameter.
Quoted 1 line
Not suggesting from each burst, just the first mbuf seen. One time
only.
Quoted 4 lines
That's what I meant by "possibly caching it". :-)
The check for the one-time cache update still takes up code space in
the per-burst fast path. (Although very little.)
Quoted 1 line
Quoted 8 lines
Quoted 1 line
But I still prefer providing configuration information at
configuration time, rather than snooping it at runtime.
Quoted 1 line
Ok, but then are we mandating that all existing apps now are required to pass in a mempool value on Tx queue config? I'm concerned about how many apps that may affect. On the other hand, if it is optional, does that not
slow down the fastpath more having to check for this optional value?
Initially, it will be optional, and log a warning if not provided. And yes, the fast path will incur a performance cost for checking its presence.
When its "experimental" status expires, it will be required, and return failure if not provided. Then the fast path no longer needs to consider its non-presence, and the performance cost can be eliminated.
Quoted 32 lines
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 theRTE_ETH_TX_OFFLOAD_MBUF_FAST_FREEflag 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.
*/
structrte_eth_txconf{
structrte_eth_threshtx_thresh; /**< Tx ring threshold registers. */uint16_ttx_rs_thresh; /**< Drives the setting of RS bit on TXDs. */uint16_ttx_free_thresh; /**< Start freeing Tx buffers if there are
less free descriptors than this value. */
uint8_ttx_deferred_start; /**< Do not start queue withrte_eth_dev_start(). */ /**
* Per-queue Tx offloads to be set using RTE_ETH_TX_OFFLOAD_* flags.
* Only offloads set ontx_queue_offload_capaortx_offload_capa
* fields onrte_eth_dev_infostructure are allowed to be set.
*/
uint64_toffloads;
Review
Quoted 6 lines
(quoted diff) +6
-0+ /** + * 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.
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?
Also, we can update tx_queue_setup() to catch the situation when FAST_FREE is set but mp is NULL, or visa-versa.
Again drivers can probably add extra check when debug is enabled, that all mbufs are exactly from that mempool.
Quoted 4 lines
uint64_t reserved_64s[2]; /**< Reserved for future fields */ void *reserved_ptrs[2]; /**< Reserved for future fields */ };
Quoted 41 lines
-----Original Message-----
From: Konstantin Ananyev <[email protected]>
Sent: Friday, July 4, 2025 5:20 PM
To: Morten Brørup <[email protected]>; [email protected]; Bruce Richardson <[email protected]>
Cc: [email protected]
Subject: RE: [RFC] ethdev: TX mbuf fast release optimizationQuoted 31 lines
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 theRTE_ETH_TX_OFFLOAD_MBUF_FAST_FREEflag 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.
*/
structrte_eth_txconf{
structrte_eth_threshtx_thresh; /**< Tx ring threshold registers. */uint16_ttx_rs_thresh; /**< Drives the setting of RS bit on TXDs. */uint16_ttx_free_thresh; /**< Start freeing Tx buffers if there are
less free descriptors than this value. */
uint8_ttx_deferred_start; /**< Do not start queue withrte_eth_dev_start(). */ /**
* Per-queue Tx offloads to be set using RTE_ETH_TX_OFFLOAD_* flags.
* Only offloads set ontx_queue_offload_capaortx_offload_capa
* fields onrte_eth_dev_infostructure are allowed to be set.
*/
uint64_toffloads;
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ /** + * 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-
Correction, meant to say: I usually recommend not to use MBUF_FAST_FREE. The rest remains the same :)
Quoted 15 lines
that's probably a good change.
At least people will realize that they have to provide a single mempool per TX queue when they enableFAST_FREEflag.
One naming suggestion I have - can we name it somehow more informative:
'fast_free_mp' or so?
Also, we can updatetx_queue_setup()to catch the situation whenFAST_FREEis set but mp is NULL, or visa-versa.
Again drivers can probably add extra check when debug is enabled, that all mbufs are exactly from that mempool.Quoted 4 lines
uint64_t reserved_64s[2]; /**< Reserved for future fields */ void *reserved_ptrs[2]; /**< Reserved for future fields */ };
Quoted 39 lines
From: Konstantin Ananyev [mailto:[email protected]]
Sent: Friday, 4 July 2025 18.20Quoted 14 lines
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 theRTE_ETH_TX_OFFLOAD_MBUF_FAST_FREEflag 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.
Quoted 5 lines
/**
* A structure used to configure a Tx ring of an Ethernet port. */
structrte_eth_txconf{
structrte_eth_threshtx_thresh; /**< Tx ring threshold registers.*/
Quoted 1 line
uint16_ttx_rs_thresh; /**< Drives the setting of RS bit on TXDs.*/
Quoted 1 line
uint16_ttx_free_thresh; /**< Start freeing Tx buffers if thereare
Quoted 3 lines
less free descriptors than this value. */
uint8_ttx_deferred_start; /**< Do not start queue with
rte_eth_dev_start(). */Quoted 2 lines
/** * Per-queue Tx offloads to be set using RTE_ETH_TX_OFFLOAD_*flags.
Quoted 5 lines
* 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;
Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ /** + * 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"
Quoted 4 lines
At least people will realize that they have to provide a single mempool per TX queue when they enable
FAST_FREEflag.
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".
Quoted 3 lines
Also, we can update
tx_queue_setup()to catch the situation whenFAST_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.)
Quoted 2 lines
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.
Quoted 6 lines
Quoted 6 lines
uint64_t reserved_64s[2]; /**< Reserved for future fields */ void *reserved_ptrs[2]; /**< Reserved for future fields */ };