aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dpdk/dpdk_scripts
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2017-06-20 13:57:08 +0200
committerTibor Frank <tifrank@cisco.com>2017-06-29 12:17:28 +0000
commit6721e7f09aa95bff6622068332a3f56afad9c87b (patch)
tree37ef7f40e53f740a62830ab46142aa87342dc56b /tests/dpdk/dpdk_scripts
parent859157b5db45927c7b4bb0b2d575e68805777a86 (diff)
CSIT-687: Directory structure reorganization
Change-Id: I772c9e214be2461adf58124998d272e7d795220f Signed-off-by: Tibor Frank <tifrank@cisco.com> Signed-off-by: Maciek Konstantynowicz <mkonstan@cisco.com>
Diffstat (limited to 'tests/dpdk/dpdk_scripts')
-rwxr-xr-xtests/dpdk/dpdk_scripts/cleanup_dpdk.sh90
-rwxr-xr-xtests/dpdk/dpdk_scripts/init_dpdk.sh35
-rwxr-xr-xtests/dpdk/dpdk_scripts/install_dpdk.sh63
-rwxr-xr-xtests/dpdk/dpdk_scripts/run_l2fwd.sh115
-rwxr-xr-xtests/dpdk/dpdk_scripts/run_l3fwd.sh104
5 files changed, 407 insertions, 0 deletions
diff --git a/tests/dpdk/dpdk_scripts/cleanup_dpdk.sh b/tests/dpdk/dpdk_scripts/cleanup_dpdk.sh
new file mode 100755
index 0000000000..48e1a29b63
--- /dev/null
+++ b/tests/dpdk/dpdk_scripts/cleanup_dpdk.sh
@@ -0,0 +1,90 @@
+#!/bin/bash
+
+set -x
+
+# Setting variables
+DPDK_VERSION=dpdk-17.05
+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..5}; 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..5}; 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_VERSION}/
+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}'`
+
+# Remove igb_uio driver
+rmmod igb_uio || \
+ { echo "Removing igb_uio failed"; exit 1; }
+
+cd ${PWDDIR}
diff --git a/tests/dpdk/dpdk_scripts/init_dpdk.sh b/tests/dpdk/dpdk_scripts/init_dpdk.sh
new file mode 100755
index 0000000000..bc4870e73e
--- /dev/null
+++ b/tests/dpdk/dpdk_scripts/init_dpdk.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+set -x
+
+# Setting variables
+DPDK_VERSION=dpdk-17.05
+ROOTDIR=/tmp/openvpp-testing
+PWDDIR=$(pwd)
+cd ${ROOTDIR}/${DPDK_VERSION}/
+
+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 ./x86_64-native-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; }
+
+cd ${PWDDIR}
diff --git a/tests/dpdk/dpdk_scripts/install_dpdk.sh b/tests/dpdk/dpdk_scripts/install_dpdk.sh
new file mode 100755
index 0000000000..126e8cafc0
--- /dev/null
+++ b/tests/dpdk/dpdk_scripts/install_dpdk.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+set -x
+
+# Setting variables
+DPDK_VERSION=dpdk-17.05
+DPDK_DIR=${DPDK_VERSION}
+DPDK_PACKAGE=${DPDK_DIR}.tar.xz
+ROOTDIR=/tmp/openvpp-testing
+PWDDIR=$(pwd)
+
+# Download the DPDK package
+cd ${ROOTDIR}
+wget "fast.dpdk.org/rel/${DPDK_PACKAGE}" || \
+ { echo "Failed to download $DPDK_PACKAGE"; exit 1; }
+tar xJvf ${DPDK_PACKAGE} || \
+ { echo "Failed to extract $DPDK_PACKAGE"; 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=x86_64-native-linuxapp-gcc -j || \
+ { echo "Failed to compile $DPDK_VERSION"; exit 1; }
+cd ${PWDDIR}
+
+# Compile the l3fwd
+export RTE_SDK=${ROOTDIR}/${DPDK_DIR}/
+export RTE_TARGET=x86_64-native-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
+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/run_l2fwd.sh b/tests/dpdk/dpdk_scripts/run_l2fwd.sh
new file mode 100755
index 0000000000..20c41d6d6f
--- /dev/null
+++ b/tests/dpdk/dpdk_scripts/run_l2fwd.sh
@@ -0,0 +1,115 @@
+#!/bin/bash
+
+set -x
+
+# Setting variables
+DPDK_VERSION=dpdk-17.05
+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
+
+# Try to kill the testpmd
+sudo pgrep testpmd
+if [ $? -eq "0" ]; then
+ success=false
+ sudo pkill testpmd
+ echo "RC = $?"
+ for attempt in {1..5}; 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..5}; 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_VERSION}/
+rm -f ${TESTPMDLOG}
+if [ "$jumbo_frames" = "yes" ]; then
+ sudo sh -c "screen -dmSL DPDK-test ./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=$((${nb_cores} + 1)) \
+ --burst=64 \
+ --rxd=1024 \
+ --txd=1024 \
+ --disable-link-check \
+ --auto-start"
+else
+ sudo sh -c "screen -dmSL DPDK-test ./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=$((${nb_cores} + 1)) \
+ --burst=64 \
+ --rxd=1024 \
+ --txd=1024 \
+ --disable-link-check \
+ --auto-start"
+fi
+
+sleep 10
+less -r ${TESTPMDLOG}
+
+cd ${PWDDIR}
diff --git a/tests/dpdk/dpdk_scripts/run_l3fwd.sh b/tests/dpdk/dpdk_scripts/run_l3fwd.sh
new file mode 100755
index 0000000000..3363d71875
--- /dev/null
+++ b/tests/dpdk/dpdk_scripts/run_l3fwd.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+set -x
+
+# Setting variables
+DPDK_VERSION=dpdk-17.05
+ROOTDIR=/tmp/openvpp-testing
+L3FWDLOG=screenlog.0
+PWDDIR=$(pwd)
+
+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..5}; 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..5}; 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
+
+sudo rm -f /dev/hugepages/*
+
+sleep 2
+
+#run the l3fwd
+cd ${ROOTDIR}/${DPDK_VERSION}/
+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 -- -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 -- -P -L -p 0x3 --config='${port_config}' \
+ --eth-dest=0,${adj_mac0} --eth-dest=1,${adj_mac1} --parse-ptype"
+fi
+
+sleep 10
+less -r ${L3FWDLOG}
+
+cd ${PWDDIR}
+