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

Mcnamara, John john.mcnamara at intel.com
Thu Sep 1 12:59:50 CEST 2016


> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Mussar, Gary
> Sent: Monday, August 29, 2016 4:10 PM
> To: Dey, Souvik <sodey at sonusnet.com>; Stephen Hemminger
> <stephen at networkplumber.org>
> Cc: nhorman at tuxdriver.com; dev at 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:

> +    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





More information about the dev mailing list