aboutsummaryrefslogtreecommitdiffstats
path: root/dpdk-tests/dpdk_scripts/run_l2fwd.sh
blob: 3ddf4fd958368dcf14e910a5c6dbc25db5514c59 (plain)
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
#!/bin/bash

ROOTDIR=/tmp/openvpp-testing
PWDDIR=$(pwd)

TESTPMD_LOG=/tmp/testpmd.log
TESTPMD_PID=/tmp/testpmd.pid

cpu_corelist=$1
nb_cores=$2
queue_nums=$3
jumbo_frames=$4

#kill the testpmd
sudo pgrep testpmd
if [ $? -eq "0" ]; then
    success=false
    sudo pkill testpmd
    for attempt in {1..5}; do
        sudo pgrep testpmd
        if [ $? -eq "1" ]; then
            success=true
            break
        fi
        sleep 1
    done
    if [ "$success" = false ]; then
        echo "The command sudo pkill testpmd failed"
        exit 1
    fi
fi

sudo rm -f ${TESTPMD_LOG}
sudo rm -f ${TESTPMD_PID}
sudo rm -f /dev/hugepages/*

#run the testpmd
cd ${ROOTDIR}
if [ "$jumbo_frames" = "yes" ]; then
tail -f /dev/null | nohup ./dpdk-16.07/x86_64-native-linuxapp-gcc/app/testpmd -l ${cpu_corelist} \
    -n 4 -- --numa --nb-ports=2 --portmask=0x3 --nb-cores=${nb_cores} \
    --max-pkt-len=9000 --txqflags=0 --forward-mode=io --rxq=${queue_nums} \
    --txq=${queue_nums} --auto-start > ${TESTPMD_LOG} 2>&1 &
echo $! > ${TESTPMD_PID}
else
tail -f /dev/null | nohup ./dpdk-16.07/x86_64-native-linuxapp-gcc/app/testpmd -l ${cpu_corelist} \
    -n 4 -- --numa --nb-ports=2 --portmask=0x3 --nb-cores=${nb_cores} \
    --forward-mode=io --rxq=${queue_nums} --txq=${queue_nums} --auto-start > ${TESTPMD_LOG} 2>&1 &
echo $! > ${TESTPMD_PID}
fi

cd ${PWDDIR}