eal/windows: add tracing stubs
authorDmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Mon, 15 Jun 2020 00:43:49 +0000 (03:43 +0300)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 15 Jun 2020 17:27:09 +0000 (19:27 +0200)
EAL common code depends on tracepoint calls, but generic implementation
cannot be enabled on Windows due to missing standard library facilities.
Add stub functions to support tracepoint compilation, so that common
code does not have to conditionally include tracepoints until proper
support is added.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
lib/librte_eal/common/eal_common_thread.c
lib/librte_eal/common/meson.build
lib/librte_eal/windows/eal.c

index f9f588c..370bb1b 100644 (file)
@@ -15,9 +15,7 @@
 #include <rte_lcore.h>
 #include <rte_memory.h>
 #include <rte_log.h>
-#ifndef RTE_EXEC_ENV_WINDOWS
 #include <rte_trace_point.h>
-#endif
 
 #include "eal_internal_cfg.h"
 #include "eal_private.h"
@@ -169,9 +167,8 @@ static void *rte_thread_init(void *arg)
                free(params);
        }
 
-#ifndef RTE_EXEC_ENV_WINDOWS
        __rte_trace_mem_per_thread_alloc();
-#endif
+
        return start_routine(routine_arg);
 }
 
index d91c222..4e92081 100644 (file)
@@ -14,6 +14,7 @@ if is_windows
                'eal_common_log.c',
                'eal_common_options.c',
                'eal_common_thread.c',
+               'eal_common_trace_points.c',
        )
        subdir_done()
 endif
index a34e519..d71e690 100644 (file)
@@ -17,6 +17,7 @@
 #include <eal_filesystem.h>
 #include <eal_options.h>
 #include <eal_private.h>
+#include <rte_trace_point.h>
 
 #include "eal_windows.h"
 
@@ -221,7 +222,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)
 {