From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Blunck Subject: [PATCH v7 11/15] vdev: implement unplug bus operation Date: Thu, 29 Jun 2017 20:22:02 +0200 Message-ID: <20170629182206.1072-12-jblunck@infradead.org> References: <20170629182206.1072-1-jblunck@infradead.org> Cc: gaetan.rivet@6wind.com, shreyansh.jain@nxp.com To: dev@dpdk.org Return-path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id 4DB847CA9 for ; Thu, 29 Jun 2017 20:22:40 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id y5so4064348wmh.3 for ; Thu, 29 Jun 2017 11:22:40 -0700 (PDT) In-Reply-To: <20170629182206.1072-1-jblunck@infradead.org> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Jan Blunck --- lib/librte_eal/common/eal_common_vdev.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index 9bb7427..baf3c5b 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -39,11 +39,13 @@ #include #include +#include #include #include #include #include #include +#include /** Double linked list of virtual device drivers. */ TAILQ_HEAD(vdev_device_list, rte_vdev_device); @@ -354,10 +356,22 @@ vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp, return NULL; } +static int +vdev_unplug(struct rte_device *dev) +{ + /* + * The virtual bus doesn't support 'unattached' devices so this is + * actually equal to hotplugging removal of it. + */ + return rte_vdev_uninit(dev->name); +} + static struct rte_bus rte_vdev_bus = { .scan = vdev_scan, .probe = vdev_probe, .find_device = vdev_find_device, + /* .plug = NULL, see comment on vdev_unplug */ + .unplug = vdev_unplug, }; RTE_REGISTER_BUS(VIRTUAL_BUS_NAME, rte_vdev_bus); -- 2.9.4