1
votes

I'm trying to use testpmd as a traffic sniffer and I want to save that traffic into a .pcap file. I've installed and configured DPDK and binded the interface from which I want to capture traffic.

Network devices using DPDK-compatible driver

0000:01:00.0 'I210 Gigabit Network Connection 157b' drv=igb_uio unused=igb

Network devices using kernel driver

0000:02:00.0 'I210 Gigabit Network Connection 157b' if=enp2s0 drv=igb unused=igb_uio Active 0000:03:00.0 'I210 Gigabit Network Connection 157b' if=enp3s0 drv=igb unused=igb_uio Active 0000:04:00.0 'QCA986x/988x 802.11ac Wireless Network Adapter 003c' if=wlp4s0 drv=ath10k_pci unused=igb_uio

The problem I find is the following:

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 is not able to open enp1s0 because it is being used by DPDK so the kernel does not have access to it.

What can I do?

Thanks in advance!!

1
I'm not sure I understand your last sentence. Do you mean you already have a DPDK application polling from that port and you'd like to run testpmd on the same port?? - pchaigno
No I've just binded the interface with DPDK with: sudo ./usertools/dpdk-devbind.py -b igb_uio 0000:01:00.0 Now I want to capture traffic using testpmd in that interface - MZab

1 Answers

0
votes

PMD is not able to open enp1s0 because it is being used by DPDK so the kernel does not have access to it.

You are right. The idea behind pcap PMD is to use kernel interface and/or .pcap files in DPDK using pcap library. But once you bound an interface to UIO, you cannot open it anymore with pcap library:

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

Instead we can use another interface (say, enp2s0) as a source:

--vdev 'eth_pcap0,rx_iface=enp2s0,tx_pcap=/home/output.pcap'

Or we can use another .pcap file as a source:

--vdev 'eth_pcap0,rx_pcap=/home/input.pcap,tx_pcap=/home/output.pcap'

Also please note that writing to .pcap might slow down the testpmd performance, i.e. the performance will be bound by pcap_dump() calls.