From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gaetan.rivet@6wind.com>
Received: from mail-wr0-f170.google.com (mail-wr0-f170.google.com
 [209.85.128.170]) by dpdk.org (Postfix) with ESMTP id BF7F6F963
 for <dev@dpdk.org>; Fri,  3 Mar 2017 16:40:48 +0100 (CET)
Received: by mail-wr0-f170.google.com with SMTP id l37so76296689wrc.1
 for <dev@dpdk.org>; Fri, 03 Mar 2017 07:40:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=from:to:subject:date:message-id:in-reply-to:references;
 bh=3bRuUnykoAWxM2CzgfJ2YSmWlgtJPJkw4Xu58oOQOjo=;
 b=v+7GqJ/sjWgSvyciiIEWKNr+k8LfpP4RrgxUXNhshYV1O0VDKbYS6YULNl64wi2pZ4
 NkCRxyPhoaHhwdZvgUoz5Ltk92FkALtrZI29Zh3olMWTN0rCXngRBejr32H7TIcrjbAW
 C6tZc5OG8iDAR2icY2zWwTH24JRMyQwFgOMJmIHuNBWu+v9mcrpQ+F+MzYV7F++n7m0w
 e691vZ38w6i1lxOjjLcYkIVuGQWB8XyXdMrVHW86aXbRPCxO6SKueeR9bmPWEi9AYQyU
 BQV7iU7ja03CXRl2iKC3lw5c1Ys3ZRQu0Kfs6QJvJgPhi4o70IX+zdhI5XIoIrpOUO3a
 1iRg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references;
 bh=3bRuUnykoAWxM2CzgfJ2YSmWlgtJPJkw4Xu58oOQOjo=;
 b=bUL13OcwoAm3XKf125oclPXxXhdS55uj0ePLmQFxfnbafN2edA+0+8WlyO3hfHtrlC
 GrBGsxg7EzPW0NMrb/q17X6zUXL7rRu2B+uLw8gwhBmX8btY7+a2BbhsLD5Hv4unGmB7
 2a5/OAdITofR1T10IOZDbTNHu516eGAEGxpyZnypLBThUEDyAH57GBhvnDG488DBItpg
 7nQUA5V9UyTxAu6t9MXyey9qGKyMYnkMxOwsiocTef/+30zc+hfomh+w69fiInO17FKl
 oZiJd8vWZ9iLUZFZZ8xmKQ9Qo6CgCpPRNf9ee1fOkCCCv+7kUwcoBCR/UXo3V87YdnvU
 SmCw==
X-Gm-Message-State: AMke39kTtPFtoFKha7sXIK+erkY2HbWjZWKO5eBrLOxNEolKoe/IQ6j8ldsZDIX+hg+upsFe
X-Received: by 10.223.135.153 with SMTP id b25mr3261498wrb.169.1488555648321; 
 Fri, 03 Mar 2017 07:40:48 -0800 (PST)
Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com.
 [62.23.145.78])
 by smtp.gmail.com with ESMTPSA id 63sm3486280wmp.9.2017.03.03.07.40.47
 for <dev@dpdk.org>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
 Fri, 03 Mar 2017 07:40:47 -0800 (PST)
From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Date: Fri,  3 Mar 2017 16:40:26 +0100
Message-Id: <546829650f06dbec31f2b7138d97f07752760683.1488550982.git.gaetan.rivet@6wind.com>
X-Mailer: git-send-email 2.1.4
In-Reply-To: <cover.1488550982.git.gaetan.rivet@6wind.com>
References: <cover.1488550982.git.gaetan.rivet@6wind.com>
Subject: [dpdk-dev] [PATCH 04/12] pci: expose device detach routine
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 03 Mar 2017 15:40:48 -0000

Make the pci_detach_all_drivers public. No further changes.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  5 +++++
 lib/librte_eal/common/eal_common_pci.c          |  6 +++---
 lib/librte_eal/common/include/rte_pci.h         | 15 +++++++++++++++
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  5 +++++
 4 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 2cf1ac8..3a87756 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -185,3 +185,8 @@ DPDK_17.02 {
 	rte_bus_unregister;
 
 } DPDK_16.11;
+
+DPDK_17.05 {
+	rte_eal_pci_detach_all_drivers;
+
+} DPDK_17.02;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 72547bd..d38335a 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -313,8 +313,8 @@ pci_probe_all_drivers(struct rte_pci_device *dev)
  * registered driver for the given device. Return -1 if initialization
  * failed, return 1 if no driver is found for this device.
  */
-static int
-pci_detach_all_drivers(struct rte_pci_device *dev)
+int
+rte_eal_pci_detach_all_drivers(struct rte_pci_device *dev)
 {
 	struct rte_pci_driver *dr = NULL;
 	int rc = 0;
@@ -388,7 +388,7 @@ rte_eal_pci_detach(const struct rte_pci_addr *addr)
 		if (rte_eal_compare_pci_addr(&dev->addr, addr))
 			continue;
 
-		ret = pci_detach_all_drivers(dev);
+		ret = rte_eal_pci_detach_all_drivers(dev);
 		if (ret < 0)
 			goto err_return;
 
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 4a67883..598a1ef 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -459,6 +459,21 @@ void pci_unmap_resource(void *requested_addr, size_t size);
 int rte_eal_pci_probe_one(const struct rte_pci_addr *addr);
 
 /**
+ * Remove any PCI drivers tied to the device.
+ *
+ * If vendor/device ID match, call the remove() function of all
+ * registered driver for the given device.
+ *
+ * @param dev
+ *	The PCI device to remove
+ * @return
+ *   - 0 on success.
+ *   - Negative on error.
+ *   - Positive if no driver exists for that device.
+ */
+int rte_eal_pci_detach_all_drivers(struct rte_pci_device *dev);
+
+/**
  * Close the single PCI device.
  *
  * Scan the content of the PCI bus, and find the pci device specified by pci
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 3c68ff5..192c0d5 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -189,3 +189,8 @@ DPDK_17.02 {
 	rte_bus_unregister;
 
 } DPDK_16.11;
+
+DPDK_17.05 {
+	rte_eal_pci_detach_all_drivers;
+
+} DPDK_17.02;
-- 
2.1.4