eal: move internal config initialization
[dpdk.git] / lib / librte_eal / linuxapp / eal / eal.c
index 354d0d8..fbfbb94 100644 (file)
@@ -212,7 +212,7 @@ rte_eal_config_create(void)
                rte_panic("Cannot mmap memory for rte_config\n");
        }
        memcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));
-       rte_config.mem_config = (struct rte_mem_config *) rte_mem_cfg_addr;
+       rte_config.mem_config = rte_mem_cfg_addr;
 
        /* store address of the config in the config itself so that secondary
         * processes could later map the config into this exact location */
@@ -492,7 +492,7 @@ eal_log_level_parse(int argc, char **argv)
        argvopt = argv;
        optind = 1;
 
-       eal_reset_internal_config(&internal_config);
+       rte_log_set_global_level(internal_config.log_level);
 
        while ((opt = getopt_long(argc, argvopt, eal_short_options,
                                  eal_long_options, &option_index)) != EOF) {
@@ -776,10 +776,10 @@ rte_eal_init(int argc, char **argv)
 
        thread_id = pthread_self();
 
-       eal_log_level_parse(argc, argv);
+       eal_reset_internal_config(&internal_config);
 
        /* set log level as early as possible */
-       rte_set_log_level(internal_config.log_level);
+       eal_log_level_parse(argc, argv);
 
        if (rte_eal_cpu_init() < 0) {
                rte_eal_init_alert("Cannot detect lcores.");
@@ -832,13 +832,6 @@ rte_eal_init(int argc, char **argv)
                return -1;
        }
 
-       if (rte_eal_pci_init() < 0) {
-               rte_eal_init_alert("Cannot init PCI\n");
-               rte_errno = EPROTO;
-               rte_atomic32_clear(&run_once);
-               return -1;
-       }
-
 #ifdef VFIO_PRESENT
        if (rte_eal_vfio_setup() < 0) {
                rte_eal_init_alert("Cannot init VFIO\n");
@@ -899,8 +892,11 @@ rte_eal_init(int argc, char **argv)
                return -1;
        }
 
-       if (rte_bus_scan())
-               rte_panic("Cannot scan the buses for devices\n");
+       if (rte_bus_scan()) {
+               rte_eal_init_alert("Cannot scan the buses for devices\n");
+               rte_errno = ENODEV;
+               return -1;
+       }
 
        RTE_LCORE_FOREACH_SLAVE(i) {
 
@@ -939,19 +935,12 @@ rte_eal_init(int argc, char **argv)
        rte_eal_mp_wait_lcore();
 
        /* Probe all the buses and devices/drivers on them */
-       if (rte_bus_probe())
-               rte_panic("Cannot probe devices\n");
-
-       /* Probe & Initialize PCI devices */
-       if (rte_eal_pci_probe()) {
-               rte_eal_init_alert("Cannot probe PCI\n");
+       if (rte_bus_probe()) {
+               rte_eal_init_alert("Cannot probe devices\n");
                rte_errno = ENOTSUP;
                return -1;
        }
 
-       if (rte_eal_dev_init() < 0)
-               rte_panic("Cannot init pmd devices\n");
-
        rte_eal_mcfg_complete();
 
        return fctret;