eal/windows: initialize hugepage info
[dpdk.git] / lib / librte_eal / windows / eal.c
index d084606..c371c36 100644 (file)
 #include <eal_filesystem.h>
 #include <eal_options.h>
 #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;
 
@@ -139,7 +143,7 @@ eal_log_level_parse(int argc, char **argv)
 }
 
 /* Parse the argument given in the command line of the application */
-__attribute__((optnone)) static int
+static int
 eal_parse_args(int argc, char **argv)
 {
        int opt, ret;
@@ -221,7 +225,38 @@ rte_eal_init_alert(const char *msg)
        RTE_LOG(ERR, EAL, "%s\n", msg);
 }
 
- /* Launch threads, called at application init(). */
+/* Stubs to enable EAL trace point compilation
+ * until eal_common_trace.c can be compiled.
+ */
+
+RTE_DEFINE_PER_LCORE(volatile int, trace_point_sz);
+RTE_DEFINE_PER_LCORE(void *, trace_mem);
+
+void
+__rte_trace_mem_per_thread_alloc(void)
+{
+}
+
+void
+__rte_trace_point_emit_field(size_t sz, const char *field,
+       const char *type)
+{
+       RTE_SET_USED(sz);
+       RTE_SET_USED(field);
+       RTE_SET_USED(type);
+}
+
+int
+__rte_trace_point_register(rte_trace_point_t *trace, const char *name,
+       void (*register_fn)(void))
+{
+       RTE_SET_USED(trace);
+       RTE_SET_USED(name);
+       RTE_SET_USED(register_fn);
+       return -ENOTSUP;
+}
+
+/* Launch threads, called at application init(). */
 int
 rte_eal_init(int argc, char **argv)
 {
@@ -231,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.");
@@ -244,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) {