From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 8B20368BE for ; Thu, 11 Dec 2014 04:50:52 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 10 Dec 2014 19:49:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208";a="497028210" Received: from kmsmsx153.gar.corp.intel.com ([172.21.73.88]) by orsmga003.jf.intel.com with ESMTP; 10 Dec 2014 19:47:00 -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; Thu, 11 Dec 2014 11:50:48 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.182]) with mapi id 14.03.0195.001; Thu, 11 Dec 2014 11:50:47 +0800 From: "Qiu, Michael" To: Tetsuya Mukawa , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 21/28] eal/pci: Fix pci_probe_all_drivers to share code with closing function Thread-Index: AQHQE3orbtPJrPIz2U+ViJgIGrNZbg== Date: Thu, 11 Dec 2014 03:50:46 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286C9EC39@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-22-git-send-email-mukawa@igel.co.jp> 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" , "masutani.hitoshi@lab.ntt.co.jp" , "menrigh@brocade.com" Subject: Re: [dpdk-dev] [PATCH v3 21/28] eal/pci: Fix pci_probe_all_drivers to share code with closing function 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 03:50:53 -0000 On 12/9/2014 2:34 PM, Tetsuya Mukawa wrote:=0A= > pci_close_all_drivers() will be implemented after the patch.=0A= > To share a part of code between thses 2 functions, The patch fixes=0A= > pci_probe_all_drivers() first.=0A= >=0A= > Signed-off-by: Tetsuya Mukawa =0A= > ---=0A= > lib/librte_eal/common/eal_common_pci.c | 28 ++++++++++++++++++++--------= =0A= > 1 file changed, 20 insertions(+), 8 deletions(-)=0A= >=0A= > diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/comm= on/eal_common_pci.c=0A= > index f01f258..1e3efea 100644=0A= > --- a/lib/librte_eal/common/eal_common_pci.c=0A= > +++ b/lib/librte_eal/common/eal_common_pci.c=0A= > @@ -99,19 +99,20 @@ static struct rte_devargs *pci_devargs_lookup(struct = rte_pci_device *dev)=0A= > return NULL;=0A= > }=0A= > =0A= > -/*=0A= > - * If vendor/device ID match, call the devinit() function of all=0A= > - * registered driver for the given device. Return -1 if initialization= =0A= > - * failed, return 1 if no driver is found for this device.=0A= > - */=0A= > +#define INVOKE_PROBE (0)=0A= =0A= I see lots of places defined this macros( so does INVOKE_CLOSE ), does=0A= any issue with it?=0A= I'm not sure if you need=0A= #ifndef XXX=0A= #define XXX=0A= #endif=0A= =0A= Please make sure of this.=0A= =0A= Thanks,=0A= Michael=0A= > +=0A= > static int=0A= > -pci_probe_all_drivers(struct rte_pci_device *dev)=0A= > +pci_invoke_all_drivers(struct rte_pci_device *dev, int type)=0A= > {=0A= > struct rte_pci_driver *dr =3D NULL;=0A= > - int rc;=0A= > + int rc =3D 0;=0A= > =0A= > TAILQ_FOREACH(dr, &pci_driver_list, next) {=0A= > - rc =3D rte_eal_pci_probe_one_driver(dr, dev);=0A= > + switch (type) {=0A= > + case INVOKE_PROBE:=0A= > + rc =3D rte_eal_pci_probe_one_driver(dr, dev);=0A= > + break;=0A= > + }=0A= > if (rc < 0)=0A= > /* negative value is an error */=0A= > return -1;=0A= > @@ -124,6 +125,17 @@ pci_probe_all_drivers(struct rte_pci_device *dev)=0A= > }=0A= > =0A= > /*=0A= > + * If vendor/device ID match, call the devinit() function of all=0A= > + * registered driver for the given device. Return -1 if initialization= =0A= > + * failed, return 1 if no driver is found for this device.=0A= > + */=0A= > +static int=0A= > +pci_probe_all_drivers(struct rte_pci_device *dev)=0A= > +{=0A= > + return pci_invoke_all_drivers(dev, INVOKE_PROBE);=0A= > +}=0A= > +=0A= > +/*=0A= > * Scan the content of the PCI bus, and call the devinit() function for= =0A= > * all registered drivers that have a matching entry in its id_table=0A= > * for discovered devices.=0A= =0A=