add new topology parameter: arch
[csit.git] / tests / dpdk / dpdk_scripts / run_l2fwd.sh
1 #!/bin/bash
2
3 set -x
4
5 # Setting variables
6 DPDK_VERSION=dpdk-17.11
7 ROOTDIR=/tmp/openvpp-testing
8 TESTPMDLOG=screenlog.0
9 PWDDIR=$(pwd)
10
11 # Setting command line arguments
12 cpu_corelist=$1
13 nb_cores=$2
14 queue_nums=$3
15 jumbo_frames=$4
16 arch=${5:-"x86_64"}
17
18 # dpdk prefers "arm64" to "aarch64" and does not allow arm64 native target
19 if [ $arch == "aarch64" ]; then
20     arch="arm64"
21     machine="armv8a"
22 else
23     machine="native"
24 fi
25
26 # Try to kill the testpmd
27 sudo pgrep testpmd
28 if [ $? -eq "0" ]; then
29     success=false
30     sudo pkill testpmd
31     echo "RC = $?"
32     for attempt in {1..5}; do
33         echo "Checking if testpmd is still alive, attempt nr ${attempt}"
34         sudo pgrep testpmd
35         if [ $? -eq "1" ]; then
36             echo "testpmd is dead"
37             success=true
38             break
39         fi
40         echo "testpmd is still alive, waiting 1 second"
41         sleep 1
42     done
43     if [ "$success" = false ]; then
44         echo "The command sudo pkill testpmd failed"
45         sudo pkill -9 testpmd
46         echo "RC = $?"
47         exit 1
48     fi
49 else
50     echo "testpmd is not running"
51 fi
52
53 # Try to kill the l3fwd
54 sudo pgrep l3fwd
55 if [ $? -eq "0" ]; then
56     success=false
57     sudo pkill l3fwd
58     echo "RC = $?"
59     for attempt in {1..5}; do
60         echo "Checking if l3fwd is still alive, attempt nr ${attempt}"
61         sudo pgrep l3fwd
62         if [ $? -eq "1" ]; then
63             echo "l3fwd is dead"
64             success=true
65             break
66         fi
67         echo "l3fwd is still alive, waiting 1 second"
68         sleep 1
69     done
70     if [ "$success" = false ]; then
71         echo "The command sudo pkill l3fwd failed"
72         sudo pkill -9 l3fwd
73         echo "RC = $?"
74         exit 1
75     fi
76 else
77     echo "l3fwd is not running"
78 fi
79
80 # Remove hugepages
81 sudo rm -f /dev/hugepages/*
82
83 sleep 2
84
85 cd ${ROOTDIR}/${DPDK_VERSION}/
86 rm -f ${TESTPMDLOG}
87 TESTPMD_BIN=./${arch}-${machine}-linuxapp-gcc/app/testpmd
88
89 if [ "$jumbo_frames" = "yes" ]; then
90     sudo sh -c "screen -dmSL DPDK-test $TESTPMD_BIN \
91         -l ${cpu_corelist} -n 4 -- \
92         --numa \
93         --nb-ports=2 \
94         --portmask=0x3 \
95         --nb-cores=${nb_cores} \
96         --max-pkt-len=9000 \
97         --txqflags=0 \
98         --forward-mode=io \
99         --rxq=${queue_nums} \
100         --txq=$((${nb_cores} + 1)) \
101         --burst=64 \
102         --rxd=1024 \
103         --txd=1024 \
104         --disable-link-check \
105         --auto-start"
106 else
107     sudo sh -c "screen -dmSL DPDK-test $TESTPMD_BIN \
108         -l ${cpu_corelist} -n 4 -- \
109         --numa \
110         --nb-ports=2 \
111         --portmask=0x3 \
112         --nb-cores=${nb_cores} \
113         --forward-mode=io \
114         --rxq=${queue_nums} \
115         --txq=$((${nb_cores} + 1)) \
116         --burst=64 \
117         --rxd=1024 \
118         --txd=1024 \
119         --disable-link-check \
120         --auto-start"
121 fi
122
123 sleep 10
124 less -r ${TESTPMDLOG}
125
126 cd ${PWDDIR}

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.