summaryrefslogtreecommitdiffstats
path: root/scripts/dpdk_setup_ports.py
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-11-03 15:17:49 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2016-11-03 15:18:00 +0200
commit9dba32c9a8c026a98993c32bdbc01f6454a79720 (patch)
tree2e9bea25aba098a050e9cfa3a33930ba3c52aede /scripts/dpdk_setup_ports.py
parent5d52395c51c8638a8c328f13cea6f0a5ddbc3642 (diff)
dpdk_setup_ports.py: config creation - don't run TRex if IP config is wanted
Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'scripts/dpdk_setup_ports.py')
-rwxr-xr-xscripts/dpdk_setup_ports.py57
1 files changed, 30 insertions, 27 deletions
diff --git a/scripts/dpdk_setup_ports.py b/scripts/dpdk_setup_ports.py
index 61875cca..f85dae5d 100755
--- a/scripts/dpdk_setup_ports.py
+++ b/scripts/dpdk_setup_ports.py
@@ -431,7 +431,7 @@ Other network devices
# input: list of different descriptions of interfaces: index, pci, name etc.
# Binds to dpdk wanted interfaces, not bound to any driver.
# output: list of maps of devices in dpdk_* format (self.m_devices.values())
- def _get_wanted_interfaces(self, input_interfaces):
+ def _get_wanted_interfaces(self, input_interfaces, get_macs = True):
if type(input_interfaces) is not list:
raise DpdkSetup('type of input interfaces should be list')
if not len(input_interfaces):
@@ -459,26 +459,23 @@ Other network devices
dev['Interface_argv'] = interface
wanted_interfaces.append(dev)
- unbound = []
- dpdk_bound = []
- for interface in wanted_interfaces:
- if 'Driver_str' not in interface:
- unbound.append(interface['Slot'])
- elif interface.get('Driver_str') in dpdk_nic_bind.dpdk_drivers:
- dpdk_bound.append(interface['Slot'])
- if unbound or dpdk_bound:
- for pci, info in dpdk_nic_bind.get_info_from_trex(unbound + dpdk_bound).items():
- if pci not in self.m_devices:
- raise DpdkSetup('Internal error: PCI %s is not found among devices' % pci)
- self.m_devices[pci].update(info)
+ if get_macs:
+ unbound = []
+ dpdk_bound = []
+ for interface in wanted_interfaces:
+ if 'Driver_str' not in interface:
+ unbound.append(interface['Slot'])
+ elif interface.get('Driver_str') in dpdk_nic_bind.dpdk_drivers:
+ dpdk_bound.append(interface['Slot'])
+ if unbound or dpdk_bound:
+ for pci, info in dpdk_nic_bind.get_info_from_trex(unbound + dpdk_bound).items():
+ if pci not in self.m_devices:
+ raise DpdkSetup('Internal error: PCI %s is not found among devices' % pci)
+ self.m_devices[pci].update(info)
return wanted_interfaces
def do_create(self):
- # gather info about NICS from dpdk_nic_bind.py
- if not self.m_devices:
- self.run_dpdk_lspci()
- wanted_interfaces = self._get_wanted_interfaces(map_driver.args.create_interfaces)
ips = map_driver.args.ips
def_gws = map_driver.args.def_gws
@@ -495,7 +492,7 @@ Other network devices
raise DpdkSetup("If specifying ips, must specify also def-gws")
if dest_macs:
raise DpdkSetup("If specifying ips, should not specify dest--macs")
- if len(ips) != len(def_gws) or len(ips) != len(wanted_interfaces):
+ if len(ips) != len(def_gws) or len(ips) != len(map_driver.args.create_interfaces):
raise DpdkSetup("Number of given IPs should equal number of given def-gws and number of interfaces")
else:
if dest_macs:
@@ -503,6 +500,11 @@ Other network devices
else:
ip_config = True
+ # gather info about NICS from dpdk_nic_bind.py
+ if not self.m_devices:
+ self.run_dpdk_lspci()
+ wanted_interfaces = self._get_wanted_interfaces(map_driver.args.create_interfaces, get_macs = not ip_config)
+
for i, interface in enumerate(wanted_interfaces):
dual_index = i + 1 - (i % 2) * 2
if ip_config:
@@ -548,9 +550,18 @@ Other network devices
ignore_numa = True
else:
sys.exit(1)
+
+ if map_driver.args.force_macs:
+ ip_based = False
+ elif dpdk_nic_bind.confirm("By default, IP based configuration file will be created. Do you want to use MAC based config? (y/N)"):
+ ip_based = False
+ else:
+ ip_based = True
+ ip_addr_digit = 1
+
if not self.m_devices:
self.run_dpdk_lspci()
- dpdk_nic_bind.show_table()
+ dpdk_nic_bind.show_table(get_macs = not ip_based)
print('Please choose even number of interfaces from the list above, either by ID , PCI or Linux IF')
print('Stateful will use order of interfaces: Client1 Server1 Client2 Server2 etc. for flows.')
print('Stateless can be in any order.')
@@ -579,14 +590,6 @@ Other network devices
if not dpdk_nic_bind.confirm('Ignore and continue? (y/N): '):
sys.exit(1)
- if map_driver.args.force_macs:
- ip_based = False
- elif dpdk_nic_bind.confirm("By default, IP based configuration file will be created. Do you want to change to MAC based config? (y/N)"):
- ip_based = False
- else:
- ip_based = True
- ip_addr_digit = 1
-
for i, interface in enumerate(wanted_interfaces):
if not ip_based:
if 'MAC' not in interface: