aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtests/dpdk/dpdk_scripts/init_dpdk.sh24
-rwxr-xr-xtests/dpdk/dpdk_scripts/run_l2fwd.sh98
-rwxr-xr-xtests/dpdk/dpdk_scripts/run_l3fwd.sh102
3 files changed, 122 insertions, 102 deletions
diff --git a/tests/dpdk/dpdk_scripts/init_dpdk.sh b/tests/dpdk/dpdk_scripts/init_dpdk.sh
index d6565e063b..7d3df0a67c 100755
--- a/tests/dpdk/dpdk_scripts/init_dpdk.sh
+++ b/tests/dpdk/dpdk_scripts/init_dpdk.sh
@@ -20,28 +20,8 @@ fi
cd ${ROOTDIR}/${DPDK_DIR}/
-modprobe uio
-echo "RC = $?"
-
-lsmod | grep igb_uio
-if [ $? -ne 1 ];
-then
- rmmod igb_uio || \
- { echo "Failed to remove igb_uio module"; exit 1; }
-fi
-
-lsmod | grep uio_pci_generic
-if [ $? -ne 1 ];
-then
- rmmod uio_pci_generic || \
- { echo "Failed to remove uio_pci_generic module"; exit 1; }
-fi
-
-insmod ./${ARCH}-${MACHINE}-linuxapp-gcc/kmod/igb_uio.ko || \
- { echo "Failed to insert igb_uio module"; exit 1; }
-
# Binding
-./usertools/dpdk-devbind.py -b igb_uio $1 $2 || \
- { echo "Failed to bind interface $1 and $2 to igb_uio"; exit 1; }
+./usertools/dpdk-devbind.py -b vfio-pci $1 $2 || \
+ { echo "Failed to bind interface $1 and $2 to vfio-pci"; exit 1; }
cd ${PWDDIR}
diff --git a/tests/dpdk/dpdk_scripts/run_l2fwd.sh b/tests/dpdk/dpdk_scripts/run_l2fwd.sh
index 0e07b68264..09cc112998 100755
--- a/tests/dpdk/dpdk_scripts/run_l2fwd.sh
+++ b/tests/dpdk/dpdk_scripts/run_l2fwd.sh
@@ -1,38 +1,51 @@
-#!/bin/bash
+#!/usr/bin/env bash
-set -x
+# Copyright (c) 2020 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
-# Setting variables
-DPDK_DIR=dpdk
-ROOTDIR=/tmp/openvpp-testing
-TESTPMDLOG=screenlog.0
-PWDDIR=$(pwd)
+set -xuo pipefail
-# Setting command line arguments
-cpu_corelist=$1
-nb_cores=$2
-queue_nums=$3
-jumbo_frames=$4
-arch=${5:-"x86_64"}
+# Setting variables.
+DPDK_DIR="dpdk"
+ROOTDIR="/tmp/openvpp-testing"
+TESTPMDLOG="screenlog.0"
+PWDDIR="$(pwd)"
-# dpdk prefers "arm64" to "aarch64" and does not allow arm64 native target
-if [ $arch == "aarch64" ]; then
+# Setting command line arguments.
+cpu_corelist="${1}"
+nb_cores="${2}"
+queue_nums="${3}"
+jumbo_frames="${4}"
+arch="$(uname -m)"
+
+# DPDK prefers "arm64" to "aarch64" and does not allow arm64 native target.
+if [ "${arch}" == "aarch64" ]; then
arch="arm64"
machine="armv8a"
else
machine="native"
fi
-# Try to kill the testpmd
+# Try to kill the testpmd.
sudo pgrep testpmd
-if [ $? -eq "0" ]; then
+if [ ${?} -eq "0" ]; then
success=false
sudo pkill testpmd
- echo "RC = $?"
- for attempt in {1..5}; do
+ echo "RC = ${?}"
+ for attempt in {1..30}; do
echo "Checking if testpmd is still alive, attempt nr ${attempt}"
sudo pgrep testpmd
- if [ $? -eq "1" ]; then
+ if [ ${?} -eq "1" ]; then
echo "testpmd is dead"
success=true
break
@@ -40,26 +53,26 @@ if [ $? -eq "0" ]; then
echo "testpmd is still alive, waiting 1 second"
sleep 1
done
- if [ "$success" = false ]; then
+ if [ "${success}" = false ]; then
echo "The command sudo pkill testpmd failed"
sudo pkill -9 testpmd
- echo "RC = $?"
+ echo "RC = ${?}"
exit 1
fi
else
echo "testpmd is not running"
fi
-# Try to kill the l3fwd
+# Try to kill the l3fwd.
sudo pgrep l3fwd
-if [ $? -eq "0" ]; then
+if [ ${?} -eq "0" ]; then
success=false
sudo pkill l3fwd
- echo "RC = $?"
- for attempt in {1..5}; do
+ echo "RC = ${?}"
+ for attempt in {1..30}; do
echo "Checking if l3fwd is still alive, attempt nr ${attempt}"
sudo pgrep l3fwd
- if [ $? -eq "1" ]; then
+ if [ ${?} -eq "1" ]; then
echo "l3fwd is dead"
success=true
break
@@ -67,27 +80,27 @@ if [ $? -eq "0" ]; then
echo "l3fwd is still alive, waiting 1 second"
sleep 1
done
- if [ "$success" = false ]; then
+ if [ "${success}" = false ]; then
echo "The command sudo pkill l3fwd failed"
sudo pkill -9 l3fwd
- echo "RC = $?"
+ echo "RC = ${?}"
exit 1
fi
else
echo "l3fwd is not running"
fi
-# Remove hugepages
+# Remove hugepages.
sudo rm -f /dev/hugepages/*
sleep 2
-cd ${ROOTDIR}/${DPDK_DIR}/
-rm -f ${TESTPMDLOG}
-TESTPMD_BIN=./${arch}-${machine}-linuxapp-gcc/app/testpmd
+cd "${ROOTDIR}/${DPDK_DIR}/"
+rm -f "${TESTPMDLOG}"
+TESTPMD_BIN="./${arch}-${machine}-linuxapp-gcc/app/testpmd"
-if [ "$jumbo_frames" = "yes" ]; then
- sudo sh -c "screen -dmSL DPDK-test $TESTPMD_BIN \
+if [ "${jumbo_frames}" = "yes" ]; then
+ sudo sh -c "screen -dmSL DPDK-test ${TESTPMD_BIN} \
-l ${cpu_corelist} -n 4 --log-level 8 -v -- \
--numa \
--nb-ports=2 \
@@ -104,7 +117,7 @@ if [ "$jumbo_frames" = "yes" ]; then
--disable-link-check \
--auto-start"
else
- sudo sh -c "screen -dmSL DPDK-test $TESTPMD_BIN \
+ sudo sh -c "screen -dmSL DPDK-test ${TESTPMD_BIN} \
-l ${cpu_corelist} -n 4 --log-level 8 -v -- \
--numa \
--nb-ports=2 \
@@ -120,7 +133,14 @@ else
--auto-start"
fi
-sleep 10
-less -r ${TESTPMDLOG}
+for attempt in {1..30}; do
+ echo "Checking if testpmd is alive, attempt nr ${attempt}"
+ fgrep "Port 1: link state change event" "${TESTPMDLOG}"
+ if [ "${?}" -eq "0" ]; then
+ cat "${TESTPMDLOG}"
+ exit 0
+ fi
+ sleep 1
+done
-cd ${PWDDIR}
+exit 1
diff --git a/tests/dpdk/dpdk_scripts/run_l3fwd.sh b/tests/dpdk/dpdk_scripts/run_l3fwd.sh
index 014ba2717f..3940cd4809 100755
--- a/tests/dpdk/dpdk_scripts/run_l3fwd.sh
+++ b/tests/dpdk/dpdk_scripts/run_l3fwd.sh
@@ -1,40 +1,54 @@
-#!/bin/bash
+#!/usr/bin/env bash
-set -x
+# Copyright (c) 2020 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
-# Setting variables
-DPDK_DIR=dpdk
-ROOTDIR=/tmp/openvpp-testing
-L3FWDLOG=screenlog.0
-PWDDIR=$(pwd)
+set -xuo pipefail
-cpu_corelist=$1
-port_config=$2
-adj_mac0=$3
-adj_mac1=$4
-jumbo_frames=$5
+# Setting variables.
+DPDK_DIR="dpdk"
+ROOTDIR="/tmp/openvpp-testing"
+L3FWDLOG="screenlog.0"
+PWDDIR="$(pwd)"
-SCRIPT_NAME=$(basename $0)
+# Setting command line arguments.
+cpu_corelist="${1}"
+port_config="${2}"
+adj_mac0="${3}"
+adj_mac1="${4}"
+jumbo_frames="${5}"
-# define a function to get the l3fwd PID
+SCRIPT_NAME="$(basename $0)"
+
+# define a function to get the l3fwd PID.
function get_l3fwd_pid()
{
pid_l3fwd=`sudo ps -elf | grep l3fwd | grep -v grep | grep -v SCREEN | grep -v ${SCRIPT_NAME} | awk '{print $4}'`
- echo ${pid_l3fwd}
+ echo "${pid_l3fwd}"
}
-# Try to kill the l3fwd
-# Don't use the pgrep and pkill
+# Try to kill the l3fwd.
+# Don't use the pgrep and pkill.
l3fwd_pid=`get_l3fwd_pid`
-echo ${l3fwd_pid}
-if [ ! -z ${l3fwd_pid} ]; then
+echo "${l3fwd_pid}"
+if [ ! -z "${l3fwd_pid}" ]; then
success=false
- sudo kill -15 ${l3fwd_pid}
- echo "RC = $?"
- for attempt in {1..5}; do
+ sudo kill -15 "${l3fwd_pid}"
+ echo "RC = ${?}"
+ for attempt in {1..30}; do
echo "Checking if l3fwd is still alive, attempt nr ${attempt}"
l3fwd_pid=`get_l3fwd_pid`
- if [ -z ${l3fwd_pid} ]; then
+ if [ -z "${l3fwd_pid}" ]; then
echo "l3fwd is dead"
success=true
break
@@ -42,26 +56,26 @@ if [ ! -z ${l3fwd_pid} ]; then
echo "l3fwd is still alive, waiting 1 second"
sleep 1
done
- if [ "$success" = false ]; then
+ if [ "${success}" = false ]; then
echo "The command sudo kill -15 l3fwd failed"
- sudo kill -9 ${l3fwd_pid}
- echo "RC = $?"
+ sudo kill -9 "${l3fwd_pid}"
+ echo "RC = ${?}"
exit 1
fi
else
echo "l3fwd is not running"
fi
-# Try to kill the testpmd
+# Try to kill the testpmd.
sudo pgrep testpmd
-if [ $? -eq "0" ]; then
+if [ ${?} -eq "0" ]; then
success=false
sudo pkill testpmd
- echo "RC = $?"
- for attempt in {1..5}; do
+ echo "RC = ${?}"
+ for attempt in {1..30}; do
echo "Checking if testpmd is still alive, attempt nr ${attempt}"
sudo pgrep testpmd
- if [ $? -eq "1" ]; then
+ if [ ${?} -eq "1" ]; then
echo "testpmd is dead"
success=true
break
@@ -69,24 +83,24 @@ if [ $? -eq "0" ]; then
echo "testpmd is still alive, waiting 1 second"
sleep 1
done
- if [ "$success" = false ]; then
+ if [ "${success}" = false ]; then
echo "The command sudo pkill testpmd failed"
sudo pkill -9 testpmd
- echo "RC = $?"
+ echo "RC = ${?}"
exit 1
fi
else
echo "testpmd is not running"
fi
+# Remove hugepages.
sudo rm -f /dev/hugepages/*
sleep 2
-#run the l3fwd
-cd ${ROOTDIR}/${DPDK_DIR}/
-rm -f ${L3FWDLOG}
-if [ "$jumbo_frames" = "yes" ]; then
+cd "${ROOTDIR}/${DPDK_DIR}/"
+rm -f "${L3FWDLOG}"
+if [ "${jumbo_frames}" = "yes" ]; then
sudo sh -c "screen -dmSL DPDK-test ./examples/l3fwd/build/app/l3fwd \
-l ${cpu_corelist} -n 4 --log-level 8 -- \
-P -L -p 0x3 --config='${port_config}' \
@@ -99,8 +113,14 @@ else
--eth-dest=0,${adj_mac0} --eth-dest=1,${adj_mac1} --parse-ptype"
fi
-sleep 10
-less -r ${L3FWDLOG}
-
-cd ${PWDDIR}
+for attempt in {1..30}; do
+ echo "Checking if l3fwd is alive, attempt nr ${attempt}"
+ fgrep "L3FWD: entering main loop on lcore" "${L3FWDLOG}"
+ if [ "${?}" -eq "0" ]; then
+ cat "${L3FWDLOG}"
+ exit 0
+ fi
+ sleep 1
+done
+exit 1