From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Raslan Darawsheh <rasland@mellanox.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH 2/2] bus/vdev: fix hotplug twice
Date: Thu, 21 Feb 2019 20:01:25 +0100 [thread overview]
Message-ID: <20190221190125.24140-3-thomas@monjalon.net> (raw)
In-Reply-To: <20190221190125.24140-1-thomas@monjalon.net>
From: Raslan Darawsheh <rasland@mellanox.com>
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>
---
drivers/bus/vdev/vdev.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 7225411791..87f0e2b6bb 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;
--
2.20.1
next prev parent reply other threads:[~2019-02-21 19:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-21 19:01 [dpdk-dev] [PATCH 0/2] small fixes for vdev hotplug Thomas Monjalon
2019-02-21 19:01 ` [dpdk-dev] [PATCH 1/2] bus/vdev: fix debug message on probing Thomas Monjalon
2019-02-22 5:06 ` Rami Rosen
2019-02-25 7:45 ` Andrew Rybchenko
2019-02-21 19:01 ` Thomas Monjalon [this message]
2019-02-25 7:50 ` [dpdk-dev] [PATCH 2/2] bus/vdev: fix hotplug twice Andrew Rybchenko
2019-03-05 12:36 ` [dpdk-dev] [PATCH 0/2] small fixes for vdev hotplug Ferruh Yigit
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=20190221190125.24140-3-thomas@monjalon.net \
--to=thomas@monjalon.net \
--cc=dev@dpdk.org \
--cc=rasland@mellanox.com \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).