[PATCH v1 0/3] net/af_packet: correctness fixes and improvements

scott.k.mitch1
2026-01-27T18:15:17Z

From: Scott <scott.k.mitch1@gmail.com>

This series addresses correctness issues and adds performance
optimizations to the AF_PACKET driver, laying the groundwork for
upcoming advanced features.

The series is structured as:

Patch 1/3: Thread safety and frame calculation fixes
- Critical correctness fixes for multi-threaded environments
- Proper atomic operations and memory ordering for tp_status
- Fixes frame address calculation bugs

Patch 2/3: Performance optimizations
- Use rte_memcpy() for better performance
- Add prefetching for next frame/mbuf
- Use rte_pktmbuf_free_bulk() instead of individual frees

Patch 3/3: New features and device arguments
- Software checksum offload support
- TX poll behavior control (txpollnotrdy devarg)
- Improved devarg validation

These changes prepare the driver for planned follow-up patches that will
add significant new capabilities:

- io_uring SQPOLL support for TX send notify, which meaningfully improves
performance by eliminating syscall overhead and enabling kernel-side
polling

- GRO/GSO support via PACKET_VNET_HDR to aggregate packets and reduce
per-packet interface traversal overhead

- TPACKET_V3 protocol support for block-based RX/TX processing, providing
packet batching benefits and reducing cache pressure

The correctness fixes in patch 1/3 are particularly important for these
future features, as io_uring SQPOLL mode involves asynchronous kernel
updates to tp_status from independent CPU cores, requiring proper memory
ordering.

Scott Mitchell (3):
net/af_packet: fix thread safety and frame calculations
net/af_packet: RX/TX rte_memcpy, bulk free, prefetch
net/af_packet: software checksum and tx poll control

drivers/net/af_packet/rte_eth_af_packet.c | 389 +++++++++++++++-------
1 file changed, 270 insertions(+), 119 deletions(-)

--
2.39.5 (Apple Git-154)