inet: frag: enforce memory limits earlier
[linux/fpc-iii.git] / samples / pktgen / parameters.sh
blobf70ea7dd5660de30daed20364e5f4e75bf6ea92a
2 # Common parameter parsing for pktgen scripts
5 function usage() {
6 echo ""
7 echo "Usage: $0 [-vx] -i ethX"
8 echo " -i : (\$DEV) output interface/device (required)"
9 echo " -s : (\$PKT_SIZE) packet size"
10 echo " -d : (\$DEST_IP) destination IP"
11 echo " -m : (\$DST_MAC) destination MAC-addr"
12 echo " -t : (\$THREADS) threads to start"
13 echo " -c : (\$SKB_CLONE) SKB clones send before alloc new SKB"
14 echo " -b : (\$BURST) HW level bursting of SKBs"
15 echo " -v : (\$VERBOSE) verbose"
16 echo " -x : (\$DEBUG) debug"
17 echo " -6 : (\$IP6) IPv6"
18 echo ""
21 ## --- Parse command line arguments / parameters ---
22 ## echo "Commandline options:"
23 while getopts "s:i:d:m:t:c:b:vxh6" option; do
24 case $option in
25 i) # interface
26 export DEV=$OPTARG
27 info "Output device set to: DEV=$DEV"
30 export PKT_SIZE=$OPTARG
31 info "Packet size set to: PKT_SIZE=$PKT_SIZE bytes"
33 d) # destination IP
34 export DEST_IP=$OPTARG
35 info "Destination IP set to: DEST_IP=$DEST_IP"
37 m) # MAC
38 export DST_MAC=$OPTARG
39 info "Destination MAC set to: DST_MAC=$DST_MAC"
42 export THREADS=$OPTARG
43 export CPU_THREADS=$OPTARG
44 let "CPU_THREADS -= 1"
45 info "Number of threads to start: $THREADS (0 to $CPU_THREADS)"
48 export CLONE_SKB=$OPTARG
49 info "CLONE_SKB=$CLONE_SKB"
52 export BURST=$OPTARG
53 info "SKB bursting: BURST=$BURST"
56 export VERBOSE=yes
57 info "Verbose mode: VERBOSE=$VERBOSE"
60 export DEBUG=yes
61 info "Debug mode: DEBUG=$DEBUG"
64 export IP6=6
65 info "IP6: IP6=$IP6"
67 h|?|*)
68 usage;
69 err 2 "[ERROR] Unknown parameters!!!"
70 esac
71 done
72 shift $(( $OPTIND - 1 ))
74 if [ -z "$PKT_SIZE" ]; then
75 # NIC adds 4 bytes CRC
76 export PKT_SIZE=60
77 info "Default packet size set to: set to: $PKT_SIZE bytes"
80 if [ -z "$THREADS" ]; then
81 # Zero CPU threads means one thread, because CPU numbers are zero indexed
82 export CPU_THREADS=0
83 export THREADS=1
86 if [ -z "$DEV" ]; then
87 usage
88 err 2 "Please specify output device"
91 if [ -z "$DST_MAC" ]; then
92 warn "Missing destination MAC address"
95 if [ -z "$DEST_IP" ]; then
96 warn "Missing destination IP address"
99 if [ ! -d /proc/net/pktgen ]; then
100 info "Loading kernel module: pktgen"
101 modprobe pktgen