|SUCCESS| net/intel: do not bypass mbuf lib for mbuf fast-free

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Sun Apr 19 11:14:06 CEST 2026


Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/163181

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-04-19

Reviewing patch for commit:

Author: Morten Brorup <mb at smartsharesystems.com>
Subject: [PATCH] net/intel: do not bypass mbuf lib for mbuf fast-free

This patch refactors the Intel common driver's vectorized TX buffer
freeing to use rte_mbuf_raw_free_bulk() instead of directly manipulating
mempool caches, ensuring mbuf instrumentation is properly invoked.

> diff --git a/doc/guides/rel_notes/release_26_07.rst b/doc/guides/rel_notes/release_26_07.rst
> index 060b26ff61..9367d38b13 100644
> --- a/doc/guides/rel_notes/release_26_07.rst
> +++ b/doc/guides/rel_notes/release_26_07.rst
> @@ -24,6 +24,10 @@ DPDK Release 26.07
>  New Features
>  ------------
>  
> +* **Updated Intel common driver.**
> +
> +  * Added missing mbuf history marking to vectorized Tx path for MBUF_FAST_FREE.
> +

[ ... ]

> diff --git a/drivers/net/intel/common/tx.h b/drivers/net/intel/common/tx.h
> index 283bd58d5d..4a201da83c 100644
> --- a/drivers/net/intel/common/tx.h
> +++ b/drivers/net/intel/common/tx.h
> @@ -285,42 +285,12 @@ ci_tx_free_bufs_vec(struct ci_tx_queue *txq, ci_desc_done_fn desc_done, bool ctx
>  			(txq->fast_free_mp = txep[0].mbuf->pool);
>  
>  	if (mp != NULL && (n & 31) == 0) {
> -		void **cache_objs;
> -		struct rte_mempool_cache *cache = rte_mempool_default_cache(mp, rte_lcore_id());
> -
> -		if (cache == NULL)
> -			goto normal;
> -
> -		cache_objs = &cache->objs[cache->len];
> -
> -		if (n > RTE_MEMPOOL_CACHE_MAX_SIZE) {
> -			rte_mempool_ops_enqueue_bulk(mp, (void *)txep, n);
> -			goto done;
> -		}
> -
> -		/* The cache follows the following algorithm
> -		 *   1. Add the objects to the cache
> -		 *   2. Anything greater than the cache min value (if it
> -		 *   crosses the cache flush threshold) is flushed to the ring.
> -		 */
> -		/* Add elements back into the cache */
> -		uint32_t copied = 0;
> -		/* n is multiple of 32 */
> -		while (copied < n) {
> -			memcpy(&cache_objs[copied], &txep[copied], 32 * sizeof(void *));
> -			copied += 32;
> -		}
> -		cache->len += n;
> -
> -		if (cache->len >= cache->flushthresh) {
> -			rte_mempool_ops_enqueue_bulk(mp, &cache->objs[cache->size],
> -					cache->len - cache->size);
> -			cache->len = cache->size;
> -		}
> +		static_assert(sizeof(*txep) == sizeof(struct rte_mbuf *),
> +				"txep array is not similar to an array of rte_mbuf pointers");
> +		rte_mbuf_raw_free_bulk(mp, (void *)txep, n);

Does this cast maintain proper alignment? The txep array contains struct
ci_tx_entry_vec elements. While the static_assert checks that sizes
match, does rte_mbuf_raw_free_bulk() expect an array of mbuf pointers
specifically, not an array of structures that happen to start with mbuf
pointers?

If struct ci_tx_entry_vec has members beyond the mbuf pointer, does this
code skip over the mbufs correctly when indexing through txep as mbuf
pointers?

>  		goto done;
>  	}
>  
> -normal:
>  	m = rte_pktmbuf_prefree_seg(txep[0].mbuf);
>  	if (likely(m)) {
>  		free[0] = m;

The patch addresses a real instrumentation gap and the refactoring
simplifies the code. However, the type casting requires verification
that struct ci_tx_entry_vec is indeed an array-of-pointers-compatible
type.


More information about the test-report mailing list