README.rst 2.6 KB

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