[PATCH v3 2/4] net/af_packet: RX/TX unlikely, bulk free, prefetch

Stephen Hemminger stephen at networkplumber.org
Thu Jan 29 02:07:15 CET 2026


On Wed, 28 Jan 2026 11:10:30 -0800
scott.k.mitch1 at gmail.com wrote:

> From: Scott Mitchell <scott.k.mitch1 at gmail.com>
> 
> - Add rte_prefetch0() to prefetch next frame/mbuf while processing
>   current packet, reducing cache miss latency
> - Use rte_pktmbuf_free_bulk() in TX path instead of individual
>   rte_pktmbuf_free() calls for better batch efficiency
> - Add unlikely() hints for error paths (oversized packets, VLAN
>   insertion failures, sendto errors) to optimize branch prediction
> - Remove unnecessary early nb_pkts == 0 when loop handles this
>   and app may never call with 0 frames.
> 
> Signed-off-by: Scott Mitchell <scott.k.mitch1 at gmail.com>

Drop the prefetch stuff, it doesn't matter.


	Original	Prefetch	Quad/Dual
TX	1.427 Mpps	1.426 Mpps	1.426 Mpps

RX	0.529 Mpps	0.530 Mpps	0.533 Mpps
 loss	87.93%		87.98%		88.0%


More information about the dev mailing list