diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2016-07-13 16:06:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-07-14 18:19:51 -0400 |
commit | d25692e4b74573e2d9418bca56f9210adba27972 (patch) | |
tree | d1b53e904bb1f0e0f347e1cfa51cb91e2550e18b /samples | |
parent | 15f2cbbde4cff41904f5e87504ff45b36796b8d2 (diff) |
pktgen: add sample script pktgen_sample05_flow_per_thread.sh
This pktgen sample script is useful for scalability testing a
receiver. The script will simply generate one flow per
thread (option -t N) using the thread number as part of the
source IP-address.
The single flow sample (pktgen_sample03_burst_single_flow.sh)
have become quite popular, but it is important that developers
also make sure to benchmark scalability of multiple receive
queues.
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples')
-rwxr-xr-x | samples/pktgen/pktgen_sample05_flow_per_thread.sh | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/samples/pktgen/pktgen_sample05_flow_per_thread.sh b/samples/pktgen/pktgen_sample05_flow_per_thread.sh new file mode 100755 index 000000000000..32ad818e2829 --- /dev/null +++ b/samples/pktgen/pktgen_sample05_flow_per_thread.sh | |||
@@ -0,0 +1,81 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # Script will generate one flow per thread (-t N) | ||
4 | # - Same destination IP | ||
5 | # - Fake source IPs for each flow (fixed based on thread number) | ||
6 | # | ||
7 | # Useful for scale testing on receiver, to see whether silo'ing flows | ||
8 | # works and scales. For optimal scalability (on receiver) each | ||
9 | # separate-flow should not access shared variables/data. This script | ||
10 | # helps magnify any of these scaling issues by overloading the receiver. | ||
11 | # | ||
12 | basedir=`dirname $0` | ||
13 | source ${basedir}/functions.sh | ||
14 | root_check_run_with_sudo "$@" | ||
15 | |||
16 | # Parameter parsing via include | ||
17 | source ${basedir}/parameters.sh | ||
18 | # Set some default params, if they didn't get set | ||
19 | [ -z "$DEST_IP" ] && DEST_IP="198.18.0.42" | ||
20 | [ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff" | ||
21 | [ -z "$CLONE_SKB" ] && CLONE_SKB="0" | ||
22 | [ -z "$BURST" ] && BURST=32 | ||
23 | |||
24 | |||
25 | # Base Config | ||
26 | DELAY="0" # Zero means max speed | ||
27 | COUNT="0" # Zero means indefinitely | ||
28 | |||
29 | # General cleanup everything since last run | ||
30 | pg_ctrl "reset" | ||
31 | |||
32 | # Threads are specified with parameter -t value in $THREADS | ||
33 | for ((thread = 0; thread < $THREADS; thread++)); do | ||
34 | dev=${DEV}@${thread} | ||
35 | |||
36 | # Add remove all other devices and add_device $dev to thread | ||
37 | pg_thread $thread "rem_device_all" | ||
38 | pg_thread $thread "add_device" $dev | ||
39 | |||
40 | # Base config | ||
41 | pg_set $dev "flag QUEUE_MAP_CPU" | ||
42 | pg_set $dev "count $COUNT" | ||
43 | pg_set $dev "clone_skb $CLONE_SKB" | ||
44 | pg_set $dev "pkt_size $PKT_SIZE" | ||
45 | pg_set $dev "delay $DELAY" | ||
46 | pg_set $dev "flag NO_TIMESTAMP" | ||
47 | |||
48 | # Single destination | ||
49 | pg_set $dev "dst_mac $DST_MAC" | ||
50 | pg_set $dev "dst $DEST_IP" | ||
51 | |||
52 | # Setup source IP-addresses based on thread number | ||
53 | pg_set $dev "src_min 198.18.$((thread+1)).1" | ||
54 | pg_set $dev "src_max 198.18.$((thread+1)).1" | ||
55 | |||
56 | # Setup burst, for easy testing -b 0 disable bursting | ||
57 | # (internally in pktgen default and minimum burst=1) | ||
58 | if [[ ${BURST} -ne 0 ]]; then | ||
59 | pg_set $dev "burst $BURST" | ||
60 | else | ||
61 | info "$dev: Not using burst" | ||
62 | fi | ||
63 | |||
64 | done | ||
65 | |||
66 | # Run if user hits control-c | ||
67 | function print_result() { | ||
68 | # Print results | ||
69 | for ((thread = 0; thread < $THREADS; thread++)); do | ||
70 | dev=${DEV}@${thread} | ||
71 | echo "Device: $dev" | ||
72 | cat /proc/net/pktgen/$dev | grep -A2 "Result:" | ||
73 | done | ||
74 | } | ||
75 | # trap keyboard interrupt (Ctrl-C) | ||
76 | trap true SIGINT | ||
77 | |||
78 | echo "Running... ctrl^C to stop" >&2 | ||
79 | pg_ctrl "start" | ||
80 | |||
81 | print_result | ||