Thread (19 messages) 19 messages, 6 authors, 2016-10-04

Re: [PATCH v1] dpdk-devbind.py: Virtio interface issue.

flat view

From: Mcnamara, John <hidden>
Date: 2016-09-01 10:59:54

quoted hunk ↗ jump to hunk
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Mussar, Gary
Sent: Monday, August 29, 2016 4:10 PM
To: Dey, Souvik <redacted>; Stephen Hemminger
[off-list ref]
Cc: nhorman@tuxdriver.com; dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface
issue.

We did this slightly differently. This is 100% python and is a bit more
general. We search for the first "net" directory under the specific device
directory.

-------------------------------------------
--- tools/dpdk-devbind.py       2016-08-29 11:02:35.594202888 -0400
+++ ../dpdk/tools/dpdk-devbind.py 2016-08-29 11:00:34.897677233 -0400
@@ -221,11 +221,11 @@
         name = name.strip(":") + "_str"
         device[name] = value
     # check for a unix interface name
-    sys_path = "/sys/bus/pci/devices/%s/net/" % dev_id
-    if exists(sys_path):
-        device["Interface"] = ",".join(os.listdir(sys_path))
-    else:
-        device["Interface"] = ""
+    device["Interface"] = ""
+    for base, dirs, files in os.walk("/sys/bus/pci/devices/%s/" %
dev_id):
+        if "net" in dirs:
+            device["Interface"] =
",".join(os.listdir(os.path.join(base,"net")))
+            break
     # check if a port is used for ssh connection
     device["Ssh_if"] = False
     device["Active"] = ""
-------------------------------------------
Hi Gary,

That looks like a cleaner solution. Could you submit that as a patch.

Souvik, could you test this patch and confirm it fixes your issue.


Gary, if you submit a patch could you make a few minor changes:
quoted hunk ↗ jump to hunk
+    device["Interface"] = ""
+    for base, dirs, files in os.walk("/sys/bus/pci/devices/%s/" % dev_id):
+        
If "files" is unused, and it looks like it is, then replace it with "_".

+            device["Interface"] = ",".join(os.listdir(os.path.join(base,"net")))
There is a space required after "," for PEP8 compliance.

John
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help