From a7fbd337035d5a5b1ca59ae290d995232a3adc22 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Mon, 27 Feb 2017 20:41:53 +0200 Subject: dpdk_setup_ports: change return code to 32 in case of Mellanox NICs. Add info on packages for compiling .ko file. Change-Id: Ic958a339ad6af696764cb76d95d72776afc8b304 Signed-off-by: Yaroslav Brustinov --- scripts/dpdk_setup_ports.py | 7 ++++--- scripts/t-rex-64 | 4 ++-- scripts/t-rex-64-debug-gdb | 19 ++++++++++++++----- scripts/trex-cfg | 33 +++++++++++++++++++++++---------- 4 files changed, 43 insertions(+), 20 deletions(-) diff --git a/scripts/dpdk_setup_ports.py b/scripts/dpdk_setup_ports.py index c956b6c0..72d91de3 100755 --- a/scripts/dpdk_setup_ports.py +++ b/scripts/dpdk_setup_ports.py @@ -21,7 +21,8 @@ import platform # exit code is Important should be # -1 : don't continue # 0 : no errors - no need to load mlx share object -# 1 : no errors - mlx share object should be loaded +# 32 : no errors - mlx share object should be loaded +MLX_EXIT_CODE = 32 class ConfigCreator(object): @@ -534,7 +535,7 @@ Other network devices if only_check_all_mlx: if Mellanox_cnt >0: - exit(1); + exit(MLX_EXIT_CODE); else: exit(0); @@ -573,7 +574,7 @@ Other network devices sys.exit(-1) if Mellanox_cnt: - return 1 + return MLX_EXIT_CODE else: return 0 diff --git a/scripts/t-rex-64 b/scripts/t-rex-64 index 208f2029..c92d48b0 100755 --- a/scripts/t-rex-64 +++ b/scripts/t-rex-64 @@ -14,8 +14,8 @@ if [ $RESULT -eq 255 ]; then exit $RESULT fi -if [ $RESULT -eq 1 ]; then -EXTRA_INPUT_ARGS="--mlx5-so" +if [ $RESULT -eq 32 ]; then + EXTRA_INPUT_ARGS="--mlx5-so" fi diff --git a/scripts/t-rex-64-debug-gdb b/scripts/t-rex-64-debug-gdb index 83ab82e0..da93138c 100755 --- a/scripts/t-rex-64-debug-gdb +++ b/scripts/t-rex-64-debug-gdb @@ -1,11 +1,20 @@ #! /bin/bash export LD_LIBRARY_PATH=`pwd` -#Add dummy lib in case we don't find it, e.g. there is no OFED installed -if ldd _t-rex-64 | grep "libibverbs.so" | grep -q "not found"; then -export LD_LIBRARY_PATH=$PWD:$PWD/dumy_libs +EXTRA_INPUT_ARGS="" + +./trex-cfg $INPUT_ARGS +RESULT=$? + +if [ $RESULT -eq 255 ]; then + echo "ERROR encountered while configuring trex system" + exit $RESULT fi - -/usr/bin/gdb --args ./_t-rex-64-debug $@ +if [ $RESULT -eq 32 ]; then + EXTRA_INPUT_ARGS="--mlx5-so" +fi + + +/usr/bin/gdb --args ./_t-rex-64-debug $@ $EXTRA_INPUT_ARGS diff --git a/scripts/trex-cfg b/scripts/trex-cfg index 02d50eb6..aaaa2a32 100755 --- a/scripts/trex-cfg +++ b/scripts/trex-cfg @@ -1,4 +1,10 @@ #! /bin/bash + +# exit code is Important should be +# -1 : don't continue +# 0 : no errors - no need to load mlx share object +# 32 : no errors - mlx share object should be loaded (returned by dpdk_setup_ports.py) + SYS=`uname -r` if [ -f /etc/debian_version ]; then OS=debian @@ -12,7 +18,7 @@ fi MACHINE_TYPE=`uname -m` if [ ${MACHINE_TYPE} != 'x86_64' ]; then echo "ERROR, only 64bit operating systems are supported, please reinstall x86 64 bit OS" - exit 1 + exit -1 fi @@ -44,7 +50,7 @@ if ! lsmod | grep -q igb_uio ; then modprobe uio if [ $? -ne 0 ]; then echo "Failed inserting uio module, please check if it is installed" - exit 1 + exit -1 fi km=ko/$SYS/igb_uio.ko if [ ! -e $km ]; then @@ -56,14 +62,21 @@ if ! lsmod | grep -q igb_uio ; then make install && cd - } &> /dev/null || { - echo Automatic compilation failed. + echo -e "Automatic compilation failed.\n" echo "You can try compiling yourself, using the following commands:" - echo "\$cd ko/src " - echo "\$make " - echo "\$make install " - echo "\$cd - " - echo "Then try to run TRex again" - exit 1 + echo " \$cd ko/src " + echo " \$make " + echo " \$make install " + echo -e " \$cd - \n" + echo -e "Then, try to run TRex again.\n" + echo 'Note: you might need additional Linux packages for that:' + echo ' * yum based (Fedora, CentOS, RedHat):' + echo ' sudo yum install kernel-devel-`uname -r`' + echo ' sudo yum group install "Development tools"' + echo ' * apt based (Ubuntu):' + echo ' sudo apt install linux-headers-`uname -r`' + echo ' sudo apt install build-essential' + exit -1 } echo Success. fi @@ -71,7 +84,7 @@ if ! lsmod | grep -q igb_uio ; then insmod $km if [ $? -ne 0 ]; then echo "Failed inserting igb_uio module" - exit 1 + exit -1 fi fi fi -- cgit 1.2.3-korg