diff mbox series

[v2,net-next,1/2] samples: pktgen: allow to specify delay parameter via new opt

Message ID 20210211155626.25213-2-irusskikh@marvell.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series pktgen: scripts improvements | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 1 of 1 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 101 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Igor Russkikh Feb. 11, 2021, 3:56 p.m. UTC
DELAY may now be explicitly specified via common parameter -w

Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
 samples/pktgen/parameters.sh                           | 10 +++++++++-
 samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh |  3 ---
 samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh    |  3 ---
 samples/pktgen/pktgen_sample01_simple.sh               |  3 ---
 samples/pktgen/pktgen_sample02_multiqueue.sh           |  1 -
 samples/pktgen/pktgen_sample03_burst_single_flow.sh    |  3 ---
 samples/pktgen/pktgen_sample04_many_flows.sh           |  3 ---
 samples/pktgen/pktgen_sample05_flow_per_thread.sh      |  3 ---
 .../pktgen_sample06_numa_awared_queue_irq_affinity.sh  |  1 -
 9 files changed, 9 insertions(+), 21 deletions(-)

Comments

Jesper Dangaard Brouer Feb. 11, 2021, 5:12 p.m. UTC | #1
On Thu, 11 Feb 2021 16:56:25 +0100
Igor Russkikh <irusskikh@marvell.com> wrote:

> diff --git a/samples/pktgen/parameters.sh b/samples/pktgen/parameters.sh
> index ff0ed474fee9..70cc2878d479 100644
> --- a/samples/pktgen/parameters.sh
> +++ b/samples/pktgen/parameters.sh
> @@ -19,12 +19,13 @@ function usage() {
>      echo "  -v : (\$VERBOSE)   verbose"
>      echo "  -x : (\$DEBUG)     debug"
>      echo "  -6 : (\$IP6)       IPv6"
> +    echo "  -w : (\$DELAY)     Tx Delay value (us)"

This is not in "us" it is in "ns" (nanosec). (Like I pointed out last time...)

>      echo ""
>  }
Igor Russkikh Feb. 11, 2021, 5:39 p.m. UTC | #2
>> +    echo "  -w : (\$DELAY)     Tx Delay value (us)"
>This is not in "us" it is in "ns" (nanosec). (Like I pointed out last time...)

Ah, sorry lost that. Will fix.

One extra thing I wanted to raise is "set -o errexit" in functions.sh.
It basically contradicts with the usecase I'm using (doing source ./functions.sh).
After that, any error in current shell makes it to quit.

Honestly, for my tests, I do always disable that line.

  Igor
Jesper Dangaard Brouer Feb. 12, 2021, 7:09 a.m. UTC | #3
On Thu, 11 Feb 2021 17:39:35 +0000
Igor Russkikh <irusskikh@marvell.com> wrote:

> >> +    echo "  -w : (\$DELAY)     Tx Delay value (us)"  
> >This is not in "us" it is in "ns" (nanosec). (Like I pointed out last time...)  
> 
> Ah, sorry lost that. Will fix.

Also remember that you made similar mistake in next patch.
When adding documentation in samples/pktgen/README.rst.
Strictly speaking, the doc update for DELAY belongs in patch-1.


> One extra thing I wanted to raise is "set -o errexit" in functions.sh.
> It basically contradicts with the usecase I'm using (doing source ./functions.sh).
> After that, any error in current shell makes it to quit.

Cc. Daniel T. Lee, can you remember why this 'errexit' was added?

> Honestly, for my tests, I do always disable that line.

In your shell script, using "append", you can disable that shell
feature in your script (instead of removing the line from functions.sh).
diff mbox series

Patch

diff --git a/samples/pktgen/parameters.sh b/samples/pktgen/parameters.sh
index ff0ed474fee9..70cc2878d479 100644
--- a/samples/pktgen/parameters.sh
+++ b/samples/pktgen/parameters.sh
@@ -19,12 +19,13 @@  function usage() {
     echo "  -v : (\$VERBOSE)   verbose"
     echo "  -x : (\$DEBUG)     debug"
     echo "  -6 : (\$IP6)       IPv6"
+    echo "  -w : (\$DELAY)     Tx Delay value (us)"
     echo ""
 }
 
 ##  --- Parse command line arguments / parameters ---
 ## echo "Commandline options:"
-while getopts "s:i:d:m:p:f:t:c:n:b:vxh6" option; do
+while getopts "s:i:d:m:p:f:t:c:n:b:w:vxh6" option; do
     case $option in
         i) # interface
           export DEV=$OPTARG
@@ -66,6 +67,10 @@  while getopts "s:i:d:m:p:f:t:c:n:b:vxh6" option; do
 	  export BURST=$OPTARG
 	  info "SKB bursting: BURST=$BURST"
           ;;
