From patchwork Thu Nov 20 09:06:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuya Mukawa X-Patchwork-Id: 1368 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 D09AA7F98; Thu, 20 Nov 2014 09:57:01 +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 A76AE7FAD for ; Thu, 20 Nov 2014 09:56:58 +0100 (CET) Received: by mail-pd0-f177.google.com with SMTP id ft15so2678291pdb.36 for ; Thu, 20 Nov 2014 01:07:27 -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=SYCpqv1bQqBBRXTVJZQFiST+Hf4ICdukt0JaEL2U3As=; b=ZZtXB/aUAIXrlOXnCltyMXqW5COFMyXImCPMzLLH1wcpZUCyJYH/Vukn3w9aEl/LqX iZhPDiPrz1tOhsqqWZBgS6oWXKRtTBJapVF5nFU1zSDkoZX8RLPovpilBSA3SnVgltJd GbDrpkkGAp1XShZMNFgnTECGlZ6GxOfQ0wBIhsaXfwJ7N1xjeGcBb1EDeCsHj748QibY AYGv8KHsneyQBAIFrjn36aSRceIAW/5cT+oCH8hEeunBtwfLxxvagAwilZQ8AqyizKWa YJSy/MQKzr/xkICfzS+kbN0fdM7bk06Q+XDuPWLaE7Qe89KhlslPFaJQs3/Cxe6vUj89 5llA== X-Gm-Message-State: ALoCoQll/XF5454m738hovmPylLooLNhHOgFmAkYU10+xeFTKm/2HJcFr0EtuSpxIGLbx93KzkTB X-Received: by 10.68.135.100 with SMTP id pr4mr28731530pbb.123.1416474447481; Thu, 20 Nov 2014 01:07:27 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id a6sm1432407pbu.64.2014.11.20.01.07.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Nov 2014 01:07:26 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Thu, 20 Nov 2014 18:06:19 +0900 Message-Id: <1416474399-16851-6-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416474399-16851-1-git-send-email-mukawa@igel.co.jp> References: <1414572576-21371-1-git-send-email-mukawa@igel.co.jp> <1416474399-16851-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 05/25] eal, ethdev: Add function pointer for closing a device 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 patch adds function pointer to rte_pci_driver and eth_driver structure. These function pointers are used when ports are detached. Signed-off-by: Tetsuya Mukawa --- lib/librte_eal/common/include/rte_pci.h | 7 +++++++ lib/librte_ether/rte_ethdev.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index fe374a8..74720d1 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -181,12 +181,19 @@ struct rte_pci_driver; typedef int (pci_devinit_t)(struct rte_pci_driver *, struct rte_pci_device *); /** + * Shutdown function for the driver called during hotplugging. + */ +typedef int (pci_devshutdown_t)( + struct rte_pci_driver *, struct rte_pci_device *); + +/** * A structure describing a PCI driver. */ struct rte_pci_driver { TAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */ const char *name; /**< Driver name. */ pci_devinit_t *devinit; /**< Device init. function. */ + pci_devshutdown_t *devshutdown; /**< Device shutdown function. */ struct rte_pci_id *id_table; /**< ID table, NULL terminated. */ uint32_t drv_flags; /**< Flags contolling handling of device. */ }; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 548467c..558d4d3 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1696,6 +1696,9 @@ struct eth_driver; typedef int (*eth_dev_init_t)(struct eth_driver *eth_drv, struct rte_eth_dev *eth_dev); +typedef int (*eth_dev_shutdown_t)(struct eth_driver *eth_drv, + struct rte_eth_dev *eth_dev); + /** * @internal * The structure associated with a PMD Ethernet driver. @@ -1712,6 +1715,7 @@ typedef int (*eth_dev_init_t)(struct eth_driver *eth_drv, struct eth_driver { struct rte_pci_driver pci_drv; /**< The PMD is also a PCI driver. */ eth_dev_init_t eth_dev_init; /**< Device init function. */ + eth_dev_shutdown_t eth_dev_shutdown;/**< Device shutdown function. */ unsigned int dev_private_size; /**< Size of device private data. */ };