Skip to content

af_packet correctness, performance, cksum

[email protected] dpdk-dev 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest4 patches 4 repliesIn review
  2. v54 patches 6 repliesSuperseded
  3. v44 patches 4 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v34 patches5 repliesSuperseded
v24 patches5 repliesSuperseded
v13 patches12 repliesSuperseded

Changes in v6 from the cover letter

- rte_net_ip_udptcp_cksum_mbuf doxygen EXPERIMENTAL tag

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4net/af_packet: fix thread safety and frame calculationsdoc/guides/rel_notes/release_26_03.rst drivers/net/af_packet/rte_eth_af_packet.c+119 -380 replies
2/4net/af_packet: RX/TX bulk free, unlikely hintdrivers/net/af_packet/rte_eth_af_packet.c+14 -270 replies
3/4net/af_packet: tx poll controldoc/guides/nics/af_packet.rst doc/guides/rel_notes/release_26_03.rst drivers/net/af_packet/rte_eth_af_packet.c+32 -80 replies
4/4net/af_packet: add software checksum offload supportdoc/guides/nics/features/afpacket.ini doc/guides/rel_notes/release_26_03.rst drivers/net/af_packet/rte_eth_af_packet.c +3 more+134 -760 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH v6 0/4] af_packet correctness, performance, cksum

From: Scott <[email protected]>

This series fixes critical thread safety bugs in the af_packet PMD and adds performance optimizations.

Patch 1 fixes two major correctness issues:
- Thread safety: tp_status was accessed without memory barriers, violating the kernel's PACKET_MMAP protocol. On aarch64 and other weakly-ordered architectures, this causes packet corruption due to missing memory ordering. The fix matches the kernel's memory model:
volatile unaligned reads/writes with explicit rte_smp_rmb/wmb barriers and __may_alias__ protection.

- Frame calculations: Fixed incorrect frame overhead and address calculations that caused memory corruption when frames don't evenly divide blocks.

Patches 2-4 add performance improvements:
- Patch 2: Bulk mbuf freeing, unlikely annotations
- Patch 3: TX poll control to reduce syscall overhead
- Patch 4: Software checksum offload support with shared rte_net utility

v6 changes:
- rte_net_ip_udptcp_cksum_mbuf doxygen EXPERIMENTAL tag

v5 changes:
- rte_net_ip_udptcp_cksum_mbuf moved to rte_net.c (avoid forced inline)
- rte_net_ip_udptcp_cksum_mbuf remove copy arg, handle more mbuf types
- af_packet and tap calling code consistent for sw cksum

v4 changes:
- Remove prefetch (perf results didn't show benefit)
- Fix variable sytle for consistency (declare at start of method)
- Add release notes for af_packet and documentation for fixes

v3 changes:
- Patch 4: Fix compile error due to implict cast with c++ compiler

v2 changes:
- Patch 1: Rewrote to use volatile + barriers instead of C11 atomics to match kernel's memory model. Added dependency on patch-160274 for __rte_may_alias attribute.
- Patch 4: Refactored to use shared rte_net_ip_udptcp_cksum_mbuf() utility function, eliminating code duplication with tap driver.

Scott Mitchell (4):
net/af_packet: fix thread safety and frame calculations net/af_packet: RX/TX bulk free, unlikely hint net/af_packet: tx poll control
net/af_packet: add software checksum offload support

 doc/guides/nics/af_packet.rst             |   6 +-
 doc/guides/nics/features/afpacket.ini     |   2 +
 doc/guides/rel_notes/release_26_03.rst    |   9 +-
 drivers/net/af_packet/rte_eth_af_packet.c | 253 +++++++++++++++-------
 drivers/net/tap/rte_eth_tap.c             |  70 +-----
 lib/net/rte_net.c                         |  69 ++++++
 lib/net/rte_net.h                         |  25 +++
 7 files changed, 292 insertions(+), 142 deletions(-)
Signature · 1 line
2.39.5 (Apple Git-154)