DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Dey, Souvik" <sodey@sonusnet.com>
Cc: "Mussar, Gary" <gmussar@ciena.com>,
	"nhorman@tuxdriver.com" <nhorman@tuxdriver.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue.
Date: Mon, 29 Aug 2016 16:33:30 -0700	[thread overview]
Message-ID: <20160829163330.2ae0f946@xeon-e3> (raw)
In-Reply-To: <BN6PR03MB27402670D815D01FE58D3E38DAE10@BN6PR03MB2740.namprd03.prod.outlook.com>

On Mon, 29 Aug 2016 23:16:35 +0000
"Dey, Souvik" <sodey@sonusnet.com> wrote:

> Hi,
> 
> I already followed the 100% python way and submitted the v3 of this patch. http://dpdk.org/dev/patchwork/patch/15378/
> How will your patch be different in solving the issue. There will always be multiple ways to solving things right.
> 
> 
> V3 of my submitted patch:
> 
> diff --git a/tools/dpdk-devbind.py b/tools/dpdk-devbind.py
> index b69ca2a..c0b46ee 100755
> --- a/tools/dpdk-devbind.py
> +++ b/tools/dpdk-devbind.py
> @@ -36,6 +36,7 @@  import sys
>  import os
>  import getopt
>  import subprocess
> +
>  from os.path import exists, abspath, dirname, basename
>  
>  # The PCI base class for NETWORK devices
> @@ -222,8 +223,19 @@  def get_pci_device_details(dev_id):
>          device[name] = value
>      # check for a unix interface name
>      sys_path = "/sys/bus/pci/devices/%s/net/" % dev_id
> +    # the path for virtio devices are different, so get the correct path
> +    virtio = "/sys/bus/pci/devices/%s/" % dev_id
> +    ls = subprocess.Popen(['ls', virtio], stdout=subprocess.PIPE)
> +    grep = subprocess.Popen('grep virt'.split(), stdin=ls.stdout,
> +                            stdout=subprocess.PIPE)
> +    ls.stdout.close()
> +    virtio = grep.communicate()[0].rstrip()
> +    ls.wait()
> +    virtio_sys_path = "/sys/bus/pci/devices/%s/%s/net/" % (dev_id, virtio)
>      if exists(sys_path):
>          device["Interface"] = ",".join(os.listdir(sys_path))
> +    elif exists(virtio_sys_path):
> +        device["Interface"] = ",".join(os.listdir(virtio_sys_path))
>      else:
>          device["Interface"] = ""
>      # check if a port is used for ssh connection

When I was suggesting pure python, I meant do it without a sub shell. Popen is just
another wrapper around a sub-shell.

  reply	other threads:[~2016-08-29 23:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25  2:25 souvikdey33
2016-08-25  9:51 ` Mcnamara, John
2016-08-25 10:19   ` Thomas Monjalon
2016-08-25 10:27     ` Mcnamara, John
2016-08-26  0:37 ` Stephen Hemminger
2016-08-26  3:59 ` [dpdk-dev] [PATCH v2] tools: fix issue with virtio interfaces souvikdey33
2016-08-26  5:50 ` souvikdey33
2016-08-26 11:35 ` [dpdk-dev] [PATCH v3] " souvikdey33
2016-10-04  9:59   ` Thomas Monjalon
2016-08-26 15:55 ` [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue Stephen Hemminger
2016-08-27  0:20   ` Dey, Souvik
2016-08-29 15:09     ` Mussar, Gary
2016-08-29 23:16       ` Dey, Souvik
2016-08-29 23:33         ` Stephen Hemminger [this message]
2016-08-30 12:56         ` Neil Horman
2016-08-30 13:12         ` Mussar, Gary
2016-09-01 10:59       ` Mcnamara, John
2016-09-01 22:08         ` Dey, Souvik
2016-09-02 12:57         ` Mussar, Gary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160829163330.2ae0f946@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=gmussar@ciena.com \
    --cc=nhorman@tuxdriver.com \
    --cc=sodey@sonusnet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).