Commit 0f88e6f3 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'pktgen-scripts-improvements'



Igor Russkikh says:

====================
pktgen: scripts improvements

Please consider small improvements to pktgen scripts we use in our environment.

Adding delay parameter through command line,
Adding new -a (append) parameter to make flex runs

v3: change us to ns in docs
v2: Review comments from Jesper

CC: Jesper Dangaard Brouer <brouer@redhat.com>
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6f162909 c8fd4852
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -28,10 +28,28 @@ across the sample scripts. Usage example is printed on errors::
  -b : ($BURST)     HW level bursting of SKBs
  -v : ($VERBOSE)   verbose
  -x : ($DEBUG)     debug
  -6 : ($IP6)       IPv6
  -w : ($DELAY)     Tx Delay value (ns)
  -a : ($APPEND)    Script will not reset generator's state, but will append its config

The global variable being set is also listed.  E.g. the required
interface/device parameter "-i" sets variable $DEV.

"-a" parameter may be used to create different flows simultaneously.
In this mode script will keep the existing config, will append its settings.
In this mode you'll have to manually run traffic with "pg_ctrl start".

For example you may use:

    source ./samples/pktgen/functions.sh
    pg_ctrl reset
    # add first device
    ./pktgen_sample06_numa_awared_queue_irq_affinity.sh -a -i ens1f0 -m 34:80:0d:a3:fc:c9 -t 8
    # add second device
    ./pktgen_sample06_numa_awared_queue_irq_affinity.sh -a -i ens1f1 -m 34:80:0d:a3:fc:c9 -t 8
    # run joint traffic on two devs
    pg_ctrl start

Common functions
----------------
The functions.sh file provides; Three different shell functions for
+6 −1
Original line number Diff line number Diff line
@@ -108,7 +108,12 @@ function pgset() {
    fi
}

[[ $EUID -eq 0 ]] && trap 'pg_ctrl "reset"' EXIT
if [[ -z "$APPEND" ]]; then
	if [[ $EUID -eq 0 ]]; then
		# Cleanup pktgen setup on exit if thats not "append mode"
		trap 'pg_ctrl "reset"' EXIT
	fi
fi

## -- General shell tricks --

+14 −1
Original line number Diff line number Diff line
@@ -19,12 +19,14 @@ function usage() {
    echo "  -v : (\$VERBOSE)   verbose"
    echo "  -x : (\$DEBUG)     debug"
    echo "  -6 : (\$IP6)       IPv6"
    echo "  -w : (\$DELAY)     Tx Delay value (ns)"
    echo "  -a : (\$APPEND)    Script will not reset generator's state, but will append its config"
    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:vxh6a" option; do
    case $option in
        i) # interface
          export DEV=$OPTARG
@@ -66,6 +68,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"
@@ -78,6 +84,10 @@ while getopts "s:i:d:m:p:f:t:c:n:b:vxh6" option; do
	  export IP6=6
	  info "IP6: IP6=$IP6"
	  ;;
        a)
          export APPEND=yes
          info "Append mode: APPEND=$APPEND"
          ;;
        h|?|*)
          usage;
          err 2 "[ERROR] Unknown parameters!!!"
@@ -100,6 +110,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
+0 −3
Original line number Diff line number Diff line
@@ -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"

+0 −3
Original line number Diff line number Diff line
@@ -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"

Loading