14c22970d73a550167aeff589e8281b17b049a6e
[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 \
53         -l ${cpu_corelist} -n 4 -- \
54         --numa \
55         --nb-ports=2 \
56         --portmask=0x3 \
57         --nb-cores=${nb_cores} \
58         --max-pkt-len=9000 \
59         --txqflags=0 \
60         --forward-mode=io \
61         --rxq=${queue_nums} \
62         --txq=$((${nb_cores} + 1)) \
63         --burst=64 \
64         --rxd=1024 \
65         --txd=1024 \
66         --disable-link-check \
67         --auto-start"
68 else
69     sudo sh -c "screen -dmSL DPDK-test ./x86_64-native-linuxapp-gcc/app/testpmd \
70         -l ${cpu_corelist} -n 4 -- \
71         --numa \
72         --nb-ports=2 \
73         --portmask=0x3 \
74         --nb-cores=${nb_cores} \
75         --forward-mode=io \
76         --rxq=${queue_nums} \
77         --txq=$((${nb_cores} + 1)) \
78         --burst=64 \
79         --rxd=1024 \
80         --txd=1024 \
81         --disable-link-check \
82         --auto-start"
83 fi
84
85 sleep 10
86 less -r ${TESTPMDLOG}
87
88 cd ${PWDDIR}