From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 2A81C5683 for ; Wed, 4 Mar 2015 03:41:58 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 03 Mar 2015 18:41:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,685,1418112000"; d="scan'208";a="686518322" Received: from kmsmsx153.gar.corp.intel.com ([172.21.73.88]) by fmsmga002.fm.intel.com with ESMTP; 03 Mar 2015 18:41:56 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.110.15) by KMSMSX153.gar.corp.intel.com (172.21.73.88) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 4 Mar 2015 10:41:52 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.62]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.161]) with mapi id 14.03.0195.001; Wed, 4 Mar 2015 10:41:50 +0800 From: "Ouyang, Changchun" To: "Richardson, Bruce" Thread-Topic: [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue Thread-Index: AQHQUYDJYC9RI/5STUiSP4J2g+zmgJ0KJXKAgAF/XOA= Date: Wed, 4 Mar 2015 02:41:50 +0000 Message-ID: References: <1424926669-14202-1-git-send-email-changchun.ouyang@intel.com> <20150303114334.GA4076@bricha3-MOBL3> In-Reply-To: <20150303114334.GA4076@bricha3-MOBL3> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci 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: Wed, 04 Mar 2015 02:41:58 -0000 Hi, > -----Original Message----- > From: Richardson, Bruce > Sent: Tuesday, March 3, 2015 7:44 PM > To: Ouyang, Changchun > Cc: dev@dpdk.org; Cao, Waterman > Subject: Re: [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue >=20 > On Thu, Feb 26, 2015 at 12:57:49PM +0800, Ouyang Changchun wrote: > First off, I think the title needs to be changed. How about something lik= e: > "dpdk_nic_bind: don't exit if an unused module is missing" >=20 > > In virtio test, on guest > > 1. Bind virtio port to igb_uio driver; 2. Remove igb_uio module; 3. > > Bind virtio port to virtio-pci driver, it fails and reports: > > "Error - no supported modules are loaded" > > > > The tool should check the to-be-bound driver flag, if it is dpdk > > driver(igb_uio, vfio etc), and the corresponding module is not loaded, > > then exit, otherwise, just report a warning, and continue to bind the n= on- > dpdk driver(like virtio-pci) to dev. >=20 > This is a good description of the problem. Once you change the title, I t= hink > an initial sentence is needed here by way of intro - such as: > "The dpdk_nic_bind script will not allow ports to be bound or unbound if > none of the kernel modules supported by DPDK is loaded. This patch relaxe= s > this restriction by checking if a DPDK module is actually requested. The > example below illustrates this problem:" >=20 Will update this description in v2. Thanks > > > > Signed-off-by: Changchun Ouyang > > --- > > tools/dpdk_nic_bind.py | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py index > > 2483056..8523f82 100755 > > --- a/tools/dpdk_nic_bind.py > > +++ b/tools/dpdk_nic_bind.py > > @@ -175,8 +175,11 @@ def check_modules(): > > > > # check if we have at least one loaded module > > if True not in [mod["Found"] for mod in mods] and b_flag is not No= ne: > > - print "Error - no supported modules are loaded" > > - sys.exit(1) > > + if b_flag in dpdk_drivers: > > + print "Error - no supported modules(DPDK driver) are loade= d" > > + sys.exit(1) > > + else: > > + print "Warning - no supported modules(DPDK driver) are loa= ded" > > > > # change DPDK driver list to only contain drivers that are loaded > > dpdk_drivers =3D [mod["Name"] for mod in mods if mod["Found"]] > > -- > > 1.8.4.2 > > > This is a worthwhile change. However, I think it could be made better: > * If we try to bind a device to ixgbe, and ixgbe is not loaded, we get no= error > from the script > * If igb_uio is loaded and we try to bind a device to vfio which is not l= oaded > again we get no error from the script. >=20 > If would be nice if instead of this checking explicitly for DPDK modules,= we > just check if the module to be bound is present and give an error if not. > =20 For all these cases, they could be detected in function bind_one, If any module exactly required can't be found/opened, it will go to except= branch and raise a error message like: Error: bind failed ..... Cannot open..... Thanks Changchun