]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - samples/pktgen/pktgen_sample03_burst_single_flow.sh
ipv4: convert dst_metrics.refcnt from atomic_t to refcount_t
[mirror_ubuntu-artful-kernel.git] / samples / pktgen / pktgen_sample03_burst_single_flow.sh
CommitLineData
1d73ba16
JDB
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
0f06a678
MKL
28if [ -z "$DEST_IP" ]; then
29 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
30fi
1d73ba16
JDB
31[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
32[ -z "$BURST" ] && BURST=32
33[ -z "$CLONE_SKB" ] && CLONE_SKB="100000"
69137ea6 34[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
1d73ba16
JDB
35
36# Base Config
37DELAY="0" # Zero means max speed
1d73ba16
JDB
38
39# General cleanup everything since last run
40pg_ctrl "reset"
41
42# Threads are specified with parameter -t value in $THREADS
e0e16672 43for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
1d73ba16
JDB
44 dev=${DEV}@${thread}
45
46 # Add remove all other devices and add_device $dev to thread
47 pg_thread $thread "rem_device_all"
48 pg_thread $thread "add_device" $dev
49
50 # Base config
51 pg_set $dev "flag QUEUE_MAP_CPU"
52 pg_set $dev "count $COUNT"
53 pg_set $dev "clone_skb $CLONE_SKB"
54 pg_set $dev "pkt_size $PKT_SIZE"
55 pg_set $dev "delay $DELAY"
56 pg_set $dev "flag NO_TIMESTAMP"
57
58 # Destination
59 pg_set $dev "dst_mac $DST_MAC"
0f06a678 60 pg_set $dev "dst$IP6 $DEST_IP"
1d73ba16
JDB
61
62 # Setup burst, for easy testing -b 0 disable bursting
63 # (internally in pktgen default and minimum burst=1)
64 if [[ ${BURST} -ne 0 ]]; then
65 pg_set $dev "burst $BURST"
66 else
67 info "$dev: Not using burst"
68 fi
69done
70
71# Run if user hits control-c
72function control_c() {
73 # Print results
e0e16672 74 for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
1d73ba16
JDB
75 dev=${DEV}@${thread}
76 echo "Device: $dev"
77 cat /proc/net/pktgen/$dev | grep -A2 "Result:"
78 done
79}
80# trap keyboard interrupt (Ctrl-C)
81trap control_c SIGINT
82
83echo "Running... ctrl^C to stop" >&2
84pg_ctrl "start"