[v6,16/33] eal/trace: hook internal trace APIs to FreeBSD

Message ID 20200419100133.3232316-17-jerinj@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series DPDK Trace support |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Jerin Jacob April 19, 2020, 10:01 a.m. UTC
From: Jerin Jacob <jerinj@marvell.com>

Connect the internal trace interface API to FreeBSD EAL.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
---
 lib/librte_eal/freebsd/eal.c        | 10 ++++++++++
 lib/librte_eal/freebsd/eal_thread.c |  4 ++++
 2 files changed, 14 insertions(+)
  

Patch

diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c
index 80dc9aa78..540b7d38c 100644
--- a/lib/librte_eal/freebsd/eal.c
+++ b/lib/librte_eal/freebsd/eal.c
@@ -52,6 +52,7 @@ 
 #include "eal_hugepages.h"
 #include "eal_options.h"
 #include "eal_memcfg.h"
+#include "eal_trace.h"
 
 #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)
 
@@ -751,6 +752,13 @@  rte_eal_init(int argc, char **argv)
 		return -1;
 	}
 
+	if (eal_trace_init() < 0) {
+		rte_eal_init_alert("Cannot init trace");
+		rte_errno = EFAULT;
+		rte_atomic32_clear(&run_once);
+		return -1;
+	}
+
 	if (eal_option_device_parse()) {
 		rte_errno = ENODEV;
 		rte_atomic32_clear(&run_once);
@@ -966,6 +974,8 @@  rte_eal_cleanup(void)
 {
 	rte_service_finalize();
 	rte_mp_channel_cleanup();
+	rte_trace_save();
+	eal_trace_fini();
 	eal_cleanup_config(&internal_config);
 	return 0;
 }
diff --git a/lib/librte_eal/freebsd/eal_thread.c b/lib/librte_eal/freebsd/eal_thread.c
index d802c1d2e..c25b4a019 100644
--- a/lib/librte_eal/freebsd/eal_thread.c
+++ b/lib/librte_eal/freebsd/eal_thread.c
@@ -20,6 +20,8 @@ 
 #include <rte_per_lcore.h>
 #include <rte_eal.h>
 #include <rte_lcore.h>
+#include <rte_trace.h>
+#include <rte_trace_point.h>
 
 #include "eal_private.h"
 #include "eal_thread.h"
@@ -124,6 +126,8 @@  eal_thread_loop(__rte_unused void *arg)
 	RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%p;cpuset=[%s%s])\n",
 		lcore_id, thread_id, cpuset, ret == 0 ? "" : "...");
 
+	__rte_trace_mem_per_thread_alloc();
+
 	/* read on our pipe to get commands */
 	while (1) {
 		void *fct_arg;