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