[dpdk-dev] [PATCH] usertools: add device index for dpdk-devbind script
Loc Nguyen
locnguyen at niometrics.com
Mon Jun 3 14:57:36 CEST 2019
Add a device index in front of the PCI ID for easy counting
Network devices using DPDK-compatible driver
============================================
0: 0000:07:00.0 ...
1: 0000:07:00.1 ...
Signed-off-by: Loc Nguyen <locnguyen at niometrics.com>
---
usertools/dpdk-devbind.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 9e79f0d28..21da3deca 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -534,7 +534,9 @@ def display_devices(title, dev_list, extra_params=None):
strings.append("%s '%s'" % (dev["Slot"], dev["Device_str"]))
# sort before printing, so that the entries appear in PCI order
strings.sort()
- print("\n".join(strings)) # print one per line
+ # add device index in front of each device
+ enum_dev_list = ['%2d' % index + ": " + device for index, device in enumerate(strings)]
+ print("\n".join(enum_dev_list)) # print one per line
def show_device_status(devices_type, device_name):
global dpdk_drivers
--
2.18.0
More information about the dev
mailing list