forked from ctrautma/vmscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testpmd.sh
executable file
·66 lines (57 loc) · 1.33 KB
/
testpmd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
NBCORES=2
QUEUES=1
CPUS=3
DESCRIPTORS=2048
MEMORY="1024"
FORWARD="io"
AUTOSTART="--auto-start"
NICS=""
progname=$0
function usage () {
cat <<EOF
Usage: $progname [-c cpus] [-n nb-cores] [-q queues] [-m socket memory] [-d descriptors] [-w "whitelisted nic" do multiple -w for multiple nics] [-f forward mode] [-u disable auto start]
EOF
exit 0
}
while getopts c:n:q:m:d:f:w:uh FLAG; do
case $FLAG in
c) echo "Using $OPTARG cpus"
CPUS=$OPTARG
;;
n) echo "nb-cores $OPTARG"
NBCORES=$OPTARG
;;
q) echo "queues $OPTARG"
QUEUES=$OPTARG
;;
m) echo "socket memory $OPTARG"
MEMORY=$OPTARG
;;
d) echo "descriptors $OPTARG"
DESCRIPTORS=$OPTARG
;;
f) echo "forward mode $OPTARG"
FORWARD=$OPTARG
;;
w) NICS+="-w $OPTARG "
echo "Whitelisted nic $OPTARG"
;;
u) echo "Autostart $OPTARG"
AUTOSTART=""
;;
h) echo "found $opt" ; usage ;;
\?) usage ;;
esac
done
shift $(($OPTIND - 1))
# create CPU mask from CPUS
((CPUS--))
MASK=`seq -s, 0 $CPUS`
set -x
testpmd -l $MASK -n4 --socket-mem $MEMORY $NICS -- \
--burst=64 -i --txqflags=0xf00 \
--rxd=$DESCRIPTORS --txd=$DESCRIPTORS \
--nb-cores=$NBCORES --rxq=$QUEUES --txq=$QUEUES \
--disable-hw-vlan --disable-rss --forward-mode=$FORWARD \
$AUTOSTART