[PATCH v16 00/21] net/pcap: improvements and test suite

Stephen Hemminger
2026-02-16T18:14:13Z

This series contains improvements to the PCAP PMD including new
features, bug fixes, code cleanup, and a comprehensive test suite.

New features:
- VLAN tag insertion on Tx and stripping on Rx
- Runtime VLAN offload configuration via vlan_offload_set callback
- Nanosecond precision timestamps (when hardware/libpcap supports it)
- Accurate link state, speed, and duplex reporting in interface mode
- Link status change (LSC) interrupt support in interface mode
- EOF notification via link status change for rx_pcap mode
- Support for Windows interface mode
- Advertise RTE_ETH_TX_OFFLOAD_MULTI_SEGS capability
- Configurable snapshot length via snaplen devarg

Bug fixes:
- Fix multi-segment transmit to dynamically allocate instead of
silently truncating packets larger than 9K stack buffer
- Change Tx burst to always consume all packets; failed sends
increment error counter rather than leaving mbufs for retry
(pcap_sendpacket failures are not transient)
- Reject non-Ethernet interfaces to prevent malformed packets
and kernel warnings on FreeBSD/macOS loopback
- Fix infinite_rx ring fill applying VLAN strip and timestamp
offloads to template packets, preventing those offloads from
working correctly during packet delivery

Code cleanup:
- Convert internal flags from int to bool
- Remove unnecessary casts of void* from rte_zmalloc
- Replace rte_malloc/rte_memcpy with libc equivalents in osdep code
- Include headers explicitly rather than relying on indirect includes
- Remove unnecessary volatile qualifier on statistics
- Reduce scope of file-level variables
- Defer pcap handle opening until device start
- Use bulk free for better Tx performance

Testing:
- Add comprehensive unit test suite covering basic operations,
timestamps, jumbo frames, VLAN handling, multi-queue, and more
- Test discovers network interfaces using pcap_findalldevs API
for portable interface enumeration across Linux, FreeBSD, macOS,
and Windows
- New tests for runtime VLAN offload toggle, VLAN strip with
infinite_rx mode, and timestamp generation in infinite_rx mode

v16:
- Split up the patches around transmit logic

Stephen Hemminger (21):
maintainers: update for pcap driver
doc: update features for PCAP PMD
net/pcap: include used headers
net/pcap: remove unnecessary casts
net/pcap: avoid using rte_malloc and rte_memcpy
net/pcap: advertise Tx multi segment
net/pcap: replace stack bounce buffer with per-queue allocation
net/pcap: fix error accounting and backpressure on transmit
net/pcap: add datapath debug logging
net/pcap: consolidate boolean flag handling
net/pcap: support VLAN strip and insert offloads
net/pcap: add link state and speed for interface mode
net/pcap: support nanosecond timestamp precision
net/pcap: reject non-Ethernet interfaces
net/pcap: reduce scope of file-level variables
net/pcap: avoid use of volatile
net/pcap: clarify maximum received packet
net/pcap: add snapshot length devarg
net/pcap: add link status change support for iface mode
net/pcap: add EOF notification via link status change
test: add comprehensive test suite for pcap PMD

MAINTAINERS | 1 +
app/test/meson.build | 2 +
app/test/test_pmd_pcap.c | 3422 ++++++++++++++++++++++++
doc/guides/nics/features/pcap.ini | 9 +
doc/guides/nics/pcap.rst | 41 +
doc/guides/rel_notes/release_26_03.rst | 13 +
drivers/net/pcap/pcap_ethdev.c | 923 +++++--
drivers/net/pcap/pcap_osdep.h | 39 +
drivers/net/pcap/pcap_osdep_freebsd.c | 98 +-
drivers/net/pcap/pcap_osdep_linux.c | 124 +-
drivers/net/pcap/pcap_osdep_windows.c | 95 +-
11 files changed, 4529 insertions(+), 238 deletions(-)
create mode 100644 app/test/test_pmd_pcap.c

--
2.51.0