From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by dpdk.org (Postfix) with ESMTP id E7C3780DA for ; Tue, 9 Dec 2014 07:31:41 +0100 (CET) Received: by mail-pa0-f42.google.com with SMTP id et14so6777706pad.15 for ; Mon, 08 Dec 2014 22:31:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hA6bSmbxm9B08auQh8GTFs3c150rFa8zSrBqtMhW9gs=; b=e17QC+rKEV1y1CdxjJJfJKoqjnNJyUpul1pHT3dA2GewIDMBnSL9jqV+T+g/C2U709 C+HniG3KA+WG2Npdi8p/Z/NnUbtmyrEz8nXSEaLXYMUSjfROUrseFnMx0FhaDssm/qk3 moXKFzKzwhprvVgMTsv6SFkYXtS4DqPDMAXdaXGL2efZAhgRUN7qJNSll/Et5N6tAnZw jci8fbCor5XXTOz38IY71M/cbhK+gjU6HDb3xXDVjcpM+1vFK70Mgt0hOOJd8roTrMzB q0et/BWwmq/w0NkYf59hPTWlJBU8iGJ/jUy6/hBWmdU+jRF2r1x03YzwTovaOkvDHrHy 7Ssg== X-Gm-Message-State: ALoCoQkIoCmcPeAF2K1TJGQK3VNhkLkU3MAle/vqIXXQV+S+eVuvS/1ldYLcy3g1aC99LlF3jC43 X-Received: by 10.68.203.226 with SMTP id kt2mr2121519pbc.141.1418106701317; Mon, 08 Dec 2014 22:31:41 -0800 (PST) Received: from eris.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id f12sm403088pat.43.2014.12.08.22.31.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Dec 2014 22:31:40 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Tue, 9 Dec 2014 15:30:23 +0900 Message-Id: <1418106629-22227-23-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1418106629-22227-1-git-send-email-mukawa@igel.co.jp> References: <1416474399-16851-1-git-send-email-mukawa@igel.co.jp> <1418106629-22227-1-git-send-email-mukawa@igel.co.jp> Cc: nakajima.yoshihiro@lab.ntt.co.jp, menrigh@brocade.com, masutani.hitoshi@lab.ntt.co.jp Subject: [dpdk-dev] [PATCH v3 22/28] eal/pci: Add pci_close_all_drivers 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: Tue, 09 Dec 2014 06:31:42 -0000 The function tries to find a driver for the specified device, and then close the driver. Signed-off-by: Tetsuya Mukawa --- lib/librte_eal/common/eal_common_pci.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 1e3efea..b404ee0 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -100,6 +100,7 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev) } #define INVOKE_PROBE (0) +#define INVOKE_CLOSE (1) static int pci_invoke_all_drivers(struct rte_pci_device *dev, int type) @@ -112,6 +113,11 @@ pci_invoke_all_drivers(struct rte_pci_device *dev, int type) case INVOKE_PROBE: rc = rte_eal_pci_probe_one_driver(dr, dev); break; +#if defined(RTE_LIBRTE_EAL_HOTPLUG) && defined(RTE_LIBRTE_EAL_LINUXAPP) + case INVOKE_CLOSE: + rc = rte_eal_pci_close_one_driver(dr, dev); + break; +#endif } if (rc < 0) /* negative value is an error */ @@ -135,6 +141,19 @@ pci_probe_all_drivers(struct rte_pci_device *dev) return pci_invoke_all_drivers(dev, INVOKE_PROBE); } +#if defined(RTE_LIBRTE_EAL_HOTPLUG) && defined(RTE_LIBRTE_EAL_LINUXAPP) +/* + * If vendor/device ID match, call the devclose() 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_close_all_drivers(struct rte_pci_device *dev) +{ + return pci_invoke_all_drivers(dev, INVOKE_CLOSE); +} +#endif /* RTE_LIBRTE_EAL_HOTPLUG & RTE_LIBRTE_EAL_LINUXAPP */ + /* * 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 -- 1.9.1