public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
* [RFC 0/4] net/af_packet: cleanups and optimizations
@ 2026-01-28 17:30 Stephen Hemminger
  2026-01-28 17:30 ` [RFC 1/4] net/af_packet: remove volatile from statistics Stephen Hemminger
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Stephen Hemminger @ 2026-01-28 17:30 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

This series contains several improvements to the AF_PACKET PMD:

1. Remove unnecessary volatile qualifiers from statistics counters
   and standardize on uint64_t for consistency.

2. Add a unit test for the AF_PACKET PMD. The test creates a TAP
   interface and uses it to verify basic send/receive functionality,
   statistics, and device operations.

3. Implement VPP-style single/dual/quad loop pattern with software
   prefetching in the receive path. This optimization processes
   packets in batches of 4, 2, and 1, prefetching upcoming frame
   headers and packet data to improve cache utilization and hide
   memory latency.

Note: The test code in patch 2 and the prefetch optimization in
patch 4 were generated with the assistance of Claude AI (Anthropic),
with manual review and cleanup afterwards.

The prefetch pattern is modeled after FD.IO VPP's packet processing
loops, which have proven effective in high-performance networking
applications. The key techniques are:
- Loop unrolling to reduce branch overhead
- Prefetching next iteration's data while processing current batch
- Graceful fallback from quad to dual to single packet processing

Testing was performed using the new unit test on a TAP interface.
Performance testing on real hardware with high packet rates would
be valuable to quantify the prefetch benefits.

Stephen Hemminger (4):
  net/af_packet: remove volatile from statistics
  test: add test for af_packet
  net/af_packet: fix indentation
  net/af_packet: add VPP-style prefetching to receive path

 app/test/meson.build                      |   1 +
 app/test/test_pmd_af_packet.c             | 875 ++++++++++++++++++++++
 drivers/net/af_packet/rte_eth_af_packet.c | 286 +++++--
 3 files changed, 1079 insertions(+), 83 deletions(-)
 create mode 100644 app/test/test_pmd_af_packet.c

-- 
2.51.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-02-03  7:31 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-28 17:30 [RFC 0/4] net/af_packet: cleanups and optimizations Stephen Hemminger
2026-01-28 17:30 ` [RFC 1/4] net/af_packet: remove volatile from statistics Stephen Hemminger
2026-01-28 19:57   ` Scott Mitchell
2026-01-28 21:00     ` Stephen Hemminger
2026-02-02  7:02       ` Scott Mitchell
2026-02-02 17:34         ` Stephen Hemminger
2026-02-02 19:12           ` Scott Mitchell
2026-02-02 20:12             ` Stephen Hemminger
2026-01-28 17:30 ` [RFC 2/4] test: add test for af_packet Stephen Hemminger
2026-01-28 20:36   ` Scott Mitchell
2026-01-28 21:45     ` Stephen Hemminger
2026-01-28 17:30 ` [RFC 3/4] net/af_packet: fix indentation Stephen Hemminger
2026-01-28 17:30 ` [RFC 4/4] net/af_packet: add VPP-style prefetching to receive path Stephen Hemminger
2026-01-29  1:06   ` Stephen Hemminger
2026-01-29  9:00     ` Morten Brørup
2026-02-02  7:09       ` Scott Mitchell
2026-02-02 18:43       ` Stephen Hemminger
2026-02-03  7:31         ` Morten Brørup

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox