From c431384c8fbf8503693bcae1bdcd58d6fa459b8a Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Fri, 18 Nov 2016 16:32:49 +0000 Subject: [PATCH] vdev: fix detaching with alias Fixes: d63eed6b2dca ("eal: add driver name alias") Signed-off-by: Anatoly Burakov Acked-by: Thomas Monjalon --- lib/librte_eal/common/eal_common_vdev.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index 0ff2377dd6..7d6e54f446 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -111,6 +111,14 @@ rte_eal_vdev_uninit(const char *name) return driver->remove(name); } + /* Give new names precedence over aliases. */ + TAILQ_FOREACH(driver, &vdev_driver_list, next) { + if (driver->driver.alias && + !strncmp(driver->driver.alias, name, + strlen(driver->driver.alias))) + return driver->remove(name); + } + RTE_LOG(ERR, EAL, "no driver found for %s\n", name); return -EINVAL; } -- 2.20.1