Adding ethtool command after binding dpdk drivers in Mellanox nics

Not like other nics, mellanox nics keep the interface after binding it
to dpdk, so we are adding ethtool command with 10 retries after binding
the driver just to make sure that the interface is initialized successfully.

Closes-Bug: #1756724
Change-Id: I7e5efebf11a58d45707ff7a289a25297ac981a99
(cherry picked from commit 2ef379057f)
This commit is contained in:
waleed mousa 2018-03-18 07:35:52 -04:00
parent 193928916e
commit e699c687aa
1 changed files with 12 additions and 0 deletions

View File

@ -270,6 +270,7 @@ def bind_dpdk_interfaces(ifname, driver, noop):
raise OvsDpdkBindException(msg)
mac_address = interface_mac(ifname)
vendor_id = get_vendor_id(ifname)
try:
out, err = processutils.execute('driverctl', 'set-override',
pci_address, driver)
@ -278,6 +279,17 @@ def bind_dpdk_interfaces(ifname, driver, noop):
raise OvsDpdkBindException(msg)
else:
_update_dpdk_map(ifname, pci_address, mac_address, driver)
# Not like other nics, beacause mellanox nics keep the
# interface after binding it to dpdk, so we are adding
# ethtool command with 10 attempts after binding the driver
# just to make sure that the interface is initialized
# successfully in order not to fail in each of this cases:
# - get_dpdk_devargs() in case of OvsDpdkPort and
# OvsDpdkBond.
# - bind_dpdk_interface() in case of OvsDpdkBond.
if vendor_id == "0x15b3":
processutils.execute('ethtool', '-i', ifname,
attempts=10)
except processutils.ProcessExecutionError:
msg = "Failed to bind interface %s with dpdk" % ifname