+        w)
+	  export DELAY=$OPTARG
+	  info "DELAY=$DELAY"
+          ;;
         v)
           export VERBOSE=yes
           info "Verbose mode: VERBOSE=$VERBOSE"
@@ -100,6 +105,9 @@  if [ -z "$THREADS" ]; then
     export THREADS=1
 fi
 
+# default DELAY
+[ -z "$DELAY" ] && export DELAY=0 # Zero means max speed
+
 export L_THREAD=$(( THREADS + F_THREAD - 1 ))
 
 if [ -z "$DEV" ]; then
diff --git a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
index 1b6204125d2d..30a610b541ad 100755
--- a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
+++ b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
@@ -50,9 +50,6 @@  if [ -n "$DST_PORT" ]; then
     validate_ports $UDP_DST_MIN $UDP_DST_MAX
 fi
 
-# Base Config
-DELAY="0"        # Zero means max speed
-
 # 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 e607cb369b20..a6195bd77532 100755
--- a/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
+++ b/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
@@ -33,9 +33,6 @@  if [ -n "$DST_PORT" ]; then
     validate_ports $UDP_DST_MIN $UDP_DST_MAX
 fi
 
-# Base Config
-DELAY="0"        # Zero means max speed
-
 # 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 a4e250b45dce..c2ad1fa32d3f 100755
--- a/samples/pktgen/pktgen_sample01_simple.sh
+++ b/samples/pktgen/pktgen_sample01_simple.sh
@@ -31,9 +31,6 @@  if [ -n "$DST_PORT" ]; then
     validate_ports $UDP_DST_MIN $UDP_DST_MAX
 fi
 
-# Base Config
-DELAY="0"        # Zero means max speed
-
 # Flow variation random source port between min and max
 UDP_SRC_MIN=9
 UDP_SRC_MAX=109
diff --git a/samples/pktgen/pktgen_sample02_multiqueue.sh b/samples/pktgen/pktgen_sample02_multiqueue.sh
index cb2495fcdc60..49e1e81a2945 100755
--- a/samples/pktgen/pktgen_sample02_multiqueue.sh
+++ b/samples/pktgen/pktgen_sample02_multiqueue.sh
@@ -17,7 +17,6 @@  source ${basedir}/parameters.sh
 [ -z "$COUNT" ] && COUNT="100000" # Zero means indefinitely
 
 # Base Config
-DELAY="0"        # Zero means max speed
 [ -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 fff50765a5aa..f9b67affb567 100755
--- a/samples/pktgen/pktgen_sample03_burst_single_flow.sh
+++ b/samples/pktgen/pktgen_sample03_burst_single_flow.sh
@@ -42,9 +42,6 @@  if [ -n "$DST_PORT" ]; then
     validate_ports $UDP_DST_MIN $UDP_DST_MAX
 fi
 
-# Base Config
-DELAY="0"  # Zero means max speed
-
 # 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 2cd6b701400d..ac2d037a6160 100755
--- a/samples/pktgen/pktgen_sample04_many_flows.sh
+++ b/samples/pktgen/pktgen_sample04_many_flows.sh
@@ -34,9 +34,6 @@  fi
 [ -z "$FLOWS" ]     && FLOWS="8000"
 [ -z "$FLOWLEN" ]   && FLOWLEN="10"
 
-# Base Config
-DELAY="0"  # Zero means max speed
-
 if [[ -n "$BURST" ]]; then
     err 1 "Bursting not supported for this mode"
 fi
diff --git a/samples/pktgen/pktgen_sample05_flow_per_thread.sh b/samples/pktgen/pktgen_sample05_flow_per_thread.sh
index 4cb6252ade39..85256484c86f 100755
--- a/samples/pktgen/pktgen_sample05_flow_per_thread.sh
+++ b/samples/pktgen/pktgen_sample05_flow_per_thread.sh
@@ -31,9 +31,6 @@  if [ -n "$DST_PORT" ]; then
     validate_ports $UDP_DST_MIN $UDP_DST_MAX
 fi
 
-# Base Config
-DELAY="0"  # Zero means max speed
-
 # General cleanup everything since last run
 pg_ctrl "reset"
 
diff --git a/samples/pktgen/pktgen_sample06_numa_awared_queue_irq_affinity.sh b/samples/pktgen/pktgen_sample06_numa_awared_queue_irq_affinity.sh
index 728106060a02..7c73ab8fbe3c 100755
--- a/samples/pktgen/pktgen_sample06_numa_awared_queue_irq_affinity.sh
+++ b/samples/pktgen/pktgen_sample06_numa_awared_queue_irq_affinity.sh
@@ -15,7 +15,6 @@  root_check_run_with_sudo "$@"
 source ${basedir}/parameters.sh
 
 # Base Config
-DELAY="0"        # Zero means max speed
 [ -z "$COUNT" ]     && COUNT="20000000"   # Zero means indefinitely
 [ -z "$CLONE_SKB" ] && CLONE_SKB="0"