* [PATCH net-next 0/2] pktgen new parameters
@ 2017-06-13 15:04 Tariq Toukan
2017-06-13 15:04 ` [PATCH net-next 1/2] pktgen: Specify num packets per thread Tariq Toukan
2017-06-13 15:04 ` [PATCH net-next 2/2] pktgen: Specify the index of first thread Tariq Toukan
0 siblings, 2 replies; 7+ messages in thread
From: Tariq Toukan @ 2017-06-13 15:04 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Jesper Dangaard Brouer, Eran Ben Elisha, Tariq Toukan
Hi Dave,
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:
f1c9eed7f437 bpf, arm64: take advantage of stack_depth tracking
Thanks,
Tariq.
Tariq Toukan (2):
pktgen: Specify num packets per thread
pktgen: Specify the index of first thread
samples/pktgen/README.rst | 2 ++
samples/pktgen/parameters.sh | 24 +++++++++++++++++-----
.../pktgen/pktgen_bench_xmit_mode_netif_receive.sh | 6 +++---
.../pktgen/pktgen_bench_xmit_mode_queue_xmit.sh | 6 +++---
samples/pktgen/pktgen_sample01_simple.sh | 2 +-
samples/pktgen/pktgen_sample02_multiqueue.sh | 7 ++++---
.../pktgen/pktgen_sample03_burst_single_flow.sh | 6 +++---
samples/pktgen/pktgen_sample04_many_flows.sh | 6 +++---
samples/pktgen/pktgen_sample05_flow_per_thread.sh | 6 +++---
9 files changed, 41 insertions(+), 24 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 1/2] pktgen: Specify num packets per thread
2017-06-13 15:04 [PATCH net-next 0/2] pktgen new parameters Tariq Toukan
@ 2017-06-13 15:04 ` Tariq Toukan
2017-06-14 7:26 ` Jesper Dangaard Brouer
2017-06-13 15:04 ` [PATCH net-next 2/2] pktgen: Specify the index of first thread Tariq Toukan
1 sibling, 1 reply; 7+ messages in thread
From: Tariq Toukan @ 2017-06-13 15:04 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Jesper Dangaard Brouer, Eran Ben Elisha, Tariq Toukan
Use -n <num>, to specify the number of packets every
thread sends.
Zero means indefinitely.
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
---
samples/pktgen/README.rst | 1 +
samples/pktgen/parameters.sh | 7 ++++++-
samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh | 2 +-
samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh | 2 +-
samples/pktgen/pktgen_sample01_simple.sh | 2 +-
samples/pktgen/pktgen_sample02_multiqueue.sh | 3 ++-
samples/pktgen/pktgen_sample03_burst_single_flow.sh | 2 +-
samples/pktgen/pktgen_sample04_many_flows.sh | 2 +-
samples/pktgen/pktgen_sample05_flow_per_thread.sh | 2 +-
9 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/samples/pktgen/README.rst b/samples/pktgen/README.rst
index 8365c4e5c513..c018d67da1a1 100644
--- a/samples/pktgen/README.rst
+++ b/samples/pktgen/README.rst
@@ -22,6 +22,7 @@ across the sample scripts. Usage example is printed on errors::
-m : ($DST_MAC) destination MAC-addr
-t : ($THREADS) threads to start
-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
-v : ($VERBOSE) verbose
-x : ($DEBUG) debug
diff --git a/samples/pktgen/parameters.sh b/samples/pktgen/parameters.sh
index f70ea7dd5660..036147594a20 100644
--- a/samples/pktgen/parameters.sh
+++ b/samples/pktgen/parameters.sh
@@ -11,6 +11,7 @@ function usage() {
echo " -m : (\$DST_MAC) destination MAC-addr"
echo " -t : (\$THREADS) threads to start"
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 " -v : (\$VERBOSE) verbose"
echo " -x : (\$DEBUG) debug"
@@ -20,7 +21,7 @@ function usage() {
## --- Parse command line arguments / parameters ---
## echo "Commandline options:"
-while getopts "s:i:d:m:t:c:b:vxh6" option; do
+while getopts "s:i:d:m:t:c:n:b:vxh6" option; do
case $option in
i) # interface
export DEV=$OPTARG
@@ -48,6 +49,10 @@ while getopts "s:i:d:m:t:c:b:vxh6" option; do
export CLONE_SKB=$OPTARG
info "CLONE_SKB=$CLONE_SKB"
;;
+ n)
+ export COUNT=$OPTARG
+ info "COUNT=$COUNT"
+ ;;
b)
export BURST=$OPTARG
info "SKB bursting: BURST=$BURST"
diff --git a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
index f3e1bedfd77f..d2694a12de61 100755
--- a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
+++ b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
@@ -39,10 +39,10 @@ if [ -z "$DEST_IP" ]; then
fi
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
[ -z "$BURST" ] && BURST=1024
+[ -z "$COUNT" ] && COUNT="10000000" # Zero means indefinitely
# Base Config
DELAY="0" # Zero means max speed
-COUNT="10000000" # Zero means indefinitely
# General cleanup everything since last run
pg_ctrl "reset"
diff --git a/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh b/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
index cc102e923241..43604c2db726 100755
--- a/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
+++ b/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
@@ -22,10 +22,10 @@ fi
if [[ -n "$BURST" ]]; then
err 1 "Bursting not supported for this mode"
fi
+[ -z "$COUNT" ] && COUNT="10000000" # Zero means indefinitely
# Base Config
DELAY="0" # Zero means max speed
-COUNT="10000000" # Zero means indefinitely
# General cleanup everything since last run
pg_ctrl "reset"
diff --git a/samples/pktgen/pktgen_sample01_simple.sh b/samples/pktgen/pktgen_sample01_simple.sh
index 29ef4ba50796..35b7fe34bda2 100755
--- a/samples/pktgen/pktgen_sample01_simple.sh
+++ b/samples/pktgen/pktgen_sample01_simple.sh
@@ -20,10 +20,10 @@ fi
[ -z "$CLONE_SKB" ] && CLONE_SKB="0"
# Example enforce param "-m" for dst_mac
[ -z "$DST_MAC" ] && usage && err 2 "Must specify -m dst_mac"
+[ -z "$COUNT" ] && COUNT="100000" # Zero means indefinitely
# Base Config
DELAY="0" # Zero means max speed
-COUNT="100000" # Zero means indefinitely
# Flow variation random source port between min and max
UDP_MIN=9
diff --git a/samples/pktgen/pktgen_sample02_multiqueue.sh b/samples/pktgen/pktgen_sample02_multiqueue.sh
index c88a161d3e6f..164194d1c79b 100755
--- a/samples/pktgen/pktgen_sample02_multiqueue.sh
+++ b/samples/pktgen/pktgen_sample02_multiqueue.sh
@@ -13,9 +13,10 @@ root_check_run_with_sudo "$@"
# Required param: -i dev in $DEV
source ${basedir}/parameters.sh
+[ -z "$COUNT" ] && COUNT="100000" # Zero means indefinitely
+
# Base Config
DELAY="0" # Zero means max speed
-COUNT="100000" # Zero means indefinitely
[ -z "$CLONE_SKB" ] && CLONE_SKB="0"
# Flow variation random source port between min and max
diff --git a/samples/pktgen/pktgen_sample03_burst_single_flow.sh b/samples/pktgen/pktgen_sample03_burst_single_flow.sh
index 80cf8f5ba6b2..e03dd4cd05ce 100755
--- a/samples/pktgen/pktgen_sample03_burst_single_flow.sh
+++ b/samples/pktgen/pktgen_sample03_burst_single_flow.sh
@@ -31,10 +31,10 @@ fi
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
[ -z "$BURST" ] && BURST=32
[ -z "$CLONE_SKB" ] && CLONE_SKB="100000"
+[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
# Base Config
DELAY="0" # Zero means max speed
-COUNT="0" # Zero means indefinitely
# General cleanup everything since last run
pg_ctrl "reset"
diff --git a/samples/pktgen/pktgen_sample04_many_flows.sh b/samples/pktgen/pktgen_sample04_many_flows.sh
index f60412e445bb..0fc72d2bcd31 100755
--- a/samples/pktgen/pktgen_sample04_many_flows.sh
+++ b/samples/pktgen/pktgen_sample04_many_flows.sh
@@ -15,6 +15,7 @@ source ${basedir}/parameters.sh
[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
[ -z "$CLONE_SKB" ] && CLONE_SKB="0"
+[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
# NOTICE: Script specific settings
# =======
@@ -26,7 +27,6 @@ source ${basedir}/parameters.sh
# Base Config
DELAY="0" # Zero means max speed
-COUNT="0" # Zero means indefinitely
if [[ -n "$BURST" ]]; then
err 1 "Bursting not supported for this mode"
diff --git a/samples/pktgen/pktgen_sample05_flow_per_thread.sh b/samples/pktgen/pktgen_sample05_flow_per_thread.sh
index 32ad818e2829..f4fb79409fd0 100755
--- a/samples/pktgen/pktgen_sample05_flow_per_thread.sh
+++ b/samples/pktgen/pktgen_sample05_flow_per_thread.sh
@@ -20,11 +20,11 @@ source ${basedir}/parameters.sh
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
[ -z "$CLONE_SKB" ] && CLONE_SKB="0"
[ -z "$BURST" ] && BURST=32
+[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
# Base Config
DELAY="0" # Zero means max speed
-COUNT="0" # Zero means indefinitely
# General cleanup everything since last run
pg_ctrl "reset"
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 2/2] pktgen: Specify the index of first thread
2017-06-13 15:04 [PATCH net-next 0/2] pktgen new parameters Tariq Toukan
2017-06-13 15:04 ` [PATCH net-next 1/2] pktgen: Specify num packets per thread Tariq Toukan
@ 2017-06-13 15:04 ` Tariq Toukan
2017-06-14 7:09 ` Jesper Dangaard Brouer
1 sibling, 1 reply; 7+ messages in thread
From: Tariq Toukan @ 2017-06-13 15:04 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Jesper Dangaard Brouer, Eran Ben Elisha, Tariq Toukan
Use "-f <num>", to specify the index of the first
sender thread.
In default first thread is #0.
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
---
samples/pktgen/README.rst | 1 +
samples/pktgen/parameters.sh | 19 ++++++++++++++-----
.../pktgen/pktgen_bench_xmit_mode_netif_receive.sh | 4 ++--
samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh | 4 ++--
samples/pktgen/pktgen_sample02_multiqueue.sh | 4 ++--
samples/pktgen/pktgen_sample03_burst_single_flow.sh | 4 ++--
samples/pktgen/pktgen_sample04_many_flows.sh | 4 ++--
samples/pktgen/pktgen_sample05_flow_per_thread.sh | 4 ++--
8 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/samples/pktgen/README.rst b/samples/pktgen/README.rst
index c018d67da1a1..527056bd27b7 100644
--- a/samples/pktgen/README.rst
+++ b/samples/pktgen/README.rst
@@ -21,6 +21,7 @@ across the sample scripts. Usage example is printed on errors::
-d : ($DEST_IP) destination IP
-m : ($DST_MAC) destination MAC-addr
-t : ($THREADS) threads to start
+ -f : ($F_THREAD) index of first thread
-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
diff --git a/samples/pktgen/parameters.sh b/samples/pktgen/parameters.sh
index 036147594a20..d2dfc5cfa66b 100644
--- a/samples/pktgen/parameters.sh
+++ b/samples/pktgen/parameters.sh
@@ -10,6 +10,7 @@ function usage() {
echo " -d : (\$DEST_IP) destination IP"
echo " -m : (\$DST_MAC) destination MAC-addr"
echo " -t : (\$THREADS) threads to start"
+ echo " -f : (\$F_THREAD) index of first thread"
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"
@@ -21,7 +22,7 @@ function usage() {
## --- Parse command line arguments / parameters ---
## echo "Commandline options:"
-while getopts "s:i:d:m:t:c:n:b:vxh6" option; do
+while getopts "s:i:d:m:f:t:c:n:b:vxh6" option; do
case $option in
i) # interface
export DEV=$OPTARG
@@ -39,11 +40,13 @@ while getopts "s:i:d:m:t:c:n:b:vxh6" option; do
export DST_MAC=$OPTARG
info "Destination MAC set to: DST_MAC=$DST_MAC"
;;
+ f)
+ export F_THREAD=$OPTARG
+ info "Index of first thread: $F_THREAD"
+ ;;
t)
export THREADS=$OPTARG
- export CPU_THREADS=$OPTARG
- let "CPU_THREADS -= 1"
- info "Number of threads to start: $THREADS (0 to $CPU_THREADS)"
+ info "Number of threads to start: $THREADS"
;;
c)
export CLONE_SKB=$OPTARG
@@ -82,12 +85,18 @@ if [ -z "$PKT_SIZE" ]; then
info "Default packet size set to: set to: $PKT_SIZE bytes"
fi
+if [ -z "$F_THREAD" ]; then
+ # Zero CPU threads means one thread, because CPU numbers are zero indexed
+ export F_THREAD=0
+fi
+
if [ -z "$THREADS" ]; then
# Zero CPU threads means one thread, because CPU numbers are zero indexed
- export CPU_THREADS=0
export THREADS=1
fi
+export L_THREAD="$THREADS + $F_THREAD - 1"
+
if [ -z "$DEV" ]; then
usage
err 2 "Please specify output device"
diff --git a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
index d2694a12de61..e5bfe759a0fb 100755
--- a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
+++ b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
@@ -48,7 +48,7 @@ DELAY="0" # Zero means max speed
pg_ctrl "reset"
# 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
# make then unique, but any name will do.
dev=${DEV}@${thread}
@@ -81,7 +81,7 @@ pg_ctrl "start"
echo "Done" >&2
# Print results
-for ((thread = 0; thread < $THREADS; thread++)); do
+for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread}
echo "Device: $dev"
cat /proc/net/pktgen/$dev | grep -A2 "Result:"
diff --git a/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh b/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
index 43604c2db726..1ad878e95539 100755
--- a/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
+++ b/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
@@ -31,7 +31,7 @@ DELAY="0" # Zero means max speed
pg_ctrl "reset"
# 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
# make then unique, but any name will do.
dev=${DEV}@${thread}
@@ -61,7 +61,7 @@ pg_ctrl "start"
echo "Done" >&2
# Print results
-for ((thread = 0; thread < $THREADS; thread++)); do
+for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread}
echo "Device: $dev"
cat /proc/net/pktgen/$dev | grep -A2 "Result:"
diff --git a/samples/pktgen/pktgen_sample02_multiqueue.sh b/samples/pktgen/pktgen_sample02_multiqueue.sh
index 164194d1c79b..cbdd3e2bceff 100755
--- a/samples/pktgen/pktgen_sample02_multiqueue.sh
+++ b/samples/pktgen/pktgen_sample02_multiqueue.sh
@@ -33,7 +33,7 @@ fi
pg_ctrl "reset"
# 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
# make then unique, but any name will do.
dev=${DEV}@${thread}
@@ -71,7 +71,7 @@ pg_ctrl "start"
echo "Done" >&2
# Print results
-for ((thread = 0; thread < $THREADS; thread++)); do
+for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread}
echo "Device: $dev"
cat /proc/net/pktgen/$dev | grep -A2 "Result:"
diff --git a/samples/pktgen/pktgen_sample03_burst_single_flow.sh b/samples/pktgen/pktgen_sample03_burst_single_flow.sh
index e03dd4cd05ce..8d26e0ca683d 100755
--- a/samples/pktgen/pktgen_sample03_burst_single_flow.sh
+++ b/samples/pktgen/pktgen_sample03_burst_single_flow.sh
@@ -40,7 +40,7 @@ DELAY="0" # Zero means max speed
pg_ctrl "reset"
# 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}
# Add remove all other devices and add_device $dev to thread
@@ -71,7 +71,7 @@ done
# Run if user hits control-c
function control_c() {
# Print results
- for ((thread = 0; thread < $THREADS; thread++)); do
+ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread}
echo "Device: $dev"
cat /proc/net/pktgen/$dev | grep -A2 "Result:"
diff --git a/samples/pktgen/pktgen_sample04_many_flows.sh b/samples/pktgen/pktgen_sample04_many_flows.sh
index 0fc72d2bcd31..497fb7520464 100755
--- a/samples/pktgen/pktgen_sample04_many_flows.sh
+++ b/samples/pktgen/pktgen_sample04_many_flows.sh
@@ -36,7 +36,7 @@ fi
pg_ctrl "reset"
# 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}
# Add remove all other devices and add_device $dev to thread
@@ -78,7 +78,7 @@ done
# Run if user hits control-c
function print_result() {
# Print results
- for ((thread = 0; thread < $THREADS; thread++)); do
+ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread}
echo "Device: $dev"
cat /proc/net/pktgen/$dev | grep -A2 "Result:"
diff --git a/samples/pktgen/pktgen_sample05_flow_per_thread.sh b/samples/pktgen/pktgen_sample05_flow_per_thread.sh
index f4fb79409fd0..ac9cfd6b2c0a 100755
--- a/samples/pktgen/pktgen_sample05_flow_per_thread.sh
+++ b/samples/pktgen/pktgen_sample05_flow_per_thread.sh
@@ -30,7 +30,7 @@ DELAY="0" # Zero means max speed
pg_ctrl "reset"
# 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}
# Add remove all other devices and add_device $dev to thread
@@ -66,7 +66,7 @@ done
# Run if user hits control-c
function print_result() {
# Print results
- for ((thread = 0; thread < $THREADS; thread++)); do
+ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
dev=${DEV}@${thread}
echo "Device: $dev"
cat /proc/net/pktgen/$dev | grep -A2 "Result:"
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 2/2] pktgen: Specify the index of first thread
2017-06-13 15:04 ` [PATCH net-next 2/2] pktgen: Specify the index of first thread Tariq Toukan
@ 2017-06-14 7:09 ` Jesper Dangaard Brouer
2017-06-14 11:10 ` Tariq Toukan
0 siblings, 1 reply; 7+ messages in thread
From: Jesper Dangaard Brouer @ 2017-06-14 7:09 UTC (permalink / raw)
To: Tariq Toukan; +Cc: David S. Miller, netdev, Eran Ben Elisha, brouer
On Tue, 13 Jun 2017 18:04:49 +0300
Tariq Toukan <tariqt@mellanox.com> wrote:
> Use "-f <num>", to specify the index of the first
> sender thread.
> In default first thread is #0.
>
> Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
> Cc: Jesper Dangaard Brouer <brouer@redhat.com>
> ---
> samples/pktgen/README.rst | 1 +
> samples/pktgen/parameters.sh | 19 ++++++++++++++-----
> .../pktgen/pktgen_bench_xmit_mode_netif_receive.sh | 4 ++--
> samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh | 4 ++--
> samples/pktgen/pktgen_sample02_multiqueue.sh | 4 ++--
> samples/pktgen/pktgen_sample03_burst_single_flow.sh | 4 ++--
> samples/pktgen/pktgen_sample04_many_flows.sh | 4 ++--
> samples/pktgen/pktgen_sample05_flow_per_thread.sh | 4 ++--
> 8 files changed, 27 insertions(+), 17 deletions(-)
>
> diff --git a/samples/pktgen/README.rst b/samples/pktgen/README.rst
> index c018d67da1a1..527056bd27b7 100644
> --- a/samples/pktgen/README.rst
> +++ b/samples/pktgen/README.rst
> @@ -21,6 +21,7 @@ across the sample scripts. Usage example is printed on errors::
> -d : ($DEST_IP) destination IP
> -m : ($DST_MAC) destination MAC-addr
> -t : ($THREADS) threads to start
> + -f : ($F_THREAD) index of first thread
IMHO the help text should be:
"index of first thread (zero indexed CPU number)"
> -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
> diff --git a/samples/pktgen/parameters.sh b/samples/pktgen/parameters.sh
> index 036147594a20..d2dfc5cfa66b 100644
> --- a/samples/pktgen/parameters.sh
> +++ b/samples/pktgen/parameters.sh
> @@ -10,6 +10,7 @@ function usage() {
> echo " -d : (\$DEST_IP) destination IP"
> echo " -m : (\$DST_MAC) destination MAC-addr"
> echo " -t : (\$THREADS) threads to start"
> + echo " -f : (\$F_THREAD) index of first thread"
Same here:
IMHO the help text should be:
"index of first thread (zero indexed CPU number)"
> 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"
> @@ -21,7 +22,7 @@ function usage() {
>
> ## --- Parse command line arguments / parameters ---
> ## echo "Commandline options:"
> -while getopts "s:i:d:m:t:c:n:b:vxh6" option; do
> +while getopts "s:i:d:m:f:t:c:n:b:vxh6" option; do
> case $option in
> i) # interface
> export DEV=$OPTARG
> @@ -39,11 +40,13 @@ while getopts "s:i:d:m:t:c:n:b:vxh6" option; do
> export DST_MAC=$OPTARG
> info "Destination MAC set to: DST_MAC=$DST_MAC"
> ;;
> + f)
> + export F_THREAD=$OPTARG
> + info "Index of first thread: $F_THREAD"
> + ;;
> t)
> export THREADS=$OPTARG
> - export CPU_THREADS=$OPTARG
> - let "CPU_THREADS -= 1"
> - info "Number of threads to start: $THREADS (0 to $CPU_THREADS)"
> + info "Number of threads to start: $THREADS"
> ;;
> c)
> export CLONE_SKB=$OPTARG
> @@ -82,12 +85,18 @@ if [ -z "$PKT_SIZE" ]; then
> info "Default packet size set to: set to: $PKT_SIZE bytes"
> fi
>
> +if [ -z "$F_THREAD" ]; then
> + # Zero CPU threads means one thread, because CPU numbers are zero indexed
Wrong comment, use:
# First thread (F_THREAD) reference the zero indexes CPU number
> + export F_THREAD=0
> +fi
> +
> if [ -z "$THREADS" ]; then
> # Zero CPU threads means one thread, because CPU numbers are zero indexed
> - export CPU_THREADS=0
Also remove comment, it is talking about CPU_THREADS
> export THREADS=1
> fi
>
> +export L_THREAD="$THREADS + $F_THREAD - 1"
> +
This is sort of bad-shell coding. This will first get expanded at the
usage point. The way you use it, it will work, because of the for loop
uses an expansion like "((xxx))".
If you echo the $L_THREAD variable you will see: "1 + 0 - 1"
IMHO the right thing is to use:
export L_THREAD=$(( THREADS + F_THREAD - 1 ))
(I tested this also works for dash + ksh + zsh)
> diff --git a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
> index d2694a12de61..e5bfe759a0fb 100755
> --- a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
> +++ b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
> @@ -48,7 +48,7 @@ DELAY="0" # Zero means max speed
> pg_ctrl "reset"
>
> # 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
> # make then unique, but any name will do.
> dev=${DEV}@${thread}
The expansion/use of $L_THREAD only works because "for-loop" expanded
it by using ""(("" arithmetic evaluation.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 1/2] pktgen: Specify num packets per thread
2017-06-13 15:04 ` [PATCH net-next 1/2] pktgen: Specify num packets per thread Tariq Toukan
@ 2017-06-14 7:26 ` Jesper Dangaard Brouer
0 siblings, 0 replies; 7+ messages in thread
From: Jesper Dangaard Brouer @ 2017-06-14 7:26 UTC (permalink / raw)
To: Tariq Toukan; +Cc: David S. Miller, netdev, Eran Ben Elisha, brouer
On Tue, 13 Jun 2017 18:04:48 +0300
Tariq Toukan <tariqt@mellanox.com> wrote:
> Use -n <num>, to specify the number of packets every
> thread sends.
> Zero means indefinitely.
>
> Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
> Cc: Jesper Dangaard Brouer <brouer@redhat.com>
Patch 1/2 looks good to me (have some comments on patch 2/2)
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 2/2] pktgen: Specify the index of first thread
2017-06-14 7:09 ` Jesper Dangaard Brouer
@ 2017-06-14 11:10 ` Tariq Toukan
2017-06-14 11:29 ` Jesper Dangaard Brouer
0 siblings, 1 reply; 7+ messages in thread
From: Tariq Toukan @ 2017-06-14 11:10 UTC (permalink / raw)
To: Jesper Dangaard Brouer, Tariq Toukan
Cc: David S. Miller, netdev, Eran Ben Elisha
On 14/06/2017 10:09 AM, Jesper Dangaard Brouer wrote:
> On Tue, 13 Jun 2017 18:04:49 +0300
> Tariq Toukan <tariqt@mellanox.com> wrote:
>
>> Use "-f <num>", to specify the index of the first
>> sender thread.
>> In default first thread is #0.
>>
>> Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
>> Cc: Jesper Dangaard Brouer <brouer@redhat.com>
>> ---
>> samples/pktgen/README.rst | 1 +
>> samples/pktgen/parameters.sh | 19 ++++++++++++++-----
>> .../pktgen/pktgen_bench_xmit_mode_netif_receive.sh | 4 ++--
>> samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh | 4 ++--
>> samples/pktgen/pktgen_sample02_multiqueue.sh | 4 ++--
>> samples/pktgen/pktgen_sample03_burst_single_flow.sh | 4 ++--
>> samples/pktgen/pktgen_sample04_many_flows.sh | 4 ++--
>> samples/pktgen/pktgen_sample05_flow_per_thread.sh | 4 ++--
>> 8 files changed, 27 insertions(+), 17 deletions(-)
>>
>> diff --git a/samples/pktgen/README.rst b/samples/pktgen/README.rst
>> index c018d67da1a1..527056bd27b7 100644
>> --- a/samples/pktgen/README.rst
>> +++ b/samples/pktgen/README.rst
>> @@ -21,6 +21,7 @@ across the sample scripts. Usage example is printed on errors::
>> -d : ($DEST_IP) destination IP
>> -m : ($DST_MAC) destination MAC-addr
>> -t : ($THREADS) threads to start
>> + -f : ($F_THREAD) index of first thread
>
> IMHO the help text should be:
> "index of first thread (zero indexed CPU number)"
>
Yeah sounds better. I'll change this.
>
>> -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
>> diff --git a/samples/pktgen/parameters.sh b/samples/pktgen/parameters.sh
>> index 036147594a20..d2dfc5cfa66b 100644
>> --- a/samples/pktgen/parameters.sh
>> +++ b/samples/pktgen/parameters.sh
>> @@ -10,6 +10,7 @@ function usage() {
>> echo " -d : (\$DEST_IP) destination IP"
>> echo " -m : (\$DST_MAC) destination MAC-addr"
>> echo " -t : (\$THREADS) threads to start"
>> + echo " -f : (\$F_THREAD) index of first thread"
>
> Same here:
> IMHO the help text should be:
> "index of first thread (zero indexed CPU number)"
>
Yes.
>
>> 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"
>> @@ -21,7 +22,7 @@ function usage() {
>>
>> ## --- Parse command line arguments / parameters ---
>> ## echo "Commandline options:"
>> -while getopts "s:i:d:m:t:c:n:b:vxh6" option; do
>> +while getopts "s:i:d:m:f:t:c:n:b:vxh6" option; do
>> case $option in
>> i) # interface
>> export DEV=$OPTARG
>> @@ -39,11 +40,13 @@ while getopts "s:i:d:m:t:c:n:b:vxh6" option; do
>> export DST_MAC=$OPTARG
>> info "Destination MAC set to: DST_MAC=$DST_MAC"
>> ;;
>> + f)
>> + export F_THREAD=$OPTARG
>> + info "Index of first thread: $F_THREAD"
>> + ;;
>> t)
>> export THREADS=$OPTARG
>> - export CPU_THREADS=$OPTARG
>> - let "CPU_THREADS -= 1"
>> - info "Number of threads to start: $THREADS (0 to $CPU_THREADS)"
>> + info "Number of threads to start: $THREADS"
>> ;;
>> c)
>> export CLONE_SKB=$OPTARG
>> @@ -82,12 +85,18 @@ if [ -z "$PKT_SIZE" ]; then
>> info "Default packet size set to: set to: $PKT_SIZE bytes"
>> fi
>>
>> +if [ -z "$F_THREAD" ]; then
>> + # Zero CPU threads means one thread, because CPU numbers are zero indexed
>
> Wrong comment, use:
> # First thread (F_THREAD) reference the zero indexes CPU number
>
I'll fix.
>> + export F_THREAD=0
>> +fi
>> +
>> if [ -z "$THREADS" ]; then
>> # Zero CPU threads means one thread, because CPU numbers are zero indexed
>> - export CPU_THREADS=0
>
> Also remove comment, it is talking about CPU_THREADS
>
I'll fix.
>> export THREADS=1
>> fi
>>
>> +export L_THREAD="$THREADS + $F_THREAD - 1"
>> +
>
> This is sort of bad-shell coding. This will first get expanded at the
> usage point. The way you use it, it will work, because of the for loop
> uses an expansion like "((xxx))".
>
> If you echo the $L_THREAD variable you will see: "1 + 0 - 1"
>
> IMHO the right thing is to use:
>
> export L_THREAD=$(( THREADS + F_THREAD - 1 ))
>
> (I tested this also works for dash + ksh + zsh)
>
Thanks, I'll use the suggested command.
>
>> diff --git a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
>> index d2694a12de61..e5bfe759a0fb 100755
>> --- a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
>> +++ b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
>> @@ -48,7 +48,7 @@ DELAY="0" # Zero means max speed
>> pg_ctrl "reset"
>>
>> # 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
>> # make then unique, but any name will do.
>> dev=${DEV}@${thread}
>
> The expansion/use of $L_THREAD only works because "for-loop" expanded
> it by using ""(("" arithmetic evaluation.
>
After changing the one above, this one should still be OK, right?
Thanks for you comments!
Regards,
Tariq
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 2/2] pktgen: Specify the index of first thread
2017-06-14 11:10 ` Tariq Toukan
@ 2017-06-14 11:29 ` Jesper Dangaard Brouer
0 siblings, 0 replies; 7+ messages in thread
From: Jesper Dangaard Brouer @ 2017-06-14 11:29 UTC (permalink / raw)
To: Tariq Toukan; +Cc: David S. Miller, netdev, Eran Ben Elisha, brouer
On Wed, 14 Jun 2017 14:10:37 +0300
Tariq Toukan <tariqt@mellanox.com> wrote:
> >> +export L_THREAD="$THREADS + $F_THREAD - 1"
> >> +
> >
> > This is sort of bad-shell coding. This will first get expanded at the
> > usage point. The way you use it, it will work, because of the for loop
> > uses an expansion like "((xxx))".
> >
> > If you echo the $L_THREAD variable you will see: "1 + 0 - 1"
> >
> > IMHO the right thing is to use:
> >
> > export L_THREAD=$(( THREADS + F_THREAD - 1 ))
> >
> > (I tested this also works for dash + ksh + zsh)
> >
> Thanks, I'll use the suggested command.
> >
> >> diff --git a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
> >> index d2694a12de61..e5bfe759a0fb 100755
> >> --- a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
> >> +++ b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
> >> @@ -48,7 +48,7 @@ DELAY="0" # Zero means max speed
> >> pg_ctrl "reset"
> >>
> >> # 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
> >> # make then unique, but any name will do.
> >> dev=${DEV}@${thread}
> >
> > The expansion/use of $L_THREAD only works because "for-loop" expanded
> > it by using ""(("" arithmetic evaluation.
> >
> After changing the one above, this one should still be OK, right?
Yes, this part is still correct.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-06-14 11:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-13 15:04 [PATCH net-next 0/2] pktgen new parameters Tariq Toukan
2017-06-13 15:04 ` [PATCH net-next 1/2] pktgen: Specify num packets per thread Tariq Toukan
2017-06-14 7:26 ` Jesper Dangaard Brouer
2017-06-13 15:04 ` [PATCH net-next 2/2] pktgen: Specify the index of first thread Tariq Toukan
2017-06-14 7:09 ` Jesper Dangaard Brouer
2017-06-14 11:10 ` Tariq Toukan
2017-06-14 11:29 ` Jesper Dangaard Brouer
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).