aboutsummaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2015-05-21 06:18:12 -0400
committerDavid S. Miller <davem@davemloft.net>2015-05-22 23:59:17 -0400
commit1d73ba16ad3975a2eb27e47e52fc215c0c5b8d83 (patch)
treee13418ede08a6f78594389094a1d66ea17469887 /samples
parent282fb58947e129dea8badf48972ea89d027a76dc (diff)
pktgen: add sample script pktgen_sample03_burst_single_flow.sh
Add the pktgen samples script pktgen_sample03_burst_single_flow.sh that demonstrates how to acheive maximum performance. If correctly tuned[1] single CPU 10Gbit/s wirespeed small pkts is possible[2] which is 14.88Mpps. The trick is to take advantage of the "burst" feature introduced in commit 38b2cf2982dc73 ("net: pktgen: packet bursting via skb->xmit_more"). [1] http://netoptimizer.blogspot.dk/2014/06/pktgen-for-network-overload-testing.html [2] http://netoptimizer.blogspot.dk/2014/10/unlocked-10gbps-tx-wirespeed-smallest.html Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples')
-rwxr-xr-xsamples/pktgen/pktgen_sample03_burst_single_flow.sh82
1 files changed, 82 insertions, 0 deletions
diff --git a/samples/pktgen/pktgen_sample03_burst_single_flow.sh b/samples/pktgen/pktgen_sample03_burst_single_flow.sh
new file mode 100755
index 000000000000..775f5d0a1e53
--- /dev/null
+++ b/samples/pktgen/pktgen_sample03_burst_single_flow.sh
@@ -0,0 +1,82 @@
1#!/bin/bash
2#
3# Script for max single flow performance
4# - If correctly tuned[1], single CPU 10G wirespeed small pkts is possible[2]
5#
6# Using pktgen "burst" option (use -b $N)
7# - To boost max performance
8# - Avail since: kernel v3.18
9# * commit 38b2cf2982dc73 ("net: pktgen: packet bursting via skb->xmit_more")
10# - This avoids writing the HW tailptr on every driver xmit
11# - The performance boost is impressive, see commit and blog [2]
12#
13# Notice: On purpose generates a single (UDP) flow towards target,
14# reason behind this is to only overload/activate a single CPU on
15# target host. And no randomness for pktgen also makes it faster.
16#
17# Tuning see:
18# [1] http://netoptimizer.blogspot.dk/2014/06/pktgen-for-network-overload-testing.html
19# [2] http://netoptimizer.blogspot.dk/2014/10/unlocked-10gbps-tx-wirespeed-smallest.html
20#
21basedir=`dirname $0`
22source ${basedir}/functions.sh
23root_check_run_with_sudo "$@"
24
25# Parameter parsing via include
26source ${basedir}/parameters.sh
27# Set some default params, if they didn't get set
28[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
29[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
30[ -z "$BURST" ] && BURST=32
31[ -z "$CLONE_SKB" ] && CLONE_SKB="100000"
32
33# Base Config
34DELAY="0" # Zero means max speed
35COUNT="0" # Zero means indefinitely
36
37# General cleanup everything since last run
38pg_ctrl "reset"
39
40# Threads are specified with parameter -t value in $THREADS
41for ((thread = 0; thread < $THREADS; thread++)); do
42 dev=${DEV}@${thread}
43
44 # Add remove all other devices and add_device $dev to thread
45 pg_thread $thread "rem_device_all"
46 pg_thread $thread "add_device" $dev
47
48 # Base config
49 pg_set $dev "flag QUEUE_MAP_CPU"
50 pg_set $dev "count $COUNT"
51 pg_set $dev "clone_skb $CLONE_SKB"
52 pg_set $dev "pkt_size $PKT_SIZE"
53 pg_set $dev "delay $DELAY"
54 pg_set $dev "flag NO_TIMESTAMP"
55
56 # Destination
57 pg_set $dev "dst_mac $DST_MAC"
58 pg_set $dev "dst $DEST_IP"
59
60 # Setup burst, for easy testing -b 0 disable bursting
61 # (internally in pktgen default and minimum burst=1)
62 if [[ ${BURST} -ne 0 ]]; then
63 pg_set $dev "burst $BURST"
64 else
65 info "$dev: Not using burst"
66 fi
67done
68
69# Run if user hits control-c
70function control_c() {
71 # Print results
72 for ((thread = 0; thread < $THREADS; thread++)); do
73 dev=${DEV}@${thread}
74 echo "Device: $dev"
75 cat /proc/net/pktgen/$dev | grep -A2 "Result:"
76 done
77}
78# trap keyboard interrupt (Ctrl-C)
79trap control_c SIGINT
80
81echo "Running... ctrl^C to stop" >&2
82pg_ctrl "start"