Ptkgen Install

# CentOS 7 pre-reqs:
sudo yum install make coreutils glibc-devel.x86_64 kernel-devel.x86_64 kernel-headers.x86_64 python libpcap-devel

# On CentOS when using Elrepo for a newer kernel, also install these (after installing the newer kernel and booting it):

# May have to install a previous version first
# sudo yum remove kernel-headers-XXX
sudo yum --enablerepo=elrepo-kernel install kernel-ml-headers kernel-ml-devel

sudo yum install glibc-devel gcc
sudo yum install numactl.x86_64 numactl-devel.x86_64 numactl-libs.x86_64
# Ubuntu 16 pre-reqs: sudo apt-get install make coreutils libc6-dev linux-headers-$(uname -r) build-essential libnuma-dev python libpcap-dev
# DPDK Install: mkdir /opt/dpdk cd /opt/dpdk/ wget http://fast.dpdk.org/rel/dpdk-17.08.tar.xz
# curl http://fast.dpdk.org/rel/dpdk-17.08.tar.xz -o dpdk-17.08.tar.xz tar -xvf dpdk-17.08.tar.xz cd dpdk-17.08/ export DPDK_TARGET=x86_64-native-linuxapp-gcc sudo make install T=$DPDK_TARGET DESTDIR=install
# Ptkgen Install: cd /opt/dpdk/ wget http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-3.4.2.tar.gz
# curl http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-3.4.2.tar.gz -o pktgen-3.4.2.tar.gz
tar -xvzf pktgen-3.4.2.tar.gz
cd pktgen-3.4.2/
export RTE_SDK=/opt/dpdk/dpdk-17.08
export RTE_TARGET=x86_64-native-linuxapp-gcc
make

# Disable LLDP client on NIC before detatching it from the Kernel:
sudo bash -c "echo lldp stop > /sys/kernel/debug/i40e/0000:09:00.0/command"
sudo bash -c "echo lldp stop > /sys/kernel/debug/i40e/0000:09:00.1/command"

# Load Kernel modules, shutdown interface and bind to DPDK:
cd /opt/dpdk/dpdk-17.08/usertools/
./dpdk-devbind.py --status-dev net
lsmod | grep uio
modinfo uio
sudo modprobe uio
sudo insmod /opt/dpdk/dpdk-17.08/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
modinfo /opt/dpdk/dpdk-17.08/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
lsmod | grep uio
sudo ip link set down enp0s25
sudo ./dpdk-devbind.py --bind=igb_uio enp0s25
./dpdk-devbind.py --status-dev net

# With 1G NAS
cd /opt/dpdk/pktgen-3.4.2/
sudo ./app/x86_64-native-linuxapp-gcc/pktgen -l 1-3 -n 1 -w 00:19.0 -- -P -m 2.0

# 10G uCPE
sudo ./app/x86_64-native-linuxapp-gcc/pktgen -l 2-6 -n 2 -w 09:00.0 -w 09:00.1 -v -- -P -m "[3:4].0, [5:6].1"
Pktgen:/> set 1 dst ip 192.168.0.2
Pktgen:/> set 1 dst ip 192.168.0.1
Pktgen:/> set 0 dst ip 192.168.0.1
Pktgen:/> str

lcore to port/queue binding:

sudo ./app/x86_64-native-linuxapp-gcc/pktgen -l 2-6 -n 2 -w 09:00.0 -w 09:00.1 -v -- -P -m "[3:4].0, [5:6].1"

^ This format is "[lcores].port [lcores].port". The colon ":" is used to specify seperate lcores for tx and rx queues. The above says "[lcore 3 for rx queue : lcore 4 for tx queue].of port 0, [lcore 5 for rx queue : lcore 6 for tx queue].of port 1".

Pktgen:/> page cpu
...
=== port to lcore mapping table (# lcores 5) ===
   lcore:    2       3       4       5       6      Total
port   0: ( D: T) ( 1: 0) ( 0: 1) ( 0: 0) ( 0: 0) = ( 1: 1)
port   1: ( D: T) ( 0: 0) ( 0: 0) ( 1: 0) ( 0: 1) = ( 1: 1)
Total   : ( 0: 0) ( 1: 0) ( 0: 1) ( 1: 0) ( 0: 1)
  Display and Timer on lcore 2, rx:tx counts per port/lcore

Working Examples:
Ubuntu Laptop with 1G 82579LM (fixed after adding PCI ID to e1000 driver)
Ubuntu NAS with 1G I217 NIC
HPE DL120 Gen9 10G with Intel X710 (fixed after downgrading to Kernel 3.10)


Previous page: Pound Proxy
Next page: Systap