vdev: fix detaching with alias
authorAnatoly Burakov <anatoly.burakov@intel.com>
Fri, 18 Nov 2016 16:32:49 +0000 (16:32 +0000)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 7 Dec 2016 20:14:43 +0000 (21:14 +0100)
Fixes: d63eed6b2dca ("eal: add driver name alias")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
lib/librte_eal/common/eal_common_vdev.c

index 0ff2377..7d6e54f 100644 (file)
@@ -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;
 }