vdev: allow external registration of virtual device drivers
authorOlivier Matz <olivier.matz@6wind.com>
Fri, 11 Apr 2014 07:36:53 +0000 (09:36 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 11 Apr 2014 14:17:57 +0000 (16:17 +0200)
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@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
lib/librte_eal/linuxapp/eal/eal.c

index c015a65..3ded563 100644 (file)
@@ -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);