Search code examples
dpdkdpdk-pmd

DPDK l2fwd - How to forward ethernet interface to my PMD


I have a board with one ethernet interface (eth0) running Linux. I'm trying to forward all incoming traffic from eth0 to my PMD driver, using dpdk-l2fwd example application.

Here is what I've tried:

./dpdk-l2fwd -c 0x3 --vdev={my_pmd}0 -- -p 0x3 -T 0

I can see that my rx_pkt_burst callback is polled by the application, but that's it.

How can I forward all incoming eth0 packets to my PMD?

I tried to use net_tap, using the following command:

./dpdk-l2fwd -c 0xff --vdev=net_tap0 --vdev={my_pmd}0 -- -p 0x7 -T 0 --portmap="(1,2)"

And my tx_pkt_burst callback is called occasionally, but not when I think it should be called. For example, if I ping this board from another one, the ping is successful, but the tx_pkt_burst callback is not been called.

I tried to use devbind tool, but no devices are detected:

./usertools/dpdk-devbind.py --status

No 'Network' devices detected
=============================

No 'Baseband' devices detected
==============================

No 'Crypto' devices detected
============================

No 'Eventdev' devices detected
==============================

No 'Mempool' devices detected
=============================

No 'Compress' devices detected
==============================

No 'Misc (rawdev)' devices detected
===================================

No 'Regex' devices detected
===========================

Update

  • DPDK version - 20.11.
  • My HW is a embedded device based on NXP's Layerscape.
$ lshw -class network
  *-network
       description: Ethernet interface
       physical id: 3
       logical name: eth0
       serial: 00:11:22:44:11:44
       size: 1Gbit/s
       capacity: 1Gbit/s
       capabilities: ethernet physical tp mii 10bt-fd 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=fsl_dpaa2_eth driverversion=5.10.35-00002-g3434eea0e1e7-dir duplex=full firmware=7.17 ip=192.168.15.157 link=yes multicast=yes port=twisted pair speed=1Gbit/s

I'm trying to bypass all traffic to the PMD I'm currently developing.

Thanks.


Solution

  • [EDIT-1] clarification of using same interface for DPDK and Kernel routing

    Answer> as discussed over comments please refer to DPDKD + kernel on same interface

    Based on the information shared there are multiple questions to the single query I'm trying to bypass all traffic to the PMD I'm currently developing. Addressing each one separately below

    1. question 1: using dpdk-l2fwd example application

    Answer> DPDK application l2fwd application makes use of basic APi with almost no HW offloads. Based on your environment (I have a board with one ethernet interface (eth0)), the right set of parameters should be -p 0x1 --no-mac-updating -T 1. This will configure the application to receive and transmit packet using single DPDK interface (that is eth0 on your board).

    Note: DPDK Application can work with DPDK PMD both physical and virtual

    1. question 2: I tried to use net_tap, using the following command:

    Answer> If the intend is to intercept the traffic from physical and then forward to tap interface, then one needs modify the eal arguments as ./build/l2fwd --vdev=net_tap0,iface="my_eth0" -- -p 0x3 -T 1 --no-mac-updating. This will allow the application to probe physical NXP interface (eth0) and make use of Linux TAP interface as secondary interface. Thus any traffic from NXP and TAP will be cross connected such as NXP (eth0) <==> TAP (my_eth0)

    1. question 3: ./usertools/dpdk-devbind.py --status returns empty

    Answer> Form the dpdk site supported NIC list NXP dpaa, dpaa2, enetc, enetfec, pfe. Cross checking the kernel driver fsl_dpaa2_eth I think it is safe to assume dpaa2 PMD is supported. As you have mentioned the NIC is not enumerated, it looks like there are certain caveats to such model revision, supported board, BSP package, vendor-sub vendor ID check etc. More details can be found Board Support Package, and DPAA2 NIC guide

    Debug & Alternative solutions:

    1. To start with use the Kernel Driver to bring in packets
    2. Use extra logging and debug to identify why the NIC is shown in the application

    Approach 1:

    1. Make sure the NIC is bind with kernel driver fsl_dpaa2_eth.
    2. ensure NIC is connected and link is up with ethtool eth0
    3. set to promiscous mode with ifconfig eth0 promisc up
    4. start DPDK application with PCAP PMD, ./build/l2fwd --vdev=net_pcap0,iface=eth0 -- -p 1 --no-mac-updating -T 1
    5. Check packet are received and redirected to PCAP eth0 PMD by checking the statistics.

    Approach 2:

    1. Ideally the NIC should be categorized under network device to be probed by debind.py.
    2. Check the device details using lshw -c net -businfo for network.
    3. try checking with lspci -Dvmmnnk [PCIe BUS:Slot:Function id] for network details.
    4. If above details does not show up as network device this might be reason for not getting listed.
    • Suggestions or workaround: You can try to forcefully bind with igb_uio or vfio-pci (I am not much famialr with NXP SoC) by dpdk-devbind -b vfio-pci [PCIe S:B:F]. Then cross check with lspci -ks [PCIe S:B:F]. Once successfully done, one can start dpdk l2fwd in PMD debug mode with ./build/l2fwd -a [PCIe S:B:F] --log-level=pmd,8 -- -p 1 --no-mac-updating | more. Thus by intercepting and interpreting the logs one can identify what is going

    Note:

    1. It is assumed the application is build with static libraries and not dynamic. To build with static libraries use make static for l2fwd.
    2. For the described use case recommended application is basicfwd/skeleton rather than l2fwd.