From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gary Mussar Subject: [PATCH] Tools: Fix issue with virtio interface names Date: Fri, 2 Sep 2016 09:16:33 -0400 Message-ID: <1472822193-107410-1-git-send-email-gmussar@ciena.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Gary Mussar To: dev@dpdk.org Return-path: Received: from mx0a-00103a01.pphosted.com (mx0a-00103a01.pphosted.com [67.231.144.234]) by dpdk.org (Postfix) with ESMTP id 8B2BF37B4 for ; Fri, 2 Sep 2016 15:16:41 +0200 (CEST) Received: from pps.filterd (m0000419.ppops.net [127.0.0.1]) by mx0a-00103a01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u82DDtRn008666 for ; Fri, 2 Sep 2016 09:16:40 -0400 Received: from mdwvexchht01.ciena.com (lin1-118-36-28.ciena.com [63.118.36.28]) by mx0a-00103a01.pphosted.com with ESMTP id 2579329qst-3 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT) for ; Fri, 02 Sep 2016 09:16:40 -0400 List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The dpdk-devbind.py script does not find/display the ifname for virtio interfaces since the "net" directory is not directly under the device directory but rather under a subdirectory. eg. > dpdk-devbind.py --status 0000:00:03.0 'Virtio network device' if= drv=virtio-pci unused= This change searches for the first "net" directory under the device directory hierarchy. eg. 0000:00:03.0 'Virtio network device' if=ens3 drv=virtio-pci unused= Fixes: 629395b063e8 ("igb_uio: remove PCI id table") Signed-off-by: Gary Mussar --- tools/dpdk-devbind.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/dpdk-devbind.py b/tools/dpdk-devbind.py index b69ca2a..34be495 100755 --- a/tools/dpdk-devbind.py +++ b/tools/dpdk-devbind.py @@ -221,11 +221,12 @@ def get_pci_device_details(dev_id): 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, _ 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"] = "" -- 2.1.1