mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race
[linux/fpc-iii.git] / samples / pktgen / pktgen_sample01_simple.sh
blobe9ab4edba2d726951311e2fd3c62ca9b35b28700
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
4 # Simple example:
5 # * pktgen sending with single thread and single interface
6 # * flow variation via random UDP source port
8 basedir=`dirname $0`
9 source ${basedir}/functions.sh
10 root_check_run_with_sudo "$@"
12 # Parameter parsing via include
13 # - go look in parameters.sh to see which setting are avail
14 # - required param is the interface "-i" stored in $DEV
15 source ${basedir}/parameters.sh
17 # Set some default params, if they didn't get set
18 if [ -z "$DEST_IP" ]; then
19 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
21 [ -z "$CLONE_SKB" ] && CLONE_SKB="0"
22 # Example enforce param "-m" for dst_mac
23 [ -z "$DST_MAC" ] && usage && err 2 "Must specify -m dst_mac"
24 [ -z "$COUNT" ] && COUNT="100000" # Zero means indefinitely
26 # Base Config
27 DELAY="0" # Zero means max speed
29 # Flow variation random source port between min and max
30 UDP_MIN=9
31 UDP_MAX=109
33 # General cleanup everything since last run
34 # (especially important if other threads were configured by other scripts)
35 pg_ctrl "reset"
37 # Add remove all other devices and add_device $DEV to thread 0
38 thread=0
39 pg_thread $thread "rem_device_all"
40 pg_thread $thread "add_device" $DEV
42 # How many packets to send (zero means indefinitely)
43 pg_set $DEV "count $COUNT"
45 # Reduce alloc cost by sending same SKB many times
46 # - this obviously affects the randomness within the packet
47 pg_set $DEV "clone_skb $CLONE_SKB"
49 # Set packet size
50 pg_set $DEV "pkt_size $PKT_SIZE"
52 # Delay between packets (zero means max speed)
53 pg_set $DEV "delay $DELAY"
55 # Flag example disabling timestamping
56 pg_set $DEV "flag NO_TIMESTAMP"
58 # Destination
59 pg_set $DEV "dst_mac $DST_MAC"
60 pg_set $DEV "dst$IP6 $DEST_IP"
62 # Setup random UDP port src range
63 pg_set $DEV "flag UDPSRC_RND"
64 pg_set $DEV "udp_src_min $UDP_MIN"
65 pg_set $DEV "udp_src_max $UDP_MAX"
67 # start_run
68 echo "Running... ctrl^C to stop" >&2
69 pg_ctrl "start"
70 echo "Done" >&2
72 # Print results
73 echo "Result device: $DEV"
74 cat /proc/net/pktgen/$DEV