Commit 5f881503 authored by David S. Miller's avatar David S. Miller

Merge branch 'pktgen-new-parameters'

Tariq Toukan says:

====================
pktgen new parameters

This patchset adds two parameters to the pktgen scripts.
* The first patch adds a parameter to control the number of
  packets sent by every pktgen thread.
* The second patch adds a parameter to control the index of
  first thread, instead of always starting from cpu 0.

Series generated against net-next commit:
f7aec129 rxrpc: Cache the congestion window setting

Thanks,
Tariq.

V2:
* rebased to latest net-next.
* per Jesper's comments on Patch 2, fixed $F_THREAD description
  and $L_THREAD evaluation.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents cb7fbb64 e0e16672
...@@ -21,7 +21,9 @@ across the sample scripts. Usage example is printed on errors:: ...@@ -21,7 +21,9 @@ across the sample scripts. Usage example is printed on errors::
-d : ($DEST_IP) destination IP -d : ($DEST_IP) destination IP
-m : ($DST_MAC) destination MAC-addr -m : ($DST_MAC) destination MAC-addr
-t : ($THREADS) threads to start -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 -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 -b : ($BURST) HW level bursting of SKBs
-v : ($VERBOSE) verbose -v : ($VERBOSE) verbose
-x : ($DEBUG) debug -x : ($DEBUG) debug
......
...@@ -10,7 +10,9 @@ function usage() { ...@@ -10,7 +10,9 @@ function usage() {
echo " -d : (\$DEST_IP) destination IP" echo " -d : (\$DEST_IP) destination IP"
echo " -m : (\$DST_MAC) destination MAC-addr" echo " -m : (\$DST_MAC) destination MAC-addr"
echo " -t : (\$THREADS) threads to start" echo " -t : (\$THREADS) threads to start"
echo " -f : (\$F_THREAD) index of first thread (zero indexed CPU number)"
echo " -c : (\$SKB_CLONE) SKB clones send before alloc new SKB" echo " -c : (\$SKB_CLONE) SKB clones send before alloc new SKB"
echo " -n : (\$COUNT) num messages to send per thread, 0 means indefinitely"
echo " -b : (\$BURST) HW level bursting of SKBs" echo " -b : (\$BURST) HW level bursting of SKBs"
echo " -v : (\$VERBOSE) verbose" echo " -v : (\$VERBOSE) verbose"
echo " -x : (\$DEBUG) debug" echo " -x : (\$DEBUG) debug"
...@@ -20,7 +22,7 @@ function usage() { ...@@ -20,7 +22,7 @@ function usage() {
## --- Parse command line arguments / parameters --- ## --- Parse command line arguments / parameters ---
## echo "Commandline options:" ## echo "Commandline options:"
while getopts "s:i:d:m:t:c:b:vxh6" option; do while getopts "s:i:d:m:f:t:c:n:b:vxh6" option; do
case $option in case $option in
i) # interface i) # interface
export DEV=$OPTARG export DEV=$OPTARG
...@@ -38,16 +40,22 @@ while getopts "s:i:d:m:t:c:b:vxh6" option; do ...@@ -38,16 +40,22 @@ while getopts "s:i:d:m:t:c:b:vxh6" option; do
export DST_MAC=$OPTARG export DST_MAC=$OPTARG
info "Destination MAC set to: DST_MAC=$DST_MAC" info "Destination MAC set to: DST_MAC=$DST_MAC"
;; ;;
f)
export F_THREAD=$OPTARG
info "Index of first thread (zero indexed CPU number): $F_THREAD"
;;
t) t)
export THREADS=$OPTARG export THREADS=$OPTARG
export CPU_THREADS=$OPTARG info "Number of threads to start: $THREADS"
let "CPU_THREADS -= 1"
info "Number of threads to start: $THREADS (0 to $CPU_THREADS)"
;; ;;
c) c)
export CLONE_SKB=$OPTARG export CLONE_SKB=$OPTARG
info "CLONE_SKB=$CLONE_SKB" info "CLONE_SKB=$CLONE_SKB"
;; ;;
n)
export COUNT=$OPTARG
info "COUNT=$COUNT"
;;
b) b)
export BURST=$OPTARG export BURST=$OPTARG
info "SKB bursting: BURST=$BURST" info "SKB bursting: BURST=$BURST"
...@@ -77,12 +85,17 @@ if [ -z "$PKT_SIZE" ]; then ...@@ -77,12 +85,17 @@ if [ -z "$PKT_SIZE" ]; then
info "Default packet size set to: set to: $PKT_SIZE bytes" info "Default packet size set to: set to: $PKT_SIZE bytes"
fi fi
if [ -z "$F_THREAD" ]; then
# First thread (F_THREAD) reference the zero indexed CPU number
export F_THREAD=0
fi
if [ -z "$THREADS" ]; then if [ -z "$THREADS" ]; then
# Zero CPU threads means one thread, because CPU numbers are zero indexed
export CPU_THREADS=0
export THREADS=1 export THREADS=1
fi fi
export L_THREAD=$(( THREADS + F_THREAD - 1 ))
if [ -z "$DEV" ]; then if [ -z "$DEV" ]; then
usage usage
err 2 "Please specify output device" err 2 "Please specify output device"
......
...@@ -39,16 +39,16 @@ if [ -z "$DEST_IP" ]; then ...@@ -39,16 +39,16 @@ if [ -z "$DEST_IP" ]; then
fi fi
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff" [ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
[ -z "$BURST" ] && BURST=1024 [ -z "$BURST" ] && BURST=1024
[ -z "$COUNT" ] && COUNT="10000000" # Zero means indefinitely
# Base Config # Base Config
DELAY="0" # Zero means max speed DELAY="0" # Zero means max speed
COUNT="10000000" # Zero means indefinitely
# General cleanup everything since last run # General cleanup everything since last run
pg_ctrl "reset" pg_ctrl "reset"
# Threads are specified with parameter -t value in $THREADS # Threads are specified with parameter -t value in $THREADS
for ((thread = 0; thread < $THREADS; thread++)); do for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
# The device name is extended with @name, using thread number to # The device name is extended with @name, using thread number to
# make then unique, but any name will do. # make then unique, but any name will do.
dev=${DEV}@${thread} dev=${DEV}@${thread}
...@@ -81,7 +81,7 @@ pg_ctrl "start" ...@@ -81,7 +81,7 @@ pg_ctrl "start"
echo "Done" >&2 echo "Done" >&2
# Print results # Print results
for ((thread = 0; thread < $THREADS; thread++)); do for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread} dev=${DEV}@${thread}
echo "Device: $dev" echo "Device: $dev"
cat /proc/net/pktgen/$dev | grep -A2 "Result:" cat /proc/net/pktgen/$dev | grep -A2 "Result:"
......
...@@ -22,16 +22,16 @@ fi ...@@ -22,16 +22,16 @@ fi
if [[ -n "$BURST" ]]; then if [[ -n "$BURST" ]]; then
err 1 "Bursting not supported for this mode" err 1 "Bursting not supported for this mode"
fi fi
[ -z "$COUNT" ] && COUNT="10000000" # Zero means indefinitely
# Base Config # Base Config
DELAY="0" # Zero means max speed DELAY="0" # Zero means max speed
COUNT="10000000" # Zero means indefinitely
# General cleanup everything since last run # General cleanup everything since last run
pg_ctrl "reset" pg_ctrl "reset"
# Threads are specified with parameter -t value in $THREADS # Threads are specified with parameter -t value in $THREADS
for ((thread = 0; thread < $THREADS; thread++)); do for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
# The device name is extended with @name, using thread number to # The device name is extended with @name, using thread number to
# make then unique, but any name will do. # make then unique, but any name will do.
dev=${DEV}@${thread} dev=${DEV}@${thread}
...@@ -61,7 +61,7 @@ pg_ctrl "start" ...@@ -61,7 +61,7 @@ pg_ctrl "start"
echo "Done" >&2 echo "Done" >&2
# Print results # Print results
for ((thread = 0; thread < $THREADS; thread++)); do for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread} dev=${DEV}@${thread}
echo "Device: $dev" echo "Device: $dev"
cat /proc/net/pktgen/$dev | grep -A2 "Result:" cat /proc/net/pktgen/$dev | grep -A2 "Result:"
......
...@@ -20,10 +20,10 @@ fi ...@@ -20,10 +20,10 @@ fi
[ -z "$CLONE_SKB" ] && CLONE_SKB="0" [ -z "$CLONE_SKB" ] && CLONE_SKB="0"
# Example enforce param "-m" for dst_mac # Example enforce param "-m" for dst_mac
[ -z "$DST_MAC" ] && usage && err 2 "Must specify -m dst_mac" [ -z "$DST_MAC" ] && usage && err 2 "Must specify -m dst_mac"
[ -z "$COUNT" ] && COUNT="100000" # Zero means indefinitely
# Base Config # Base Config
DELAY="0" # Zero means max speed DELAY="0" # Zero means max speed
COUNT="100000" # Zero means indefinitely
# Flow variation random source port between min and max # Flow variation random source port between min and max
UDP_MIN=9 UDP_MIN=9
......
...@@ -13,9 +13,10 @@ root_check_run_with_sudo "$@" ...@@ -13,9 +13,10 @@ root_check_run_with_sudo "$@"
# Required param: -i dev in $DEV # Required param: -i dev in $DEV
source ${basedir}/parameters.sh source ${basedir}/parameters.sh
[ -z "$COUNT" ] && COUNT="100000" # Zero means indefinitely
# Base Config # Base Config
DELAY="0" # Zero means max speed DELAY="0" # Zero means max speed
COUNT="100000" # Zero means indefinitely
[ -z "$CLONE_SKB" ] && CLONE_SKB="0" [ -z "$CLONE_SKB" ] && CLONE_SKB="0"
# Flow variation random source port between min and max # Flow variation random source port between min and max
...@@ -32,7 +33,7 @@ fi ...@@ -32,7 +33,7 @@ fi
pg_ctrl "reset" pg_ctrl "reset"
# Threads are specified with parameter -t value in $THREADS # Threads are specified with parameter -t value in $THREADS
for ((thread = 0; thread < $THREADS; thread++)); do for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
# The device name is extended with @name, using thread number to # The device name is extended with @name, using thread number to
# make then unique, but any name will do. # make then unique, but any name will do.
dev=${DEV}@${thread} dev=${DEV}@${thread}
...@@ -70,7 +71,7 @@ pg_ctrl "start" ...@@ -70,7 +71,7 @@ pg_ctrl "start"
echo "Done" >&2 echo "Done" >&2
# Print results # Print results
for ((thread = 0; thread < $THREADS; thread++)); do for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread} dev=${DEV}@${thread}
echo "Device: $dev" echo "Device: $dev"
cat /proc/net/pktgen/$dev | grep -A2 "Result:" cat /proc/net/pktgen/$dev | grep -A2 "Result:"
......
...@@ -31,16 +31,16 @@ fi ...@@ -31,16 +31,16 @@ fi
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff" [ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
[ -z "$BURST" ] && BURST=32 [ -z "$BURST" ] && BURST=32
[ -z "$CLONE_SKB" ] && CLONE_SKB="100000" [ -z "$CLONE_SKB" ] && CLONE_SKB="100000"
[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
# Base Config # Base Config
DELAY="0" # Zero means max speed DELAY="0" # Zero means max speed
COUNT="0" # Zero means indefinitely
# General cleanup everything since last run # General cleanup everything since last run
pg_ctrl "reset" pg_ctrl "reset"
# Threads are specified with parameter -t value in $THREADS # Threads are specified with parameter -t value in $THREADS
for ((thread = 0; thread < $THREADS; thread++)); do for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread} dev=${DEV}@${thread}
# Add remove all other devices and add_device $dev to thread # Add remove all other devices and add_device $dev to thread
...@@ -71,7 +71,7 @@ done ...@@ -71,7 +71,7 @@ done
# Run if user hits control-c # Run if user hits control-c
function control_c() { function control_c() {
# Print results # Print results
for ((thread = 0; thread < $THREADS; thread++)); do for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread} dev=${DEV}@${thread}
echo "Device: $dev" echo "Device: $dev"
cat /proc/net/pktgen/$dev | grep -A2 "Result:" cat /proc/net/pktgen/$dev | grep -A2 "Result:"
......
...@@ -15,6 +15,7 @@ source ${basedir}/parameters.sh ...@@ -15,6 +15,7 @@ source ${basedir}/parameters.sh
[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42" [ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff" [ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
[ -z "$CLONE_SKB" ] && CLONE_SKB="0" [ -z "$CLONE_SKB" ] && CLONE_SKB="0"
[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
# NOTICE: Script specific settings # NOTICE: Script specific settings
# ======= # =======
...@@ -26,7 +27,6 @@ source ${basedir}/parameters.sh ...@@ -26,7 +27,6 @@ source ${basedir}/parameters.sh
# Base Config # Base Config
DELAY="0" # Zero means max speed DELAY="0" # Zero means max speed
COUNT="0" # Zero means indefinitely
if [[ -n "$BURST" ]]; then if [[ -n "$BURST" ]]; then
err 1 "Bursting not supported for this mode" err 1 "Bursting not supported for this mode"
...@@ -36,7 +36,7 @@ fi ...@@ -36,7 +36,7 @@ fi
pg_ctrl "reset" pg_ctrl "reset"
# Threads are specified with parameter -t value in $THREADS # Threads are specified with parameter -t value in $THREADS
for ((thread = 0; thread < $THREADS; thread++)); do for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread} dev=${DEV}@${thread}
# Add remove all other devices and add_device $dev to thread # Add remove all other devices and add_device $dev to thread
...@@ -78,7 +78,7 @@ done ...@@ -78,7 +78,7 @@ done
# Run if user hits control-c # Run if user hits control-c
function print_result() { function print_result() {
# Print results # Print results
for ((thread = 0; thread < $THREADS; thread++)); do for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread} dev=${DEV}@${thread}
echo "Device: $dev" echo "Device: $dev"
cat /proc/net/pktgen/$dev | grep -A2 "Result:" cat /proc/net/pktgen/$dev | grep -A2 "Result:"
......
...@@ -20,17 +20,17 @@ source ${basedir}/parameters.sh ...@@ -20,17 +20,17 @@ source ${basedir}/parameters.sh
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff" [ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
[ -z "$CLONE_SKB" ] && CLONE_SKB="0" [ -z "$CLONE_SKB" ] && CLONE_SKB="0"
[ -z "$BURST" ] && BURST=32 [ -z "$BURST" ] && BURST=32
[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
# Base Config # Base Config
DELAY="0" # Zero means max speed DELAY="0" # Zero means max speed
COUNT="0" # Zero means indefinitely
# General cleanup everything since last run # General cleanup everything since last run
pg_ctrl "reset" pg_ctrl "reset"
# Threads are specified with parameter -t value in $THREADS # Threads are specified with parameter -t value in $THREADS
for ((thread = 0; thread < $THREADS; thread++)); do for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread} dev=${DEV}@${thread}
# Add remove all other devices and add_device $dev to thread # Add remove all other devices and add_device $dev to thread
...@@ -66,7 +66,7 @@ done ...@@ -66,7 +66,7 @@ done
# Run if user hits control-c # Run if user hits control-c
function print_result() { function print_result() {
# Print results # Print results
for ((thread = 0; thread < $THREADS; thread++)); do for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread} dev=${DEV}@${thread}
echo "Device: $dev" echo "Device: $dev"
cat /proc/net/pktgen/$dev | grep -A2 "Result:" cat /proc/net/pktgen/$dev | grep -A2 "Result:"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment