xref: /OK3568_Linux_fs/kernel/samples/pktgen/README.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunSample and benchmark scripts for pktgen (packet generator)
2*4882a593Smuzhiyun==========================================================
3*4882a593SmuzhiyunThis directory contains some pktgen sample and benchmark scripts, that
4*4882a593Smuzhiyuncan easily be copied and adjusted for your own use-case.
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunGeneral doc is located in kernel: Documentation/networking/pktgen.rst
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunHelper include files
9*4882a593Smuzhiyun====================
10*4882a593SmuzhiyunThis directory contains two helper shell files, that can be "included"
11*4882a593Smuzhiyunby shell source'ing.  Namely "functions.sh" and "parameters.sh".
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunCommon parameters
14*4882a593Smuzhiyun-----------------
15*4882a593SmuzhiyunThe parameters.sh file support easy and consistant parameter parsing
16*4882a593Smuzhiyunacross the sample scripts.  Usage example is printed on errors::
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun Usage: ./pktgen_sample01_simple.sh [-vx] -i ethX
19*4882a593Smuzhiyun  -i : ($DEV)       output interface/device (required)
20*4882a593Smuzhiyun  -s : ($PKT_SIZE)  packet size
21*4882a593Smuzhiyun  -d : ($DEST_IP)   destination IP. CIDR (e.g. 198.18.0.0/15) is also allowed
22*4882a593Smuzhiyun  -m : ($DST_MAC)   destination MAC-addr
23*4882a593Smuzhiyun  -p : ($DST_PORT)  destination PORT range (e.g. 433-444) is also allowed
24*4882a593Smuzhiyun  -t : ($THREADS)   threads to start
25*4882a593Smuzhiyun  -f : ($F_THREAD)  index of first thread (zero indexed CPU number)
26*4882a593Smuzhiyun  -c : ($SKB_CLONE) SKB clones send before alloc new SKB
27*4882a593Smuzhiyun  -n : ($COUNT)     num messages to send per thread, 0 means indefinitely
28*4882a593Smuzhiyun  -b : ($BURST)     HW level bursting of SKBs
29*4882a593Smuzhiyun  -v : ($VERBOSE)   verbose
30*4882a593Smuzhiyun  -x : ($DEBUG)     debug
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunThe global variable being set is also listed.  E.g. the required
33*4882a593Smuzhiyuninterface/device parameter "-i" sets variable $DEV.
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunCommon functions
36*4882a593Smuzhiyun----------------
37*4882a593SmuzhiyunThe functions.sh file provides; Three different shell functions for
38*4882a593Smuzhiyunconfiguring the different components of pktgen: pg_ctrl(), pg_thread()
39*4882a593Smuzhiyunand pg_set().
40*4882a593Smuzhiyun
41*4882a593SmuzhiyunThese functions correspond to pktgens different components.
42*4882a593Smuzhiyun * pg_ctrl()   control "pgctrl" (/proc/net/pktgen/pgctrl)
43*4882a593Smuzhiyun * pg_thread() control the kernel threads and binding to devices
44*4882a593Smuzhiyun * pg_set()    control setup of individual devices
45*4882a593Smuzhiyun
46*4882a593SmuzhiyunSee sample scripts for usage examples.
47