diff options
author | 2016-02-28 11:11:43 +0200 | |
---|---|---|
committer | 2016-02-28 11:11:43 +0200 | |
commit | 42274c193cc6f2562c1e1a31c4e47ade8bed97c4 (patch) | |
tree | 74dd40242875446ee54be72db2b24e40202aef12 | |
parent | 23532d37dd0f8e23ec59e36eb96dd766e65cb6b6 (diff) |
fix for up to 12 ports, fix error in case port_limit higher than number of interfaces
-rwxr-xr-x | scripts/dpdk_setup_ports.py | 23 | ||||
-rw-r--r-- | src/main_dpdk.cpp | 4 |
2 files changed, 15 insertions, 12 deletions
diff --git a/scripts/dpdk_setup_ports.py b/scripts/dpdk_setup_ports.py index 8dfd742e..57670f47 100755 --- a/scripts/dpdk_setup_ports.py +++ b/scripts/dpdk_setup_ports.py @@ -32,7 +32,7 @@ The name of the configuration file should be /etc/trex_cfg.yaml " The minimum configuration file should include something like this - version : 2 # version 2 of the configuration file interfaces : ["03:00.0","03:00.1","13:00.1","13:00.0"] # list of the interfaces to bind run ./dpdk_nic_bind.py --status to see the list - port_limit : 2 # number of ports to use valid is 2,4,6,8 + port_limit : 2 # number of ports to use valid is 2,4,6,8,10,12 example of already bind devices @@ -76,20 +76,23 @@ Other network devices raise e stream.close(); + cfg_dict = self.m_cfg_dict[0] + if not cfg_dict.has_key('version') : + self.raise_error ("Configuration file %s is old, should include version field\n" % fcfg ) - if not self.m_cfg_dict[0].has_key('version') : - self.raise_error ("Configuration file %s is old, should include version field" % fcfg ) + if int(cfg_dict['version'])<2 : + self.raise_error ("Configuration file %s is old, should include version field with value greater than 2\n" % fcfg) - if int(self.m_cfg_dict[0]['version'])<2 : - self.raise_error ("Configuration file %s is old, should include version field with value greater than 2" % fcfg) + if not cfg_dict.has_key('interfaces') : + self.raise_error ("Configuration file %s is old, should include interfaces field with 2,4,6,8,10,12 number of elemets\n" % fcfg) - if not self.m_cfg_dict[0].has_key('interfaces') : - self.raise_error ("Configuration file %s is old, should include interfaces field with 2,4,6,8 number of elemets" % fcfg) + if_list=cfg_dict['interfaces'] + if not (len(if_list) in [2,4,6,8,10,12]): + self.raise_error ("Configuration file %s should include interfaces field with 2,4,6,8,10,12 number of elemets\n" % fcfg) - if_list=self.m_cfg_dict[0]['interfaces'] - if not (len(if_list) in [2,4,6,8]): - self.raise_error ("Configuration file %s should include interfaces field with 2,4,6,8 number of elemets" % fcfg) + 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) def do_bind_one (self,key): cmd='./dpdk_nic_bind.py --force --bind=igb_uio %s ' % ( key) diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index 25c10e5d..c23e27d4 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -3225,8 +3225,8 @@ int CGlobalTRex::queues_prob_init(){ rte_exit(EXIT_FAILURE, "number of cores should be at least 3 \n"); } - if ( !( (m_max_ports == 4) || (m_max_ports == 2) || (m_max_ports == 8) || (m_max_ports == 6) ) ){ - rte_exit(EXIT_FAILURE, "supported number of ports are 2-8 you have %d \n",m_max_ports); + if ( !( (m_max_ports == 4) || (m_max_ports == 2) || (m_max_ports == 8) || (m_max_ports == 6) || (m_max_ports == 10) || (m_max_ports == 12) ) ){ + rte_exit(EXIT_FAILURE, "supported number of ports is 2-12, you have %d \n", m_max_ports); } assert((m_max_ports>>1) <= get_cores_tx() ); |