Message ID | C281A17C31CFD745B242416D0E96EC63AB81F535@ONWVEXCHMB04.ciena.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 775912BD5; Mon, 29 Aug 2016 17:09:38 +0200 (CEST) Received: from mx0a-00103a01.pphosted.com (mx0a-00103a01.pphosted.com [67.231.144.234]) by dpdk.org (Postfix) with ESMTP id 1F7CDFFA for <dev@dpdk.org>; Mon, 29 Aug 2016 17:09:36 +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 u7TF3QfF012820; Mon, 29 Aug 2016 11:09:35 -0400 Received: from vawvcgsie2k1301.ciena.com (lin1-118-36-35.ciena.com [63.118.36.35]) by mx0a-00103a01.pphosted.com with ESMTP id 254mq32j4f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 29 Aug 2016 11:09:35 -0400 Received: from ONWVEXCHHT01.ciena.com (10.128.6.16) by VAWVCGSIE2K1301.ciena.com (10.4.62.15) with Microsoft SMTP Server (TLS) id 15.0.1104.5; Mon, 29 Aug 2016 11:09:33 -0400 Received: from ONWVEXCHMB04.ciena.com ([::1]) by ONWVEXCHHT01.ciena.com ([::1]) with mapi; Mon, 29 Aug 2016 11:09:32 -0400 From: "Mussar, Gary" <gmussar@ciena.com> To: "Dey, Souvik" <sodey@sonusnet.com>, Stephen Hemminger <stephen@networkplumber.org> CC: "nhorman@tuxdriver.com" <nhorman@tuxdriver.com>, "dev@dpdk.org" <dev@dpdk.org> Date: Mon, 29 Aug 2016 11:09:31 -0400 Thread-Topic: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue. Thread-Index: AQHR/ngJrYBSlPHhJUWN6RhK2Yt0WKBbZ3YAgACM9VCABBxAUA== Message-ID: <C281A17C31CFD745B242416D0E96EC63AB81F535@ONWVEXCHMB04.ciena.com> References: <20160825022546.96468-1-sodey@sonusnet.com> <20160826085500.5691e07d@xeon-e3> <BN6PR03MB2740E7E9FFD9EC7D093A3442DAEF0@BN6PR03MB2740.namprd03.prod.outlook.com> In-Reply-To: <BN6PR03MB2740E7E9FFD9EC7D093A3442DAEF0@BN6PR03MB2740.namprd03.prod.outlook.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US x-tm-as-product-ver: SMEX-10.0.0.1412-7.000.1014-22542.007 x-tm-as-result: No--37.870800-8.000000-31 x-tm-as-user-approved-sender: No x-tm-as-user-blocked-sender: No Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-29_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 impostorscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608290150 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 <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Mussar, Gary
Aug. 29, 2016, 3:09 p.m. UTC
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. ------------------------------------------- ------------------------------------------- Gary -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Dey, Souvik Sent: Friday, August 26, 2016 8:21 PM To: Stephen Hemminger Cc: nhorman@tuxdriver.com; dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue. Hi , I have already updated it and have re submitted the patch v3. Can you please check that http://dpdk.org/dev/patchwork/patch/15378/ -- Regards, Souvik -----Original Message----- From: Stephen Hemminger [mailto:stephen@networkplumber.org] Sent: Friday, August 26, 2016 11:55 AM To: Dey, Souvik <sodey@sonusnet.com> Cc: nhorman@tuxdriver.com; dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue. On Wed, 24 Aug 2016 22:25:46 -0400 souvikdey33 <sodey@sonusnet.com> wrote: > + #The path for virtio devices are different. Get the correct path. > + virtio = "/sys/bus/pci/devices/%s/" % dev_id > + cmd = " ls %s | grep 'virt' " %virtio > + virtio = commands.getoutput(cmd) > + virtio_sys_path = "/sys/bus/pci/devices/%s/%s/net/" % > +(dev_id,virtio) > if exists(sys_path): > device["Interface"] = ",".join(os.listdir(sys_path)) There should be a way to do this in python without going out to shell. This would be safer and more secure. The code already uses os.listdir() (which is the python library version of ls) in later section. Why not use that here to check for virtio bus.
Comments
> -----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 <sodey@sonusnet.com>; Stephen Hemminger > <stephen@networkplumber.org> > 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: > + 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
Yes this patch definitely solves my issue too. -----Original Message----- From: Mcnamara, John [mailto:john.mcnamara@intel.com] Sent: Thursday, September 1, 2016 7:00 AM To: Mussar, Gary <gmussar@ciena.com>; Dey, Souvik <sodey@sonusnet.com>; Stephen Hemminger <stephen@networkplumber.org> Cc: nhorman@tuxdriver.com; dev@dpdk.org Subject: RE: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue. > -----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 <sodey@sonusnet.com>; Stephen Hemminger > <stephen@networkplumber.org> > 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: > + 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
I will get a proper patch sent hopefully today. Gary -----Original Message----- From: Mcnamara, John [mailto:john.mcnamara@intel.com] Sent: Thursday, September 01, 2016 7:00 AM To: Mussar, Gary; Dey, Souvik; Stephen Hemminger Cc: nhorman@tuxdriver.com; dev@dpdk.org Subject: RE: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue. > -----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 <sodey@sonusnet.com>; Stephen Hemminger > <stephen@networkplumber.org> > 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: > + 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
--- 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"] = ""