From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f174.google.com (mail-wr0-f174.google.com [209.85.128.174]) by dpdk.org (Postfix) with ESMTP id 13F632C71 for ; Wed, 8 Mar 2017 16:16:07 +0100 (CET) Received: by mail-wr0-f174.google.com with SMTP id g10so25537407wrg.2 for ; Wed, 08 Mar 2017 07:16:07 -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:in-reply-to :references; bh=3bRuUnykoAWxM2CzgfJ2YSmWlgtJPJkw4Xu58oOQOjo=; b=ZI8qAJW7I7LU2sPC527s0dlnoOlDqDUOhn5tWJx9+iTY5pHLNBueWhFyQalH6a7X1L MQoZf/J2tySCCVnDQbpjaiUFsRy/PEck/6X3pjRf0aDnlzYkCczk3tdtOomotJab9TZa VaUVTfRsOvw+p7Qtyo7cS3HyZ8yH64B4jr0XKuxuHComR3ABgw+KqM/zTw3Nl0s0HNWK HtBMhuWHxnkJ5nk/YmgE1+tWdoMxD0rUB/LYWUWwh28yfxYBkAzRcLw33ljWal6e6dA7 /qr45Wa3ULfvludqMxP0JSRutEVOEUk9G2YS0cPuyGgemgupt+JL4SDmqAJ1yCicAOXn u9qw== 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:in-reply-to:references; bh=3bRuUnykoAWxM2CzgfJ2YSmWlgtJPJkw4Xu58oOQOjo=; b=L3XRsKMlPFkfCG7zuZWl1vV/4RDEDFY88wzioXtTGTt3AgKblfntzZ35cTMp1+vb1e yjABttT+yttF7tbos5KNpWM2cQ5SUski8LSuzeTALR/c48y0nfNbiJaLRyQb68bO16YI FZ69Rm41NiWIBUvO9xNn9WQahzu+2glvCrbiz5VJ6Id40x4dbqOzkpxUKiz78kYre+ji gYQ6E9zNkxoVuXu1GTj0w3L0WshElF3e8JRTjU27AkpEj9NPHrky/5/BCNXznLlF3dH6 +YBZQ2JeQFLZqiQzGwpuOtrO/FsFViiwEXySnqirYWyTvx1F6oph9m6l9X6ryZ1HAsQi moSA== X-Gm-Message-State: AMke39m2J0G6yQZCthcgszZEvtu9Z6/WwAZZbpxUbkrJZcSCBRAVrhcwxAVuf+R1Fzur/Vyy X-Received: by 10.223.136.33 with SMTP id d30mr6290743wrd.117.1488986166607; Wed, 08 Mar 2017 07:16:06 -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 t103sm4553592wrc.43.2017.03.08.07.16.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Mar 2017 07:16:05 -0800 (PST) From: Gaetan Rivet To: dev@dpdk.org Date: Wed, 8 Mar 2017 16:15:37 +0100 Message-Id: <13489561ed463e8356ceac586fa782fc847e7e20.1488985489.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 04/13] pci: expose device detach routine X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Mar 2017 15:16:07 -0000 Make the pci_detach_all_drivers public. No further changes. Signed-off-by: Gaetan Rivet --- 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