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 (via tx_prepare) and stripping on Rx
- Runtime VLAN offload configuration via vlan_offload_set callback
- Nanosecond precision timestamps (when libpcap supports it)
- Link state reporting in interface mode
- Link status change (LSC) interrupt support in interface mode
- EOF notification via link status change for rx_pcap mode
- Advertise RTE_ETH_TX_OFFLOAD_MULTI_SEGS capability
- Configurable snapshot length via snaplen devarg
Bug fixes:
- Fix build on Windows from RTE_LOG_LINE changes.
- Fix multi-segment transmit to dynamically allocate instead of
silently truncating packets larger than 9K stack buffer
- Fix Tx burst error handling: distinguish malformed mbufs (counted
as errors) from pcap_sendpacket backpressure (break and retry)
- 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
Testing:
- Add comprehensive unit test suite (26 test cases) covering basic
file I/O, timestamps, jumbo frames, VLAN strip/insert, multi-queue,
snaplen, EOF notification, and link status
- Test discovers network interfaces using pcap_findalldevs API
for portable interface enumeration across Linux, FreeBSD, macOS,
and Windows
- Tests use packet_burst_generator for standardized test packet
creation
v18:
- Move VLAN insert from tx burst path to tx_prepare callback,
consistent with virtio and af_packet driver patterns
- Simplify link status patch to just report UP/DOWN state;
remove speed and duplex querying that had cross-platform
portability issues (FreeBSD ifmedia_baudrate not available
in userspace, Windows GetIfEntry2 linking issues)
- Fix test_vlan_insert_tx to call rte_eth_tx_prepare() before
rte_eth_tx_burst() to match the new tx_prepare VLAN insert
implementation
Stephen Hemminger (23):
maintainers: update for pcap driver
net/pcap: fix build on Windows
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
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 status 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
eal/windows: add wrapper for access function
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 | 3574 ++++++++++++++++++++++++
doc/guides/nics/features/pcap.ini | 9 +
doc/guides/nics/pcap.rst | 48 +
doc/guides/rel_notes/release_26_03.rst | 12 +
drivers/net/pcap/pcap_ethdev.c | 812 ++++--
drivers/net/pcap/pcap_osdep.h | 27 +
drivers/net/pcap/pcap_osdep_freebsd.c | 43 +-
drivers/net/pcap/pcap_osdep_linux.c | 33 +-
drivers/net/pcap/pcap_osdep_windows.c | 76 +-
lib/eal/windows/include/rte_os_shim.h | 1 +
lib/eal/windows/include/unistd.h | 7 +
13 files changed, 4423 insertions(+), 222 deletions(-)
create mode 100644 app/test/test_pmd_pcap.c
--
2.51.0