From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f179.google.com (mail-pf0-f179.google.com [209.85.192.179]) by dpdk.org (Postfix) with ESMTP id 625272BD4 for ; Tue, 30 Aug 2016 01:33:20 +0200 (CEST) Received: by mail-pf0-f179.google.com with SMTP id p64so978703pfb.1 for ; Mon, 29 Aug 2016 16:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1pN5V60CSldncaPJpPY73z2BQGib+wC3bWFoLHgk4sk=; b=Cn0e1XOUZbc3uKp9+uoxM3sookl+YjpTdOe+JNtJhICDU0oT8aLDmKouxChrMV+rCC 1zLniQ42P+wMKGND6lXY39IzrQbyDhV4M93ic6pTeGnuHXWN5r+4lznsVB4otxAaVZRQ 5FB+bPAa7LY8XPUUeSlu9PwDQox0uTjQpwKpT/GnARelctcEfxOgMQ4cgEBvxXYph5ZG 0Hxo6NK+bc70PbMOOCaLruvgAPQ14jgiAzHaSIk+geto+IvDTsHi6GvLdEndQ7R2zYYV JLkdW2QYMhBw/qyXGyth0MNzYVR13W8uKmm7EqKSO7i/HOHCoPGT7ct2GvuZynQOny0h meDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1pN5V60CSldncaPJpPY73z2BQGib+wC3bWFoLHgk4sk=; b=Wlzw3PcG2nse3VgtfzGfijPCsJ12yPKMCimzBBQ2XsqemtFibihiZDyiLSw6kFxSTR MYWb4k/OgvNyifjl5o6OBeHEtfg/S4UR7HiAD7V9D/cNCPhzbWiUSlwKUJI73aCrcKTq 5bnPIjV7BIyhdpW+uwRGuyR8yERZcll1WpNWjY+WlYO6tTeGWwYqmJyBWTm00Ta7bcRr FBSIyWqjHISD1vHR9aTHK351wn5S3VfRiC5nadvwKNYsoBdXdtjHsX5oi3fLaY2s4lF1 7ToB3JBka/ct5wWjfcYdJSItoPEJU7BiwMBHulrKsNIWBwvJYBymz1tqzFRIjW0jWBtt lJMw== X-Gm-Message-State: AE9vXwNk5MO6mwXMOK/GCyV0YHztxplGZ3rGgHhtmQqSLjvs2qATXCeNqPIZBszNcUF+YQ== X-Received: by 10.98.14.72 with SMTP id w69mr950185pfi.119.1472513599697; Mon, 29 Aug 2016 16:33:19 -0700 (PDT) Received: from xeon-e3 (static-50-53-69-251.bvtn.or.frontiernet.net. [50.53.69.251]) by smtp.gmail.com with ESMTPSA id p187sm51720097pfb.5.2016.08.29.16.33.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Aug 2016 16:33:19 -0700 (PDT) Date: Mon, 29 Aug 2016 16:33:30 -0700 From: Stephen Hemminger To: "Dey, Souvik" Cc: "Mussar, Gary" , "nhorman@tuxdriver.com" , "dev@dpdk.org" Message-ID: <20160829163330.2ae0f946@xeon-e3> In-Reply-To: References: <20160825022546.96468-1-sodey@sonusnet.com> <20160826085500.5691e07d@xeon-e3> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2016 23:33:20 -0000 On Mon, 29 Aug 2016 23:16:35 +0000 "Dey, Souvik" 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.