- Install a recent DPDK release e.g.
git clone https://dpdk.org/git/dpdk
sudo rm -fr /usr/local/lib/x86_64-linux-gnu # DPDK changed a number of lib names and need to clean up
cd dpdk
git checkout v23.03
meson build
ninja -C build
sudo ninja -C build install
sudo ldconfig # make sure ld.so is pointing new DPDK libraries- Install the corresponding
pktgen-dpdk
git clone http://dpdk.org/git/apps/pktgen-dpdk
cd pktgen-dpdk
git checkout pktgen-23.03.0
make
or
make build # Same as 'make'
or
make rebuild # Rebuild Pktgen, which removes the Builddir then builds it again via meson/ninja
or
make rebuildlua # to enable Lua builds
or
make rebuildgui # to enable GUI builds with GTK-
GRUB configuration:
isolcpus=0-39 nohz_full=0-39 rcu_nocbs=0-39 intel_iommu=on iommu=pt default_hugepagesz=1G hugepagesz=1G hugepages=80 intel_idle.max_cstate=0 processor.max_cstate=0 intel_pstate=disable rcu_nocb_poll audit=0
-
Flow Control OFF:
ethtool -A $netdev rx off tx off -
Memory optimizations:
sysctl -w vm.zone_reclaim_mode=0 sysctl -w vm.swappiness=0
-
Move all IRQs to far NUMA node:
IRQBALANCE_BANNED_CPUS=$LOCAL_NUMA_CPUMAP irqbalance --oneshot -
Disable irqbalance:
systemctl stop irqbalance -
Change PCI MaxReadReq to 1024B for each port of each NIC:
setpci -s $PORT_PCI_ADDRESS 68.w # it will return 4 digits ABCD setpci -s $PORT_PCI_ADDRESS 68.w=3BCD
-
Set CQE COMPRESSION to AGGRESSIVE:
mlxconfig -d $PORT_PCI_ADDRESS set CQE_COMPRESSION=1 -
Disable Linux realtime throttling:
echo -1 > /proc/sys/kernel/sched_rt_runtime_us -
Setup huge pages and hugetlbfs
mkdir -p /mnt/huge chmod 777 /mnt/huge mount -t hugetlbfs nodev /mnt/huge
-
Load vfio kernel modules by adding the following modules to
/etc/modules:vfio vfio_iommu_type1 vfio_pci vfio_virqfd
Then
update-initramfs -u -k all. -
Reboot and check:
dmesg | grep -e DMAR -e IOMMU -e AMD-Vishould display thatIOMMU,Directed I/OorInterrupt Remappingis enabled, depending on hardware and kernel the exact message can vary.It is also important that the device(s) you want to pass through are in a separate IOMMU group. This can be checked with:
find /sys/kernel/iommu_groups/ -type l -
Everything ok? Bind the device to DPDK drivers if needed. Mellanox PMD does not device binding.
# set link down ip link set dev enp2s0np0 down python3 dpdk-devbind.py -b vfio-pci 02:00.0
- Copy and edit the config file at
scripts/cfg/pktgen-setup.shtopktgen-dpdk/cfg - Copy
pktgen-40Gtopktgen-dpdk - Run
tools/run.pyin pktgen-dpdk