diff options
Diffstat (limited to 'tests/dpdk/dpdk_scripts')
-rwxr-xr-x | tests/dpdk/dpdk_scripts/cleanup_dpdk.sh | 86 | ||||
-rwxr-xr-x | tests/dpdk/dpdk_scripts/init_dpdk.sh | 27 | ||||
-rwxr-xr-x | tests/dpdk/dpdk_scripts/install_dpdk.sh | 71 | ||||
-rwxr-xr-x | tests/dpdk/dpdk_scripts/patch_l3fwd.sh | 35 | ||||
-rwxr-xr-x | tests/dpdk/dpdk_scripts/patch_l3fwd_flip_routes | 10 | ||||
-rwxr-xr-x | tests/dpdk/dpdk_scripts/run_l2fwd.sh | 148 | ||||
-rwxr-xr-x | tests/dpdk/dpdk_scripts/run_l3fwd.sh | 126 |
7 files changed, 0 insertions, 503 deletions
diff --git a/tests/dpdk/dpdk_scripts/cleanup_dpdk.sh b/tests/dpdk/dpdk_scripts/cleanup_dpdk.sh deleted file mode 100755 index a97b4ba121..0000000000 --- a/tests/dpdk/dpdk_scripts/cleanup_dpdk.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash - -set -x - -# Setting variables -DPDK_DIR=dpdk -ROOTDIR=/tmp/openvpp-testing -TESTPMDLOG=screenlog.0 -PWDDIR=$(pwd) - -# Setting command line arguments -port1_driver=$1 -port1_pci=$2 -port2_driver=$3 -port2_pci=$4 - -# Try to kill the testpmd -sudo pgrep testpmd -if [ $? -eq "0" ]; then - success=false - sudo pkill testpmd - echo "RC = $?" - for attempt in {1..60}; do - echo "Checking if testpmd is still alive, attempt nr ${attempt}" - sudo pgrep testpmd - if [ $? -eq "1" ]; then - echo "testpmd is dead" - success=true - break - fi - echo "testpmd is still alive, waiting 1 second" - sleep 1 - done - if [ "$success" = false ]; then - echo "The command sudo pkill testpmd failed" - sudo pkill -9 testpmd - echo "RC = $?" - exit 1 - fi -else - echo "testpmd is not running" -fi - -#also kill the l3fwd -sudo pgrep l3fwd -if [ $? -eq "0" ]; then - success=false - sudo pkill l3fwd - echo "RC = $?" - for attempt in {1..60}; do - echo "Checking if l3fwd is still alive, attempt nr ${attempt}" - sudo pgrep l3fwd - if [ $? -eq "1" ]; then - echo "l3fwd is dead" - success=true - break - fi - echo "l3fwd is still alive, waiting 1 second" - sleep 1 - done - if [ "$success" = false ]; then - echo "The command sudo pkill l3fwd failed" - sudo pkill -9 l3fwd - echo "RC = $?" - exit 1 - fi -else - echo "l3fwd is not running" -fi - -# Remove hugepages -sudo rm -f /dev/hugepages/* - -# Unbind interfaces -cd ${ROOTDIR}/${DPDK_DIR}/ -sudo ./usertools/dpdk-devbind.py -b ${port1_driver} ${port1_pci} || \ - { echo "Unbind ${port1_pci} failed"; exit 1; } -sudo ./usertools/dpdk-devbind.py -b ${port2_driver} ${port2_pci} || \ - { echo "Unbind ${port1_pci} failed"; exit 1; } - -sleep 2 - -if1_name=`./usertools/dpdk-devbind.py --s | grep "${port1_pci}" | sed -n 's/.*if=\(\S\)/\1/p' | awk -F' ' '{print $1}'` -if2_name=`./usertools/dpdk-devbind.py --s | grep "${port2_pci}" | sed -n 's/.*if=\(\S\)/\1/p' | awk -F' ' '{print $1}'` - -cd ${PWDDIR} diff --git a/tests/dpdk/dpdk_scripts/init_dpdk.sh b/tests/dpdk/dpdk_scripts/init_dpdk.sh deleted file mode 100755 index 7d3df0a67c..0000000000 --- a/tests/dpdk/dpdk_scripts/init_dpdk.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -set -x - -# Setting variables -DPDK_DIR=dpdk -ROOTDIR=/tmp/openvpp-testing -PWDDIR=$(pwd) - -# set arch, default to x86_64 if none given -ARCH=${3:-"x86_64"} - -# dpdk prefers "arm64" to "aarch64" and does not allow arm64 native target -if [ $ARCH == "aarch64" ]; then - ARCH="arm64" - MACHINE="armv8a" -else - MACHINE="native" -fi - -cd ${ROOTDIR}/${DPDK_DIR}/ - -# Binding -./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/install_dpdk.sh b/tests/dpdk/dpdk_scripts/install_dpdk.sh deleted file mode 100755 index 05a922b457..0000000000 --- a/tests/dpdk/dpdk_scripts/install_dpdk.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -set -x - -# Setting variables - -# set arch, default to x86_64 if none given -ARCH=${1:-"x86_64"} - -# dpdk prefers "arm64" to "aarch64" and does not allow arm64 native target -if [ $ARCH == "aarch64" ]; then - ARCH="arm64" - MACHINE="armv8a" -else - MACHINE="native" -fi - -DPDK_DIR=dpdk -ROOTDIR=/tmp/openvpp-testing -PWDDIR=$(pwd) - -cd ${ROOTDIR} -mkdir ${DPDK_DIR} -tar -xvf download_dir/dpdk*.tar.xz --strip=1 --directory dpdk || \ - { echo "Failed to extract DPDK"; exit 1; } - -# Compile the DPDK -cd ./${DPDK_DIR} -sudo sed -i 's/^CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n/CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=y/g' ./config/common_base -make install T=${ARCH}-${MACHINE}-linuxapp-gcc -j || \ - { echo "Failed to compile DPDK"; exit 1; } -cd ${PWDDIR} - -# Compile the l3fwd -export RTE_SDK=${ROOTDIR}/${DPDK_DIR}/ -export RTE_TARGET=${ARCH}-${MACHINE}-linuxapp-gcc -cd ${RTE_SDK}/examples/l3fwd -sudo sed -i 's/^#define RTE_TEST_RX_DESC_DEFAULT 128/#define RTE_TEST_RX_DESC_DEFAULT 1024/g' ./main.c -sudo sed -i 's/^#define RTE_TEST_TX_DESC_DEFAULT 512/#define RTE_TEST_TX_DESC_DEFAULT 1024/g' ./main.c -make -j || \ - { echo "Failed to compile l3fwd"; exit 1; } -cd ${PWDDIR} - -# Check and setup the hugepages -SYS_HUGEPAGE=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages) -echo " SYS_HUGEPAGE = ${SYS_HUGEPAGE}" -if [ ${SYS_HUGEPAGE} -lt 4096 ]; then - echo " It is not enough, should be at least 4096" - MOUNT=$(mount | grep /mnt/huge) - while [ "${MOUNT}" != "" ] - do - sudo umount /mnt/huge - sleep 1 - MOUNT=$(mount | grep /mnt/huge) - done - - echo 2048 | sudo tee /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages - echo 2048 | sudo tee /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages - - echo " Mounting hugepages" - sudo mkdir -p /mnt/huge - sudo mount -t hugetlbfs nodev /mnt/huge/ || \ - { echo "Failed to mount hugepages"; exit 1; } -fi - -# Check and set the max map count -SYS_MAP=$(cat /proc/sys/vm/max_map_count) - -if [ ${SYS_MAP} -lt 200000 ]; then - echo 200000 | sudo tee /proc/sys/vm/max_map_count -fi diff --git a/tests/dpdk/dpdk_scripts/patch_l3fwd.sh b/tests/dpdk/dpdk_scripts/patch_l3fwd.sh deleted file mode 100755 index 54ae7eaffc..0000000000 --- a/tests/dpdk/dpdk_scripts/patch_l3fwd.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -set -x - -# Setting variables -# set arch, default to x86_64 if none given -ARCH=${1:-"x86_64"} -PATCH=$2 - -# dpdk prefers "arm64" to "aarch64" and does not allow arm64 native target -if [ $ARCH == "aarch64" ]; then - ARCH="arm64" - MACHINE="armv8a" -else - MACHINE="native" -fi - -DPDK_DIR=dpdk -ROOTDIR=/tmp/openvpp-testing -PWDDIR=$(pwd) - -# Compile the l3fwd -export RTE_SDK=${ROOTDIR}/${DPDK_DIR}/ -export RTE_TARGET=${ARCH}-${MACHINE}-linuxapp-gcc -cd ${RTE_SDK}/examples/l3fwd -sudo sed -i 's/^#define RTE_TEST_RX_DESC_DEFAULT 128/#define RTE_TEST_RX_DESC_DEFAULT 2048/g' ./main.c -sudo sed -i 's/^#define RTE_TEST_TX_DESC_DEFAULT 512/#define RTE_TEST_TX_DESC_DEFAULT 2048/g' ./main.c - -chmod +x ${PATCH} && source ${PATCH} - -make clean -make -j || \ - { echo "Failed to compile l3fwd"; exit 1; } -cd ${PWDDIR} - diff --git a/tests/dpdk/dpdk_scripts/patch_l3fwd_flip_routes b/tests/dpdk/dpdk_scripts/patch_l3fwd_flip_routes deleted file mode 100755 index e0b204eb9c..0000000000 --- a/tests/dpdk/dpdk_scripts/patch_l3fwd_flip_routes +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -patch --ignore-whitespace l3fwd_lpm.c <<"_EOF" -44,45c44,45 -< {IPv4(1, 1, 1, 0), 24, 0}, -< {IPv4(2, 1, 1, 0), 24, 1}, ---- -> {IPv4(1, 1, 1, 0), 24, 1}, -> {IPv4(2, 1, 1, 0), 24, 0}, -_EOF diff --git a/tests/dpdk/dpdk_scripts/run_l2fwd.sh b/tests/dpdk/dpdk_scripts/run_l2fwd.sh deleted file mode 100755 index 0ec4f2d85f..0000000000 --- a/tests/dpdk/dpdk_scripts/run_l2fwd.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -set -xuo pipefail - -# Setting variables. -DPDK_DIR="dpdk" -ROOTDIR="/tmp/openvpp-testing" -TESTPMDLOG="screenlog.0" -PWDDIR="$(pwd)" - -# Setting command line arguments. -cpu_corelist="${1}" -nb_cores="${2}" -queue_nums="${3}" -jumbo_frames="${4}" -rxd="${5:-128}" -txd="${6:-512}" -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. -sudo pgrep testpmd -if [ ${?} -eq "0" ]; then - success=false - sudo pkill testpmd - echo "RC = ${?}" - for attempt in {1..60}; do - echo "Checking if testpmd is still alive, attempt nr ${attempt}" - sudo pgrep testpmd - if [ ${?} -eq "1" ]; then - echo "testpmd is dead" - success=true - break - fi - echo "testpmd is still alive, waiting 1 second" - sleep 1 - done - if [ "${success}" = false ]; then - echo "The command sudo pkill testpmd failed" - sudo pkill -9 testpmd - echo "RC = ${?}" - exit 1 - fi -else - echo "testpmd is not running" -fi - -# Try to kill the l3fwd. -sudo pgrep l3fwd -if [ ${?} -eq "0" ]; then - success=false - sudo pkill l3fwd - echo "RC = ${?}" - for attempt in {1..60}; do - echo "Checking if l3fwd is still alive, attempt nr ${attempt}" - sudo pgrep l3fwd - if [ ${?} -eq "1" ]; then - echo "l3fwd is dead" - success=true - break - fi - echo "l3fwd is still alive, waiting 1 second" - sleep 1 - done - if [ "${success}" = false ]; then - echo "The command sudo pkill l3fwd failed" - sudo pkill -9 l3fwd - echo "RC = ${?}" - exit 1 - fi -else - echo "l3fwd is not running" -fi - -# Remove hugepages. -sudo rm -f /dev/hugepages/* - -sleep 2 - -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} \ - -l ${cpu_corelist} -n 4 --log-level 8 -v -- \ - --numa \ - --nb-ports=2 \ - --portmask=0x3 \ - --nb-cores=${nb_cores} \ - --max-pkt-len=9000 \ - --tx-offloads=0x7FFFFFFF \ - --forward-mode=io \ - --rxq=${queue_nums} \ - --txq=$((${nb_cores} + 1)) \ - --burst=64 \ - --rxd=${rxd} \ - --txd=${txd} \ - --disable-link-check \ - --auto-start" -else - sudo sh -c "screen -dmSL DPDK-test ${TESTPMD_BIN} \ - -l ${cpu_corelist} -n 4 --log-level 8 -v -- \ - --numa \ - --nb-ports=2 \ - --portmask=0x3 \ - --nb-cores=${nb_cores} \ - --forward-mode=io \ - --rxq=${queue_nums} \ - --txq=$((${nb_cores} + 1)) \ - --burst=64 \ - --rxd=${rxd} \ - --txd=${txd} \ - --disable-link-check \ - --auto-start" -fi - -for attempt in {1..60}; do - echo "Checking if testpmd is alive, attempt nr ${attempt}" - fgrep "Press enter to exit" "${TESTPMDLOG}" - if [ "${?}" -eq "0" ]; then - exit 0 - fi - sleep 1 -done -cat "${TESTPMDLOG}" - -exit 1 diff --git a/tests/dpdk/dpdk_scripts/run_l3fwd.sh b/tests/dpdk/dpdk_scripts/run_l3fwd.sh deleted file mode 100755 index bab7668f5c..0000000000 --- a/tests/dpdk/dpdk_scripts/run_l3fwd.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -set -xuo pipefail - -# Setting variables. -DPDK_DIR="dpdk" -ROOTDIR="/tmp/openvpp-testing" -L3FWDLOG="screenlog.0" -PWDDIR="$(pwd)" - -# Setting command line arguments. -cpu_corelist="${1}" -port_config="${2}" -adj_mac0="${3}" -adj_mac1="${4}" -jumbo_frames="${5}" - -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}" -} - -# 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 - success=false - sudo kill -15 "${l3fwd_pid}" - echo "RC = ${?}" - for attempt in {1..60}; do - echo "Checking if l3fwd is still alive, attempt nr ${attempt}" - l3fwd_pid=`get_l3fwd_pid` - if [ -z "${l3fwd_pid}" ]; then - echo "l3fwd is dead" - success=true - break - fi - echo "l3fwd is still alive, waiting 1 second" - sleep 1 - done - if [ "${success}" = false ]; then - echo "The command sudo kill -15 l3fwd failed" - sudo kill -9 "${l3fwd_pid}" - echo "RC = ${?}" - exit 1 - fi -else - echo "l3fwd is not running" -fi - -# Try to kill the testpmd. -sudo pgrep testpmd -if [ ${?} -eq "0" ]; then - success=false - sudo pkill testpmd - echo "RC = ${?}" - for attempt in {1..60}; do - echo "Checking if testpmd is still alive, attempt nr ${attempt}" - sudo pgrep testpmd - if [ ${?} -eq "1" ]; then - echo "testpmd is dead" - success=true - break - fi - echo "testpmd is still alive, waiting 1 second" - sleep 1 - done - if [ "${success}" = false ]; then - echo "The command sudo pkill testpmd failed" - sudo pkill -9 testpmd - echo "RC = ${?}" - exit 1 - fi -else - echo "testpmd is not running" -fi - -# Remove hugepages. -sudo rm -f /dev/hugepages/* - -sleep 2 - -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}' \ - --enable-jumbo --max-pkt-len=9000 --eth-dest=0,${adj_mac0} \ - --eth-dest=1,${adj_mac1} --parse-ptype" -else - 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}' \ - --eth-dest=0,${adj_mac0} --eth-dest=1,${adj_mac1} --parse-ptype" -fi - -for attempt in {1..60}; 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 |