From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id DBB3A6A87 for ; Thu, 11 Dec 2014 05:50:56 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 10 Dec 2014 20:50:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,555,1413270000"; d="scan'208";a="645856927" Received: from pgsmsx106.gar.corp.intel.com ([10.221.44.98]) by fmsmga002.fm.intel.com with ESMTP; 10 Dec 2014 20:50:45 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by pgsmsx106.gar.corp.intel.com (10.221.44.98) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 11 Dec 2014 12:46:23 +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 12:46:23 +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 04:46:21 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286C9EC61@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> <533710CFB86FA344BFBF2D6802E60286C9EC39@SHSMSX101.ccr.corp.intel.com> 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 04:50:57 -0000 On 12/11/2014 11:52 AM, Qiu, Michael wrote:=0A= > 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/com= mon/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= > 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= Another choice is move them to one file like eal_private.h to avoid=0A= defined in so many places.=0A= =0A= Thanks,=0A= Michael=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= =0A=