aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2016-07-20 18:48:43 -0400
committerDavid S. Miller <davem@davemloft.net>2016-07-21 01:16:02 -0400
commit0f06a6787e0516352117f0720e3052f46bc13523 (patch)
tree53e05e9d4fd215852c082235e87d21e2ab41fc4a
parent1c137ef48662904ba83812de94dce01f99b24f0c (diff)
samples: Add an IPv6 '-6' option to the pktgen scripts
Add a '-6' option to the sample pktgen scripts for sending out IPv6 packets. [root@kerneldev010.prn1 ~/pktgen]# ./pktgen_sample03_burst_single_flow.sh -i eth0 -s 64 -d fe80::f652:14ff:fec2:a14c -m f4:52:14:c2:a1:4c -b 32 -6 [root@kerneldev011.prn1 ~]# tcpdump -i eth0 -nn -c3 port 9 tcpdump: WARNING: eth0: no IPv4 address assigned tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 14:38:51.815297 IP6 fe80::f652:14ff:fec2:2ad2.9 > fe80::f652:14ff:fec2:a14c.9: UDP, length 16 14:38:51.815311 IP6 fe80::f652:14ff:fec2:2ad2.9 > fe80::f652:14ff:fec2:a14c.9: UDP, length 16 14:38:51.815313 IP6 fe80::f652:14ff:fec2:2ad2.9 > fe80::f652:14ff:fec2:a14c.9: UDP, length 16 Signed-off-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--samples/pktgen/parameters.sh7
-rwxr-xr-xsamples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh6
-rwxr-xr-xsamples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh6
-rwxr-xr-xsamples/pktgen/pktgen_sample01_simple.sh6
-rwxr-xr-xsamples/pktgen/pktgen_sample02_multiqueue.sh6
-rwxr-xr-xsamples/pktgen/pktgen_sample03_burst_single_flow.sh6
6 files changed, 26 insertions, 11 deletions
diff --git a/samples/pktgen/parameters.sh b/samples/pktgen/parameters.sh
index 33b70fdd5a4a..f70ea7dd5660 100644
--- a/samples/pktgen/parameters.sh
+++ b/samples/pktgen/parameters.sh
@@ -14,12 +14,13 @@ function usage() {
14 echo " -b : (\$BURST) HW level bursting of SKBs" 14 echo " -b : (\$BURST) HW level bursting of SKBs"
15 echo " -v : (\$VERBOSE) verbose" 15 echo " -v : (\$VERBOSE) verbose"
16 echo " -x : (\$DEBUG) debug" 16 echo " -x : (\$DEBUG) debug"
17 echo " -6 : (\$IP6) IPv6"
17 echo "" 18 echo ""
18} 19}
19 20
20## --- Parse command line arguments / parameters --- 21## --- Parse command line arguments / parameters ---
21## echo "Commandline options:" 22## echo "Commandline options:"
22while getopts "s:i:d:m:t:c:b:vxh" option; do 23while getopts "s:i:d:m:t:c:b:vxh6" option; do
23 case $option in 24 case $option in
24 i) # interface 25 i) # interface
25 export DEV=$OPTARG 26 export DEV=$OPTARG
@@ -59,6 +60,10 @@ while getopts "s:i:d:m:t:c:b:vxh" option; do
59 export DEBUG=yes 60 export DEBUG=yes
60 info "Debug mode: DEBUG=$DEBUG" 61 info "Debug mode: DEBUG=$DEBUG"
61 ;; 62 ;;
63 6)
64 export IP6=6
65 info "IP6: IP6=$IP6"
66 ;;
62 h|?|*) 67 h|?|*)
63 usage; 68 usage;
64 err 2 "[ERROR] Unknown parameters!!!" 69 err 2 "[ERROR] Unknown parameters!!!"
diff --git a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
index cb1590331b47..f3e1bedfd77f 100755
--- a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
+++ b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
@@ -34,7 +34,9 @@ root_check_run_with_sudo "$@"
34source ${basedir}/parameters.sh 34source ${basedir}/parameters.sh
35# Using invalid DST_MAC will cause the packets to get dropped in 35# Using invalid DST_MAC will cause the packets to get dropped in
36# ip_rcv() which is part of the test 36# ip_rcv() which is part of the test
37[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42" 37if [ -z "$DEST_IP" ]; then
38 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
39fi
38[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff" 40[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
39[ -z "$BURST" ] && BURST=1024 41[ -z "$BURST" ] && BURST=1024
40 42
@@ -64,7 +66,7 @@ for ((thread = 0; thread < $THREADS; thread++)); do
64 66
65 # Destination 67 # Destination
66 pg_set $dev "dst_mac $DST_MAC" 68 pg_set $dev "dst_mac $DST_MAC"
67 pg_set $dev "dst $DEST_IP" 69 pg_set $dev "dst$IP6 $DEST_IP"
68 70
69 # Inject packet into RX path of stack 71 # Inject packet into RX path of stack
70 pg_set $dev "xmit_mode netif_receive" 72 pg_set $dev "xmit_mode netif_receive"
diff --git a/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh b/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
index 4e4e92b2515e..cc102e923241 100755
--- a/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
+++ b/samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh
@@ -13,7 +13,9 @@ root_check_run_with_sudo "$@"
13 13
14# Parameter parsing via include 14# Parameter parsing via include
15source ${basedir}/parameters.sh 15source ${basedir}/parameters.sh
16[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42" 16if [ -z "$DEST_IP" ]; then
17 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
18fi
17[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff" 19[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
18 20
19# Burst greater than 1 are invalid for queue_xmit mode 21# Burst greater than 1 are invalid for queue_xmit mode
@@ -47,7 +49,7 @@ for ((thread = 0; thread < $THREADS; thread++)); do
47 49
48 # Destination 50 # Destination
49 pg_set $dev "dst_mac $DST_MAC" 51 pg_set $dev "dst_mac $DST_MAC"
50 pg_set $dev "dst $DEST_IP" 52 pg_set $dev "dst$IP6 $DEST_IP"
51 53
52 # Inject packet into TX qdisc egress path of stack 54 # Inject packet into TX qdisc egress path of stack
53 pg_set $dev "xmit_mode queue_xmit" 55 pg_set $dev "xmit_mode queue_xmit"
diff --git a/samples/pktgen/pktgen_sample01_simple.sh b/samples/pktgen/pktgen_sample01_simple.sh
index 8c9d318c221b..29ef4ba50796 100755
--- a/samples/pktgen/pktgen_sample01_simple.sh
+++ b/samples/pktgen/pktgen_sample01_simple.sh
@@ -14,7 +14,9 @@ root_check_run_with_sudo "$@"
14source ${basedir}/parameters.sh 14source ${basedir}/parameters.sh
15# 15#
16# Set some default params, if they didn't get set 16# Set some default params, if they didn't get set
17[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42" 17if [ -z "$DEST_IP" ]; then
18 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
19fi
18[ -z "$CLONE_SKB" ] && CLONE_SKB="0" 20[ -z "$CLONE_SKB" ] && CLONE_SKB="0"
19# Example enforce param "-m" for dst_mac 21# Example enforce param "-m" for dst_mac
20[ -z "$DST_MAC" ] && usage && err 2 "Must specify -m dst_mac" 22[ -z "$DST_MAC" ] && usage && err 2 "Must specify -m dst_mac"
@@ -54,7 +56,7 @@ pg_set $DEV "flag NO_TIMESTAMP"
54 56
55# Destination 57# Destination
56pg_set $DEV "dst_mac $DST_MAC" 58pg_set $DEV "dst_mac $DST_MAC"
57pg_set $DEV "dst $DEST_IP" 59pg_set $DEV "dst$IP6 $DEST_IP"
58 60
59# Setup random UDP port src range 61# Setup random UDP port src range
60pg_set $DEV "flag UDPSRC_RND" 62pg_set $DEV "flag UDPSRC_RND"
diff --git a/samples/pktgen/pktgen_sample02_multiqueue.sh b/samples/pktgen/pktgen_sample02_multiqueue.sh
index 32467aea8e47..c88a161d3e6f 100755
--- a/samples/pktgen/pktgen_sample02_multiqueue.sh
+++ b/samples/pktgen/pktgen_sample02_multiqueue.sh
@@ -23,7 +23,9 @@ UDP_MIN=9
23UDP_MAX=109 23UDP_MAX=109
24 24
25# (example of setting default params in your script) 25# (example of setting default params in your script)
26[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42" 26if [ -z "$DEST_IP" ]; then
27 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
28fi
27[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff" 29[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
28 30
29# General cleanup everything since last run 31# General cleanup everything since last run
@@ -54,7 +56,7 @@ for ((thread = 0; thread < $THREADS; thread++)); do
54 56
55 # Destination 57 # Destination
56 pg_set $dev "dst_mac $DST_MAC" 58 pg_set $dev "dst_mac $DST_MAC"
57 pg_set $dev "dst $DEST_IP" 59 pg_set $dev "dst$IP6 $DEST_IP"
58 60
59 # Setup random UDP port src range 61 # Setup random UDP port src range
60 pg_set $dev "flag UDPSRC_RND" 62 pg_set $dev "flag UDPSRC_RND"
diff --git a/samples/pktgen/pktgen_sample03_burst_single_flow.sh b/samples/pktgen/pktgen_sample03_burst_single_flow.sh
index 775f5d0a1e53..80cf8f5ba6b2 100755
--- a/samples/pktgen/pktgen_sample03_burst_single_flow.sh
+++ b/samples/pktgen/pktgen_sample03_burst_single_flow.sh
@@ -25,7 +25,9 @@ root_check_run_with_sudo "$@"
25# Parameter parsing via include 25# Parameter parsing via include
26source ${basedir}/parameters.sh 26source ${basedir}/parameters.sh
27# Set some default params, if they didn't get set 27# Set some default params, if they didn't get set
28[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42" 28if [ -z "$DEST_IP" ]; then
29 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
30fi
29[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff" 31[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
30[ -z "$BURST" ] && BURST=32 32[ -z "$BURST" ] && BURST=32
31[ -z "$CLONE_SKB" ] && CLONE_SKB="100000" 33[ -z "$CLONE_SKB" ] && CLONE_SKB="100000"
@@ -55,7 +57,7 @@ for ((thread = 0; thread < $THREADS; thread++)); do
55 57
56 # Destination 58 # Destination
57 pg_set $dev "dst_mac $DST_MAC" 59 pg_set $dev "dst_mac $DST_MAC"
58 pg_set $dev "dst $DEST_IP" 60 pg_set $dev "dst$IP6 $DEST_IP"
59 61
60 # Setup burst, for easy testing -b 0 disable bursting 62 # Setup burst, for easy testing -b 0 disable bursting
61 # (internally in pktgen default and minimum burst=1) 63 # (internally in pktgen default and minimum burst=1)