All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Cc: Gaetan Rivet <gaetan.rivet@6wind.com>
Subject: [PATCH v4 1/8] vdev: implement plug operation
Date: Sat, 15 Jul 2017 19:56:35 +0200	[thread overview]
Message-ID: <86dc328887222ac3591a5d280196922e986a59d2.1499964391.git.gaetan.rivet@6wind.com> (raw)
In-Reply-To: <cover.1499964391.git.gaetan.rivet@6wind.com>
In-Reply-To: <cover.1499964391.git.gaetan.rivet@6wind.com>

This method must be implemented to allow using a unified, generic API to
hotplug devices, including virtual ones.

VDEV devices actually exist unattached after performing a scan on the
rte_devargs list. As such it makes sense to be able to perform a device
hotplug afterward.

Finally, missing this generic interface forces the EAL to be dependent
on vdev-specific API, which hinders the plan of moving the vdev bus to
drivers/bus.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 lib/librte_eal/common/eal_common_vdev.c  | 12 +++++++-----
 lib/librte_eal/common/include/rte_vdev.h |  7 +++++++
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index e00dda9..85cf3fc 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -319,12 +319,14 @@ vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
 }
 
 static int
+vdev_plug(struct rte_device *dev, const char *args __rte_unused)
+{
+	return vdev_probe_all_drivers(RTE_DEV_TO_VDEV(dev));
+}
+
+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);
 }
 
@@ -332,7 +334,7 @@ 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 */
+	.plug = vdev_plug,
 	.unplug = vdev_unplug,
 	.parse = vdev_parse,
 };
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
index fc24298..29f5a52 100644
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -46,6 +46,13 @@ struct rte_vdev_device {
 	struct rte_device device;               /**< Inherit core device */
 };
 
+/**
+ * @internal
+ * Helper macro for drivers that need to convert to struct rte_vdev_device.
+ */
+#define RTE_DEV_TO_VDEV(ptr) \
+	container_of(ptr, struct rte_vdev_device, device)
+
 static inline const char *
 rte_vdev_device_name(const struct rte_vdev_device *dev)
 {
-- 
2.1.4

  reply	other threads:[~2017-07-15 17:56 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-09  1:45 [PATCH 0/9] fix hotplug API Gaetan Rivet
2017-07-09  1:45 ` [PATCH 1/9] eal: return device handle upon plugin Gaetan Rivet
2017-07-09  1:45 ` [PATCH 2/9] eal: fix hotplug add Gaetan Rivet
2017-07-09  1:45 ` [PATCH 3/9] devargs: introduce removal function Gaetan Rivet
2017-07-09  1:45 ` [PATCH 4/9] eal: release devargs on device removal Gaetan Rivet
2017-07-09  1:45 ` [PATCH 5/9] pci: use given name as generic name Gaetan Rivet
2017-07-09  1:45 ` [PATCH 6/9] pci: fix generic driver pointer on probe error Gaetan Rivet
2017-07-09  1:45 ` [PATCH 7/9] pci: fix hotplug operations Gaetan Rivet
2017-07-09  1:45 ` [PATCH 8/9] vdev: implement plug operation Gaetan Rivet
2017-07-09  1:45 ` [PATCH 9/9] bus: remove useless plug parameter Gaetan Rivet
2017-07-09 10:38 ` [PATCH 0/9] fix hotplug API Jan Blunck
2017-07-09 12:19   ` Gaëtan Rivet
2017-07-09 14:19   ` Thomas Monjalon
     [not found]     ` <20170711160211.GW11154@bidouze.vm.6wind.com>
     [not found]       ` <CALe+Z00Rc_6cn_ckWrK1cD2RsdWENM3s+ytOpxNymTmaqh8e0g@mail.gmail.com>
2017-07-11 19:21         ` Gaëtan Rivet
2017-07-10 23:18 ` [PATCH v2 0/8] " Gaetan Rivet
2017-07-10 23:19   ` [PATCH v2 1/8] vdev: implement plug operation Gaetan Rivet
2017-07-10 23:19   ` [PATCH v2 2/8] devargs: introduce removal function Gaetan Rivet
2017-07-10 23:19   ` [PATCH v2 3/8] devargs: introduce insert function Gaetan Rivet
2017-07-11 22:13     ` Thomas Monjalon
2017-07-10 23:19   ` [PATCH v2 4/8] eal: fix hotplug add / remove Gaetan Rivet
2017-07-11 22:18     ` Thomas Monjalon
2017-07-10 23:19   ` [PATCH v2 5/8] pci: use given name as generic name Gaetan Rivet
2017-07-11 22:05     ` [dpdk-stable] " Thomas Monjalon
2017-07-10 23:19   ` [PATCH v2 6/8] pci: fix generic driver pointer on probe error Gaetan Rivet
2017-07-10 23:19   ` [PATCH v2 7/8] pci: fix hotplug operations Gaetan Rivet
2017-07-10 23:19   ` [PATCH v2 8/8] bus: remove useless plug parameter Gaetan Rivet
2017-07-11 23:25   ` [PATCH v3 0/8] fix hotplug API Gaetan Rivet
2017-07-11 23:25     ` [PATCH v3 1/8] vdev: implement plug operation Gaetan Rivet
2017-07-11 23:25     ` [PATCH v3 2/8] devargs: introduce removal function Gaetan Rivet
2017-07-12  8:27       ` Jan Blunck
2017-07-12 17:22         ` Gaëtan Rivet
2017-07-11 23:25     ` [PATCH v3 3/8] devargs: introduce insert function Gaetan Rivet
2017-07-12  8:20       ` Jan Blunck
2017-07-12 17:20         ` Gaëtan Rivet
2017-07-13 19:44           ` Jan Blunck
2017-07-11 23:25     ` [PATCH v3 4/8] eal: fix hotplug add / remove Gaetan Rivet
2017-07-12  8:44       ` Jan Blunck
2017-07-12 17:33         ` Gaëtan Rivet
2017-07-11 23:25     ` [PATCH v3 5/8] pci: use given name as generic name Gaetan Rivet
2017-07-11 23:25     ` [PATCH v3 6/8] pci: fix generic driver pointer on probe error Gaetan Rivet
2017-07-11 23:25     ` [PATCH v3 7/8] pci: fix hotplug operations Gaetan Rivet
2017-07-11 23:25     ` [PATCH v3 8/8] bus: remove useless plug parameter Gaetan Rivet
2017-07-15 17:56     ` [PATCH v4 0/8] fix hotplug API Gaetan Rivet
2017-07-15 17:56       ` Gaetan Rivet [this message]
2017-07-15 17:56       ` [PATCH v4 2/8] devargs: introduce removal function Gaetan Rivet
2017-07-15 17:56       ` [PATCH v4 3/8] devargs: introduce insert function Gaetan Rivet
2017-07-15 17:56       ` [PATCH v4 4/8] eal: fix hotplug add / remove Gaetan Rivet
2017-07-15 17:56       ` [PATCH v4 5/8] pci: use given name as generic name Gaetan Rivet
2017-07-15 17:56       ` [PATCH v4 6/8] pci: fix generic driver pointer on probe error Gaetan Rivet
2017-07-15 17:56       ` [PATCH v4 7/8] pci: fix hotplug operations Gaetan Rivet
2017-07-15 17:56       ` [PATCH v4 8/8] bus: remove useless plug parameter Gaetan Rivet
2017-07-19 21:27       ` [PATCH v4 0/8] fix hotplug API Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86dc328887222ac3591a5d280196922e986a59d2.1499964391.git.gaetan.rivet@6wind.com \
    --to=gaetan.rivet@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.