dpdk_setup_ports: change return code to 32 in case of Mellanox NICs.
authorYaroslav Brustinov <[email protected]>
Mon, 27 Feb 2017 18:41:53 +0000 (20:41 +0200)
committerYaroslav Brustinov <[email protected]>
Mon, 27 Feb 2017 18:41:53 +0000 (20:41 +0200)
Add info on packages for compiling .ko file.

Change-Id: Ic958a339ad6af696764cb76d95d72776afc8b304
Signed-off-by: Yaroslav Brustinov <[email protected]>
scripts/dpdk_setup_ports.py
scripts/t-rex-64
scripts/t-rex-64-debug-gdb
scripts/trex-cfg

index c956b6c..72d91de 100755 (executable)
@@ -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
 
index 208f202..c92d48b 100755 (executable)
@@ -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
 
 
index 83ab82e..da93138 100755 (executable)
@@ -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
 
index 02d50eb..aaaa2a3 100755 (executable)
@@ -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