dpdk: add pdump capture module for DPDK secondary process#1656
Conversation
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>
|
This also needs to support autoconf, with a |
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. |
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>
Last info I had, is that pcap-dpdk.c had no maintainer. |
|
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. |
|
superseded by #1659 |
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.