Skip to content

Commit 0f06a67

Browse files
iamkafaidavem330
authored andcommitted
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>
1 parent 1c137ef commit 0f06a67

6 files changed

Lines changed: 26 additions & 11 deletions

‎samples/pktgen/parameters.sh‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ function usage() {
1414
echo " -b : (\$BURST) HW level bursting of SKBs"
1515
echo " -v : (\$VERBOSE) verbose"
1616
echo " -x : (\$DEBUG) debug"
17+
echo " -6 : (\$IP6) IPv6"
1718
echo ""
1819
}
1920

2021
## --- Parse command line arguments / parameters ---
2122
## echo "Commandline options:"
22-
while getopts "s:i:d:m:t:c:b:vxh" option; do
23+
while getopts "s:i:d:m:t:c:b:vxh6" option; do
2324
case $option in
2425
i) # interface
2526
export DEV=$OPTARG
@@ -59,6 +60,10 @@ while getopts "s:i:d:m:t:c:b:vxh" option; do
5960
export DEBUG=yes
6061
info "Debug mode: DEBUG=$DEBUG"
6162
;;
63+
6)
64+
export IP6=6
65+
info "IP6: IP6=$IP6"
66+
;;
6267
h|?|*)
6368
usage;
6469
err 2 "[ERROR] Unknown parameters!!!"

‎samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ root_check_run_with_sudo "$@"
3434
source ${basedir}/parameters.sh
3535
# Using invalid DST_MAC will cause the packets to get dropped in
3636
# ip_rcv() which is part of the test
37-
[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
37+
if [ -z "$DEST_IP" ]; then
38+
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
39+
fi
3840
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
3941
[ -z "$BURST" ] && BURST=1024
4042

@@ -64,7 +66,7 @@ for ((thread = 0; thread < $THREADS; thread++)); do
6466

6567
# Destination
6668
pg_set $dev "dst_mac $DST_MAC"
67-
pg_set $dev "dst $DEST_IP"
69+
pg_set $dev "dst$IP6 $DEST_IP"
6870

6971
# Inject packet into RX path of stack
7072
pg_set $dev "xmit_mode netif_receive"

‎samples/pktgen/pktgen_bench_xmit_mode_queue_xmit.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ root_check_run_with_sudo "$@"
1313

1414
# Parameter parsing via include
1515
source ${basedir}/parameters.sh
16-
[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
16+
if [ -z "$DEST_IP" ]; then
17+
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
18+
fi
1719
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
1820

1921
# Burst greater than 1 are invalid for queue_xmit mode
@@ -47,7 +49,7 @@ for ((thread = 0; thread < $THREADS; thread++)); do
4749

4850
# Destination
4951
pg_set $dev "dst_mac $DST_MAC"
50-
pg_set $dev "dst $DEST_IP"
52+
pg_set $dev "dst$IP6 $DEST_IP"
5153

5254
# Inject packet into TX qdisc egress path of stack
5355
pg_set $dev "xmit_mode queue_xmit"

‎samples/pktgen/pktgen_sample01_simple.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ root_check_run_with_sudo "$@"
1414
source ${basedir}/parameters.sh
1515
#
1616
# Set some default params, if they didn't get set
17-
[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
17+
if [ -z "$DEST_IP" ]; then
18+
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
19+
fi
1820
[ -z "$CLONE_SKB" ] && CLONE_SKB="0"
1921
# Example enforce param "-m" for dst_mac
2022
[ -z "$DST_MAC" ] && usage && err 2 "Must specify -m dst_mac"
@@ -54,7 +56,7 @@ pg_set $DEV "flag NO_TIMESTAMP"
5456

5557
# Destination
5658
pg_set $DEV "dst_mac $DST_MAC"
57-
pg_set $DEV "dst $DEST_IP"
59+
pg_set $DEV "dst$IP6 $DEST_IP"
5860

5961
# Setup random UDP port src range
6062
pg_set $DEV "flag UDPSRC_RND"

‎samples/pktgen/pktgen_sample02_multiqueue.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ UDP_MIN=9
2323
UDP_MAX=109
2424

2525
# (example of setting default params in your script)
26-
[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
26+
if [ -z "$DEST_IP" ]; then
27+
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
28+
fi
2729
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
2830

2931
# General cleanup everything since last run
@@ -54,7 +56,7 @@ for ((thread = 0; thread < $THREADS; thread++)); do
5456

5557
# Destination
5658
pg_set $dev "dst_mac $DST_MAC"
57-
pg_set $dev "dst $DEST_IP"
59+
pg_set $dev "dst$IP6 $DEST_IP"
5860

5961
# Setup random UDP port src range
6062
pg_set $dev "flag UDPSRC_RND"

‎samples/pktgen/pktgen_sample03_burst_single_flow.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ root_check_run_with_sudo "$@"
2525
# Parameter parsing via include
2626
source ${basedir}/parameters.sh
2727
# Set some default params, if they didn't get set
28-
[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
28+
if [ -z "$DEST_IP" ]; then
29+
[ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
30+
fi
2931
[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
3032
[ -z "$BURST" ] && BURST=32
3133
[ -z "$CLONE_SKB" ] && CLONE_SKB="100000"
@@ -55,7 +57,7 @@ for ((thread = 0; thread < $THREADS; thread++)); do
5557

5658
# Destination
5759
pg_set $dev "dst_mac $DST_MAC"
58-
pg_set $dev "dst $DEST_IP"
60+
pg_set $dev "dst$IP6 $DEST_IP"
5961

6062
# Setup burst, for easy testing -b 0 disable bursting
6163
# (internally in pktgen default and minimum burst=1)

0 commit comments

Comments
 (0)