--- tags: DPDK, l3fwd SOP --- # DPDK 19.11.6 l3fwd Ubuntu Linux with Pktgen ###### tags: DPDK, l3fwd ## System Updated by Sohail: 16/8/2021 Model: SCB-1921B-AA1 OS: Ubuntu 18.04.5 LTS (Kernel 5.4.0-42-generic) DPDK: 19.11.4 LTS BIOS: 1920032 Environment: ![](https://i.imgur.com/gagt9qv.png) ## Prerequisites **System requirements for compilation of the DPDK** **General development tools (with GCC version 4.9 or later)** ```javascript= # yum groupinstall "Development Tools" // For RHEL/Fedora systems # apt install build-essential // For Ubuntu/Debian systems ``` **Python (python3.5 or later)** ```javascript= # sudo apt-get install libssl-dev openssl # wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz # tar xzvf Python-3.5.0.tgz # cd Python-3.5.0 # ./configure # make # python3 --version Output: Python 3.5.0 ``` **Library for handling NUMA** ```javascript= # yum install numactl-devel // For RHEL/Fedora systems # apt install libnuma-dev // For Ubuntu/Debian systems ``` **Other tools: pkg-config** ```javascript= # apt install pkg config ``` ### **System requirements for running DPDK applications: ** ```javascript= * Linux kernel version 3.16 or later (The version can be checked using the uname -r command.) * glibc version 2.7 or later (The version can be checked using the ldd --version command. GCC auto install using pkg-config and glibc auto included. Check the GCC version using gcc --version) * Kernel configuration/grub file * HUGETLBFS * PROC_PAGE_MONITOR support * HPET and HPET_MMAP configuration options should also be enabled if HPET support is required. See the section on High Precision Event Timer (HPET) Functionality for more details. ``` http://doc.dpdk.org/guides/linux_gsg/sys_reqs.html ## Install DPDK ### Download and decompress Download DPDK from source: https://core.dpdk.org/download/ or download by command: ```javascript= # wget http://fast.dpdk.org/rel/dpdk-19.11.4.tar.xz # tar xvJf dpdk-19.11.6.tar .xz # cd dpdk-stable 19.11.6 ``` ### Install DPDK by script Run the setup script and choose the compiling options according to your target. ```javascript= # cd ~/dpdk-stable-19.11.6/usertools # ./dpdk-setup.sh ``` ![](https://i.imgur.com/2VEXUiq.png) #### Options to choose: 1. option: [44] x86_64-native-linuxapp-gcc 2. option: [48] Insert IGB UIO module 3. option: [51] Set hugepage maaping for non-NUMA systems 4. option: [52] Set hugepage maaping for NUMA systems 5. option: [65] Exit Script. ![](https://i.imgur.com/o4kZRkX.png) ### Open another terminal and check the network businfo: ```javascript= #sudo apt-get install ethtool #lshw -c network -businfo ``` ![](https://i.imgur.com/QDHX2d6.png) ### To check the specific interface ```javascript= #ethtool -p <interface name> ********* see the port there is light blinking ************ ``` ### set the grub settings: ```javascript= # sudo nano /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="default_hugepagesz=1G hugepagesz=1G hugepages=8 isolcpus=16,17,18,19 " # update-grub ``` ### Build the source code: ```javascript= # export RTE_SDK=/root/dpdk-stable-19.11.6 # cd # cd /dpdk-stable-19.11.4 # make config T=x86_64-native-linuxapp-gcc # make ``` ### setup Hugepages: ```javascript= # mkdir -p /mnt/huge # mount -t hugetlbfs nodev /mnt/huge ``` ### Build source code that you want to run, for example, l3fwd: ```javascript= # export RTE_SDK=/root/dpdk-stable-19.11.6 # cd /root/dpdk-stable-19.11.4/examples/l3fwd # make clean # make ``` ### Build DPDK Pktgen Application ```javascript= # cd /root # wget http://git.dpdk.org/apps/pktgen-dpdk/snapshot/pktgen-3.4.9.tar.gz # tar xzf pktgen-3.4.9.tar.gz # cd pktgen-3.4.9 # export RTE_SDK=/root/dpdk/dpdk-stable-17.11.10 # export RTE_TARGET=x86_64-native-linuxapp-gcc # make Use “ln” command to link pktgen and Pktgen.lua to the directory which you like: # ln -sf `pwd`/app/x86_64-native-linuxapp-gcc/pitmen /root # ln -sf `pwd`/Pktgen.lua /root ``` ### Execute the pktgen ```javascript= # ./pktgen --master-lcore 2 -c 0000000c -n 4 -w 03:00.0 -w 03:00.1 --socket-mem=512 --file-prefix=dpdk_pktgen -- -P -T -m “3.0,3.1” ``` Note: dont forget to set these parameters after running the pktgen. ![](https://i.imgur.com/hSgtn3J.png) For detail check the output pics. ### igb_uio Kmod Driver Download and Bind: Download the .gz file from this link http://git.dpdk.org/dpdk-kmods/commit/?id=cbf8177ae9bcf55359e08008d6c4e23a31f5d607 ```javascript= # tar xvf dpdk-kmods-cbf8177ae9bcf55359e08008d6c4e23a31f5d607.tar.gz # cd dpdk-kmods-cbf8177ae9bcf55359e08008d6c4e23a31f5d607 # cd /linux/igb_uio/ # modprobe uio # insmod ./igb_uio.ko ``` ### Check the Status of Devices are binded or not ```javascript= # cd /root/dpdk-stable-19.11.6/usertools # ./dpdk-devbind.py -s ``` ![](https://i.imgur.com/80HIzVl.png) ### Bind the Driver and check again ```javascript= cd /root/dpdk-stable-19.11.6/usertools # ./dpdk-devbind.py -b igb_uio 82:00.0 82:00.1 # ./dpdk-devbind.py -s ``` ![](https://i.imgur.com/VAMZC1J.png) ### Execute the sample code, l3fwd: ```javascript= # cd /root/dpdk-stable-19.11.6 # ./examples/l3fwd/build/l3fwd -c 0x3c -n 4 -- -P -p 0xf --config="(0,0,2),(1,0,3),(2,0,4),(3,0,5)" ``` ## Output Pktgen Node output ![](https://i.imgur.com/6ZuO0Ft.png) ![](https://i.imgur.com/TrjHmOA.png) l3fwd Node output ![](https://i.imgur.com/rnwfOiM.png)