bbd69b6dec58f770b3f6f976c23ce0a599d620bb
[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
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 # Try to kill the l3fwd
45 sudo pgrep l3fwd
46 if [ $? -eq "0" ]; then
47     success=false
48     sudo pkill l3fwd
49     echo "RC = $?"
50     for attempt in {1..5}; do
51         echo "Checking if l3fwd is still alive, attempt nr ${attempt}"
52         sudo pgrep l3fwd
53         if [ $? -eq "1" ]; then
54             echo "l3fwd is dead"
55             success=true
56             break
57         fi
58         echo "l3fwd is still alive, waiting 1 second"
59         sleep 1
60     done
61     if [ "$success" = false ]; then
62         echo "The command sudo pkill l3fwd failed"
63         sudo pkill -9 l3fwd
64         echo "RC = $?"
65         exit 1
66     fi
67 else
68     echo "l3fwd is not running"
69 fi
70
71 # Remove hugepages
72 sudo rm -f /dev/hugepages/*
73
74 sleep 2
75
76 cd ${ROOTDIR}/${DPDK_VERSION}/
77 rm -f ${TESTPMDLOG}
78 if [ "$jumbo_frames" = "yes" ]; then
79     sudo sh -c "screen -dmSL DPDK-test ./x86_64-native-linuxapp-gcc/app/testpmd \
80         -l ${cpu_corelist} -n 4 -- \
81         --numa \
82         --nb-ports=2 \
83         --portmask=0x3 \
84         --nb-cores=${nb_cores} \
85         --max-pkt-len=9000 \
86         --txqflags=0 \
87         --forward-mode=io \
88         --rxq=${queue_nums} \
89         --txq=$((${nb_cores} + 1)) \
90         --burst=64 \
91         --rxd=1024 \
92         --txd=1024 \
93         --disable-link-check \
94         --auto-start"
95 else
96     sudo sh -c "screen -dmSL DPDK-test ./x86_64-native-linuxapp-gcc/app/testpmd \
97         -l ${cpu_corelist} -n 4 -- \
98         --numa \
99         --nb-ports=2 \
100         --portmask=0x3 \
101         --nb-cores=${nb_cores} \
102         --forward-mode=io \
103         --rxq=${queue_nums} \
104         --txq=$((${nb_cores} + 1)) \
105         --burst=64 \
106         --rxd=1024 \
107         --txd=1024 \
108         --disable-link-check \
109         --auto-start"
110 fi
111
112 sleep 10
113 less -r ${TESTPMDLOG}
114
115 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.