diff mbox series

[dpdk-dev,02/20] eventdev: add routines for logging eventmode helper

Message ID 1528478659-15859-3-git-send-email-anoob.joseph@caviumnetworks.com (mailing list archive)
State Changes Requested, archived
Delegated to: Jerin Jacob
Headers show
Series add eventmode helper functions | expand

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail apply issues

Commit Message

Anoob Joseph June 8, 2018, 5:24 p.m. UTC
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
 config/common_base                                 |  1 +
 lib/librte_eal/common/eal_common_log.c             |  1 +
 lib/librte_eal/common/include/rte_log.h            |  1 +
 .../rte_eventmode_helper_internal.h                | 24 ++++++++++++++++++++++
 4 files changed, 27 insertions(+)
diff mbox series

Patch

diff --git a/config/common_base b/config/common_base
index 6b0d1cb..21da7d4 100644
--- a/config/common_base
+++ b/config/common_base
@@ -594,6 +594,7 @@  CONFIG_RTE_LIBRTE_PMD_ISAL=n
 #
 CONFIG_RTE_LIBRTE_EVENTDEV=y
 CONFIG_RTE_LIBRTE_EVENTDEV_DEBUG=n
+CONFIG_RTE_LIBRTE_EVENTMODE_HELPER_DEBUG=n
 CONFIG_RTE_EVENT_MAX_DEVS=16
 CONFIG_RTE_EVENT_MAX_QUEUES_PER_DEV=64
 CONFIG_RTE_EVENT_TIMER_ADAPTER_NUM_MAX=32
diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
index 8181189..ee85705 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -324,6 +324,7 @@  static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EFD,        "lib.efd"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_GSO,        "lib.gso"},
+	{RTE_LOGTYPE_EVENTMODE,  "lib.eventmode"},
 	{RTE_LOGTYPE_USER1,      "user1"},
 	{RTE_LOGTYPE_USER2,      "user2"},
 	{RTE_LOGTYPE_USER3,      "user3"},
diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
index 2f789cb..e7ffc54 100644
--- a/lib/librte_eal/common/include/rte_log.h
+++ b/lib/librte_eal/common/include/rte_log.h
@@ -61,6 +61,7 @@  extern struct rte_logs rte_logs;
 #define RTE_LOGTYPE_EFD       18 /**< Log related to EFD. */
 #define RTE_LOGTYPE_EVENTDEV  19 /**< Log related to eventdev. */
 #define RTE_LOGTYPE_GSO       20 /**< Log related to GSO. */
+#define RTE_LOGTYPE_EVENTMODE 21 /**< Log related to eventmode. */
 
 /* these log types can be used in an application */
 #define RTE_LOGTYPE_USER1     24 /**< User-defined log type 1. */
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index 5b08582..e946f11 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -3,4 +3,28 @@ 
  */
 #ifndef _RTE_EVENTMODE_HELPER_INTERNAL_H_
 #define _RTE_EVENTMODE_HELPER_INTERNAL_H_
+
+#include <rte_log.h>
+
+/* Logging macros */
+
+#define RTE_EM_HLPR_LOG_ERR(...) \
+	RTE_LOG(ERR, EVENTMODE, \
+		RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#define RTE_EM_HLPR_LOG_INFO(...) \
+	RTE_LOG(INFO, EVENTMODE, \
+		RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#ifdef RTE_LIBRTE_EVENTMODE_HELPER_DEBUG
+#define RTE_EM_HLPR_LOG_DEBUG(...) \
+	RTE_LOG(DEBUG, EVENTMODE, \
+		RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,)))
+#else
+#define RTE_EM_HLPR_LOG_DEBUG(...) (void)0
+#endif
+
 #endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */