diff options
author | Tariq Toukan <tariqt@mellanox.com> | 2017-06-15 12:07:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-16 12:32:34 -0400 |
commit | e0e16672ee9e2c31d9601d762cf934196b13a7fc (patch) | |
tree | fe98cc2b576624b43bd00dbebcdcb2636d952401 /samples | |
parent | 69137ea60c9dad58773a1918de6c1b00b088520c (diff) |
pktgen: Specify the index of first thread
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>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/pktgen/README.rst | 1 | ||||
-rw-r--r-- | samples/pktgen/parameters.sh | 20 | ||||
-rwxr-xr-x | samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh | 4 | ||||
-rwxr-xr-x | samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh | 4 | ||||
-rwxr-xr-x | samples/pktgen/pktgen_sample02_multiqueue.sh | 4 | ||||
-rwxr-xr-x | samples/pktgen/pktgen_sample03_burst_single_flow.sh | 4 | ||||
-rwxr-xr-x | samples/pktgen/pktgen_sample04_many_flows.sh | 4 | ||||
-rwxr-xr-x | samples/pktgen/pktgen_sample05_flow_per_thread.sh | 4 |
8 files changed, 27 insertions, 18 deletions
diff --git a/samples/pktgen/README.rst b/samples/pktgen/README.rst index c018d67da1a1..ff8929da61c5 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:: | |||
21 | -d : ($DEST_IP) destination IP | 21 | -d : ($DEST_IP) destination IP |
22 | -m : ($DST_MAC) destination MAC-addr | 22 | -m : ($DST_MAC) destination MAC-addr |
23 | -t : ($THREADS) threads to start | 23 | -t : ($THREADS) threads to start |
24 | -f : ($F_THREAD) index of first thread (zero indexed CPU number) | ||
24 | -c : ($SKB_CLONE) SKB clones send before alloc new SKB | 25 | -c : ($SKB_CLONE) SKB clones send before alloc new SKB |
25 | -n : ($COUNT) num messages to send per thread, 0 means indefinitely | 26 | -n : ($COUNT) num messages to send per thread, 0 means indefinitely |
26 | -b : ($BURST) HW level bursting of SKBs | 27 | -b : ($BURST) HW level bursting of SKBs |
diff --git a/samples/pktgen/parameters.sh b/samples/pktgen/parameters.sh index 036147594a20..3a6244d5f47a 100644 --- a/samples/pktgen/parameters.sh +++ b/samples/pktgen/parameters.sh | |||
@@ -10,6 +10,7 @@ function usage() { | |||
10 | echo " -d : (\$DEST_IP) destination IP" | 10 | echo " -d : (\$DEST_IP) destination IP" |
11 | echo " -m : (\$DST_MAC) destination MAC-addr" | 11 | echo " -m : (\$DST_MAC) destination MAC-addr" |
12 | echo " -t : (\$THREADS) threads to start" | 12 | echo " -t : (\$THREADS) threads to start" |
13 | echo " -f : (\$F_THREAD) index of first thread (zero indexed CPU number)" | ||
13 | echo " -c : (\$SKB_CLONE) SKB clones send before alloc new SKB" | 14 | echo " -c : (\$SKB_CLONE) SKB clones send before alloc new SKB" |
14 | echo " -n : (\$COUNT) num messages to send per thread, 0 means indefinitely" | 15 | echo " -n : (\$COUNT) num messages to send per thread, 0 means indefinitely" |
15 | echo " -b : (\$BURST) HW level bursting of SKBs" | 16 | echo " -b : (\$BURST) HW level bursting of SKBs" |
@@ -21,7 +22,7 @@ function usage() { | |||
21 | 22 | ||
22 | ## --- Parse command line arguments / parameters --- | 23 | ## --- Parse command line arguments / parameters --- |
23 | ## echo "Commandline options:" | 24 | ## echo "Commandline options:" |
24 | while getopts "s:i:d:m:t:c:n:b:vxh6" option; do | 25 | while getopts "s:i:d:m:f:t:c:n:b:vxh6" option; do |
25 | case $option in | 26 | case $option in |
26 | i) # interface | 27 | i) # interface |
27 | export DEV=$OPTARG | 28 | export DEV=$OPTARG |
@@ -39,11 +40,13 @@ while getopts "s:i:d:m:t:c:n:b:vxh6" option; do | |||
39 | export DST_MAC=$OPTARG | 40 | export DST_MAC=$OPTARG |
40 | info "Destination MAC set to: DST_MAC=$DST_MAC" | 41 | info "Destination MAC set to: DST_MAC=$DST_MAC" |
41 | ;; | 42 | ;; |
43 | f) | ||
44 | export F_THREAD=$OPTARG | ||
45 | info "Index of first thread (zero indexed CPU number): $F_THREAD" | ||
46 | ;; | ||
42 | t) | 47 | t) |
43 | export THREADS=$OPTARG | 48 | export THREADS=$OPTARG |
44 | export CPU_THREADS=$OPTARG | 49 | info "Number of threads to start: $THREADS" |
45 | let "CPU_THREADS -= 1" | ||
46 | info "Number of threads to start: $THREADS (0 to $CPU_THREADS)" | ||
47 | ;; | 50 | ;; |
48 | c) | 51 | c) |
49 | export CLONE_SKB=$OPTARG | 52 | export CLONE_SKB=$OPTARG |
@@ -82,12 +85,17 @@ if [ -z "$PKT_SIZE" ]; then | |||
82 | info "Default packet size set to: set to: $PKT_SIZE bytes" | 85 | info "Default packet size set to: set to: $PKT_SIZE bytes" |
83 | fi | 86 | fi |
84 | 87 | ||
88 | if [ -z "$F_THREAD" ]; then | ||
89 | # First thread (F_THREAD) reference the zero indexed CPU number | ||
90 | export F_THREAD=0 | ||
91 | fi | ||
92 | |||
85 | if [ -z "$THREADS" ]; then | 93 | if [ -z "$THREADS" ]; then |
86 | # Zero CPU threads means one thread, because CPU numbers are zero indexed | ||
87 | export CPU_THREADS=0 | ||
88 | export THREADS=1 | 94 | export THREADS=1 |
89 | fi | 95 | fi |
90 | 96 | ||
97 | export L_THREAD=$(( THREADS + F_THREAD - 1 )) | ||
98 | |||
91 | if [ -z "$DEV" ]; then | 99 | if [ -z "$DEV" ]; then |
92 | usage | 100 | usage |
93 | err 2 "Please specify output device" | 101 | 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 | |||
48 | pg_ctrl "reset" | 48 | pg_ctrl "reset" |
49 | 49 | ||
50 | # Threads are specified with parameter -t value in $THREADS | 50 | # Threads are specified with parameter -t value in $THREADS |
51 | for ((thread = 0; thread < $THREADS; thread++)); do | 51 | for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do |
52 | # The device name is extended with @name, using thread number to | 52 | # The device name is extended with @name, using thread number to |
53 | # make then unique, but any name will do. | 53 | # make then unique, but any name will do. |
54 | dev=${DEV}@${thread} | 54 | dev=${DEV}@${thread} |
@@ -81,7 +81,7 @@ pg_ctrl "start" | |||
81 | echo "Done" >&2 | 81 | echo "Done" >&2 |
82 | 82 | ||
83 | # Print results | 83 | # Print results |
84 | for ((thread = 0; thread < $THREADS; thread++)); do | 84 | for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do |
85 | dev=${DEV}@${thread} | 85 | dev=${DEV}@${thread} |
86 | echo "Device: $dev" | 86 | echo "Device: $dev" |
87 | cat /proc/net/pktgen/$dev | grep -A2 "Result:" | 87 | 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 | |||
31 | pg_ctrl "reset" | 31 | pg_ctrl "reset" |
32 | 32 | ||
33 | # Threads are specified with parameter -t value in $THREADS | 33 | # Threads are specified with parameter -t value in $THREADS |
34 | for ((thread = 0; thread < $THREADS; thread++)); do | 34 | for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do |
35 | # The device name is extended with @name, using thread number to | 35 | # The device name is extended with @name, using thread number to |
36 | # make then unique, but any name will do. | 36 | # make then unique, but any name will do. |
37 | dev=${DEV}@${thread} | 37 | dev=${DEV}@${thread} |
@@ -61,7 +61,7 @@ pg_ctrl "start" | |||
61 | echo "Done" >&2 | 61 | echo "Done" >&2 |
62 | 62 | ||
63 | # Print results | 63 | # Print results |
64 | for ((thread = 0; thread < $THREADS; thread++)); do | 64 | for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do |
65 | dev=${DEV}@${thread} | 65 | dev=${DEV}@${thread} |
66 | echo "Device: $dev" | 66 | echo "Device: $dev" |
67 | cat /proc/net/pktgen/$dev | grep -A2 "Result:" | 67 | 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 | |||
33 | pg_ctrl "reset" | 33 | pg_ctrl "reset" |
34 | 34 | ||
35 | # Threads are specified with parameter -t value in $THREADS | 35 | # Threads are specified with parameter -t value in $THREADS |
36 | for ((thread = 0; thread < $THREADS; thread++)); do | 36 | for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do |
37 | # The device name is extended with @name, using thread number to | 37 | # The device name is extended with @name, using thread number to |
38 | # make then unique, but any name will do. | 38 | # make then unique, but any name will do. |
39 | dev=${DEV}@${thread} | 39 | dev=${DEV}@${thread} |
@@ -71,7 +71,7 @@ pg_ctrl "start" | |||
71 | echo "Done" >&2 | 71 | echo "Done" >&2 |
72 | 72 | ||
73 | # Print results | 73 | # Print results |
74 | for ((thread = 0; thread < $THREADS; thread++)); do | 74 | for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do |
75 | dev=${DEV}@${thread} | 75 | dev=${DEV}@${thread} |
76 | echo "Device: $dev" | 76 | echo "Device: $dev" |
77 | cat /proc/net/pktgen/$dev | grep -A2 "Result:" | 77 | 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 | |||
40 | pg_ctrl "reset" | 40 | pg_ctrl "reset" |
41 | 41 | ||
42 | # Threads are specified with parameter -t value in $THREADS | 42 | # Threads are specified with parameter -t value in $THREADS |
43 | for ((thread = 0; thread < $THREADS; thread++)); do | 43 | for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do |
44 | dev=${DEV}@${thread} | 44 | dev=${DEV}@${thread} |
45 | 45 | ||
46 | # Add remove all other devices and add_device $dev to thread | 46 | # Add remove all other devices and add_device $dev to thread |
@@ -71,7 +71,7 @@ done | |||
71 | # Run if user hits control-c | 71 | # Run if user hits control-c |
72 | function control_c() { | 72 | function control_c() { |
73 | # Print results | 73 | # Print results |
74 | for ((thread = 0; thread < $THREADS; thread++)); do | 74 | for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do |
75 | dev=${DEV}@${thread} | 75 | dev=${DEV}@${thread} |
76 | echo "Device: $dev" | 76 | echo "Device: $dev" |
77 | cat /proc/net/pktgen/$dev | grep -A2 "Result:" | 77 | 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 | |||
36 | pg_ctrl "reset" | 36 | pg_ctrl "reset" |
37 | 37 | ||
38 | # Threads are specified with parameter -t value in $THREADS | 38 | # Threads are specified with parameter -t value in $THREADS |
39 | for ((thread = 0; thread < $THREADS; thread++)); do | 39 | for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do |
40 | dev=${DEV}@${thread} | 40 | dev=${DEV}@${thread} |
41 | 41 | ||
42 | # Add remove all other devices and add_device $dev to thread | 42 | # Add remove all other devices and add_device $dev to thread |
@@ -78,7 +78,7 @@ done | |||
78 | # Run if user hits control-c | 78 | # Run if user hits control-c |
79 | function print_result() { | 79 | function print_result() { |
80 | # Print results | 80 | # Print results |
81 | for ((thread = 0; thread < $THREADS; thread++)); do | 81 | for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do |
82 | dev=${DEV}@${thread} | 82 | dev=${DEV}@${thread} |
83 | echo "Device: $dev" | 83 | echo "Device: $dev" |
84 | cat /proc/net/pktgen/$dev | grep -A2 "Result:" | 84 | 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 | |||
30 | pg_ctrl "reset" | 30 | pg_ctrl "reset" |
31 | 31 | ||
32 | # Threads are specified with parameter -t value in $THREADS | 32 | # Threads are specified with parameter -t value in $THREADS |
33 | for ((thread = 0; thread < $THREADS; thread++)); do | 33 | for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do |
34 | dev=${DEV}@${thread} | 34 | dev=${DEV}@${thread} |
35 | 35 | ||
36 | # Add remove all other devices and add_device $dev to thread | 36 | # Add remove all other devices and add_device $dev to thread |
@@ -66,7 +66,7 @@ done | |||
66 | # Run if user hits control-c | 66 | # Run if user hits control-c |
67 | function print_result() { | 67 | function print_result() { |
68 | # Print results | 68 | # Print results |
69 | for ((thread = 0; thread < $THREADS; thread++)); do | 69 | for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do |
70 | dev=${DEV}@${thread} | 70 | dev=${DEV}@${thread} |
71 | echo "Device: $dev" | 71 | echo "Device: $dev" |
72 | cat /proc/net/pktgen/$dev | grep -A2 "Result:" | 72 | cat /proc/net/pktgen/$dev | grep -A2 "Result:" |