80ed14a3308b2e19f6125fea94ce5b2d0b60d3cc
[csit.git] / dpdk-tests / dpdk_scripts / run_l2fwd.sh
1 #!/bin/bash
2
3 set -x
4
5 # Setting variables
6 DPDK_VERSION=dpdk-17.02
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
17 # Try to kill the testpmd
18 sudo pgrep testpmd
19 if [ $? -eq "0" ]; then
20     success=false
21     sudo pkill testpmd
22     echo "RC = $?"
23     for attempt in {1..5}; do
24         echo "Checking if testpmd is still alive, attempt nr ${attempt}"
25         sudo pgrep testpmd
26         if [ $? -eq "1" ]; then
27             echo "testpmd is dead"
28             success=true
29             break
30         fi
31         echo "testpmd is still alive, waiting 1 second"
32         sleep 1
33     done
34     if [ "$success" = false ]; then
35         echo "The command sudo pkill testpmd failed"
36         sudo pkill -9 testpmd
37         echo "RC = $?"
38         exit 1
39     fi
40 else
41     echo "testpmd is not running"
42 fi
43
44 # Remove hugepages
45 sudo rm -f /dev/hugepages/*
46
47 sleep 2
48
49 cd ${ROOTDIR}/${DPDK_VERSION}/
50 rm -f ${TESTPMDLOG}
51 if [ "$jumbo_frames" = "yes" ]; then
52     sudo sh -c "screen -dmSL DPDK-test ./x86_64-native-linuxapp-gcc/app/testpmd -l ${cpu_corelist} \
53         -n 4 -- --numa --nb-ports=2 --portmask=0x3 --nb-cores=${nb_cores} \
54         --max-pkt-len=9000 --txqflags=0 --forward-mode=io --rxq=${queue_nums} \
55         --txq=${queue_nums} --auto-start"
56     sleep 10
57     cat ${TESTPMDLOG}
58 else
59     sudo sh -c "screen -dmSL DPDK-test ./x86_64-native-linuxapp-gcc/app/testpmd -l ${cpu_corelist} \
60         -n 4 -- --numa --nb-ports=2 --portmask=0x3 --nb-cores=${nb_cores} \
61         --forward-mode=io --rxq=${queue_nums} --txq=${queue_nums} --auto-start"
62     sleep 10
63     cat ${TESTPMDLOG}
64 fi
65
66 cd ${PWDDIR}