0

I want to have any Traffic generator(say iperf,D-ITG or even ping) to send data to a tun interface. This tun interface should automatically forward to NIC which is binded to DPDK. I want to run l3fwd example which picks up data from the interface.

I used the option --vdev=net_tun0 in commandline which creates tun interface. I thought tun/tap PMD will automatically poll the packets at tun/tap interface and redirect to/from NIC. But, that's not happening. I am not able to receive any packets.

I require dpdk and traffic generator to run on the same PC. DPDK should pick the traffic at the userspace.

oowekyala
  • 7,518
  • 1
  • 15
  • 20
Vishal
  • 11
  • 6
  • Do you see packets go into tun0, but never appear in l3fwd? – Andriy Berestovskyy Jul 19 '19 at 19:14
  • Yes. It's the same issue. – Vishal Jul 21 '19 at 04:34
  • What’s the state of the interface and the port? – Andriy Berestovskyy Jul 21 '19 at 08:33
  • Port 0 address dpdk 00:00:00:00:00:00 destination -> NIC mac address. Port 1 is NIC port MAC address -> NIC address destination also NIC address. So, I used TAP instead of TUN which gives me the ability to set MAC address. For TAP, address is its own, destination -> NIC address. and vice versa for NIC port. NIC port has 1 rx 1 tx queue. TUN/TAP port has 0 rx , 1 tx queue. I run the l3fwd with command. ./build/l3fwd -l 1 -n 4 -- -p 3 config="(0,0,1)" --parse-ptype. – Vishal Jul 21 '19 at 18:53
  • All interfaces up and running? Why 0 RX queues on tap? – Andriy Berestovskyy Jul 21 '19 at 20:34
  • I don't know. I can see data entering the tap interface on wireshark. – Vishal Jul 22 '19 at 06:03
  • Maybe i have alloted only one lcore which is consumed by NIC. – Vishal Jul 22 '19 at 09:02
  • AL: probe driver: 8086:100e net_e1000_em rte_pmd_tap_probe(): Initializing pmd_tap for net_tap0 as gtp soft parse-ptype is enabled LPM or EM none selected, default LPM on – Vishal Jul 22 '19 at 10:00
  • Initializing port 0 ... 0 <<<<<<<<<<<>>>>>>>>>>>>>>> Creating queues: nb_rxq=1 nb_txq=1... Address:08:00:27:E7:A2:D6, Destination:00:64:74:61:70:11, Allocated mbuf pool on socket 0 LPM: Adding route 0xc0a80100 / 24 (0) LPM: Adding route 0xc0a83800 / 24 (1) LPM: Adding route IPV6 / 48 (0) LPM: Adding route IPV6 / 48 (1) – Vishal Jul 22 '19 at 10:01
  • txq=1,0,0 Initializing port 1 ... <<<<<<<<<<<>>>>>>>>>>>>>>> Creating queues: nb_rxq=0 nb_txq=1... Address:00:64:74:61:70:11, Destination:08:00:27:E7:A2:D6, txq=1,0,0 Initializing rx queues on lcore 1 ... RX QUEUES : 1 rxq=0,0,0 Port 0: softly parse packet type info Checking link status....................done Port0 Link Up. Speed 1000 Mbps -full-duplex – Vishal Jul 22 '19 at 10:01
  • I can run 1 interface at a time. If I set -p 2 Port 1 which is Tap port gets activated. And starts receiving data. If -p 1 is set, Port 0 starts receiving. But if -p 3 is set, Port 0 and Port 1 are set. And there only port 0 is receiving data. – Vishal Jul 22 '19 at 10:21
  • So did you try to add more lcores? – Andriy Berestovskyy Jul 22 '19 at 22:34
  • Yes. I found out that my laptop had only 2 cores. But, for this we require 3 lcores. 0 is for master. – Vishal Jul 23 '19 at 05:31

1 Answers1

0

Since the question is not that clear (whether it is DPDK RX-TX or Kernel RX-TX), here are the answers for DPDK application point of view

  • DPDK TUN PMD allows creating Kernel TUN interface with ip layer onwards (there is no MAC Layer). just like all PMD devices, you have to poll with rte_eth_rx_burst and use rte_eth_tx_burst inside DPDK Application.
  • Similarly, if you plan to use TAP PMD, dpdk will create Kernel TAP the interface which has to be polled with rte_eth_rx_burst and rte_eth_tx_burst inside DPDK application.

Once you use vdev=net_tap0 this creates Kernel tap interface dtap0. So to grab packets received to Kernel interface you have call rte_eth_rx_burst to send a specific packet to Kernel TAP interface you need to use rte_eth_tx_burst.

as per your requirement which is to direct any traffic generator to kernel to TAP interface, then send to physical NIC bound with DPDK, this what you have to do

  1. make use a simple application like examples/skeleton or testpmd or examples/l2fwd with no mac update`
  2. ensure you pass the vdev=net_tap0,iface=<your desired name for interface> to the DPDK application.
  3. Using ip or ifconfig bring up the interface with ip address and the state as up (Promisc mode is optional).
  4. ensure your destination address route is through tap interface by cross-checking route -n.
  5. now kick start your traffic generator with dest-ip and interface as required.

Note: In my deployment case, I ended up setting static ARP too.

This will send the packet to kernel TAP interface, which is then intercepted by DPDK application via rx_burst calls. Using port to port forward behaviour this is then forwarded to DPDK Physical NIC. In reverse direction, the packet received from physical nic is bought into the application by rx_burst and then tx_burst to TAP PMD. this will then inject to the kernel TAP interface.

Vipin Varghese
  • 4,540
  • 2
  • 9
  • 25