aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/utils.py
diff options
context:
space:
mode:
authorKarthik S <ksundara@redhat.com>2017-07-05 06:52:36 -0400
committerEmilien Macchi <emilien@redhat.com>2017-08-02 18:08:22 +0000
commit312a77a1ac353c1a135ac0b901863bbe8ee66f20 (patch)
tree5e5d8775ec2004c88982285b09bf1d6d8388525b /os_net_config/utils.py
parentd7a8b39585778e17d995df09079e7a1a0b8780a6 (diff)
OvS 2.7 support - dpdk-devargs needs to provided for DPDK devices
The pci address of the DPDK NIC needs to be specified as dpdk-devargs when adding the DPDK port. This is required for using DPDK with OvS 2.7 Change-Id: I4975130961199ee04dd002ec987081299e3ddd4a Closes-Bug: #1702457 Signed-off-by: Karthik S <ksundara@redhat.com>
Diffstat (limited to 'os_net_config/utils.py')
-rw-r--r--os_net_config/utils.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/os_net_config/utils.py b/os_net_config/utils.py
index b7a54bf..27e888d 100644
--- a/os_net_config/utils.py
+++ b/os_net_config/utils.py
@@ -238,6 +238,14 @@ def bind_dpdk_interfaces(ifname, driver, noop):
except processutils.ProcessExecutionError:
msg = "Failed to bind interface %s with dpdk" % ifname
raise OvsDpdkBindException(msg)
+ else:
+ # Check if the pci address is already fetched and stored.
+ # If the pci address could not be fetched from dpdk_mapping.yaml
+ # raise OvsDpdkBindException, since the interface is neither
+ # available nor bound with dpdk.
+ if not get_stored_pci_address(ifname, noop):
+ msg = "Interface %s cannot be found" % ifname
+ raise OvsDpdkBindException(msg)
else:
logger.info('Interface %(name)s bound to DPDK driver %(driver)s '
'using driverctl command' %
@@ -264,6 +272,17 @@ def get_pci_address(ifname, noop):
'ethtool' % ifname)
+def get_stored_pci_address(ifname, noop):
+ if not noop:
+ dpdk_map = _get_dpdk_map()
+ for dpdk_nic in dpdk_map:
+ if dpdk_nic['name'] == ifname:
+ return dpdk_nic['pci_address']
+ else:
+ logger.info('Fetch the PCI address of the interface %s using '
+ 'ethtool' % ifname)
+
+
# Once the interface is bound to a DPDK driver, all the references to the
# interface including '/sys' and '/proc', will be removed. And there is no
# way to identify the nic name after it is bound. So, the DPDK bound nic info