From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [RFC 0/4] net/af_packet: cleanups and optimizations
Date: Wed, 28 Jan 2026 09:30:16 -0800 [thread overview]
Message-ID: <20260128173138.151837-1-stephen@networkplumber.org> (raw)
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
next reply other threads:[~2026-01-28 17:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 17:30 Stephen Hemminger [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260128173138.151837-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox