summaryrefslogtreecommitdiff
path: root/usertools
diff options
context:
space:
mode:
authorAnatoly Burakov <anatoly.burakov@intel.com>2018-11-19 10:33:12 +0000
committerThomas Monjalon <thomas@monjalon.net>2018-11-23 01:43:20 +0100
commit109cb989d9a9c55ca80256cbde184b6a22be3b86 (patch)
tree69ae6a42ab4b4a93b22f5fe5350377e7d43690a2 /usertools
parentd82e5db6f6561356990000cac40e78b59ba0c65f (diff)
downloaddpdk-next-eventdev-109cb989d9a9c55ca80256cbde184b6a22be3b86.zip
dpdk-next-eventdev-109cb989d9a9c55ca80256cbde184b6a22be3b86.tar.gz
dpdk-next-eventdev-109cb989d9a9c55ca80256cbde184b6a22be3b86.tar.xz
usertools: skip empty categories in devices status
If there aren't any devices of a particular category on user's system, we still display them, which is bad for usability. Fix devbind to not print out a category unless there are devices in it. Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com> Reviewed-by: David Hunt <david.hunt@intel.com>
Diffstat (limited to 'usertools')
-rwxr-xr-xusertools/dpdk-devbind.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 40dc28a..a9cd66a 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -546,14 +546,27 @@ def show_device_status(devices_type, device_name):
else:
kernel_drv.append(devices[d])
+ n_devs = len(dpdk_drv) + len(kernel_drv) + len(no_drv)
+
+ # don't bother displaying anything if there are no devices
+ if n_devs == 0:
+ msg = "No '%s' devices detected" % device_name
+ print("")
+ print(msg)
+ print("".join('=' * len(msg)))
+ return
+
# print each category separately, so we can clearly see what's used by DPDK
- display_devices("%s devices using DPDK-compatible driver" % device_name,
- dpdk_drv, "drv=%(Driver_str)s unused=%(Module_str)s")
- display_devices("%s devices using kernel driver" % device_name, kernel_drv,
- "if=%(Interface)s drv=%(Driver_str)s "
- "unused=%(Module_str)s %(Active)s")
- display_devices("Other %s devices" % device_name, no_drv,
- "unused=%(Module_str)s")
+ if len(dpdk_drv) != 0:
+ display_devices("%s devices using DPDK-compatible driver" % device_name,
+ dpdk_drv, "drv=%(Driver_str)s unused=%(Module_str)s")
+ if len(kernel_drv) != 0:
+ display_devices("%s devices using kernel driver" % device_name, kernel_drv,
+ "if=%(Interface)s drv=%(Driver_str)s "
+ "unused=%(Module_str)s %(Active)s")
+ if len(no_drv) != 0:
+ display_devices("Other %s devices" % device_name, no_drv,
+ "unused=%(Module_str)s")
def show_status():
'''Function called when the script is passed the "--status" option.