我想运行pdump来捕获dpdk的l3fwd应用程序上的数据包。 但我在按照 dpdk 文档中讨论的步骤操作时遇到了错误。
我使用 dpdk 版本 24.03,我想与 l3fwd acl 应用程序一起运行 pdump。 我已按照 dpdk 文档中的建议按以下方式修改了 l3fwd 代码:
#define RTE_LIBRTE_PDUMP 1
#ifdef RTE_LIBRTE_PDUMP
#include <rte_pdump.h>
#endif
我已经添加了
rte_pdump_uninit(); in signal_handler
signal_handler(int signum)
{
if (signum == SIGINT || signum == SIGTERM) {
printf("\n\nSignal %d received, preparing to exit...\n",
signum);
#ifdef RTE_LIBRTE_PDUMP
/* uninitialize packet capture framework */
rte_pdump_uninit();
printf("*************** PDUMP IS ALSO EXITING *********");
#endif
force_quit = true;
}
}
我在 main() 中添加了以下代码片段
#ifdef RTE_LIBRTE_PDUMP
/* initialize packet capture framework */
rte_pdump_init();
#endif
完成更改后,我重新编译了 dpdk 应用程序并运行 l3fwd acl,我将添加以下输出:
sudo ./build/examples/dpdk-l3fwd -c ff -n 3 -- -p 0x3 --lookup acl --parse-ptype --config="(0,0,2),(1,0,3 )" --rule_ipv4="/root/rule_ipv4.db" --rule_ipv6="/root/rule_ipv6.db" -P
EAL: memzone_reserve_aligned_thread_unsafe(): Number of requested memzone segments exceeds maximum 0
PDUMP: rte_pdump_init(): cannot allocate pdump statistics
EAL: Detected CPU lcores: 56
EAL: Detected NUMA nodes: 2
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: VFIO support initialized
EAL: Probe PCI driver: net_ixgbe (8086:10fb) device: 0000:07:00.0 (socket 0)
EAL: Probe PCI driver: net_ixgbe (8086:10fb) device: 0000:07:00.1 (socket 0)
*************** Initializing PDUMP !!!!! ***************soft parse-ptype is enabled
Initializing port 0 ... Creating queues: nb_rxq=1 nb_txq=8... Port 0 modified RSS hash function based on hardware support,requested:0x3bffc configured:0x38d34
Address:00:E0:ED:32:31:1C, Destination:02:00:00:00:00:00, Allocated mbuf pool on socket 0
ACL options are:
rule_ipv4: /root/rule_ipv4.db
rule_ipv6: /root/rule_ipv6.db
alg: default
L3FWDACL: IPv4 Route entries 2:
1:1.1.1.1/32 0.0.0.0/0 0 : 65535 0 : 65535 0x0/0x0 0xffffffff-0x1fffffff-0x2
2:2.2.2.2/32 0.0.0.0/0 0 : 65535 0 : 65535 0x0/0x0 0xffffffff-0x1ffffffe-0x1
L3FWDACL: IPv4 ACL entries 0:
L3FWDACL: IPv6 Route entries 1:
1:0000:0000:0000:0000:0000:0000:0000:0000/0 0000:0000:0000:0000:0000:0000:0000:0000/0 0 : 65535 0 : 65535 0x0/0x0 0xffffffff-0x1fffffff-0x1
L3FWDACL: IPv6 ACL entries 0:
acl context <l3fwd-acl-ipv40>@0x103cd8040
socket_id=0
alg=3
first_load_sz=4
max_rules=100000
rule_size=96
num_rules=2
num_categories=1
num_tries=1
acl context <l3fwd-acl-ipv60>@0x1047b0440
socket_id=0
alg=3
first_load_sz=4
max_rules=100000
rule_size=192
num_rules=1
num_categories=1
num_tries=1
txq=0,0,0 txq=1,1,0 txq=2,2,0 txq=3,3,0 txq=4,4,0 txq=5,5,0 txq=6,6,0 txq=7,7,0
Initializing port 1 ... Creating queues: nb_rxq=1 nb_txq=8... Port 1 modified RSS hash function based on hardware support,requested:0x3bffc configured:0x38d34
Address:00:E0:ED:32:31:1D, Destination:02:00:00:00:00:01, txq=0,0,0 txq=1,1,0 txq=2,2,0 txq=3,3,0 txq=4,4,0 txq=5,5,0 txq=6,6,0 txq=7,7,0
Initializing rx queues on lcore 0 ...
Initializing rx queues on lcore 1 ...
Initializing rx queues on lcore 2 ... rxq=0,0,0
Initializing rx queues on lcore 3 ... rxq=1,0,0
Initializing rx queues on lcore 4 ...
Initializing rx queues on lcore 5 ...
Initializing rx queues on lcore 6 ...
Initializing rx queues on lcore 7 ...
Port 0: softly parse packet type info
Port 1: softly parse packet type info
Checking link status.done
Port 0 Link up at 10 Gbps FDX Autoneg
Port 1 Link up at 10 Gbps FDX Autoneg
L3FWD: lcore 1 has nothing to do
L3FWD: entering main loop on lcore 2
L3FWD: -- lcoreid=2 portid=0 rxqueueid=0
L3FWD: lcore 6 has nothing to do
L3FWD: lcore 5 has nothing to do
L3FWD: entering main loop on lcore 3
L3FWD: -- lcoreid=3 portid=1 rxqueueid=0
L3FWD: lcore 7 has nothing to do
L3FWD: lcore 0 has nothing to do
L3FWD: lcore 4 has nothing to do
然后在另一个终端中运行 dpdk pdump 应用程序,得到以下输出:
sudo ./build/app/dpdk-pdump -- --pdump 'port=0,queue=*,rx-dev=/tmp/rx.pcap,tx-dev=/tmp/tx.pcap'
EAL: Detected CPU lcores: 56
EAL: Detected NUMA nodes: 2
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket_6058_8587c6a9a8c
EAL: Selected IOVA mode 'PA'
EAL: VFIO support initialized
EAL: Probe PCI driver: net_ixgbe (8086:10fb) device: 0000:07:00.0 (socket 0)
EAL: Probe PCI driver: net_ixgbe (8086:10fb) device: 0000:07:00.1 (socket 0)
vdev_action(): failed to add vdev, net_pcap_rx_0
Port 2 MAC: 02 70 63 61 70 00
vdev_action(): failed to add vdev, net_pcap_rx_0
vdev_action(): failed to add vdev, net_pcap_tx_0
Port 3 MAC: 02 70 63 61 70 01
EAL: Fail to recv reply for request /var/run/dpdk/rte/mp_socket:mp_pdump
PDUMP: pdump_prepare_client_request(): client request for pdump enable/disable failed
EAL: Fail to recv reply for request /var/run/dpdk/rte/mp_socket:mp_pdump
PDUMP: pdump_prepare_client_request(): client request for pdump enable/disable failed
EAL: Fail to recv reply for request /var/run/dpdk/rte/mp_socket:mp_pdump
PDUMP: pdump_prepare_client_request(): client request for pdump enable/disable failed
EAL: Error - exiting with code: 1
Cause: Connection timed out
在另一个终端上运行 pdump 并收到错误后,我在 l3fwd acl 终端上得到此输出,EAL:找不到操作:mp_pdump
...
L3FWD: lcore 0 has nothing to do
L3FWD: lcore 4 has nothing to do
EAL: Cannot find action: mp_pdump
EAL: Cannot find action: mp_pdump
EAL: Cannot find action: mp_pdump
我不知道发生了什么,它本身应该运行正常。 任何帮助,将不胜感激 问候。
考虑添加
if dpdk_conf.has('RTE_LIB_PDUMP')
deps += 'pdump'
endif
到
examples/l3fwd/meson.build
并重建程序。