blob: f4adeed5f5f02b91edb008902ef573966f95d4f9 [file] [log] [blame]
Jesper Dangaard Brouerb64b0d12015-05-21 12:17:19 +02001Sample and benchmark scripts for pktgen (packet generator)
2==========================================================
3This directory contains some pktgen sample and benchmark scripts, that
4can easily be copied and adjusted for your own use-case.
5
Mauro Carvalho Chehabc1e4535f2020-04-30 18:04:13 +02006General doc is located in kernel: Documentation/networking/pktgen.rst
Jesper Dangaard Brouerb64b0d12015-05-21 12:17:19 +02007
8Helper include files
9====================
10This directory contains two helper shell files, that can be "included"
11by shell source'ing. Namely "functions.sh" and "parameters.sh".
12
13Common parameters
14-----------------
15The parameters.sh file support easy and consistant parameter parsing
16across the sample scripts. Usage example is printed on errors::
17
18 Usage: ./pktgen_sample01_simple.sh [-vx] -i ethX
19 -i : ($DEV) output interface/device (required)
20 -s : ($PKT_SIZE) packet size
Daniel T. Lee40f843e2019-10-05 17:25:09 +090021 -d : ($DEST_IP) destination IP. CIDR (e.g. 198.18.0.0/15) is also allowed
Jesper Dangaard Brouerb64b0d12015-05-21 12:17:19 +020022 -m : ($DST_MAC) destination MAC-addr
Daniel T. Lee6e32a742019-06-29 22:33:58 +090023 -p : ($DST_PORT) destination PORT range (e.g. 433-444) is also allowed
Jesper Dangaard Brouerb64b0d12015-05-21 12:17:19 +020024 -t : ($THREADS) threads to start
Tariq Toukane0e16672017-06-15 19:07:22 +030025 -f : ($F_THREAD) index of first thread (zero indexed CPU number)
Jesper Dangaard Brouerb64b0d12015-05-21 12:17:19 +020026 -c : ($SKB_CLONE) SKB clones send before alloc new SKB
Tariq Toukan69137ea2017-06-15 19:07:21 +030027 -n : ($COUNT) num messages to send per thread, 0 means indefinitely
Jesper Dangaard Brouerb64b0d12015-05-21 12:17:19 +020028 -b : ($BURST) HW level bursting of SKBs
29 -v : ($VERBOSE) verbose
30 -x : ($DEBUG) debug
Igor Russkikhc8fd4852021-03-11 11:32:53 +010031 -6 : ($IP6) IPv6
Igor Russkikhef700f22021-03-11 11:32:52 +010032 -w : ($DELAY) Tx Delay value (ns)
Igor Russkikhc8fd4852021-03-11 11:32:53 +010033 -a : ($APPEND) Script will not reset generator's state, but will append its config
Jesper Dangaard Brouerb64b0d12015-05-21 12:17:19 +020034
35The global variable being set is also listed. E.g. the required
36interface/device parameter "-i" sets variable $DEV.
37
Igor Russkikhc8fd4852021-03-11 11:32:53 +010038"-a" parameter may be used to create different flows simultaneously.
39In this mode script will keep the existing config, will append its settings.
40In this mode you'll have to manually run traffic with "pg_ctrl start".
41
42For example you may use:
43
44 source ./samples/pktgen/functions.sh
45 pg_ctrl reset
46 # add first device
47 ./pktgen_sample06_numa_awared_queue_irq_affinity.sh -a -i ens1f0 -m 34:80:0d:a3:fc:c9 -t 8
48 # add second device
49 ./pktgen_sample06_numa_awared_queue_irq_affinity.sh -a -i ens1f1 -m 34:80:0d:a3:fc:c9 -t 8
50 # run joint traffic on two devs
51 pg_ctrl start
52
Jesper Dangaard Brouerb64b0d12015-05-21 12:17:19 +020053Common functions
54----------------
55The functions.sh file provides; Three different shell functions for
56configuring the different components of pktgen: pg_ctrl(), pg_thread()
57and pg_set().
58
59These functions correspond to pktgens different components.
60 * pg_ctrl() control "pgctrl" (/proc/net/pktgen/pgctrl)
61 * pg_thread() control the kernel threads and binding to devices
62 * pg_set() control setup of individual devices
63
64See sample scripts for usage examples.