From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by dpdk.org (Postfix) with ESMTP id 35E4F6A95 for ; Thu, 11 Dec 2014 05:59:56 +0100 (CET) Received: by mail-pa0-f53.google.com with SMTP id kq14so4273710pab.12 for ; Wed, 10 Dec 2014 20:59:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=JZ838CHgDnhAcP4+31upIdxVed+qtlJrsmKz+vVZWTA=; b=O9JcdeKAi6xhrOhLzK9OyFPuKnZMv233Zh+MdoPkMVv6CJ6mzz3hvp0Suc7GJFbhpS wA7nkn8pEJT/W36RCNxzCnr5harLzsGmpnW6ri7hhsexlCrWnGVbB1oPLthcAzZn+nQ/ qVmLHJChPm4yRpEUnsK77PyoQ+lWFcfGIJ4z+pHPhpszjrTgcCnFQ1ZoVRWXyJXSiN1e GZjuaYz6/3i2iKDYqXEkXb5mNuOqJwiDP/zgQdHMh31H45II0aTHDHF3/stiALvTTXjv hhSg7/jXRAwrO2S40LGDXrE2yq+cBEFNDyTePLghl5qHUus/72GQkAK1y11RsyeMlcTG qCVA== X-Gm-Message-State: ALoCoQkmdvZ4dhBlqHvxVrccMqLJxV943/tt7nNxt1qPf+44eXFJrfFW6N2T5A6gRRBrimoGFosX X-Received: by 10.70.140.229 with SMTP id rj5mr13663551pdb.60.1418273995537; Wed, 10 Dec 2014 20:59:55 -0800 (PST) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id qf1sm51867pdb.49.2014.12.10.20.59.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Dec 2014 20:59:55 -0800 (PST) Message-ID: <548924C8.5010200@igel.co.jp> Date: Thu, 11 Dec 2014 13:59:52 +0900 From: Tetsuya Mukawa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: "Qiu, Michael" , "dev@dpdk.org" 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> <533710CFB86FA344BFBF2D6802E60286C9EC61@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <533710CFB86FA344BFBF2D6802E60286C9EC61@SHSMSX101.ccr.corp.intel.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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:59:56 -0000 (2014/12/11 13:46), Qiu, Michael wrote: > On 12/11/2014 11:52 AM, Qiu, Michael wrote: >> On 12/9/2014 2:34 PM, Tetsuya Mukawa wrote: >>> pci_close_all_drivers() will be implemented after the patch. >>> To share a part of code between thses 2 functions, The patch fixes >>> pci_probe_all_drivers() first. >>> >>> Signed-off-by: Tetsuya Mukawa >>> --- >>> lib/librte_eal/common/eal_common_pci.c | 28 ++++++++++++++++++++-------- >>> 1 file changed, 20 insertions(+), 8 deletions(-) >>> >>> diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c >>> index f01f258..1e3efea 100644 >>> --- a/lib/librte_eal/common/eal_common_pci.c >>> +++ b/lib/librte_eal/common/eal_common_pci.c >>> @@ -99,19 +99,20 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev) >>> return NULL; >>> } >>> >>> -/* >>> - * If vendor/device ID match, call the devinit() function of all >>> - * registered driver for the given device. Return -1 if initialization >>> - * failed, return 1 if no driver is found for this device. >>> - */ >>> +#define INVOKE_PROBE (0) >> I see lots of places defined this macros( so does INVOKE_CLOSE ), does >> any issue with it? >> I'm not sure if you need >> #ifndef XXX >> #define XXX >> #endif >> >> Please make sure of this. > Another choice is move them to one file like eal_private.h to avoid > defined in so many places. Thanks. I will do like above. Tetsuya > Thanks, > Michael >> Thanks, >> Michael >>> + >>> static int >>> -pci_probe_all_drivers(struct rte_pci_device *dev) >>> +pci_invoke_all_drivers(struct rte_pci_device *dev, int type) >>> { >>> struct rte_pci_driver *dr = NULL; >>> - int rc; >>> + int rc = 0; >>> >>> TAILQ_FOREACH(dr, &pci_driver_list, next) { >>> - rc = rte_eal_pci_probe_one_driver(dr, dev); >>> + switch (type) { >>> + case INVOKE_PROBE: >>> + rc = rte_eal_pci_probe_one_driver(dr, dev); >>> + break; >>> + } >>> if (rc < 0) >>> /* negative value is an error */ >>> return -1; >>> @@ -124,6 +125,17 @@ pci_probe_all_drivers(struct rte_pci_device *dev) >>> } >>> >>> /* >>> + * If vendor/device ID match, call the devinit() function of all >>> + * registered driver for the given device. Return -1 if initialization >>> + * failed, return 1 if no driver is found for this device. >>> + */ >>> +static int >>> +pci_probe_all_drivers(struct rte_pci_device *dev) >>> +{ >>> + return pci_invoke_all_drivers(dev, INVOKE_PROBE); >>> +} >>> + >>> +/* >>> * Scan the content of the PCI bus, and call the devinit() function for >>> * all registered drivers that have a matching entry in its id_table >>> * for discovered devices.