summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-12-25 02:02:59 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2017-01-01 03:00:28 +0200
commit7b8fd5a8e29202f21edfcb4f463ff920a0464ddb (patch)
tree9324ba5a0c12f298073d24e192bf76e1cfad0cd7
parenta56ae96bdbfe53894aad17192cd21d43c6e8a289 (diff)
Max number of ports: 16
Change-Id: I93e2efe542578b0745d2f40adb2bcf35ffdff31b Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
-rwxr-xr-xscripts/dpdk_setup_ports.py18
-rw-r--r--src/main_dpdk.cpp2
-rwxr-xr-xsrc/platform_cfg.cpp5
-rwxr-xr-xsrc/platform_cfg.h1
-rw-r--r--src/trex_defs.h2
5 files changed, 17 insertions, 11 deletions
diff --git a/scripts/dpdk_setup_ports.py b/scripts/dpdk_setup_ports.py
index 6683ca57..9ad1a826 100755
--- a/scripts/dpdk_setup_ports.py
+++ b/scripts/dpdk_setup_ports.py
@@ -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):
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index 9cc0e612..4e921954 100644
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -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];
diff --git a/src/platform_cfg.cpp b/src/platform_cfg.cpp
index 575c4c72..6aae450b 100755
--- a/src/platform_cfg.cpp
+++ b/src/platform_cfg.cpp
@@ -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;
diff --git a/src/platform_cfg.h b/src/platform_cfg.h
index c839bd96..b921c9c7 100755
--- a/src/platform_cfg.h
+++ b/src/platform_cfg.h
@@ -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)
diff --git a/src/trex_defs.h b/src/trex_defs.h
index 8a4bf664..60a60df9 100644
--- a/src/trex_defs.h
+++ b/src/trex_defs.h
@@ -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