Reference Documentation

IntelĀ® PAC
Napatech SmartNIC
Reference Information
Napatech Software Suite: pktgen


The pktgen tool is used to generate and transmit packets to a specified port.


pktgen [-p] [-n] [-m] [-s] [-i] [-r] [-t] [-f] [--help] [-h]

Command Description
--help, -hDisplay the help text.
-f <file> Replay the file
Note: -f option overrules -m, -s, -i, and -t options.
Note: Without -r option, replay at capture speed; use -r option to set a fixed rate.
-p <port>Set the port to transmit on.
-n <packets to transmit>0 = infinite
If used with -f, the parameter specifies the number of times to replay the file.
-r <rate[K|M|G]>0 = line rate
<rate> = <rate> Mbps
<rate>K = <rate> Kbps
<rate>M = <rate> Mbps
<rate>G = <rate> Gbps
Note: Not all adapters support speeds lower than 1Mbps.
-m <offset:8|16|32|64>Insert an incrementing sequence number modifier at <offset> with a bit width of 8|16|32|64
-s <packet size>Fixed packet size
-s r[<min>:<max>]Random packet size between [min:max]
-s i[<min>:<max>]Increment packet size between [min:max]
-s d[<min>:<max>]Decrement packet size between [min:max]
-i Inject a TX timestamp (used when measuring latency in combination with latency)
-N <NUMA node>Set the NUMA node to get a TX host buffer from
--allow-any-host-bufferIgnore error that the host buffer is too small for optimal performance and try anyway.
-t <udp|empty|inc>UDP, empty, or incrementing payload.
Empty payload means whatever content the RAM has.
For UDP packet sizes must be at least 64 bytes.
Incrementing payload is a 16-bit incrementing pattern.

Default options are:
./pktgen -p 0 -n 0 -s 1024 -r 0 -t empty

pktgen uses the TX statistic to check that every packet has been transmitted. In some cases when for example the port used by pktgen is disabled and enabled while transmitting, the TX statistic goes out of sync. This causes pktgen to hang with a message like:

Packets waiting to be sent: 243299

pktgen can then be terminated by pressing CTRL+C once again.