DPDK Framework Installation and Testing

From RidgeRun Developer Wiki



Previous: DPDK Framework/Introduction Index  







Introduction

This page summarises the process of installing the DPDK framework. It is essential to mention that not all ethernet cards are compatible with DPDK. For instance, DPDK is not compatible with the built-in ethernet card from the NVIDIA Jetson Devkit boards. For this purpose, we assume that the ethernet card is connected to the PCIe (discretely or integrately).

Installing Dependencies

The dependencies for DPDK are:

Building System:

  • meson
  • ninja

System Tools:

  • pyelftools
  • libnuma
  • build-essential

To install them:

# Update repositories
sudo apt-get update

# Install compilers and interpreters
sudo apt-get install python3 python3-pip build-essential

# Install building system
sudo apt-get install ninja-build
pip3 install meson

# Install tools
pip3 install pyelftools
sudo apt-get install libnuma-dev

Compiling DPDK

First, download DPDK from this link. For the case of this page, we are going to select the 23.11.1 LTS (Long Term Support). Alternatively, it is possible to download it using:

wget https://fast.dpdk.org/rel/dpdk-23.11.1.tar.xz

Then, uncompress the file and prepare the environment for compilation:

tar xf dpdk-23.11.1.tar.xz
cd dpdk-stable-23.11.1

Proceed with the compilation. By default, it is installed into /usr/local as prefix:

meson builddir -Dexamples=all
ninja -C builddir
sudo ninja -C builddir install

Testing DPDK

For testing the DPDK installation, first, load the UIO modules:

 sudo modprobe uio
 sudo modprobe uio_pci_generic

The UIO (Userspace IO) modules allow userspace applications to access hardware devices.

Then, it is possible to search if the device can be used for DPDK by listing it:

cd usertools
python3  ./dpdk-devbind.py -s

It should give a similar output to the following:

user@user-ridgerun ~/tmp/dpdk-stable-23.11.1/usertools $ python3 dpdk-devbind.py -s

Network devices using kernel driver
===================================
0000:02:00.0 'RTL810xE PCI Express Fast Ethernet controller 8136' if=enp2s0 drv=r8169 unused=vfio-pci,uio_pci_generic *Active*
0000:03:00.0 'QCA9377 802.11ac Wireless Network Adapter 0042' if=wlp3s0 drv=ath10k_pci unused=vfio-pci,uio_pci_generic 

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

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

No 'DMA' devices detected
=========================

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

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

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

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

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

No 'ML' devices detected
========================

The output above shows the Ethernet card: 'RTL810xE PCI Express Fast Ethernet controller 8136', which is, in this case, a laptop ethernet card.

After listing, it is possible to unbind the kernel from the Ethernet card:

NIC=enp2s0
sudo ifconfig $NIC down

where NIC=enp2s0 is the network interface, obtained by using ip addr command. The command from above releases the interface.

Then, bind it to DPDK:

PCIE_ID=0000:02:00.0
sudo python3 ./dpdk-devbind.py --bind=uio_pci_generic ${PCIE_ID}

where PCIE_ID=0000:02:00.0 is obtained using the python3 dpdk-devbind.py -s command (shown above).

To check the binding, re-execute:

cd usertools
python3  ./dpdk-devbind.py -s

the output shows the binding:

user@user-ridgerun ~/tmp/dpdk-stable-23.11.1/usertools $ python3  ./dpdk-devbind.py -s

Network devices using DPDK-compatible driver
============================================
0000:02:00.0 'RTL810xE PCI Express Fast Ethernet controller 8136' drv=uio_pci_generic unused=r8169,vfio-pci

Network devices using kernel driver
===================================
0000:03:00.0 'QCA9377 802.11ac Wireless Network Adapter 0042' if=wlp3s0 drv=ath10k_pci unused=vfio-pci,uio_pci_generic *Active*

...

To restore, unbind the adapter:

PCIE_ID=0000:02:00.0
sudo python3 ./dpdk-devbind.py --unbind ${PCIE_ID}

and restart the system.

Relevant Note

When the Ethernet card is being used by DPDK, it won't appear in ifconfig or ip addr since the kernel is not longer controlling the card. It is only accessible by DPDK-based applications.




RidgeRun Services

RidgeRun has expertise in offloading processing algorithms using FPGAs, from Image Signal Processing to AI offloading. Our services include:

  • Algorithm Acceleration using FPGAs.
  • Image Signal Processing IP Cores.
  • Linux Device Drivers.
  • Low Power AI Acceleration using FPGAs.
  • Accelerated C++ Applications.

And it includes much more. Contact us at https://www.ridgerun.com/contact.



Previous: DPDK Framework/Introduction Index