Pktgen Documentation
Release 2.7.7
Keith Wiles
Apr 20, 2017
1 Getting Started with Pktgen
2 Running Pktgen
3 EAL Commandline Options
4 Pktgen Commandline Options
5 Multiple Instances of Pktgen or other application
6 Runtime Options and Commands
7 Running Script Files
8 Using Lua with Pktgen
9 Socket Support for Pktgen
10 Changes in Pktgen
11 Copyright and License
12 Third Party License Notices
Contents
3
7
11
13
17
19
33
35
41
43
45
47
i
ii
Pktgen Documentation, Release 2.7.7
Pktgen, (Packet Gen-erator) is a software based traffic generator powered by the DPDK fast
packet processing framework.
Some of the features of Pktgen are:
• It is capable of generating 10Gbit wire rate traffic with 64 byte frames.
• It can act as a transmitter or receiver at line rate.
• It has a runtime environment to configure, and start and stop traffic flows.
• It can display real time metrics for a number of ports.
• It can generate packets in sequence by iterating source or destination MAC, IP addresses
or ports.
• It can handle packets with UDP, TCP, ARP, ICMP, GRE, MPLS and Queue-in-Queue.
• It can be controlled remotely over a TCP connection.
• It is configurable via Lua and can run command scripts to set up repeatable test cases.
• The software is fully available under a BSD licence.
Pktgen was created 2010 by Keith Wiles @ windriver.com, now at intel.com
Contents
1
Pktgen Documentation, Release 2.7.7
2
Contents
CHAPTER 1
Getting Started with Pktgen
This section contains instructions on how to get up and running with DPDK and the pktgen
traffic generator application.
These instructions relate to setting up DPDK and pktgen on an Ubuntu desktop system. How-
ever, the should work on any recent Linux system with kernel support for hugeTLB/hugepages.
System requirements
The main system requirement is that the DPDK packet processing framework is supported.
The DPDK Linux Getting Started Guide has a section on the System Requirements that ex-
plains the BIOS, System and Toolchain requirements to compile and run a DPDK based appli-
cation such as pktgen. Ensure that your system meets those requirements before proceeding.
You will also need a DPDK supported NIC.
The current version of pktgen was developed and tested using Ubuntu 13.10 x86_64, kernel
version 3.5.0-25, on a Westmere Dual socket board running at 2.4GHz with 12GB of ram 6GB
per socket.
Setting up hugeTLB/hugepage support
To get hugeTLB/hugepage support your Linux kernel must be at
HUGETLBFS kernel option must be enabled.
The DPDK Linux Getting Started Guide has a section on the Use of Hugepages in the Linux
Environment.
least 2.6.33 and the
Once you have made the required changed make sure you have HUGE TLB support in the
kernel with the following commands:
3
Pktgen Documentation, Release 2.7.7
$ grep -i huge /boot/config-2.6.35-24-generic
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y
$ grep -i huge /proc/meminfo
HugePages_Total:
HugePages_Free:
HugePages_Rsvd:
HugePages_Surp:
Hugepagesize:
128
128
0
0
2048 kB
The values in Total and Free may be different depending on your system.
You will need to edit the /etc/sysctl.conf file to setup the hugepages size:
$ sudo vi /etc/sysctl.conf
Add to the bottom of the file:
vm.nr_hugepages=256
You can configure the vm.nr_hugepages=256 as required.
small will effect the performance of pktgen or cause it to terminate on startup.
You will also need to edit the /etc/fstab file to mount the hugepages at startup:
$ sudo vi /etc/fstab
Add to the bottom of the file:
huge /mnt/huge hugetlbfs defaults 0 0
In some cases making it too
$ sudo mkdir /mnt/huge
$ sudo chmod 777 /mnt/huge
You should also reboot your machine as the huge pages must be setup just after boot to make
sure there is enough contiguous memory for the 2MB pages.
Note:
If you start an application that makes extensive use of hugepages, such as Eclipse or
WR Workbench, before starting pktgen for the first time after reboot, pktgen may fail to load.
In this case you should close the other application that is using hugepages.
BIOS settings
In the BIOS make sure that the HPET High Precision Event Timer is enabled. Also make
sure hyper-threading is enabled. See the DPDK documentation on enabling additional BIOS
functionality for more details.
Terminal display
The pktgen output display requires 132 columns and about 42 lines to display correctly. The
author uses an xterm of 132x42, but you can also have a larger display and maybe a bit smaller.
If you are displaying more then 4-6 ports then you will need a wider display.
4
Chapter 1. Getting Started with Pktgen