From patchwork Tue Nov 4 03:45:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuya Mukawa X-Patchwork-Id: 1108 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 7E5067FD1; Tue, 4 Nov 2014 04:37:45 +0100 (CET) Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by dpdk.org (Postfix) with ESMTP id 2EDA87FD1 for ; Tue, 4 Nov 2014 04:37:43 +0100 (CET) Received: by mail-pd0-f177.google.com with SMTP id v10so12766508pde.36 for ; Mon, 03 Nov 2014 19:46:59 -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=EH1lDDZpH+yq8VVT4ZZsps+tY9HNSAwL7Jt3NuRYwF2lQ/TL9/gVjJiFlMm1L2zptZ jx2QcpYQz4iUfjnzDuzQIc6/C8+KvVb92LjDJn5N/dv1hnsYHufm0mb3MCKrgkwYSsfO 7fDrERJvKV8IhIQYF3hW6WTZOah1iKAhms1CovozNUtPAE3/uyE33A6wwy6I9hrg5Y3r qnkT7S5T8kdR+CCM2P1AnMSdzzbrK5kL/CoauUaF/ziyAkbarN+FQum6XRxgRXhfKcOU JL1sjbT+L7qoyNRMBfShYj/9uMWm2HXU7lntJxbdnFpI+9tOfc4XpmwwSPWs20Ut/p4K NaOw== X-Gm-Message-State: ALoCoQkiyOfwA47eYv6bT1sZhz8/k0j5pSOY1kYO2s1nQoTKAlM7mUhwowPvr5PiKRf+8tZSMY10 X-Received: by 10.67.30.34 with SMTP id kb2mr46386071pad.97.1415072819407; Mon, 03 Nov 2014 19:46:59 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id jc3sm18430580pbb.49.2014.11.03.19.46.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Nov 2014 19:46:58 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Tue, 4 Nov 2014 12:45:42 +0900 Message-Id: <1415072748-31937-23-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415072748-31937-1-git-send-email-mukawa@igel.co.jp> References: <1414572576-21371-1-git-send-email-mukawa@igel.co.jp> <1415072748-31937-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 v2 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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