From patchwork Tue Dec 9 03:42:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuya Mukawa X-Patchwork-Id: 1848 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 E8A05805D; Tue, 9 Dec 2014 04:44:08 +0100 (CET) Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by dpdk.org (Postfix) with ESMTP id E0CEC80A3 for ; Tue, 9 Dec 2014 04:44:06 +0100 (CET) Received: by mail-pd0-f179.google.com with SMTP id fp1so6154636pdb.10 for ; Mon, 08 Dec 2014 19:44:06 -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=MwzefqfTQPxpVo7XG1cnWjyjroVZkXS/+n3Hf0c6iTo3LF+Qvgv1znPBtxJZJw9qWB FEYFEo+lMfP3vSdk2K29LxaCGt5BgiPnMKx25lD4Y0vNod6P0yOlZiosNveSuQtUoITw 4ttvBj3QaKy5GND5hpCOCt5D02vi+fw8NIj6I1EpfrUoB1TDMyXq510yY3muSMDhqu05 aPPjQFiJqE0IhDMsRwoDipcwf6C312bi3GC6g+m0ORt8bUJbF+1vuYY2Dsup21Y//8R1 bAiOwSb47+zPumCZaiSYsrwWczE5bd61efdDl+SyYwgYlYMDj3NOKRPSS76atiqL9JRT I5cw== X-Gm-Message-State: ALoCoQn1fWhBuKZjVVso/+7Etx9WdUsU0B06C9v0fZcLwpXhRWU4ZWVLkIcwd5XfvfB5NNO/uiFL X-Received: by 10.68.65.2 with SMTP id t2mr1315875pbs.39.1418096646298; Mon, 08 Dec 2014 19:44:06 -0800 (PST) Received: from eris.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id xx2sm2185pab.17.2014.12.08.19.44.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Dec 2014 19:44:05 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Tue, 9 Dec 2014 12:42:45 +0900 Message-Id: <1418096571-27531-23-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1418096571-27531-1-git-send-email-mukawa@igel.co.jp> References: <1416474399-16851-1-git-send-email-mukawa@igel.co.jp> <1418096571-27531-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 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