From: Juhee Kang <hidden> Date: 2021-08-25 10:57:26
This patch series improves the ability to print the execution result of pktgen
samples by adding a line which calls the function before termination and adding
trap SIGINT. Also, this series documents the latest pktgen usage options.
Currently, pktgen samples print the execution result when terminated usually.
However, sample03 is not working properly.
This is results of sample04 and sample03:
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample04_many_flows.sh -n 1
Running... ctrl^C to stop
Device: eth0@0
Result: OK: 19(c5+d13) usec, 1 (60byte,0frags)
51762pps 24Mb/sec (24845760bps) errors: 0
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample03_burst_single_flow.sh -n 1
Running... ctrl^C to stop
Because sample03 doesn't call the function which prints the execution result
when terminated normally, unlike other samples. So the first commit solves
this issue by adding a line which calls the function before termination.
Also, all pktgen samples are able to send infinite messages per thread by
setting the count option to 0, and pktgen is stopped by Ctrl-C. However,
the sample besides sample{3...5} don't work appropriately because Ctrl-C stops
the script, not just pktgen.
This is results of samples:
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample04_many_flows.sh -n 0
Running... ctrl^C to stop
^CDevice: eth0@0
Result: OK: 569657(c569538+d118) usec, 84650 (60byte,0frags)
148597pps 71Mb/sec (71326560bps) errors: 0
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample01_simple.sh -n 0
Running... ctrl^C to stop
^C
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample02_multiqueue.sh -n 0
Running... ctrl^C to stop
^C
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample06_numa_awared_queue_irq_affinity.sh -n 0
Running... ctrl^C to stop
^C
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_bench_xmit_mode_netif_receive.sh -n 0
Running... ctrl^C to stop
^C
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_bench_xmit_mode_queue_xmit.sh -n 0
Running... ctrl^C to stop
^C
So the second commit solves this issue by adding trap SIGINT. Also, changes
control_c function to print_results to maintain consistency with other samples
on the first commit and second commit.
And current pktgen.rst documentation doesn't add the latest pktgen sample
usage options such as count and IPv6, and so on. Also, the old pktgen
sample scripts are still included in the document. The old scripts were removed
by the commit a4b6ade8359f ("samples/pktgen: remove remaining old pktgen
sample scripts").
Thus, the last commit documents the latest pktgen sample usage and removes
old sample scripts. And fixes a minor typo.
Juhee Kang (3):
samples: pktgen: fix to print when terminated normally
samples: pktgen: add trap SIGINT for printing execution result
pktgen: document the latest pktgen usage options
Documentation/networking/pktgen.rst | 18 ++++++++----------
.../pktgen_bench_xmit_mode_netif_receive.sh | 19 +++++++++++++------
.../pktgen_bench_xmit_mode_queue_xmit.sh | 19 +++++++++++++------
samples/pktgen/pktgen_sample01_simple.sh | 13 ++++++++++---
samples/pktgen/pktgen_sample02_multiqueue.sh | 19 +++++++++++++------
.../pktgen_sample03_burst_single_flow.sh | 6 ++++--
...sample06_numa_awared_queue_irq_affinity.sh | 19 +++++++++++++------
7 files changed, 74 insertions(+), 39 deletions(-)
--
2.30.2
From: Juhee Kang <hidden> Date: 2021-08-25 10:57:33
Currently, most pktgen samples print the execution result when the
program is terminated normally. However, sample03 doesn't work
appropriately.
This is results of samples:
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample04_many_flows.sh -n 1
Running... ctrl^C to stop
Device: eth0@0
Result: OK: 19(c5+d13) usec, 1 (60byte,0frags)
51762pps 24Mb/sec (24845760bps) errors: 0
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample03_burst_single_flow.sh -n 1
Running... ctrl^C to stop
The reason why it doesn't print the execution result when the program is
terminated usually is that sample03 doesn't call the function which
prints the result, unlike other samples.
So, this commit solves this issue by calling the function before
termination. Also, this commit changes control_c function to
print_result to maintain consistency with other samples.
Signed-off-by: Juhee Kang <redacted>
---
samples/pktgen/pktgen_sample03_burst_single_flow.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
@@ -85,7 +85,7 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); dodone# Run if user hits control-c-functioncontrol_c(){+functionprint_result(){# Print resultsfor((thread=$F_THREAD;thread<=$L_THREAD;thread++));dodev=${DEV}@${thread}
@@ -94,11 +94,13 @@ function control_c() {done}# trap keyboard interrupt (Ctrl-C)-trapcontrol_cSIGINT+traptrueSIGINTif[-z"$APPEND"];thenecho"Running... ctrl^C to stop">&2pg_ctrl"start"++print_resultelseecho"Append mode: config done. Do more or use 'pg_ctrl start' to run"fi--
From: Juhee Kang <hidden> Date: 2021-08-25 10:57:36
Currently, the pktgen.rst documentation doesn't cover the latest pktgen
sample usage options such as count and IPv6, and so on. Also, this
documentation includes the old sample scripts which are no longer use
because it was removed by the commit a4b6ade8359f ("samples/pktgen :
remove remaining old pktgen sample scripts")
Thus, this commit documents pktgen sample usage using the latest options
and removes old sample scripts, and fixes a minor typo.
Signed-off-by: Juhee Kang <redacted>
---
Documentation/networking/pktgen.rst | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
@@ -248,26 +248,24 @@ Usage::: -i : ($DEV) output interface/device (required) -s : ($PKT_SIZE) packet size- -d : ($DEST_IP) destination IP+ -d : ($DEST_IP) destination IP. CIDR (e.g. 198.18.0.0/15) is also allowed -m : ($DST_MAC) destination MAC-addr+ -p : ($DST_PORT) destination PORT range (e.g. 433-444) is also allowed -t : ($THREADS) threads to start+ -f : ($F_THREAD) index of first thread (zero indexed CPU number) -c : ($SKB_CLONE) SKB clones send before alloc new SKB+ -n : ($COUNT) num messages to send per thread, 0 means indefinitely -b : ($BURST) HW level bursting of SKBs -v : ($VERBOSE) verbose -x : ($DEBUG) debug+ -6 : ($IP6) IPv6+ -w : ($DELAY) Tx Delay value (ns)+ -a : ($APPEND) Script will not reset generator's state, but will append its config The global variables being set are also listed. E.g. the required interface/device parameter "-i" sets variable $DEV. Copy the pktgen_sampleXX scripts and modify them to fit your own needs.-The old scripts::-- pktgen.conf-1-2 # 1 CPU 2 dev- pktgen.conf-1-1-rdos # 1 CPU 1 dev w. route DoS- pktgen.conf-1-1-ip6 # 1 CPU 1 dev ipv6- pktgen.conf-1-1-ip6-rdos # 1 CPU 1 dev ipv6 w. route DoS- pktgen.conf-1-1-flows # 1 CPU 1 dev multiple flows.- Interrupt affinity ===================
@@ -398,7 +396,7 @@ Current commands and configuration options References:- ftp://robur.slu.se/pub/Linux/net-development/pktgen-testing/-- tp://robur.slu.se/pub/Linux/net-development/pktgen-testing/examples/+- ftp://robur.slu.se/pub/Linux/net-development/pktgen-testing/examples/ Paper from Linux-Kongress in Erlangen 2004.- ftp://robur.slu.se/pub/Linux/net-development/pktgen-testing/pktgen_paper.pdf--
From: Juhee Kang <hidden> Date: 2021-08-25 10:57:37
All pktgen samples can send indefinitely num messages per thread by
setting the count option to 0(-n 0). If running sample with setting
count 0 and press Ctrl-C to stop this program, the program prints the
result of the execution so far. Currently, the samples besides
sample{3...5} don't work properly. Because Ctrl-C stops the script, not
just pktgen.
This is results of samples:
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample04_many_flows.sh -n 0
Running... ctrl^C to stop
^CDevice: eth0@0
Result: OK: 569657(c569538+d118) usec, 84650 (60byte,0frags)
148597pps 71Mb/sec (71326560bps) errors: 0
# DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample01_simple.sh -n 0
Running... ctrl^C to stop
^C
In order to solve this, this commit adds trap SIGINT. Also, this commit
changes control_c function to print_result to maintain consistency with
other samples.
Signed-off-by: Juhee Kang <redacted>
---
.../pktgen_bench_xmit_mode_netif_receive.sh | 19 +++++++++++++------
.../pktgen_bench_xmit_mode_queue_xmit.sh | 19 +++++++++++++------
samples/pktgen/pktgen_sample01_simple.sh | 13 ++++++++++---
samples/pktgen/pktgen_sample02_multiqueue.sh | 19 +++++++++++++------
...sample06_numa_awared_queue_irq_affinity.sh | 19 +++++++++++++------
5 files changed, 62 insertions(+), 27 deletions(-)
@@ -79,15 +79,22 @@ pg_set $DEV "flag UDPSRC_RND" pg_set$DEV"udp_src_min $UDP_SRC_MIN" pg_set$DEV"udp_src_max $UDP_SRC_MAX"+# Run if user hits control-c+functionprint_result(){+# Print results+echo"Result device: $DEV"+cat/proc/net/pktgen/$DEV+}+# trap keyboard interrupt (Ctrl-C)+traptrueSIGINT+if[-z"$APPEND"];then# start_runecho"Running... ctrl^C to stop">&2pg_ctrl"start"echo"Done">&2-# Print results-echo"Result device: $DEV"-cat/proc/net/pktgen/$DEV+print_resultelseecho"Append mode: config done. Do more or use 'pg_ctrl start' to run"fi
@@ -83,18 +83,25 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); dopg_set$dev"udp_src_max $UDP_SRC_MAX"done-if[-z"$APPEND"];then-# start_run-echo"Running... ctrl^C to stop">&2-pg_ctrl"start"-echo"Done">&2-+# Run if user hits control-c+functionprint_result(){# Print resultsfor((thread=$F_THREAD;thread<=$L_THREAD;thread++));dodev=${DEV}@${thread}echo"Device: $dev"cat/proc/net/pktgen/$dev|grep-A2"Result:"done+}+# trap keyboard interrupt (Ctrl-C)+traptrueSIGINT++if[-z"$APPEND"];then+# start_run+echo"Running... ctrl^C to stop">&2+pg_ctrl"start"+echo"Done">&2++print_resultelseecho"Append mode: config done. Do more or use 'pg_ctrl start' to run"fi
@@ -100,12 +100,8 @@ for ((i = 0; i < $THREADS; i++)); dopg_set$dev"udp_src_max $UDP_SRC_MAX"done-# start_run-if[-z"$APPEND"];then-echo"Running... ctrl^C to stop">&2-pg_ctrl"start"-echo"Done">&2-+# Run if user hits control-c+functionprint_result(){# Print resultsfor((i=0;i<$THREADS;i++));dothread=${cpu_array[$((i+F_THREAD))]}
@@ -113,6 +109,17 @@ if [ -z "$APPEND" ]; thenecho"Device: $dev"cat/proc/net/pktgen/$dev|grep-A2"Result:"done+}+# trap keyboard interrupt (Ctrl-C)+traptrueSIGINT++# start_run+if[-z"$APPEND"];then+echo"Running... ctrl^C to stop">&2+pg_ctrl"start"+echo"Done">&2++print_resultelseecho"Append mode: config done. Do more or use 'pg_ctrl start' to run"fi--