3 # Copyright (c) 2020 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
20 ROOTDIR="/tmp/openvpp-testing"
21 L3FWDLOG="screenlog.0"
24 # Setting command line arguments.
31 SCRIPT_NAME="$(basename $0)"
33 # define a function to get the l3fwd PID.
34 function get_l3fwd_pid()
36 pid_l3fwd=`sudo ps -elf | grep l3fwd | grep -v grep | grep -v SCREEN | grep -v ${SCRIPT_NAME} | awk '{print $4}'`
40 # Try to kill the l3fwd.
41 # Don't use the pgrep and pkill.
42 l3fwd_pid=`get_l3fwd_pid`
44 if [ ! -z "${l3fwd_pid}" ]; then
46 sudo kill -15 "${l3fwd_pid}"
48 for attempt in {1..60}; do
49 echo "Checking if l3fwd is still alive, attempt nr ${attempt}"
50 l3fwd_pid=`get_l3fwd_pid`
51 if [ -z "${l3fwd_pid}" ]; then
56 echo "l3fwd is still alive, waiting 1 second"
59 if [ "${success}" = false ]; then
60 echo "The command sudo kill -15 l3fwd failed"
61 sudo kill -9 "${l3fwd_pid}"
66 echo "l3fwd is not running"
69 # Try to kill the testpmd.
71 if [ ${?} -eq "0" ]; then
75 for attempt in {1..60}; do
76 echo "Checking if testpmd is still alive, attempt nr ${attempt}"
78 if [ ${?} -eq "1" ]; then
79 echo "testpmd is dead"
83 echo "testpmd is still alive, waiting 1 second"
86 if [ "${success}" = false ]; then
87 echo "The command sudo pkill testpmd failed"
93 echo "testpmd is not running"
97 sudo rm -f /dev/hugepages/*
101 cd "${ROOTDIR}/${DPDK_DIR}/"
103 if [ "${jumbo_frames}" = "yes" ]; then
104 sudo sh -c "screen -dmSL DPDK-test ./examples/l3fwd/build/app/l3fwd \
105 -l ${cpu_corelist} -n 4 --log-level 8 -- \
106 -P -L -p 0x3 --config='${port_config}' \
107 --enable-jumbo --max-pkt-len=9000 --eth-dest=0,${adj_mac0} \
108 --eth-dest=1,${adj_mac1} --parse-ptype"
110 sudo sh -c "screen -dmSL DPDK-test ./examples/l3fwd/build/app/l3fwd \
111 -l ${cpu_corelist} -n 4 --log-level 8 -- \
112 -P -L -p 0x3 --config='${port_config}' \
113 --eth-dest=0,${adj_mac0} --eth-dest=1,${adj_mac1} --parse-ptype"
116 for attempt in {1..60}; do
117 echo "Checking if l3fwd is alive, attempt nr ${attempt}"
118 fgrep "L3FWD: entering main loop on lcore" "${L3FWDLOG}"
119 if [ "${?}" -eq "0" ]; then