Skip to content

dpdk: add pdump capture module for DPDK secondary process#1656

Closed
vjardin wants to merge 1 commit into
the-tcpdump-group:masterfrom
vjardin:vj_add_dpdk_grout
Closed

dpdk: add pdump capture module for DPDK secondary process#1656
vjardin wants to merge 1 commit into
the-tcpdump-group:masterfrom
vjardin:vj_add_dpdk_grout

Conversation

@vjardin

@vjardin vjardin commented Mar 17, 2026

Copy link
Copy Markdown

The intent is to provide libpcap and tcpdump support for grout, the DPDK-based graph router forwarding stack (https://git.dpdk.org/apps/grout/). When grout owns the NIC, standard packet capture tools cannot access the ports. This module bridges the gap using the DPDK pdump framework.

Add pcap-dpdk-pdump.c, a new capture module that runs as a DPDK secondary process and uses rte_pdump to mirror packets from an existing primary application. This is different from pcap-dpdk.c which acts as a standalone primary and takes exclusive ownership of the NIC.

The module uses "grout:" device names (e.g. grout:0) to avoid conflicts with pcap-dpdk.c's "dpdk:" prefix. Both modules can coexist: pdump is registered first in the capture_source_types array so it initializes EAL as secondary before the standalone module runs.

The secondary attaches to the primary's shared hugepages, creates an rte_ring and rte_mempool, then calls rte_pdump_enable() to install RX/TX callbacks in the primary that copy packets into the ring. The dispatch function drains the ring and applies BPF filters with 802.1Q VLAN tag stripping to match kernel AF_PACKET behavior: BPF runs on stripped frames while the original frame (with VLAN tag) is delivered to the callback.

The DPDK pdump support is controlled by a separate PCAP_SUPPORT_DPDK_PDUMP define and can be disabled independently with -DDISABLE_DPDK_PDUMP=ON. Default EAL arguments for the secondary process are built in so that no environment variable is needed for basic usage.

The intent is to provide libpcap and tcpdump support for grout, the
DPDK-based graph router forwarding stack (https://git.dpdk.org/apps/grout/).
When grout owns the NIC, standard packet capture tools cannot access
the ports. This module bridges the gap using the DPDK pdump framework.

Add pcap-dpdk-pdump.c, a new capture module that runs as a DPDK
secondary process and uses rte_pdump to mirror packets from an existing
primary application. This is different from pcap-dpdk.c which acts as a
standalone primary and takes exclusive ownership of the NIC.

The module uses "grout:" device names (e.g. grout:0) to avoid conflicts
with pcap-dpdk.c's "dpdk:" prefix. Both modules can coexist: pdump is
registered first in the capture_source_types array so it initializes
EAL as secondary before the standalone module runs.

The secondary attaches to the primary's shared hugepages, creates an
rte_ring and rte_mempool, then calls rte_pdump_enable() to install
RX/TX callbacks in the primary that copy packets into the ring. The
dispatch function drains the ring and applies BPF filters with 802.1Q
VLAN tag stripping to match kernel AF_PACKET behavior: BPF runs on
stripped frames while the original frame (with VLAN tag) is delivered
to the callback.

The DPDK pdump support is controlled by a separate PCAP_SUPPORT_DPDK_PDUMP
define and can be disabled independently with -DDISABLE_DPDK_PDUMP=ON.
Default EAL arguments for the secondary process are built in so that
no environment variable is needed for basic usage.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
@guyharris

Copy link
Copy Markdown
Member

This also needs to support autoconf, with a --enable_ option.

@guyharris

Copy link
Copy Markdown
Member

Add pcap-dpdk-pdump.c, a new capture module that runs as a DPDK secondary process and uses rte_pdump to mirror packets from an existing primary application. This is different from pcap-dpdk.c which acts as a standalone primary and takes exclusive ownership of the NIC.

Presumably you mean that pcap-dpdk-pdump.c runs a separate process, rather than that pcap-dpdk-pdump.c code can only be run in a special separate process running a program designed to work with some primary program.

@infrastation infrastation added the DPDK Data Plane Development Kit label Mar 17, 2026
vjardin added a commit to vjardin/grout that referenced this pull request Mar 17, 2026
Add a --pdump flag that enables DPDK secondary process attachment for
packet capture. When set, grout starts without --in-memory (shared
hugepages) and calls rte_pdump_init() to register the IPC handler.

Stock system tcpdump can then attach as a secondary process and
capture live traffic using the grout:N device syntax. A wrapper script
(subprojects/packagefiles/libpcap/grout-tcpdump.sh) handles the
LD_LIBRARY_PATH setup while libpcap upstream support is pending
(the-tcpdump-group/libpcap#1656).

The libpcap subproject is built as a shared library with DPDK pdump
support via cmake. It produces libpcap.so with both PCAP_SUPPORT_DPDK
(standalone dpdk:N devices) and PCAP_SUPPORT_DPDK_PDUMP (secondary
grout:N devices) enabled.

The DPDK subproject requires a patch to lib/eal/common/eal_common_thread.c
that removes an overly conservative rte_mp_disable() call from
rte_thread_register(), which blocked secondary process attachment
when non-EAL worker threads are registered.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
@mcr

mcr commented Mar 18, 2026

Copy link
Copy Markdown
Member

The module uses "grout:" device names (e.g. grout:0) to avoid conflicts with pcap-dpdk.c's "dpdk:" prefix.

Last info I had, is that pcap-dpdk.c had no maintainer.
If your code does everything pcap-dpdk did, and it sounds like it does and does it better, then let's nuke pcap-dpdk.c.
I'd have no problem if you replace pcap-dpdk.c, and if the syntax for interfaces is nominally compatible, or at least, understable to dpdk people, then take over dpdk: prefix too.

@vjardin

vjardin commented Mar 19, 2026

Copy link
Copy Markdown
Author

bad news: it was wrongly working since it relies on the secondary process feature of the DPDK which is a wrong design option. Instead of pushing this bad solution, I do prefer to give it up and I'll post a new design that shall be safer.

FYI, it is WIP at vjardin@3da7a90

Note: about the other libpcap DPDK, I am not interested to take over the maintenance of this part, it does not match my use cases.

@vjardin vjardin closed this Mar 19, 2026
@vjardin

vjardin commented Mar 20, 2026

Copy link
Copy Markdown
Author

superseded by #1659

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DPDK Data Plane Development Kit

Development

Successfully merging this pull request may close these issues.

4 participants