move so flag in case of mellanox
authorHanoh Haim <[email protected]>
Tue, 7 Feb 2017 13:04:41 +0000 (15:04 +0200)
committerIdo Barnea <[email protected]>
Mon, 13 Feb 2017 10:32:26 +0000 (12:32 +0200)
Signed-off-by: Hanoh Haim <[email protected]>
scripts/dpdk_setup_ports.py
scripts/t-rex-64

index 8915788..b49d4d9 100755 (executable)
@@ -459,6 +459,8 @@ Other network devices
         self.m_devices= dpdk_nic_bind.devices
 
     def do_run (self,only_check_all_mlx=False):
+        """ return the number of mellanox drivers"""
+
         self.run_dpdk_lspci ()
         if (map_driver.parent_args.dump_interfaces is None or
                     (map_driver.parent_args.dump_interfaces == [] and
@@ -554,6 +556,12 @@ Other network devices
                 print("Could not start scapy_daemon_server, which is needed by GUI to create packets.\nIf you don't need it, use --no-scapy-server flag.")
                 sys.exit(1)
 
+        if Mellanox_cnt:
+            return 1
+        else:
+            return 0
+
+
 
     def do_return_to_linux(self):
         if not self.m_devices:
@@ -1019,7 +1027,7 @@ def main ():
         elif map_driver.args.linux:
             obj.do_return_to_linux();
         else:
-            obj.do_run();
+            exit(obj.do_run())
         print('')
     except DpdkSetup as e:
         print(e)
index e8947f6..9ad9612 100755 (executable)
@@ -5,13 +5,19 @@ if [ "$(id -u)" != 0 ]; then
 fi
 
 INPUT_ARGS=${@//[\96\97]/-} # replace bizarre minuses with normal one
+EXTRA_INPUT_ARGS=""
 
 ./trex-cfg $INPUT_ARGS
 RESULT=$?
-if [ $RESULT -ne 0 ]; then
+if [ $RESULT -lt 0 ]; then
   exit $RESULT
 fi
 
+if [ $RESULT -eq 1 ]; then
+EXTRA_INPUT_ARGS="--mlx5-so"
+fi
+
+
 pci_desc_re='^(\S+) - (.+)$'
 source find_python.sh
 while read line
@@ -35,17 +41,17 @@ fi
 
 # if we have a new core run optimized trex 
 if  grep -q avx /proc/cpuinfo ; then
-    ./_$(basename $0) $INPUT_ARGS
+    ./_$(basename $0) $INPUT_ARGS $EXTRA_INPUT_ARGS
     RESULT=$?
     if [ $RESULT -eq 132 ]; then
         echo " WARNING this program is optimized for the new Intel processors.  "
         echo " try the ./t-rex-64-o application that should work for any Intel processor but might be slower. "
         echo " try to run t-rex-64-o .. "
-        ./_t-rex-64-o $INPUT_ARGS
+        ./_t-rex-64-o $INPUT_ARGS  $EXTRA_INPUT_ARGS
         RESULT=$?
     fi
 else
-        ./_t-rex-64-o $INPUT_ARGS
+        ./_t-rex-64-o $INPUT_ARGS $EXTRA_INPUT_ARGS
         RESULT=$?
 fi