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 <olivier.matz at 6wind.com>
---
 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 c015a65..3ded563 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);

-- 
1.8.5.3

Reply via email to