[DPDK] dumpcap报错EAL init failed: is primary process running?解决办法
问题
我写了一个DPDK程序,现在想要用DPDK自带的dpdk-dumpcap工具来抓包测试。根据官网描述,我们需要先启动我们的程序为主进程,然后启动dpdk-dumpcap为副进程。但是我直接运行dpdk-dumpcap,显示如下错误:
注:在编译DPDK时,需要有libpcap库才会编译dpdk-dumpcap程序。
${DPDK_HOME}/build/app/dpdk-dumpcap -D
EAL: Cannot initialize tailq: RTE_FIB
Tailq 0: qname:<RTE_RING>, tqh_first:0x11fff2d1c0, tqh_last:0x11fff2d1c0
Tailq 1: qname:<RTE_MEMPOOL>, tqh_first:0x11fff2d280, tqh_last:0x11fff2d280
Tailq 2: qname:<RTE_MBUF_DYNFIELD>, tqh_first:(nil), tqh_last:0x1000044e8
Tailq 3: qname:<RTE_MBUF_DYNFLAG>, tqh_first:(nil), tqh_last:0x100004518
Tailq 4: qname:<UIO_RESOURCE_LIST>, tqh_first:(nil), tqh_last:0x100004548
Tailq 5: qname:<VFIO_RESOURCE_LIST>, tqh_first:(nil), tqh_last:0x100004578
Tailq 6: qname:<RTE_HASH>, tqh_first:(nil), tqh_last:0x1000045a8
Tailq 7: qname:<RTE_FBK_HASH>, tqh_first:(nil), tqh_last:0x1000045d8
Tailq 8: qname:<RTE_THASH>, tqh_first:(nil), tqh_last:0x100004608
Tailq 9: qname:<RTE_REORDER>, tqh_first:(nil), tqh_last:0x100004638
Tailq 10: qname:<RTE_ACL>, tqh_first:(nil), tqh_last:0x100004668
Tailq 11: qname:<RTE_LPM>, tqh_first:(nil), tqh_last:0x100004698
Tailq 12: qname:<RTE_LPM6>, tqh_first:(nil), tqh_last:0x1000046c8
Tailq 13: qname:<RTE_SWX_PIPELINE>, tqh_first:(nil), tqh_last:0x1000046f8
Tailq 14: qname:<RTE_SWX_CTL_PIPELINE>, tqh_first:(nil), tqh_last:0x100004728
Tailq 15: qname:<RTE_STACK>, tqh_first:(nil), tqh_last:0x100004758
Tailq 16: qname:<VMBUS_RESOURCE_LIST>, tqh_first:(nil), tqh_last:0x100004788
Tailq 17: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 18: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 19: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 20: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 21: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 22: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 23: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 24: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 25: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 26: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 27: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 28: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 29: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 30: qname:<>, tqh_first:(nil), tqh_last:(nil)
Tailq 31: qname:<>, tqh_first:(nil), tqh_last:(nil)
EAL: FATAL: Cannot init tail queues for objects
EAL: Cannot init tail queues for objects
EAL: Error - exiting with code: 1
Cause: EAL init failed: is primary process running?
根据报错的信息,dpdk-dumpcap貌似识别不到我的主进程。但事实上应该是能识别到的,因为如果不启动主进程的话,会在一开始额外报如下错误:
EAL: failed to send to (/var/run/dpdk/rte/mp_socket) due to No such file or directory
EAL: Fail to send request /var/run/dpdk/rte/mp_socket:bus_vdev_mp
vdev_scan(): Failed to request vdev from primary
...
上网查找一番,最后在Secondary DPDK with FastClick · Issue #339 · tbarbette/fastclick · GitHub里找到了问题原因。原因在于我的主进程和dpdk-dumpcap的编译选项不同,所以无法识别。毕竟我的主进程是用我自己写的cmake文件编译的,而dpdk-dumpcap是用默认的meson编译的,二者编译选项肯定不同。
解决办法
dpdk-dumpcap的源代码只有一个文件。所以我直接复制过来放到我的cmake项目里,跟着主程序一起编译,这样就能保证编译选项相同了。
标签:last,EAL,nil,process,tqh,qname,报错,Tailq,first From: https://www.cnblogs.com/CQzhangyu/p/18406754