usertools: add option to unbind all devices

-u accepts "dpdk" argument to unbind all devices bound to a DPDK driver.

Usage:
usertools/dpdk-devbind.py -u dpdk

Example:
$ usertools/dpdk-devbind.py -s

Network devices using DPDK-compatible driver
============================================
0000:08:00.1 '...' drv=igb_uio unused=
0000:81:00.0 '...' drv=igb_uio unused=
0000:88:00.0 '...' drv=igb_uio unused=
0000:88:00.1 '...' drv=igb_uio unused=
...

$ usertools/dpdk-devbind.py -u dpdk
$ usertools/dpdk-devbind.py -s

Network devices using DPDK-compatible driver
============================================
<none>
....

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Ferruh Yigit 2017-05-04 15:10:50 +01:00 committed by Thomas Monjalon
parent a1e7c17555
commit 657c713385

View File

@ -518,6 +518,14 @@ def bind_one(dev_id, driver, force):
def unbind_all(dev_list, force=False):
"""Unbind method, takes a list of device locations"""
if dev_list[0] == "dpdk":
for d in devices.keys():
if "Driver_str" in devices[d]:
if devices[d]["Driver_str"] in dpdk_drivers:
unbind_one(devices[d]["Slot"], force)
return
dev_list = map(dev_id_from_dev_name, dev_list)
for d in dev_list:
unbind_one(d, force)