summaryrefslogtreecommitdiff
path: root/drivers/bus
diff options
context:
space:
mode:
authorRaslan Darawsheh <rasland@mellanox.com>2019-02-21 20:01:25 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2019-03-05 12:32:31 +0000
commite892fa595e19b5cce315045444b3b7e31130ef19 (patch)
treefa3dd05329bdd08b2a19383fcf38bb251f89d34b /drivers/bus
parent4169ed6ed1c31b75f070cdccf3ee82561d4b79ce (diff)
downloaddpdk-next-eventdev-e892fa595e19b5cce315045444b3b7e31130ef19.zip
dpdk-next-eventdev-e892fa595e19b5cce315045444b3b7e31130ef19.tar.gz
dpdk-next-eventdev-e892fa595e19b5cce315045444b3b7e31130ef19.tar.xz
bus/vdev: fix hotplug twice
In case vdev was already probed, it shouldn't be probed again, and it should return -EEXIST as error. There are some checks in vdev_probe() and insert_vdev(), but a check was missing in vdev_plug(). The check is moved in vdev_probe_all_drivers() which is called in all code paths. Fixes: e9d159c3d534 ("eal: allow probing a device again") Cc: stable@dpdk.org Signed-off-by: Raslan Darawsheh <rasland@mellanox.com> Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Diffstat (limited to 'drivers/bus')
-rw-r--r--drivers/bus/vdev/vdev.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 7225411..87f0e2b 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -143,6 +143,9 @@ vdev_probe_all_drivers(struct rte_vdev_device *dev)
struct rte_vdev_driver *driver;
int ret;
+ if (rte_dev_is_probed(&dev->device))
+ return -EEXIST;
+
name = rte_vdev_device_name(dev);
VDEV_LOG(DEBUG, "Search driver to probe device %s", name);
@@ -480,7 +483,7 @@ static int
vdev_probe(void)
{
struct rte_vdev_device *dev;
- int ret = 0;
+ int r, ret = 0;
/* call the init function for each virtual device */
TAILQ_FOREACH(dev, &vdev_device_list, next) {
@@ -489,10 +492,10 @@ vdev_probe(void)
* we call each driver probe.
*/
- if (rte_dev_is_probed(&dev->device))
- continue;
-
- if (vdev_probe_all_drivers(dev)) {
+ r = vdev_probe_all_drivers(dev);
+ if (r != 0) {
+ if (r == -EEXIST)
+ continue;
VDEV_LOG(ERR, "failed to initialize %s device",
rte_vdev_device_name(dev));
ret = -1;