I am testing dpdk application in PC with PCI-E Dual-RJ45 gigabit NIC card to develop a network based application. I have started my project with dpdk 21.08 and Codewarrior IDE.
PC details :
uname -a
Linux mglocadmin-ThinkCentre-M73 5.15.0-105-generic #115~20.04.1-Ubuntu SMP Mon Apr 15 17:33:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
The following steps to install DPDK (Data Plane Development Kit) on Ubuntu 20.04:
sudo apt update
sudo apt install build-essential meson python3-pyelftools libnuma-dev pkgconf
wget https://fast.dpdk.org/rel/dpdk-21.08.tar.xz
tar -xf dpdk-21.08.tar.xz
meson build
ninja -C build
meson -Dexamples=all build
sudo ninja install
sudo ldconfig
Setup hugepage in PC:
mkdir -p /dev/hugepages
mountpoint -q /dev/hugepages || mount -t hugetlbfs nodev /dev/hugepages
echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
Log "dpdk-devbind.py -s":
Network devices using DPDK-compatible driver
0000:02:00.0 '82571EB/82571GB Gigabit Ethernet Controller D0/D1 (copper applications) 105e' drv=uio_pci_generic unused=e1000e,vfio-pci
0000:02:00.1 '82571EB/82571GB Gigabit Ethernet Controller D0/D1 (copper applications) 105e' drv=uio_pci_generic unused=e1000e,vfio-pci
Network devices using kernel driver
0000:03:00.0 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller 8168' if=enp3s0 drv=r8169 unused=vfio-pci,uio_pci_generic *Active*
I follow the steps to load DPDK KNI Kernel Module below the link
https://doc.dpdk.org/guides-21.08/prog_guide/kernel_nic_interface.html#kni-default-carrier-state
Testing KNI application in PC
$ sudo ./dpdk-kni -l 0-1 -n 4 -- -P -p 0x3 --config="(0,0,0),(1,1,1)"
ERROR log:
EAL: Detected 4 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: No available 1048576 kB hugepages reported
EAL: VFIO support initialized
EAL: Probe PCI driver: net_e1000_em (8086:105e) device: 0000:02:00.0 (socket 0)
EAL: Probe PCI driver: net_e1000_em (8086:105e) device: 0000:02:00.1 (socket 0)
TELEMETRY: No legacy callbacks, legacy socket not created
KNI: Can not open /dev/kni
APP: Initialising port 0 ...
KNI: KNI subsystem has not been initialized. Invoke rte_kni_init() first
EAL: Error - exiting with code: 1
Cause: Fail to create kni for port: 0
Try to find rte_kni.ko kernal module file in DPDK directory :
$ sudo find / -name rte_kni.ko
rte_kni.ko: No such file or directory
NOTE: Dpdk-l2fwd and Dpdk-L2fwd-crypto working in PC
kindly help us to resolve this issue.
已解决! 转到解答。
Thank you for your Reply @yipingwang .
I am using meson to configuration and ninja to build DPDK application and also i find the solution on my own
Here the solution(using Meson):
1.Need to edit the /home/mglocadmin/NIC/dpdk-21.08/meson_options.txt file and make sure that you enable the boolean as a true to get rte_kni.ko
option('enable_kmods', type: 'boolean', value: true, description:'build kernel modules')
2.Build and test KNI
meson -Dexamples=all build
ninja –C build
Log:
make: Entering directory '/usr/src/linux-headers-5.15.0-105-generic'
CC [M] /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/kni_net.o
CC [M] /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/kni_misc.o
LD [M] /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/rte_kni.o
MODPOST /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/Module.symvers
CC [M] /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/rte_kni.mod.o
LD [M] /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/rte_kni.ko
BTF [M] /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/rte_kni.ko
3.Load KNI module
sudo insmod /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/rte_kni.ko kthread_mode=multiple
To cross-compile DPDK, including the kernel modules, the kernel source tree needs to be specified by setting RTE_KERNELDIR:
make -j CROSS=aarch64-linux-gnu- RTE_KERNELDIR=<kernel_src_rootdir> CROSS_COMPILE=aarch64-linux-gnu-
Thank you for your Reply @yipingwang .
I am using meson to configuration and ninja to build DPDK application and also i find the solution on my own
Here the solution(using Meson):
1.Need to edit the /home/mglocadmin/NIC/dpdk-21.08/meson_options.txt file and make sure that you enable the boolean as a true to get rte_kni.ko
option('enable_kmods', type: 'boolean', value: true, description:'build kernel modules')
2.Build and test KNI
meson -Dexamples=all build
ninja –C build
Log:
make: Entering directory '/usr/src/linux-headers-5.15.0-105-generic'
CC [M] /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/kni_net.o
CC [M] /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/kni_misc.o
LD [M] /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/rte_kni.o
MODPOST /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/Module.symvers
CC [M] /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/rte_kni.mod.o
LD [M] /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/rte_kni.ko
BTF [M] /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/rte_kni.ko
3.Load KNI module
sudo insmod /home/mglocadmin/NIC/dpdk-21.08/build/kernel/linux/kni/rte_kni.ko kthread_mode=multiple