From 396b69e56a3462ff80537deccebcdecb2771d8ca Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Fri, 11 Apr 2014 09:36:53 +0200 Subject: [PATCH] vdev: allow external registration of virtual device drivers The registration of an external vdev driver (a .so library) is done in a function that has the ((constructor)) attribute. This function is called when dlopen(driver.so) is invoked. As a result, we need to do the dlopen() before calling rte_eal_vdev_init() that calls the initialization functions of all registered drivers. Signed-off-by: Olivier Matz Acked-by: Thomas Monjalon --- lib/librte_eal/linuxapp/eal/eal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index c015a65807..3ded563725 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -1046,10 +1046,8 @@ rte_eal_init(int argc, char **argv) rte_eal_mcfg_complete(); - if (rte_eal_vdev_init() < 0) - rte_panic("Cannot init virtual devices\n"); - TAILQ_FOREACH(solib, &solib_list, next) { + RTE_LOG(INFO, EAL, "open shared lib %s\n", solib->name); solib->lib_handle = dlopen(solib->name, RTLD_NOW); if ((solib->lib_handle == NULL) && (solib->name[0] != '/')) { /* relative path: try again with "./" prefix */ @@ -1061,6 +1059,9 @@ rte_eal_init(int argc, char **argv) RTE_LOG(WARNING, EAL, "%s\n", dlerror()); } + if (rte_eal_vdev_init() < 0) + rte_panic("Cannot init virtual devices\n"); + RTE_LOG(DEBUG, EAL, "Master core %u is ready (tid=%x)\n", rte_config.master_lcore, (int)thread_id); -- 2.20.1