summaryrefslogtreecommitdiffstats
path: root/scripts/dpdk_setup_ports.py
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-02-28 11:11:43 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2016-02-28 11:11:43 +0200
commit42274c193cc6f2562c1e1a31c4e47ade8bed97c4 (patch)
tree74dd40242875446ee54be72db2b24e40202aef12 /scripts/dpdk_setup_ports.py
parent23532d37dd0f8e23ec59e36eb96dd766e65cb6b6 (diff)
fix for up to 12 ports, fix error in case port_limit higher than number of interfaces
Diffstat (limited to 'scripts/dpdk_setup_ports.py')
-rwxr-xr-xscripts/dpdk_setup_ports.py23
1 files changed, 13 insertions, 10 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)