aboutsummaryrefslogtreecommitdiffstats
path: root/dpdk-tests/dpdk_scripts
diff options
context:
space:
mode:
Diffstat (limited to 'dpdk-tests/dpdk_scripts')
-rwxr-xr-xdpdk-tests/dpdk_scripts/cleanup_dpdk.sh45
-rwxr-xr-xdpdk-tests/dpdk_scripts/init_dpdk.sh32
-rwxr-xr-xdpdk-tests/dpdk_scripts/install_dpdk.sh39
-rwxr-xr-xdpdk-tests/dpdk_scripts/run_l2fwd.sh48
4 files changed, 108 insertions, 56 deletions
diff --git a/dpdk-tests/dpdk_scripts/cleanup_dpdk.sh b/dpdk-tests/dpdk_scripts/cleanup_dpdk.sh
index c4d0828ac1..3533a1a580 100755
--- a/dpdk-tests/dpdk_scripts/cleanup_dpdk.sh
+++ b/dpdk-tests/dpdk_scripts/cleanup_dpdk.sh
@@ -1,54 +1,63 @@
#!/bin/bash
+set -x
+
+# Setting variables
+DPDK_VERSION=dpdk-17.02
ROOTDIR=/tmp/openvpp-testing
+TESTPMDLOG=screenlog.0
PWDDIR=$(pwd)
-TESTPMD_LOG=/tmp/testpmd.log
-TESTPMD_PID=/tmp/testpmd.pid
-
+# Setting command line arguments
port1_driver=$1
port1_pci=$2
port2_driver=$3
port2_pci=$4
-#kill the dpdk application
+# Try to kill the testpmd
sudo pgrep testpmd
if [ $? -eq "0" ]; then
success=false
- sudo pkill tail
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
- cat ${TESTPMD_LOG}
+else
+ echo "testpmd is not running"
fi
-sudo rm -f ${TESTPMD_LOG}
-sudo rm -f ${TESTPMD_PID}
+# Remove hugepages
sudo rm -f /dev/hugepages/*
-cd ${ROOTDIR}/dpdk-16.07/
-./tools/dpdk-devbind.py -b ${port1_driver} ${port1_pci}
-./tools/dpdk-devbind.py -b ${port2_driver} ${port2_pci}
+# 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=`./tools/dpdk-devbind.py --s | grep "${port1_pci}" | sed -n 's/.*if=\(\S\)/\1/p' | awk -F' ' '{print $1}'`
-if2_name=`./tools/dpdk-devbind.py --s | grep "${port2_pci}" | sed -n 's/.*if=\(\S\)/\1/p' | awk -F' ' '{print $1}'`
-
-ifconfig ${if1_name} up
-ifconfig ${if2_name} up
+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}'`
-rmmod igb_uio
-rmmod uio
+# Remove igb_uio driver
+rmmod igb_uio || \
+ echo "Removing igb_uio failed" || exit 1
cd ${PWDDIR}
diff --git a/dpdk-tests/dpdk_scripts/init_dpdk.sh b/dpdk-tests/dpdk_scripts/init_dpdk.sh
index b0bd426021..9870f49f42 100755
--- a/dpdk-tests/dpdk_scripts/init_dpdk.sh
+++ b/dpdk-tests/dpdk_scripts/init_dpdk.sh
@@ -1,17 +1,35 @@
#!/bin/bash
+set -x
+
+# Setting variables
+DPDK_VERSION=dpdk-17.02
ROOTDIR=/tmp/openvpp-testing
PWDDIR=$(pwd)
+cd ${ROOTDIR}/${DPDK_VERSION}/
-cd ${ROOTDIR}/dpdk-16.07/
modprobe uio
+echo "RC = $?"
+
lsmod | grep igb_uio
-if [ $? -eq 1 ];
+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
- insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko || exit 1
-else
- rmmod igb_uio
- insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko || exit 1
+ rmmod uio_pci_generic || \
+ echo "Failed to remove uio_pci_generic module" || exit 1
fi
-./tools/dpdk-devbind.py -b igb_uio $1 $2
+
+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/dpdk-tests/dpdk_scripts/install_dpdk.sh b/dpdk-tests/dpdk_scripts/install_dpdk.sh
index 99fa957d59..4b4c04a727 100755
--- a/dpdk-tests/dpdk_scripts/install_dpdk.sh
+++ b/dpdk-tests/dpdk_scripts/install_dpdk.sh
@@ -1,31 +1,40 @@
#!/bin/bash
-DPDK_VERSION=16.07
-DPDK_DIR=dpdk-${DPDK_VERSION}
-DPDK_PACKAGE=${DPDK_DIR}.tar.xz
+set -x
+# Setting variables
+DPDK_VERSION=dpdk-17.02
+DPDK_DIR=${DPDK_VERSION}
+DPDK_PACKAGE=${DPDK_DIR}.tar.xz
ROOTDIR=/tmp/openvpp-testing
PWDDIR=$(pwd)
-#download the DPDK package
-#compile and install the DPDK
+# Download the DPDK package
cd ${ROOTDIR}
-wget -q "fast.dpdk.org/rel/${DPDK_PACKAGE}" || exit 1
-tar xJf ${DPDK_PACKAGE}
+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}
-make install T=x86_64-native-linuxapp-gcc -j || exit 1
+make install T=x86_64-native-linuxapp-gcc -j || \
+ echo "Failed to compile $DPDK_VERSION" || exit 1
cd ${PWDDIR}
-#compile the l3fwd
+# Compile the l3fwd
export RTE_SDK=${ROOTDIR}/${DPDK_DIR}/
export RTE_TARGET=x86_64-native-linuxapp-gcc
cd ${RTE_SDK}/examples/l3fwd
-make -j || exit 1
+make -j || \
+ echo "Failed to compile l3fwd" || exit 1
cd ${PWDDIR}
-#check and setup the hugepages
+# 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
@@ -37,13 +46,15 @@ if [ ${SYS_HUGEPAGE} -lt 4096 ]; then
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/
- test $? -eq 0 || exit 1
+ sudo mount -t hugetlbfs nodev /mnt/huge/ || \
+ echo "Failed to mount hugepages" || exit 1
fi
-#check and set the max map count
+# 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/dpdk-tests/dpdk_scripts/run_l2fwd.sh b/dpdk-tests/dpdk_scripts/run_l2fwd.sh
index 3ddf4fd958..80ed14a330 100755
--- a/dpdk-tests/dpdk_scripts/run_l2fwd.sh
+++ b/dpdk-tests/dpdk_scripts/run_l2fwd.sh
@@ -1,52 +1,66 @@
#!/bin/bash
+set -x
+
+# Setting variables
+DPDK_VERSION=dpdk-17.02
ROOTDIR=/tmp/openvpp-testing
+TESTPMDLOG=screenlog.0
PWDDIR=$(pwd)
-TESTPMD_LOG=/tmp/testpmd.log
-TESTPMD_PID=/tmp/testpmd.pid
-
+# Setting command line arguments
cpu_corelist=$1
nb_cores=$2
queue_nums=$3
jumbo_frames=$4
-#kill the testpmd
+# 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 ${TESTPMD_LOG}
-sudo rm -f ${TESTPMD_PID}
+# Remove hugepages
sudo rm -f /dev/hugepages/*
-#run the testpmd
-cd ${ROOTDIR}
+sleep 2
+
+cd ${ROOTDIR}/${DPDK_VERSION}/
+rm -f ${TESTPMDLOG}
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}
+ 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=${queue_nums} --auto-start"
+ sleep 10
+ cat ${TESTPMDLOG}
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}
+ 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=${queue_nums} --auto-start"
+ sleep 10
+ cat ${TESTPMDLOG}
fi
cd ${PWDDIR}