From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 316342BCD for ; Thu, 1 Sep 2016 12:59:54 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP; 01 Sep 2016 03:59:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,267,1470726000"; d="scan'208";a="3874461" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga004.jf.intel.com with ESMTP; 01 Sep 2016 03:59:51 -0700 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.204]) by IRSMSX102.ger.corp.intel.com ([169.254.2.123]) with mapi id 14.03.0248.002; Thu, 1 Sep 2016 11:59:51 +0100 From: "Mcnamara, John" To: "Mussar, Gary" , "Dey, Souvik" , Stephen Hemminger CC: "nhorman@tuxdriver.com" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue. Thread-Index: AQHR/ngeGndZGSeU0k6WZg29Av3v16BbVrIAgACNPoCABB0MgIAEgKqA Date: Thu, 1 Sep 2016 10:59:50 +0000 Message-ID: References: <20160825022546.96468-1-sodey@sonusnet.com> <20160826085500.5691e07d@xeon-e3> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjIxYzBkZTEtYzFhZS00MjM5LTgwMjgtOWVhNGZkOWNhMzU4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkVCSlpoMHZZTEh1cUdUNGhFdVR2NzFrcjAwbnJQTUo0RWJRRXBibkFPa1U9In0= x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Thu, 01 Sep 2016 10:59:54 -0000 > -----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 ; Stephen Hemminger > > Cc: nhorman@tuxdriver.com; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface > issue. >=20 > 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 devic= e > directory. >=20 > ------------------------------------------- > --- 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 =3D name.strip(":") + "_str" > device[name] =3D value > # check for a unix interface name > - sys_path =3D "/sys/bus/pci/devices/%s/net/" % dev_id > - if exists(sys_path): > - device["Interface"] =3D ",".join(os.listdir(sys_path)) > - else: > - device["Interface"] =3D "" > + device["Interface"] =3D "" > + for base, dirs, files in os.walk("/sys/bus/pci/devices/%s/" % > dev_id): > + if "net" in dirs: > + device["Interface"] =3D > ",".join(os.listdir(os.path.join(base,"net"))) > + break > # check if a port is used for ssh connection > device["Ssh_if"] =3D False > device["Active"] =3D "" > ------------------------------------------- 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"] =3D "" > + for base, dirs, files in os.walk("/sys/bus/pci/devices/%s/" % dev_id= ): > + =20 If "files" is unused, and it looks like it is, then replace it with "_". > + device["Interface"] =3D ",".join(os.listdir(os.path.join(bas= e,"net"))) There is a space required after "," for PEP8 compliance. John