[dpdk-dev] [PATCH 15/39] eventdev: add routines for logging eventmode helper

Anoob Joseph anoobj at marvell.com
Mon Jun 3 19:32:15 CEST 2019


Adding routines for logging eventmode helper.

Signed-off-by: Anoob Joseph <anoobj at marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik at marvell.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                | 29 ++++++++++++++++++++++
 4 files changed, 32 insertions(+)

diff --git a/config/common_base b/config/common_base
index 8576973..96c2537 100644
--- a/config/common_base
+++ b/config/common_base
@@ -685,6 +685,7 @@ CONFIG_RTE_LIBRTE_PMD_ZLIB=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 c714a4b..bc34dc2 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 cbb4184..78d595c 100644
--- a/lib/librte_eal/common/include/rte_log.h
+++ b/lib/librte_eal/common/include/rte_log.h
@@ -62,6 +62,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 0da7003..7af7758 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -3,4 +3,33 @@
  */
 #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_WARNING(...) \
+	RTE_LOG(WARNING, 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_ */
-- 
2.7.4



More information about the dev mailing list