Back to home page

OSCL-LXR

 
 

    


0001 Sample and benchmark scripts for pktgen (packet generator)
0002 ==========================================================
0003 This directory contains some pktgen sample and benchmark scripts, that
0004 can easily be copied and adjusted for your own use-case.
0005 
0006 General doc is located in kernel: Documentation/networking/pktgen.rst
0007 
0008 Helper include files
0009 ====================
0010 This directory contains two helper shell files, that can be "included"
0011 by shell source'ing.  Namely "functions.sh" and "parameters.sh".
0012 
0013 Common parameters
0014 -----------------
0015 The parameters.sh file support easy and consistant parameter parsing
0016 across the sample scripts.  Usage example is printed on errors::
0017 
0018  Usage: ./pktgen_sample01_simple.sh [-vx] -i ethX
0019   -i : ($DEV)       output interface/device (required)
0020   -s : ($PKT_SIZE)  packet size
0021   -d : ($DEST_IP)   destination IP. CIDR (e.g. 198.18.0.0/15) is also allowed
0022   -m : ($DST_MAC)   destination MAC-addr
0023   -p : ($DST_PORT)  destination PORT range (e.g. 433-444) is also allowed
0024   -t : ($THREADS)   threads to start
0025   -f : ($F_THREAD)  index of first thread (zero indexed CPU number)
0026   -c : ($SKB_CLONE) SKB clones send before alloc new SKB
0027   -n : ($COUNT)     num messages to send per thread, 0 means indefinitely
0028   -b : ($BURST)     HW level bursting of SKBs
0029   -v : ($VERBOSE)   verbose
0030   -x : ($DEBUG)     debug
0031   -6 : ($IP6)       IPv6
0032   -w : ($DELAY)     Tx Delay value (ns)
0033   -a : ($APPEND)    Script will not reset generator's state, but will append its config
0034 
0035 The global variable being set is also listed.  E.g. the required
0036 interface/device parameter "-i" sets variable $DEV.
0037 
0038 "-a" parameter may be used to create different flows simultaneously.
0039 In this mode script will keep the existing config, will append its settings.
0040 In this mode you'll have to manually run traffic with "pg_ctrl start".
0041 
0042 For example you may use:
0043 
0044     source ./samples/pktgen/functions.sh
0045     pg_ctrl reset
0046     # add first device
0047     ./pktgen_sample06_numa_awared_queue_irq_affinity.sh -a -i ens1f0 -m 34:80:0d:a3:fc:c9 -t 8
0048     # add second device
0049     ./pktgen_sample06_numa_awared_queue_irq_affinity.sh -a -i ens1f1 -m 34:80:0d:a3:fc:c9 -t 8
0050     # run joint traffic on two devs
0051     pg_ctrl start
0052 
0053 Common functions
0054 ----------------
0055 The functions.sh file provides; Three different shell functions for
0056 configuring the different components of pktgen: pg_ctrl(), pg_thread()
0057 and pg_set().
0058 
0059 These functions correspond to pktgens different components.
0060  * pg_ctrl()   control "pgctrl" (/proc/net/pktgen/pgctrl)
0061  * pg_thread() control the kernel threads and binding to devices
0062  * pg_set()    control setup of individual devices
0063 
0064 See sample scripts for usage examples.