Transmitting packets from NIC in DPDK - For Beginners

Introduction

In the last article, I have explained about a basic DPDK application which reads the packets from NIC interface. In this article we will learn about packet transmission from NIC interface. If you are passionate about fast packet processing using DPDK then this article is for you.

Setting up DPDK environment

The DPDK environment setup includes binding the NIC to the specific kernel modules to access them directly and setting up huge pages. All of this is explained in detail in the last article. Kindly go through it in case you need to setup your DPDK environment.

Writing DPDK application

After setting up DPDK environment, we will now write our C++ based DPDK application which transmit the packets from NIC. The application is present at:
https://github.com/awaiskhalidawan/dpdk-tutorials.

Below are the steps to build and run the application:

git clone https://github.com/awaiskhalidawan/dpdk-tutorials.git
cd dpdk-tutorials/
mkdir build
cd build
cmake ..
make

The application binaries will be generated in dpdk-tutorials/bin folder after the successful execution of above steps.

To finally run your DPDK application:

cd dpdk-tutorials/bin
sudo ./sending-a-packet-from-nic --lcores=0 -n 4 --

Congratulations! You have run your DPDK application. This is a simple application which simply transmits packets on NIC interface and prints the total packets transmitted after each transmission. All of this is being done without the involvement of Linux Kernel.

There is an extensive explanation of DPDK APIs and steps in the code of this application. Don't forget to go through the code while you run this DPDK application.

Summary

In this article, a simple DPDK application is written and executed. This application transmits packets on NIC interface and prints the transmitted packet count.

Feel free to write me in the comments if you are unable to perform the steps successfully, mentioned in this article.

1
Subscribe to my newsletter

Read articles from Muhammad Awais Khalid directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Muhammad Awais Khalid
Muhammad Awais Khalid

I am a software engineer. During my career, I have developed high performance software solutions in multiple domains. I have expertise in: C/C++, Linux, Data Plane Development Kit (DPDK), VoIP (Voice Over IP) Lawful Interception Systems, Parallel Computing, GPU Computing