From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 79D8768BE for ; Thu, 11 Dec 2014 16:45:23 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 11 Dec 2014 07:43:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208";a="497289672" Received: from pgsmsx107.gar.corp.intel.com ([10.221.44.105]) by orsmga003.jf.intel.com with ESMTP; 11 Dec 2014 07:41:27 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by PGSMSX107.gar.corp.intel.com (10.221.44.105) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 11 Dec 2014 23:45:16 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.67]) with mapi id 14.03.0195.001; Thu, 11 Dec 2014 23:45:16 +0800 From: "Qiu, Michael" To: "Richardson, Bruce" Thread-Topic: [dpdk-dev] [PATCH v3 20/28] eal/pci: Add rte_eal_pci_close_one_driver Thread-Index: AQHQE3oTWCnEJLC/aE+T0P5g9WM5kw== Date: Thu, 11 Dec 2014 15:45:14 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286C9EED1@SHSMSX101.ccr.corp.intel.com> References: <1416474399-16851-1-git-send-email-mukawa@igel.co.jp> <1418106629-22227-1-git-send-email-mukawa@igel.co.jp> <1418106629-22227-21-git-send-email-mukawa@igel.co.jp> <533710CFB86FA344BFBF2D6802E60286C9EC20@SHSMSX101.ccr.corp.intel.com> <20141211095550.GA5668@bricha3-MOBL3> Accept-Language: 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: "nakajima.yoshihiro@lab.ntt.co.jp" , "menrigh@brocade.com" , "dev@dpdk.org" , "masutani.hitoshi@lab.ntt.co.jp" Subject: Re: [dpdk-dev] [PATCH v3 20/28] eal/pci: Add rte_eal_pci_close_one_driver 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, 11 Dec 2014 15:45:24 -0000 On 2014/12/11 17:56, Richardson, Bruce wrote:=0A= > On Thu, Dec 11, 2014 at 03:41:06AM +0000, Qiu, Michael wrote:=0A= >> On 12/9/2014 2:33 PM, Tetsuya Mukawa wrote:=0A= >>> The function is used for closing the specified driver and device.=0A= >>>=0A= >>> Signed-off-by: Tetsuya Mukawa =0A= >>> ---=0A= >>> lib/librte_eal/common/eal_private.h | 15 +++++++++=0A= >>> lib/librte_eal/linuxapp/eal/eal_pci.c | 61 +++++++++++++++++++++++++++= ++++++++=0A= >>> 2 files changed, 76 insertions(+)=0A= >>>=0A= >>> diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/commo= n/eal_private.h=0A= >>> index a1127ab..f892ac4 100644=0A= >>> --- a/lib/librte_eal/common/eal_private.h=0A= >>> +++ b/lib/librte_eal/common/eal_private.h=0A= >>> @@ -176,6 +176,21 @@ int rte_eal_pci_probe_one_driver(struct rte_pci_dr= iver *dr,=0A= >>> struct rte_pci_device *dev);=0A= >>> =0A= >>> /**=0A= >>> + * Munmap memory for single PCI device=0A= >>> + *=0A= >>> + * This function is private to EAL.=0A= >>> + *=0A= >>> + * @param dr=0A= >>> + * The pointer to the pci driver structure=0A= >>> + * @param dev=0A= >>> + * The pointer to the pci device structure=0A= >>> + * @return=0A= >>> + * 0 on success, negative on error=0A= >>> + */=0A= >>> +int rte_eal_pci_close_one_driver(struct rte_pci_driver *dr,=0A= >>> + struct rte_pci_device *dev);=0A= >>> +=0A= >>> +/**=0A= >>> * Init tail queues for non-EAL library structures. This is to allow= =0A= >>> * the rings, mempools, etc. lists to be shared among multiple process= es=0A= >>> *=0A= >>> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/lin= uxapp/eal/eal_pci.c=0A= >>> index 8d683f5..93456f3 100644=0A= >>> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c=0A= >>> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c=0A= >>> @@ -616,6 +616,67 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver= *dr, struct rte_pci_device *d=0A= >>> return 1;=0A= >>> }=0A= >>> =0A= >>> +#if defined(RTE_LIBRTE_EAL_HOTPLUG) && defined(RTE_LIBRTE_EAL_LINUXAPP= )=0A= >>> +/*=0A= >>> + * If vendor/device ID match, call the devshutdown() function of the= =0A= >>> + * driver.=0A= >>> + */=0A= >>> +int=0A= >>> +rte_eal_pci_close_one_driver(struct rte_pci_driver *dr,=0A= >>> + struct rte_pci_device *dev)=0A= >>> +{=0A= >>> + struct rte_pci_id *id_table;=0A= >>> +=0A= >>> + if ((dr =3D=3D NULL) || (dev =3D=3D NULL))=0A= >>> + return -EINVAL;=0A= >>> +=0A= >>> + for (id_table =3D dr->id_table ; id_table->vendor_id !=3D 0; id_table= ++) {=0A= >>> +=0A= >>> + /* check if device's identifiers match the driver's ones */=0A= >>> + if (id_table->vendor_id !=3D dev->id.vendor_id &&=0A= >>> + id_table->vendor_id !=3D PCI_ANY_ID)=0A= >> Here and below, it is better to make indentation like this:=0A= >>=0A= >> + if (id_table->vendor_id !=3D dev->id.vendor_id &&=0A= >> + id_table->vendor_id !=3D PCI_ANY_ID)=0A= >>=0A= >> But I don't know if there are any strict rule of dpdk community :)=0A= >>=0A= > I don't think we have any strict rules - I'm sure Thomas can confirm. How= ever,=0A= > I prefer the original suggested version, as for the second version you pr= opose=0A= > the second half of the if will appear indended as part of the if body for= those=0A= > people who use a 4-character tab-stop in their editor. By indenting the s= econd=0A= > line with two tabs, or tab + some space, you can guarantee that the rest = of the=0A= > if statement never lines up with the if body, making the separation betwe= en=0A= > statement and body clearer.=0A= =0A= My suggestion is just my habit, as I ever worked on kernel and qemu.=0A= =0A= It is not a big deal. But I think we guys should be better to reach an=0A= agreement on this, then all dpdk code should keep the style. Otherwise=0A= the code is mixed style which is very ugly.=0A= =0A= Do you agree me?=0A= =0A= Thanks,=0A= Michael=0A= > Just my 2c.=0A= >=0A= > /Bruce=0A= >=0A= =0A=