[dpdk-dev] [PATCH 02/11] log: define logtype register wrapper for drivers

David Marchand david.marchand at redhat.com
Mon Aug 19 13:41:50 CEST 2019


The function rte_log_register_type_and_pick_level() fills a gap for
dynamically loaded code (especially drivers) who would not pick up
the log level passed at startup.

Let's promote it to stable and export it for use by drivers via
a wrapper.

Signed-off-by: David Marchand <david.marchand at redhat.com>
---
 lib/librte_eal/common/include/rte_log.h | 12 ++++++++----
 lib/librte_eal/rte_eal_version.map      |  8 +++++++-
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
index cbb4184..c3aff00 100644
--- a/lib/librte_eal/common/include/rte_log.h
+++ b/lib/librte_eal/common/include/rte_log.h
@@ -209,9 +209,6 @@ int rte_log_cur_msg_logtype(void);
 int rte_log_register(const char *name);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * Register a dynamic log type and try to pick its level from EAL options
  *
  * rte_log_register() is called inside. If successful, the function tries
@@ -227,9 +224,16 @@ int rte_log_register(const char *name);
  *    - >=0: the newly registered log type
  *    - <0: rte_log_register() error value
  */
-__rte_experimental
 int rte_log_register_type_and_pick_level(const char *name, uint32_t level_def);
 
+#define RTE_LOG_REGISTER(token, name, level, fallback) \
+RTE_INIT(token##_init) \
+{ \
+	token = rte_log_register_type_and_pick_level(name, level); \
+	if (token < 0) \
+		token = fallback; \
+}
+
 /**
  * Dump log information.
  *
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 7cbf82d..7326e92 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -312,6 +312,13 @@ DPDK_19.08 {
 
 } DPDK_19.05;
 
+DPDK_19.11 {
+	global:
+
+	rte_log_register_type_and_pick_level;
+
+} DPDK_19.08;
+
 EXPERIMENTAL {
 	global:
 
@@ -342,7 +349,6 @@ EXPERIMENTAL {
 	rte_fbarray_is_used;
 	rte_fbarray_set_free;
 	rte_fbarray_set_used;
-	rte_log_register_type_and_pick_level;
 	rte_malloc_dump_heaps;
 	rte_mem_alloc_validator_register;
 	rte_mem_alloc_validator_unregister;
-- 
1.8.3.1



More information about the dev mailing list