Skip to contentSkip to conversation

tools/dpdk_nic_bind.py: Verbosely warn the user on bind

PATCH In review Aaron Conole 3 participants 5 messages Dec 11, 2015 – Mar 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/dpdk_nic_bind.py: Verbosely warn the user on bind

DPDK ports are only detected during the EAL initialization. After that, any new DPDK ports which are bound will not be visible to the application.

The dpdk_nic_bind.py can be a bit more helpful to let users know that DPDK enabled applications will not find rebound ports until after they have been restarted.

---
 tools/dpdk_nic_bind.py | 8 ++++++++
 1 file changed, 8 insertions(+)
tools/dpdk_nic_bind.py +8 -0
index f02454e..ca39389 100755
@@ -344,8 +344,10 @@ def bind_one(dev_id, driver, force):
             dev["Driver_str"] = "" # clear driver string
 
     # if we are binding to one of DPDK drivers, add PCI id's to that driver
+    bDpdkDriver = False
     if driver in dpdk_drivers:
         filename = "/sys/bus/pci/drivers/%s/new_id" % driver
+        bDpdkDriver = True
         try:
             f = open(filename, "w")
         except:
@@ -371,12 +373,18 @@ def bind_one(dev_id, driver, force):
     try:
         f.write(dev_id)
         f.close()
+        if bDpdkDriver:
+            print "Device rebound to dpdk driver."
+            print "Remember to restart any application that will use this port."
     except:
         # for some reason, closing dev_id after adding a new PCI ID to new_id
         # results in IOError. however, if the device was successfully bound,
         # we don't care for any errors and can safely ignore IOError
         tmp = get_pci_device_details(dev_id)
         if "Driver_str" in tmp and tmp["Driver_str"] == driver:
+            if bDpdkDriver:
+                print "Device rebound to dpdk driver."
+                print "Remember to restart any application that will use this port."
             return
         print "Error: bind failed for %s - Cannot bind to driver %s" % (dev_id, driver)
         if saved_driver is not None: # restore any previous driver
Signature · 1 line
2.6.1.133.gf5b6079
#1 lore raw

Ping... This patch has been sitting^Hrotting for a bit over a month.

Quoted 47 lines

DPDK ports are only detected during the EAL initialization. After that, any new DPDK ports which are bound will not be visible to the application.

The dpdk_nic_bind.py can be a bit more helpful to let users know that DPDK enabled applications will not find rebound ports until after they have been restarted.

---
tools/dpdk_nic_bind.py | 8 ++++++++

 1 file changed, 8 insertions(+)
tools/dpdk_nic_bind.py +8 -0
index f02454e..ca39389 100755
@@ -344,8 +344,10 @@ def bind_one(dev_id, driver, force):
             dev["Driver_str"] = "" # clear driver string
 
     # if we are binding to one of DPDK drivers, add PCI id's to that driver
+    bDpdkDriver = False
     if driver in dpdk_drivers:
         filename = "/sys/bus/pci/drivers/%s/new_id" % driver
+        bDpdkDriver = True
         try:
             f = open(filename, "w")
         except:
@@ -371,12 +373,18 @@ def bind_one(dev_id, driver, force):
     try:
         f.write(dev_id)
         f.close()
+        if bDpdkDriver:
+            print "Device rebound to dpdk driver."
+            print "Remember to restart any application that will use this port."
     except:
         # for some reason, closing dev_id after adding a new PCI ID to new_id
         # results in IOError. however, if the device was successfully bound,
         # we don't care for any errors and can safely ignore IOError
         tmp = get_pci_device_details(dev_id)
         if "Driver_str" in tmp and tmp["Driver_str"] == driver:
+            if bDpdkDriver:
+                print "Device rebound to dpdk driver."
+                print "Remember to restart any application that will use this port."
             return
         print "Error: bind failed for %s - Cannot bind to driver %s" % (dev_id, driver)
         if saved_driver is not None: # restore any previous driver
#2 lore raw
In reply to Aaron Conole

2015-12-11 11:20, Aaron Conole:

Quoted 6 lines

DPDK ports are only detected during the EAL initialization. After that, any new DPDK ports which are bound will not be visible to the application.

The dpdk_nic_bind.py can be a bit more helpful to let users know that DPDK enabled applications will not find rebound ports until after they have been restarted.

I think it's better to improve hotplug and allow hot binding. A work is in progress towards this direction. David, can you confirm?
Is this patch still valuable in the meantime?

tools/dpdk_nic_bind.py def bind_one(dev_id, driver, force): · line 347

Quoted 7 lines
tools/dpdk_nic_bind.py +1 -0
@@ -344,8 +344,10 @@ def bind_one(dev_id, driver, force):
             dev["Driver_str"] = "" # clear driver string
 
     # if we are binding to one of DPDK drivers, add PCI id's to that driver
+    bDpdkDriver = False

Please do not use camel case.

#3 lore raw
Quoted 11 lines · Thomas Monjalon

2015-12-11 11:20, Aaron Conole:

Quoted 6 lines

DPDK ports are only detected during the EAL initialization. After that, any new DPDK ports which are bound will not be visible to the application.

The dpdk_nic_bind.py can be a bit more helpful to let users know that DPDK enabled applications will not find rebound ports until after they have been restarted.

I think it's better to improve hotplug and allow hot binding. A work is in progress towards this direction. David, can you confirm?

I intend to provide some rfc patches later this week, for next release.

Signature · 1 line
David Marchand
#4 lore raw

2016-01-26 21:21, David Marchand:

Quoted 10 lines
Quoted 8 lines · Thomas Monjalon

2015-12-11 11:20, Aaron Conole:

Quoted 6 lines

DPDK ports are only detected during the EAL initialization. After that, any new DPDK ports which are bound will not be visible to the application.

The dpdk_nic_bind.py can be a bit more helpful to let users know that DPDK enabled applications will not find rebound ports until after they have been restarted.

Quoted 5 lines
Quoted 3 lines

I think it's better to improve hotplug and allow hot binding. A work is in progress towards this direction. David, can you confirm?

I intend to provide some rfc patches later this week, for next release.

These "auto-hotplug" patches won't be ready for 16.04.
But it's possible to use a new bound device with rte_eth_dev_attach(). So this patch is rejected.