From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f173.google.com (mail-pd0-f173.google.com [209.85.192.173]) by dpdk.org (Postfix) with ESMTP id E1E7A804A for ; Wed, 29 Oct 2014 09:41:55 +0100 (CET) Received: by mail-pd0-f173.google.com with SMTP id v10so2573382pde.4 for ; Wed, 29 Oct 2014 01:50:46 -0700 (PDT) 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=ftMdSFovzeP2lQIF0gq47oLOjoy10BEj+olJYFKb8ztl91a0c04Omm5IwfkgP2iWvf XR46LrqbDFYfvFOy/IEW7iX2FwmaWzui4CVD+AGZLDcdihGL4RLwtK74SlvEYSnrdQUp PXPXy4DInOVGGh8Is0HEVx+l98yq58UavcCh5Nn3rCGZQHlW37FQ4i23u/wSfFxyDLJN MgVfZ7qKc8rE1EpNlC6NGIhbckFwwLvkhnfcpH0O175ueFrNegEpNMwslY1AT0lQ9zh5 AaZ+gSlgyPA1n0LOMEAWLOLaoef3Df1BI9JkLBhRsW2rWkTO8Nx4h6xAvy12Gfqks8Am 1Azg== X-Gm-Message-State: ALoCoQkEpm0FTDqzCH+f6oRG7YTdt4DuZHS8X/RxfHO73kTGwF6Xg7YLDIS31YXGjhU8OGtN8+25 X-Received: by 10.68.57.140 with SMTP id i12mr797091pbq.115.1414572646175; Wed, 29 Oct 2014 01:50:46 -0700 (PDT) Received: from eris.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id ky4sm3686872pbc.55.2014.10.29.01.50.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Oct 2014 01:50:45 -0700 (PDT) From: Tetsuya Mukawa To: dev@dpdk.org Date: Wed, 29 Oct 2014 17:49:33 +0900 Message-Id: <1414572576-21371-23-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1414572576-21371-1-git-send-email-mukawa@igel.co.jp> References: <1414572576-21371-1-git-send-email-mukawa@igel.co.jp> Cc: nakajima.yoshihiro@lab.ntt.co.jp, masutani.hitoshi@lab.ntt.co.jp Subject: [dpdk-dev] [RFC PATCH 22/25] 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: Wed, 29 Oct 2014 08:41:58 -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