From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id C72C0325A for ; Tue, 27 Jun 2017 18:11:42 +0200 (CEST) Received: by mail-wm0-f53.google.com with SMTP id 62so29303513wmw.1 for ; Tue, 27 Jun 2017 09:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=80A40L5ySUgSJOLVmlTjPlioGENljO6lbO2s1rDqKC8=; b=TjGOIiERu3E+sC8/yuaM+OalsIrncpcILqSIr6vWy1O8/cfnVYmawMWN9ZrHK6A12D hK1Y33Oqw1C+AOUD4Fseck4cRL+ITUFMQRF1OUfyzfUwfTdpgpIK4eYqXHpvMaqFdn+L aTV7XOC2jPQpinQzyAo3c4+zrGP5TT2zzn0C4vcQOKGLuDRXdlmY86q1mKO/s4eU0FzO huswK4Vh0TWTSyneJKH2a8qJ4NrSMBa64GOqNl7P6pBpi9WwLaXGfujKE4+ajZfkz2Gf bEF+Av9nEkwR8n2MvY4n0ypvgDRn7TiVF0ZiV3CyZKNXvrCokCkPORNgHxLDF/SlGrzF OuJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=80A40L5ySUgSJOLVmlTjPlioGENljO6lbO2s1rDqKC8=; b=qtSnY9fxkUCNj5TKYUHmXzbN+i+J1ZV05yHOOa0ZB0cJTsBN9AA0MzFBL96OdtjPrN J+wLXNg15Q1KFc7Yk6WqhyEJMlwSodL62OZ6LT9zOupuqyl4ZreLDndePEGeXVoDzglg kKJDcyD6ptZsd8barVhGxYEE9zlEFr+kG4s8Sd0LpVyWWHfEN4SN0A4PLRGne0jXaZe5 B9dYO55uIe2lOZ1f6tU2KGrQC4hACr7jRYvhGB0NR14/lJk47i7myGhYksDhnU06cHXD Bdf5zt63/FTRt4JeJFGRLlBl9tfeL89hXqgW/o85DYe7W8XcRnPxkBRjquclfMYGcnH7 lWaQ== X-Gm-Message-State: AKS2vOzXCSir268iXRwFqnJiPzK7hqeLmg8BLKWt8PtgB5oOrH3ZbRjb hyOoelch+r6GNStobjE= X-Received: by 10.28.24.213 with SMTP id 204mr4154284wmy.15.1498579901075; Tue, 27 Jun 2017 09:11:41 -0700 (PDT) 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 v13sm4080465wmd.5.2017.06.27.09.11.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Jun 2017 09:11:40 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 27 Jun 2017 18:11:14 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v6 07/11] vdev: implement hotplug bus operation 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: Tue, 27 Jun 2017 16:11:43 -0000 Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_vdev.c | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index 625a8e2..f5c557f 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -38,11 +38,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); @@ -358,10 +360,44 @@ vdev_find_device(rte_dev_cmp_t cmp, return NULL; } +static struct rte_device * +vdev_plug(struct rte_devargs *da) +{ + struct rte_vdev_device *dev; + int ret; + + ret = rte_vdev_init(da->virt.drv_name, da->args); + if (ret) { + rte_errno = -ret; + return NULL; + } + dev = find_vdev(da->virt.drv_name); + return &dev->device; +} + +static int +vdev_unplug(struct rte_device *dev) +{ + struct rte_devargs *da; + int ret; + + da = dev->devargs; + if (da == NULL) { + rte_errno = EINVAL; + return -1; + } + ret = rte_vdev_uninit(da->virt.drv_name); + if (ret) + rte_errno = -ret; + return ret; +} + static struct rte_bus rte_vdev_bus = { .scan = vdev_scan, .probe = vdev_probe, .find_device = vdev_find_device, + .plug = vdev_plug, + .unplug = vdev_unplug, }; RTE_INIT(rte_vdev_bus_register); -- 2.1.4