Intel FAST_FREE offload question
Intel NIC folks,
Why do the Intel network drivers, when using RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE, fall back to normal freeing when the mempool cache is empty (cache->len == 0)? It doesn't make sense to me.
Example:
https://git.dpdk.org/dpdk/tree/drivers/net/intel/common/tx.h#n146
Med venlig hilsen / Kind regards,
-Morten Brørup
Quoted 9 lines · Morten Brørup
Intel NIC folks,
Why do the Intel network drivers, when using
RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE, fall back to normal freeing when the mempool cache is empty (cache->len== 0)? It doesn't make sense to me.Example:
https://git.dpdk.org/dpdk/tree/drivers/net/intel/common/tx.h#n146
Good question. I suspect that it may be a bug and that we meant to check for size == 0 rather than len == 0.
Quoted 10 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Friday, 21 February 2025 18.10Quoted 4 lines · Morten Brørup
Intel NIC folks,
Why do the Intel network drivers, when using
RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE, fall back to normal freeing whenthe
Quoted 1 line
mempool cache is empty (
cache->len== 0)? It doesn't make sense to
Quoted 8 lines
me.
Quoted 4 lines
Example:
https://git.dpdk.org/dpdk/tree/drivers/net/intel/common/tx.h#n146Good question. I suspect that it may be a bug and that we meant to check
for size == 0 rather than len == 0.
Then checking for cache == NULL suffices, because rte_mempool_default_cache() returns NULL if the cache size is 0:
https://elixir.bootlin.com/dpdk/v24.11.1/source/lib/mempool/rte_mempool.h#L1333
PATCH 1/1 net/intel: allow fast-free to empty cache
In reply to Morten BrørupWhen freeing transmitted mbufs, there is no reason to send the freed mbufs directly to the ring if the cache is empty - only if it is zero size (in which case the cache pointer is NULL). Therefore, remove the empty check and only check for a null cache pointer.
--- drivers/net/intel/common/tx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/intel/common/tx.h +1 -1
@@ -143,7 +143,7 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq, ci_desc_done_fn desc_done, bool ctxvoid **cache_objs;struct rte_mempool_cache *cache =rte_mempool_default_cache (mp,rte_lcore_id ()); -if (!cache || cache->len ==0 ) +if (cache ==NULL ) goto normal; cache_objs = &cache->objs[cache->len];
Signature · 1 line
2.43.0
RE: [PATCH] net/intel: allow fast-free to empty cache
Quoted 30 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 10 March 2025 14.26When freeing transmitted mbufs, there is no reason to send the freed mbufs directly to the ring if the cache is empty - only if it is zero size (in which case the cache pointer is NULL). Therefore, remove the empty check and only check for a null cache pointer.
Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/common/tx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/intel/common/tx.h +0
-0@@ -143,7 +143,7 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq,
ci_desc_done_fndesc_done, bool ctxdrivers/net/intel/common/tx.h +0
-0void **cache_objs; struct rte_mempool_cache *cache =
rte_mempool_default_cache(mp, rte_lcore_id());drivers/net/intel/common/tx.h +1
-2-if (!cache || cache->len ==0 ) +if (cache ==NULL ) goto normal; cache_objs = &cache->objs[cache->len]; --
Quoted 1 line
2.43.0
Yep, it did look strange.
Re: [PATCH] net/intel: allow fast-free to empty cache
Quoted 28 lines · Morten Brørup
Quoted 28 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 10 March 2025 14.26When freeing transmitted mbufs, there is no reason to send the freed mbufs directly to the ring if the cache is empty - only if it is zero size (in which case the cache pointer is NULL). Therefore, remove the empty check and only check for a null cache pointer.
Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/common/tx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/intel/common/tx.h +0
-0@@ -143,7 +143,7 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq,
ci_desc_done_fndesc_done, bool ctxdrivers/net/intel/common/tx.h +0
-0void **cache_objs; struct rte_mempool_cache *cache =
rte_mempool_default_cache(mp, rte_lcore_id());drivers/net/intel/common/tx.h +1
-1-if (!cache || cache->len ==0 ) +if (cache ==NULL ) goto normal;
Quoted 7 lines
Quoted 3 lines
cache_objs= &cache->objs[cache->len];
--
2.43.0Yep, it did look strange.
Reviewed-by Morten Brørup <[email protected]>
Thanks for review.
FYI: Given that this is in a sensitive area and we are now past rc2, I'm going to postponse merging this patch till 25.07, rather than risk it in 25.03.
/Bruce
RE: [PATCH] net/intel: allow fast-free to empty cache
Quoted 35 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 10 March 2025 16.27Quoted 4 lines · Morten Brørup
Quoted 4 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 10 March 2025 14.26When freeing transmitted mbufs, there is no reason to send the
freed
Quoted 1 line
Quoted 1 line
mbufs directly to the ring if the cache is empty - only if it is
zero
Quoted 1 line
Quoted 1 line
size (in which case the cache pointer is NULL). Therefore, remove
the
Quoted 22 lines
Quoted 22 lines
empty check and only check for a null cache pointer.
Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/common/tx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/intel/common/tx.h +0
-0@@ -143,7 +143,7 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq,
ci_desc_done_fndesc_done, bool ctxdrivers/net/intel/common/tx.h +0
-0void **cache_objs; struct rte_mempool_cache *cache =
rte_mempool_default_cache(mp, rte_lcore_id());drivers/net/intel/common/tx.h +1
-1-if (!cache || cache->len ==0 ) +if (cache ==NULL ) goto normal;
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
cache_objs= &cache->objs[cache->len];
--
2.43.0Yep, it did look strange.
Reviewed-by Morten Brørup <[email protected]>Thanks for review.
BTW, I recall other Intel drivers having the same "feature":
https://elixir.bootlin.com/dpdk/v24.11.1/source/drivers/net/iavf/iavf_rxtx_vec_avx512.c#L1876
https://elixir.bootlin.com/dpdk/v24.11.1/source/drivers/net/ice/ice_rxtx_vec_avx512.c#L891
Quoted 5 lines
FYI: Given that this is in a sensitive area and we are now past rc2, I'm going
to postponse merging this patch till 25.07, rather than risk it in 25.03.
Agree.
Quoted 2 lines
/Bruce
Re: [PATCH] net/intel: allow fast-free to empty cache
Quoted 42 lines · Morten Brørup
Quoted 42 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 10 March 2025 16.27Quoted 4 lines · Morten Brørup
Quoted 4 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 10 March 2025 14.26When freeing transmitted mbufs, there is no reason to send the
freed
Quoted 1 line
Quoted 1 line
mbufs directly to the ring if the cache is empty - only if it is
zero
Quoted 1 line
Quoted 1 line
size (in which case the cache pointer is NULL). Therefore, remove
the
Quoted 29 lines
Quoted 24 lines
empty check and only check for a null cache pointer.
Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/common/tx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/intel/common/tx.h +0
-0@@ -143,7 +143,7 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq,
ci_desc_done_fndesc_done, bool ctxdrivers/net/intel/common/tx.h +0
-0void **cache_objs; struct rte_mempool_cache *cache =
rte_mempool_default_cache(mp, rte_lcore_id());drivers/net/intel/common/tx.h +1
-2-if (!cache || cache->len ==0 ) +if (cache ==NULL ) goto normal; cache_objs = &cache->objs[cache->len]; --Quoted 1 line
2.43.0
Yep, it did look strange.
Reviewed-by Morten Brørup <[email protected]>
Quoted 6 lines
Quoted 1 line
Thanks for review.
BTW, I recall other Intel drivers having the same "feature":
https://elixir.bootlin.com/dpdk/v24.11.1/source/drivers/net/iavf/iavf_rxtx_vec_avx512.c#L1876
https://elixir.bootlin.com/dpdk/v24.11.1/source/drivers/net/ice/ice_rxtx_vec_avx512.c#L891
With the deduplication work I did earlier this release, this code should now be shared between ixgbe, i40e, iavf and ice drivers, so we hopefully can fix all 4 with one change.
RE: [PATCH] net/intel: allow fast-free to empty cache
Quoted 60 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 10 March 2025 16.53Quoted 10 lines · Morten Brørup
Quoted 10 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 10 March 2025 16.27Quoted 4 lines · Morten Brørup
Quoted 4 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 10 March 2025 14.26When freeing transmitted mbufs, there is no reason to send the
freed
Quoted 1 line
Quoted 1 line
mbufs directly to the ring if the cache is empty - only if it
is
Quoted 2 lines
Quoted 2 lines
zero
Quoted 1 line
Quoted 1 line
size (in which case the cache pointer is NULL). Therefore,
remove
Quoted 8 lines
Quoted 8 lines
the
Quoted 7 lines
Quoted 7 lines
empty check and only check for a null cache pointer.
Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/common/tx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/net/intel/common/tx.h ci_tx_free_bufs_vec(struct ci_tx_queue
Quoted 6 lines
drivers/net/intel/common/tx.h +0
-0@@ -143,7 +143,7 @@ ci_tx_free_bufs_vec(struct ci_tx_queue*txq,
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 11 lines
ci_desc_done_fndesc_done, bool ctxdrivers/net/intel/common/tx.h +0
-0void **cache_objs; struct rte_mempool_cache *cache =
rte_mempool_default_cache(mp, rte_lcore_id());drivers/net/intel/common/tx.h +1
-2-if (!cache || cache->len ==0 ) +if (cache ==NULL ) goto normal; cache_objs = &cache->objs[cache->len]; --Quoted 1 line
2.43.0
Yep, it did look strange.
Reviewed-by Morten Brørup <[email protected]>Quoted 4 lines
Quoted 1 line
Thanks for review.
BTW, I recall other Intel drivers having the same "feature":
https://elixir.bootlin.com/dpdk/v24.11.1/source/drivers/net/iavf/iavf_r
xtx_vec_avx512.c#L1876Quoted 1 line
https://elixir.bootlin.com/dpdk/v24.11.1/source/drivers/net/ice/ice_rxt
x_vec_avx512.c#L891Quoted 1 line
Quoted 5 lines
With the deduplication work I did earlier this release, this code should
now be shared between ixgbe, i40e, iavf and ice drivers, so we hopefully
can fix all 4 with one change.
Excellent! Your deduplication already starts paying off. :-)
It looks like only the non-deduplicated idpf driver remains to be modified separately:drivers/net/intel/idpf/idpf_common_rxtx_avx512.c
Bruce Richardson
AppliedRe: [PATCH] net/intel: allow fast-free to empty cache
In reply to Morten BrørupQuoted 28 lines · Morten Brørup
Quoted 28 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 10 March 2025 14.26When freeing transmitted mbufs, there is no reason to send the freed mbufs directly to the ring if the cache is empty - only if it is zero size (in which case the cache pointer is NULL). Therefore, remove the empty check and only check for a null cache pointer.
Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/common/tx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/intel/common/tx.h +0
-0@@ -143,7 +143,7 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq,
ci_desc_done_fndesc_done, bool ctxdrivers/net/intel/common/tx.h +0
-0void **cache_objs; struct rte_mempool_cache *cache =
rte_mempool_default_cache(mp, rte_lcore_id());drivers/net/intel/common/tx.h +1
-1-if (!cache || cache->len ==0 ) +if (cache ==NULL ) goto normal;
Quoted 7 lines
Quoted 3 lines
cache_objs= &cache->objs[cache->len];
--
2.43.0Yep, it did look strange.
Reviewed-by Morten Brørup <[email protected]>
Applied to dpdk-next-net-intel.
/Bruce
RE: [PATCH] net/intel: allow fast-free to empty cache
[Public]
Snipped
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
When freeing transmitted mbufs, there is no reason to send the freed mbufs directly to the ring if the cache is empty - only if it is zero size (in which case the cache pointer is NULL). Therefore, remove the empty check and only check for a null cache pointer.
Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/intel/common/tx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/intel/common/tx.hindexd9cf4474fc..d361fe64ab100644drivers/net/intel/common/tx.h +0
-0@@ -143,7 +143,7 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq,
ci_desc_done_fndesc_done, bool ctx
void **cache_objs;
structrte_mempool_cache*cache =rte_mempool_default_cache(mp, rte_lcore_id());drivers/net/intel/common/tx.h +1
-1-if (!cache || cache->len ==0 ) +if (cache ==NULL ) goto normal;
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
cache_objs = &cache->objs[cache->len];--
2.43.0Yep, it did look strange.
Reviewed-by Morten Brørup <[email protected]>Applied to dpdk-next-net-intel.
At AMD we tested the code change on the platform AMD Siena EPYC 8534P using Intel E810 2CQDA2.
- simd: AVX512
- TEST: DPDK-TESTPMD in tx mode
- cmd: ./dpdk-testpmd -l 15,16,17 --force-max-simd-bitwidth=512 -a c1:00.0 -a c1:00.1 -- -i --nb-cores=2 --nb-ports=2 --rxq=1 --txq=1 --rxd=1024 --txd=1024 --forward-mode=txonly -a
- Before vs After
-- TX-RX Desc 1024, TX-RX 1Q: 117.12, 117.13
-- TX-RX Desc 1024, TX-RX 2Q: 117.13, 117.17
-- TX-RX Desc 2048, TX-RX 1Q: 117.16, 117.18
-- TX-RX Desc 2048, TX-RX 2Q: 117.13, 117.15
Quoted 2 lines
/Bruce