mbox

[0/2] Small usability improvements for devbind

Message ID cover.1563982007.git.anatoly.burakov@intel.com (mailing list archive)
Headers

Message

Anatoly Burakov July 24, 2019, 3:34 p.m. UTC
  Over the course of using devbind, i find myself frequently bumping up
against two common errors (with the assumption being that i'm not the
only person who hits these errors).

First happens when i forget to specify the driver. The error message in
this case looks something like the following:

anatoly@xxxx:~$ sudo DPDK/usertools/dpdk-devbind.py -b 08:00.0 08:00.1
Error: bind failed for 0000:08:00.1 - Cannot open /sys/bus/pci/drivers/08:00.0/bind
Error: unbind failed for 0000:08:00.1 - Cannot open /sys/bus/pci/drivers//unbind

This is confusing to anyone who isn't intimately familiar with how driver binding
through sysfs works. The first patch in this series changes the error message to
instead look like the following:

anatoly@xxxx:~$ sudo DPDK/usertools/dpdk-devbind.py -b 08:00.0 08:00.1
ERROR: Driver '08:00.0' does not look like a valid driver. Did you forget to specify the driver to bind devices to?

We do that by assuming that no one in their right mind will name their PCI driver
with something that looks like a PCI address, so we check if the driver string is
actually a valid device string. If it is, we error out.

The second error i often come across is forgetting to load the driver. This
error looks something like this:

anatoly@xxxx:~$ sudo DPDK/usertools/dpdk-devbind.py -b vfio-pci 08:00.1
Error: bind failed for 0000:08:00.1 - Cannot open /sys/bus/pci/drivers/vfio-pci/bind

This too isn't very informative. The second patch in this patchset changes this error
to look like this instead:

anatoly@xxxx:~$ sudo DPDK/usertools/dpdk-devbind.py -b vfio-pci 08:00.1
ERROR: Driver 'vfio-pci' is not loaded.

Nice and informative!

Anatoly Burakov (2):
  usertools/devbind: add error on forgetting to specify driver
  usertools/devbind: check if module is loaded before binding

 usertools/dpdk-devbind.py | 81 ++++++++++++++++++++++++++-------------
 1 file changed, 55 insertions(+), 26 deletions(-)