RFC net/af_packet: cleanups and optimizations
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest4 patches 13 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | net/af_packet: remove volatile from statisticsdrivers/ | +7 | 6 replies | |
| 2/4 | test: add test for af_packetapp/ app/ | +876 | 2 replies | |
| 3/4 | net/af_packet: fix indentationdrivers/ | +32 | 0 replies | |
| 4/4 | net/af_packet: add VPP-style prefetching to receive pathdrivers/ | +164 | 5 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC 0/4] net/af_packet: cleanups and optimizations
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
Signature · 1 line
2.51.0