Max number of ports: 16 40/5340/1
authorYaroslav Brustinov <[email protected]>
Sun, 25 Dec 2016 00:02:59 +0000 (02:02 +0200)
committerYaroslav Brustinov <[email protected]>
Sun, 1 Jan 2017 01:00:28 +0000 (03:00 +0200)
Change-Id: I93e2efe542578b0745d2f40adb2bcf35ffdff31b
Signed-off-by: Yaroslav Brustinov <[email protected]>
scripts/dpdk_setup_ports.py
src/main_dpdk.cpp
src/platform_cfg.cpp
src/platform_cfg.h
src/trex_defs.h

index 6683ca5..9ad1a82 100755 (executable)
@@ -391,7 +391,7 @@ Other network devices
         fcfg=self.m_cfg_file
 
         if not os.path.isfile(fcfg) :
-            self.raise_error ("There is no valid configuration file %s " % fcfg)
+            self.raise_error ("There is no valid configuration file %s\n" % fcfg)
 
         try:
           stream = open(fcfg, 'r')
@@ -403,22 +403,22 @@ Other network devices
         stream.close();
         cfg_dict = self.m_cfg_dict[0]
         if 'version' not in cfg_dict:
-            self.raise_error ("Configuration file %s is old, should include version field\n" % fcfg )
+            raise DpdkSetup("Configuration file %s is old, should include version field\n" % fcfg )
 
         if int(cfg_dict['version'])<2 :
-            self.raise_error ("Configuration file %s is old, expected version 2, got: %s\n" % (fcfg, cfg_dict['version']))
+            raise DpdkSetup("Configuration file %s is old, expected version 2, got: %s\n" % (fcfg, cfg_dict['version']))
 
         if 'interfaces' not in self.m_cfg_dict[0]:
-            self.raise_error ("Configuration file %s is old, should include interfaces field even number of elemets" % fcfg)
+            raise DpdkSetup("Configuration file %s is old, should include interfaces field even number of elemets" % fcfg)
 
         if_list=self.m_cfg_dict[0]['interfaces']
         l=len(if_list);
-        if (l>20):
-            self.raise_error ("Configuration file %s should include interfaces field with maximum of number of elemets" % (fcfg,l))
-        if ((l % 2)==1):
-            self.raise_error ("Configuration file %s should include even number of interfaces " % (fcfg,l))
+        if l > 16:
+            raise DpdkSetup("Configuration file %s should include interfaces field with maximum 16 elements, got: %s." % (fcfg,l))
+        if l % 2:
+            raise DpdkSetup("Configuration file %s should include even number of interfaces " % (fcfg,l))
         if 'port_limit' in cfg_dict and cfg_dict['port_limit'] > len(if_list):
-            self.raise_error ('Error: port_limit should not be higher than number of interfaces in config file: %s\n' % fcfg)
+            raise DpdkSetup('Error: port_limit should not be higher than number of interfaces in config file: %s\n' % fcfg)
 
 
     def do_bind_one (self,key,mellanox):
index 9cc0e61..4e92195 100644 (file)
@@ -122,7 +122,7 @@ static inline int get_is_rx_thread_enabled() {
 
 struct port_cfg_t;
 
-#define MAX_DPDK_ARGS 40
+#define MAX_DPDK_ARGS 50
 static CPlatformYamlInfo global_platform_cfg_info;
 static int global_dpdk_args_num ;
 static char * global_dpdk_args[MAX_DPDK_ARGS];
index 575c4c7..6aae450 100755 (executable)
@@ -344,6 +344,11 @@ void operator >> (const YAML::Node& node, CPlatformYamlInfo & plat_info) {
 
     /* must have interfaces */
     const YAML::Node& interfaces = node["interfaces"];
+    if ( interfaces.size() > TREX_MAX_PORTS ) {
+        printf("ERROR: Maximal number of interfaces is: %d, and you have specified: %d.\n",
+                    TREX_MAX_PORTS, (int) interfaces.size());
+        exit(-1);
+    }
     for(unsigned i=0;i<interfaces.size();i++) {
         std::string  fi;
         const YAML::Node & node = interfaces;
index c839bd9..b921c9c 100755 (executable)
@@ -28,6 +28,7 @@ limitations under the License.
 #include <vector>
 #include <string>
 #include "tw_cfg.h"
+#include "trex_defs.h"
 
 
 #define CONST_NB_MBUF_2_10G  (16380/2)
index 8a4bf66..60a60df 100644 (file)
@@ -21,7 +21,7 @@ limitations under the License.
 #ifndef __TREX_DEFS_H__
 #define __TREX_DEFS_H__
 
-#define TREX_MAX_PORTS 12
+#define TREX_MAX_PORTS 16
 
 // maximum number of IP ID type flow stats we support
 #define MAX_FLOW_STATS 127