From: Jesper Dangaard Brouer <brouer@redhat.com>
To: netdev@vger.kernel.org
Cc: Jesper Dangaard Brouer <brouer@redhat.com>,
Daniel Borkmann <borkmann@iogearbox.net>,
Alexei Starovoitov <ast@plumgrid.com>,
Robert Olsson <robert@herjulf.se>,
Ben Greear <greearb@candelatech.com>
Subject: [net-next PATCH 09/10] pktgen: add sample script pktgen_sample03_burst_single_flow.sh
Date: Tue, 19 May 2015 23:36:39 +0200 [thread overview]
Message-ID: <20150519213639.9070.50273.stgit@ivy> (raw)
In-Reply-To: <20150519213326.9070.18264.stgit@ivy>
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>
---
.../pktgen/pktgen_sample03_burst_single_flow.sh | 82 ++++++++++++++++++++
1 files changed, 82 insertions(+), 0 deletions(-)
create mode 100755 samples/pktgen/pktgen_sample03_burst_single_flow.sh
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 0000000..f60d579
--- /dev/null
+++ b/samples/pktgen/pktgen_sample03_burst_single_flow.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+#
+# Script for max single flow performance
+# - If correctly tuned[1], single CPU 10G wirespeed small pkts is possible[2]
+#
+# Using pktgen "burst" option (use -b $N)
+# - To boost max performance
+# - Avail since: kernel v3.18
+# * commit 38b2cf2982dc73 ("net: pktgen: packet bursting via skb->xmit_more")
+# - This avoids writing the HW tailptr on every driver xmit
+# - The performance boost is impressive, see commit and blog [2]
+#
+# Notice: On purpose generates a single (UDP) flow towards target,
+# reason behind this is to only overload/activate a single CPU on
+# target host. And no randomness for pktgen also makes it faster.
+#
+# Tuning see:
+# [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
+#
+basedir=`dirname $0`
+source ${basedir}/functions.sh
+root_check_run_with_sudo "$@"
+
+# Parameter parsing via include
+source ${basedir}/parameters.sh
+# Set some default params, if they didn't get set
+[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
+[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
+[ -z "$BURST" ] && BURST=32
+[ -z "$CLONE_SKB" ] && CLONE_SKB="100000"
+
+# Base Config
+DELAY="0" # Zero means max speed
+COUNT="0" # Zero means indefinitely
+
+# General cleanup everything since last run
+pg_ctrl "reset"
+
+# Threads are specified with parameter -t value in $THREADS
+for ((thread = 0; thread < $THREADS; thread++)); do
+ dev=${DEV}@${thread}
+
+ # Add remove all other devices and add_device $dev to thread
+ pg_thread $thread "rem_device_all"
+ pg_thread $thread "add_device" $dev
+
+ # Base config
+ pg_set $dev "flag QUEUE_MAP_CPU"
+ pg_set $dev "count $COUNT"
+ pg_set $dev "clone_skb $CLONE_SKB"
+ pg_set $dev "pkt_size $PKT_SIZE"
+ pg_set $dev "delay $DELAY"
+ pg_set $dev "flag NO_TIMESTAMP"
+
+ # Destination
+ pg_set $dev "dst_mac $DST_MAC"
+ pg_set $dev "dst $DEST_IP"
+
+ # Setup burst, for easy testing -b 0 disable bursting
+ # (internally in pktgen default and minimum burst=1)
+ if [[ ${BURST} != 0 ]]; then
+ pg_set $dev "burst $BURST"
+ else
+ info "$dev: Not using burst"
+ fi
+done
+
+# Run if user hits control-c
+function control_c() {
+ # Print results
+ for ((thread = 0; thread < $THREADS; thread++)); do
+ dev=${DEV}@${thread}
+ echo "Device: $dev"
+ cat /proc/net/pktgen/$dev | grep -A2 "Result:"
+ done
+}
+# trap keyboard interrupt (Ctrl-C)
+trap control_c SIGINT
+
+echo "Running... ctrl^C to stop" >&2
+pg_ctrl "start"
next prev parent reply other threads:[~2015-05-19 21:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 21:35 [net-next PATCH 00/10] pktgen: cleanups and introducing new samples/pktgen scripts Jesper Dangaard Brouer
2015-05-19 21:35 ` [net-next PATCH 01/10] pktgen: remove obsolete "max_before_softirq" from pktgen doc Jesper Dangaard Brouer
2015-05-19 21:35 ` [net-next PATCH 02/10] pktgen: adjust spacing in proc file interface output Jesper Dangaard Brouer
2015-05-19 21:35 ` [net-next PATCH 03/10] pktgen: doc were missing several config options Jesper Dangaard Brouer
2015-05-19 21:35 ` [net-next PATCH 04/10] pktgen: document ability to add same device to several threads Jesper Dangaard Brouer
2015-05-19 21:54 ` Alexei Starovoitov
2015-05-19 21:35 ` [net-next PATCH 05/10] pktgen: make /proc/net/pktgen/pgctrl report fail on invalid input Jesper Dangaard Brouer
2015-05-19 21:36 ` [net-next PATCH 06/10] pktgen: new pktgen helper functions for samples scripts Jesper Dangaard Brouer
2015-05-20 21:23 ` Cong Wang
2015-05-21 9:18 ` Jesper Dangaard Brouer
2015-05-19 21:36 ` [net-next PATCH 07/10] pktgen: add sample script pktgen_sample01_simple.sh Jesper Dangaard Brouer
2015-05-19 21:36 ` [net-next PATCH 08/10] pktgen: add sample script pktgen_sample02_multiqueue.sh Jesper Dangaard Brouer
2015-05-19 21:36 ` Jesper Dangaard Brouer [this message]
2015-05-20 21:33 ` [net-next PATCH 09/10] pktgen: add sample script pktgen_sample03_burst_single_flow.sh Cong Wang
2015-05-21 9:47 ` Jesper Dangaard Brouer
2015-05-19 21:36 ` [net-next PATCH 10/10] pktgen: add benchmark script pktgen_bench_xmit_mode_netif_receive.sh Jesper Dangaard Brouer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150519213639.9070.50273.stgit@ivy \
--to=brouer@redhat.com \
--cc=ast@plumgrid.com \
--cc=borkmann@iogearbox.net \
--cc=greearb@candelatech.com \
--cc=netdev@vger.kernel.org \
--cc=robert@herjulf.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).