usertools: support globbing for PCI device binding
authorBruce Richardson <bruce.richardson@intel.com>
Mon, 24 Aug 2020 17:04:39 +0000 (18:04 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 8 Sep 2020 21:39:32 +0000 (23:39 +0200)
commit781eafc9653806e87f5e5dab88a5d8d5cbc0b1a6
treecb8511eb5f9e0fd4fde855c0a71c708fd41d0cf3
parent36f66d1cc71bda02cc95b29db7e7488f37583cd6
usertools: support globbing for PCI device binding

When binding or unbinding a range of devices, it can be useful to use
wildcards to specify the devices rather than repeating the same prefix
multiple times. We can use the python "glob" module to give us this
functionality - at least for PCI devices - by checking /sys for matching
files.

Examples of use from my system:

    ./dpdk-devbind.py -b vfio-pci 80:04.*
    ./dpdk-devbind.py -u 80:04.[2-7]

The first example binds eight devices, 80:04.0..80:04.7, to vfio-pci. The
second then unbinds six of those devices, 80:04.2..80:04.7, from any
driver.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
usertools/dpdk-devbind.py