eal/windows: initialize hugepage info
[dpdk.git] / lib / librte_eal / windows / eal.c
index d71e690..c371c36 100644 (file)
 #include <eal_private.h>
 #include <rte_trace_point.h>
 
+#include "eal_hugepages.h"
 #include "eal_windows.h"
 
+#define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)
+
  /* Allow the application to print its usage message too if set */
 static rte_usage_hook_t        rte_application_usage_hook;
 
@@ -263,8 +266,11 @@ rte_eal_init(int argc, char **argv)
 
        eal_log_level_parse(argc, argv);
 
-       /* create a map of all processors in the system */
-       eal_create_cpu_map();
+       if (eal_create_cpu_map() < 0) {
+               rte_eal_init_alert("Cannot discover CPU and NUMA.");
+               /* rte_errno is set */
+               return -1;
+       }
 
        if (rte_eal_cpu_init() < 0) {
                rte_eal_init_alert("Cannot detect lcores.");
@@ -276,6 +282,17 @@ rte_eal_init(int argc, char **argv)
        if (fctret < 0)
                exit(1);
 
+       if (!internal_config.no_hugetlbfs && (eal_hugepage_info_init() < 0)) {
+               rte_eal_init_alert("Cannot get hugepage information");
+               rte_errno = EACCES;
+               return -1;
+       }
+
+       if (internal_config.memory == 0 && !internal_config.force_sockets) {
+               if (internal_config.no_hugetlbfs)
+                       internal_config.memory = MEMSIZE_IF_NO_HUGE_PAGE;
+       }
+
        eal_thread_init_master(rte_config.master_lcore);
 
        RTE_LCORE_FOREACH_SLAVE(i) {