eal: use sizeof to avoid a double use of a define
[dpdk.git] / lib / librte_eal / linuxapp / eal / eal.c
index 18a07b0..9c7d762 100644 (file)
@@ -56,7 +56,6 @@
 #include <rte_common.h>
 #include <rte_debug.h>
 #include <rte_memory.h>
-#include <rte_memzone.h>
 #include <rte_launch.h>
 #include <rte_eal.h>
 #include <rte_eal_memconfig.h>
 #include <rte_cpuflags.h>
 #include <rte_interrupts.h>
 #include <rte_bus.h>
-#include <rte_pci.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
 #include <rte_version.h>
 #include <rte_atomic.h>
 #include <malloc_heap.h>
+#include <rte_vfio.h>
 
 #include "eal_private.h"
 #include "eal_thread.h"
@@ -710,14 +709,9 @@ static int rte_eal_vfio_setup(void)
 {
        int vfio_enabled = 0;
 
-       if (vfio_enable("vfio"))
+       if (rte_vfio_enable("vfio"))
                return -1;
-       vfio_enabled = vfio_is_enabled("vfio");
-
-       if (!internal_config.no_pci) {
-               if (!pci_vfio_is_enabled())
-                       RTE_LOG(DEBUG, EAL, "VFIO PCI modules not loaded\n");
-       }
+       vfio_enabled = rte_vfio_is_enabled("vfio");
 
        if (vfio_enabled) {
 
@@ -813,6 +807,15 @@ rte_eal_init(int argc, char **argv)
        /* autodetect the iova mapping mode (default is iova_pa) */
        rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class();
 
+       /* Workaround for KNI which requires physical address to work */
+       if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA &&
+                       rte_eal_check_module("rte_kni") == 1) {
+               rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA;
+               RTE_LOG(WARNING, EAL,
+                       "Some devices want IOVA as VA but PA will be used because.. "
+                       "KNI module inserted\n");
+       }
+
        if (internal_config.no_hugetlbfs == 0 &&
                        internal_config.process_type != RTE_PROC_SECONDARY &&
                        eal_hugepage_info_init() < 0) {
@@ -895,7 +898,7 @@ rte_eal_init(int argc, char **argv)
 
        eal_thread_init_master(rte_config.master_lcore);
 
-       ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN);
+       ret = eal_thread_dump_affinity(cpuset, sizeof(cpuset));
 
        RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%x;cpuset=[%s%s])\n",
                rte_config.master_lcore, (int)thread_id, cpuset,
@@ -926,7 +929,7 @@ rte_eal_init(int argc, char **argv)
                        rte_panic("Cannot create thread\n");
 
                /* Set thread_name for aid in debugging. */
-               snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
+               snprintf(thread_name, sizeof(thread_name),
                        "lcore-slave-%d", i);
                ret = rte_thread_setname(lcore_config[i].thread_id,
                                                thread_name);