我试图使用testpmd作为流量嗅探器,并希望将该流量保存到.pcap文件中。我已经安装和配置了DPDK,并绑定了我想要捕获流量的接口。
使用DPDK兼容驱动程序的网络设备
0000:01:00.0 'I210千兆网络连接157 B‘drv=igb_uio unused=igb
使用内核驱动程序的网络设备
0000:02:00.0 'I210千兆网络连接157 B‘if=enp2s0 drv=igb unused=igb_uio活动0000:03:00.0 'I210千兆网络连接157 B’if=enp3s0 drv=igb unused=igb_uio活动0000:04:00.0 'QCA986x/988x 802.11ac无线网络适配器003c‘if=wlp4s0 drv=ath10k_pci unused=igb_uio
我发现的问题如下:
my@server:~/dpdk-stable-17.11.1$ sudo build/app/testpmd -c '0xf' -n 4 --vdev 'eth_pcap0,rx_iface=enp1s0,tx_pcap=/home/output.pcap' -- --port-topology=chained --total-num-mbufs=2048 --nb-cores=3
EAL: Detected 4 lcore(s)
EAL: Probing VFIO support...
EAL: PCI device 0000:01:00.0 on NUMA socket -1
EAL: Invalid NUMA socket, default to 0
EAL: probe driver: 8086:157b net_e1000_igb
EAL: PCI device 0000:02:00.0 on NUMA socket -1
EAL: Invalid NUMA socket, default to 0
EAL: probe driver: 8086:157b net_e1000_igb
EAL: PCI device 0000:03:00.0 on NUMA socket -1
EAL: Invalid NUMA socket, default to 0
EAL: probe driver: 8086:157b net_e1000_igb
PMD: Initializing pmd_pcap for eth_pcap0
PMD: Couldn't open enp1s0: enp1s0: SIOCETHTOOL(ETHTOOL_GET_TS_INFO) ioctl failed: No such device
PMD: Couldn't open interface enp1s0
vdev_probe(): failed to initialize eth_pcap0 device
EAL: Bus (vdev) probe failed.
USER1: create a new mbuf pool <mbuf_pool_socket_0>: n=2048, size=2176, socket=0
Configuring Port 0 (socket 0)
Port 0: 00:0D:B9:48:87:54
Checking link statuses...
Done
No commandline core given, start packet forwarding
io packet forwarding - ports=1 - cores=1 - streams=1 - NUMA support enabled, MP over anonymous pages disabled
Logical Core 1 (socket 0) forwards packets on 1 streams:
RX P=0/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
io packet forwarding packets/burst=32
nb forwarding cores=3 - nb forwarding ports=1
port 0:
CRC stripping enabled
RX queues=1 - RX desc=128 - RX free threshold=32
RX threshold registers: pthresh=8 hthresh=8 wthresh=4
TX queues=1 - TX desc=512 - TX free threshold=0
TX threshold registers: pthresh=8 hthresh=1 wthresh=16
TX RS bit threshold=0 - TXQ flags=0x0
Press enter to exit
PMD: eth_igb_interrupt_action(): Port 0: Link Up - speed 1000 Mbps - full-duplex
Port 0: LSC event
Telling cores to stop...
Waiting for lcores to finish...
---------------------- Forward statistics for port 0 ----------------------
RX-packets: 4498370 RX-dropped: 1630 RX-total: 4500000
TX-packets: 4498370 TX-dropped: 0 TX-total: 4498370
----------------------------------------------------------------------------
+++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
RX-packets: 4498370 RX-dropped: 1630 RX-total: 4500000
TX-packets: 4498370 TX-dropped: 0 TX-total: 4498370
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Done.
Shutting down port 0...
Stopping ports...
Done
Closing ports...
Done
Bye...PMD无法打开enp1s0,因为它是由DPDK使用的,因此内核无法访问它。
我能做什么?
提前谢谢!!
发布于 2018-04-16 17:17:48
PMD无法打开enp1s0,因为它是由DPDK使用的,因此内核无法访问它。
你是正确的。pcap的思想是使用pcap在DPDK中使用内核接口和/或.pcap文件。但是,一旦将接口绑定到UIO,就不能再用pcap打开它了:
PMD: Initializing pmd_pcap for eth_pcap0
PMD: Couldn't open enp1s0: enp1s0: SIOCETHTOOL(ETHTOOL_GET_TS_INFO) ioctl failed: No such device
PMD: Couldn't open interface enp1s0
vdev_probe(): failed to initialize eth_pcap0 device相反,我们可以使用另一个接口(例如,enp2s0)作为源:
--vdev 'eth_pcap0,rx_iface=enp2s0,tx_pcap=/home/output.pcap'或者我们可以使用另一个.pcap文件作为源:
--vdev 'eth_pcap0,rx_pcap=/home/input.pcap,tx_pcap=/home/output.pcap'还请注意,写入.pcap可能会减慢testpmd性能,即性能将受到pcap_dump()调用的约束。
https://stackoverflow.com/questions/49860366
复制相似问题