Skip to contentSkip to conversation

rte_log: make rte_logs private

PATCH In review Stephen Hemminger 3 participants 11 messages Aug 27, 2020 – Sep 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rte_log: make rte_logs private

As announced in earlier releases, rte_logs can now be made internal to eal_common_log.

---
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_20_11.rst |  2 ++
 lib/librte_eal/common/eal_common_log.c | 11 ++++++++---
 lib/librte_eal/include/rte_log.h       | 16 ++--------------
 lib/librte_eal/rte_eal_version.map     |  1 -
 5 files changed, 12 insertions(+), 22 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
index 345c38d5b630..5445a4f0a061 100644
@@ -77,10 +77,6 @@ Deprecation Notices
 * eal: The function ``rte_eal_remote_launch`` will return new error codes
   after read or write error on the pipe, instead of calling ``rte_panic``.
 
-* eal: The ``rte_logs`` struct and global symbol will be made private to
-  remove it from the externally visible ABI and allow it to be updated in the
-  future.
-
 * eal: The ``rte_dev_event`` structure will be made private to the EAL as no
   public API makes use of it.
 
doc/guides/rel_notes/release_20_11.rst +2 -0
index df227a1773b8..e422ac790912 100644
@@ -84,6 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* eal: The ``rte_logs`` struct and global symbol was made private
+  and is no longer part of the API.
 
 ABI Changes
 -----------
lib/librte_eal/common/eal_common_log.c +8 -3
index 8835c8fff897..a25766de181a 100644
@@ -17,11 +17,16 @@
 
 #include "eal_private.h"
 
-/* global log structure */
-struct rte_logs rte_logs = {
+/** The rte_log structure. */
+static struct rte_logs {
+	uint32_t type;  /**< Bitfield with enabled logs. */
+	uint32_t level; /**< Log level. */
+	FILE *file;     /**< Output file set by rte_openlog_stream, or NULL. */
+	size_t dynamic_types_len;
+	struct rte_log_dynamic_type *dynamic_types;
+} rte_logs = {
 	.type = ~0,
 	.level = RTE_LOG_DEBUG,
-	.file = NULL,
 };
 
 struct rte_eal_opt_loglevel {
lib/librte_eal/include/rte_log.h +2 -14
index eaf66e4f61de..655c3b39c29e 100644
@@ -29,18 +29,6 @@ extern "C" {
 
 struct rte_log_dynamic_type;
 
-/** The rte_log structure. */
-struct rte_logs {
-	uint32_t type;  /**< Bitfield with enabled logs. */
-	uint32_t level; /**< Log level. */
-	FILE *file;     /**< Output file set by rte_openlog_stream, or NULL. */
-	size_t dynamic_types_len;
-	struct rte_log_dynamic_type *dynamic_types;
-};
-
-/** Global log information */
-extern struct rte_logs rte_logs;
-
 /* SDK log type */
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
 #define RTE_LOGTYPE_MALLOC     1 /**< Log related to malloc. */
@@ -274,7 +262,7 @@ void rte_log_dump(FILE *f);
  * to rte_openlog_stream().
  *
  * The level argument determines if the log should be displayed or
- * not, depending on the global rte_logs variable.
+ * not, depending on the loglevel settings.
  *
  * The preferred alternative is the RTE_LOG() because it adds the
  * level and type in the logged string.
@@ -305,7 +293,7 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...)
  * to rte_openlog_stream().
  *
  * The level argument determines if the log should be displayed or
- * not, depending on the global rte_logs variable. A trailing
+ * not, depending on the loglevel settings. A trailing
  * newline may be added if needed.
  *
  * The preferred alternative is the RTE_LOG() because it adds the
lib/librte_eal/rte_eal_version.map +0 -1
index 0b18e2ef85f9..6b0dfdd9667c 100644
@@ -114,7 +114,6 @@ DPDK_21 {
 	rte_log_set_level;
 	rte_log_set_level_pattern;
 	rte_log_set_level_regexp;
-	rte_logs;
 	rte_malloc;
 	rte_malloc_dump_stats;
 	rte_malloc_get_socket_stats;
Signature · 1 line
2.27.0
#2 lore raw
In reply to Stephen Hemminger
Quoted 3 lines · Stephen Hemminger

As announced in earlier releases, rte_logs can now be made internal to eal_common_log.

I had prepared this cleanup before my PTO and was about to send it. Just to avoid duplicate work, do you intend to work on other cleanups ?

Hiding this symbol is fine, but we must remove the experimental tag on rte_log_get_stream since it becomes the only way to access the log stream.

More comments below.
Thanks.

Quoted 30 lines
---
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_20_11.rst |  2 ++
 lib/librte_eal/common/eal_common_log.c | 11 ++++++++---
 lib/librte_eal/include/rte_log.h       | 16 ++--------------
 lib/librte_eal/rte_eal_version.map     |  1 -
 5 files changed, 12 insertions(+), 22 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
index 345c38d5b630..5445a4f0a061 100644
@@ -77,10 +77,6 @@ Deprecation Notices
 * eal: The function ``rte_eal_remote_launch`` will return new error codes
   after read or write error on the pipe, instead of calling ``rte_panic``.
 
-* eal: The ``rte_logs`` struct and global symbol will be made private to
-  remove it from the externally visible ABI and allow it to be updated in the
-  future.
-
 * eal: The ``rte_dev_event`` structure will be made private to the EAL as no
   public API makes use of it.
 
doc/guides/rel_notes/release_20_11.rst +0 -0
index df227a1773b8..e422ac790912 100644

doc/guides/rel_notes/release_20_11.rst API Changes · line 88

Quoted 5 lines
doc/guides/rel_notes/release_20_11.rst +2 -0
@@ -84,6 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* eal: The ``rte_logs`` struct and global symbol was made private
+  and is no longer part of the API.

Missing double empty line.

Quoted 32 lines
doc/guides/rel_notes/release_20_11.rst +0 -0
 ABI Changes
 -----------
lib/librte_eal/common/eal_common_log.c +8 -3
index 8835c8fff897..a25766de181a 100644
@@ -17,11 +17,16 @@
 
 #include "eal_private.h"
 
-/* global log structure */
-struct rte_logs rte_logs = {
+/** The rte_log structure. */
+static struct rte_logs {
+       uint32_t type;  /**< Bitfield with enabled logs. */
+       uint32_t level; /**< Log level. */
+       FILE *file;     /**< Output file set by rte_openlog_stream, or NULL. */
+       size_t dynamic_types_len;
+       struct rte_log_dynamic_type *dynamic_types;
+} rte_logs = {
        .type = ~0,
        .level = RTE_LOG_DEBUG,
-       .file = NULL,
 };
 
 struct rte_eal_opt_loglevel {
lib/librte_eal/include/rte_log.h +0 -0
index eaf66e4f61de..655c3b39c29e 100644

lib/librte_eal/include/rte_log.h extern "C" { · line 30

Quoted 2 lines
lib/librte_eal/include/rte_log.h +0 -0
@@ -29,18 +29,6 @@ extern "C" {
 
 struct rte_log_dynamic_type;

No need for rte_log_dynamic_type forward declaration anymore if you simply move rte_logs or this type declaration in eal_common_log.c.

Quoted 49 lines
lib/librte_eal/include/rte_log.h +2 -14
-/** The rte_log structure. */
-struct rte_logs {
-       uint32_t type;  /**< Bitfield with enabled logs. */
-       uint32_t level; /**< Log level. */
-       FILE *file;     /**< Output file set by rte_openlog_stream, or NULL. */
-       size_t dynamic_types_len;
-       struct rte_log_dynamic_type *dynamic_types;
-};
-
-/** Global log information */
-extern struct rte_logs rte_logs;
-
 /* SDK log type */
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
 #define RTE_LOGTYPE_MALLOC     1 /**< Log related to malloc. */
@@ -274,7 +262,7 @@ void rte_log_dump(FILE *f);
  * to rte_openlog_stream().
  *
  * The level argument determines if the log should be displayed or
- * not, depending on the global rte_logs variable.
+ * not, depending on the loglevel settings.
  *
  * The preferred alternative is the RTE_LOG() because it adds the
  * level and type in the logged string.
@@ -305,7 +293,7 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...)
  * to rte_openlog_stream().
  *
  * The level argument determines if the log should be displayed or
- * not, depending on the global rte_logs variable. A trailing
+ * not, depending on the loglevel settings. A trailing
  * newline may be added if needed.
  *
  * The preferred alternative is the RTE_LOG() because it adds the
lib/librte_eal/rte_eal_version.map +0 -2
index 0b18e2ef85f9..6b0dfdd9667c 100644
@@ -114,7 +114,6 @@ DPDK_21 {
        rte_log_set_level;
        rte_log_set_level_pattern;
        rte_log_set_level_regexp;
-       rte_logs;
        rte_malloc;
        rte_malloc_dump_stats;
        rte_malloc_get_socket_stats;
--

2.27.0

Signature · 1 line
David Marchand
#3 lore raw
Quoted 10 lines · On Wed, 2 Sep 2020 10:40:19 +0200 David Marchand <[email protected]>…
Quoted 3 lines · Stephen Hemminger

As announced in earlier releases, rte_logs can now be made internal to eal_common_log.

I had prepared this cleanup before my PTO and was about to send it. Just to avoid duplicate work, do you intend to work on other cleanups ?

Quoted 6 lines

Hiding this symbol is fine, but we must remove the experimental tag on rte_log_get_stream since it becomes the only way to access the log stream.

More comments below.
Thanks.

No intention on doing other cleanups, just saw this while implementing a log stream provider.

Agree, the rte_log_get_stream() can be permanent API now.

#4 lore raw

v2 cover rte_log: make internal structures private

In reply to Stephen Hemminger

v2 add additonal patch to make rte_log_get_stream not experimental

Stephen Hemminger (2):
rte_log: take experimental tag off of rte_log_get_stream
rte_log: make rte_logs private

 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_20_11.rst |  2 ++
 lib/librte_eal/common/eal_common_log.c | 11 ++++++++---
 lib/librte_eal/include/rte_log.h       | 17 ++---------------
 lib/librte_eal/rte_eal_version.map     |  3 +--
 5 files changed, 13 insertions(+), 24 deletions(-)
Signature · 1 line
2.27.0
#5 lore raw

PATCH v2 1/2 rte_log: take experimental tag off of rte_log_get_stream

Applications will need to use this API now to get internal state of rte_log.

---
 lib/librte_eal/include/rte_log.h   | 1 -
 lib/librte_eal/rte_eal_version.map | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
lib/librte_eal/include/rte_log.h +0 -1
index eaf66e4f61de..7fe0968383db 100644
@@ -112,7 +112,6 @@ int rte_openlog_stream(FILE *f);
  * @return
  *   Pointer to the stream.
  */
-__rte_experimental
 FILE *rte_log_get_stream(void);
 
 /**
lib/librte_eal/rte_eal_version.map +1 -1
index 0b18e2ef85f9..0564f2fdc7aa 100644
@@ -109,6 +109,7 @@ DPDK_21 {
 	rte_log_dump;
 	rte_log_get_global_level;
 	rte_log_get_level;
+	rte_log_get_stream;
 	rte_log_register;
 	rte_log_set_global_level;
 	rte_log_set_level;
@@ -330,7 +331,6 @@ EXPERIMENTAL {
 	rte_rand_max;
 
 	# added in 19.11
-	rte_log_get_stream;
 	rte_mcfg_get_single_file_segments;
 
 	# added in 20.02
Signature · 1 line
2.27.0
#6 lore raw

Re: [dpdk-dev] [PATCH v2 1/2] rte_log: take experimental tag off of rte_log_get_stream

Quoted 16 lines · Stephen Hemminger

Applications will need to use this API now to get internal state of rte_log.

---
 lib/librte_eal/include/rte_log.h   | 1 -
 lib/librte_eal/rte_eal_version.map | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
lib/librte_eal/include/rte_log.h +0 -0
index eaf66e4f61de..7fe0968383db 100644

lib/librte_eal/include/rte_log.h int rte_openlog_stream(FILE *f); · line 115

Quoted 5 lines
lib/librte_eal/include/rte_log.h +0 -1
@@ -112,7 +112,6 @@ int rte_openlog_stream(FILE *f);
  * @return
  *   Pointer to the stream.
  */
-__rte_experimental
 FILE *rte_log_get_stream(void);

There is still a banner in the function description. I will fix it while applying.

Signature · 1 line
David Marchand
#7 lore raw

PATCH v2 2/2 rte_log: make rte_logs private

In reply to Stephen Hemminger

As announced in earlier releases, rte_logs can now be made internal to eal_common_log.

---
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_20_11.rst |  2 ++
 lib/librte_eal/common/eal_common_log.c | 11 ++++++++---
 lib/librte_eal/include/rte_log.h       | 16 ++--------------
 lib/librte_eal/rte_eal_version.map     |  1 -
 5 files changed, 12 insertions(+), 22 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -4
index 345c38d5b630..5445a4f0a061 100644
@@ -77,10 +77,6 @@ Deprecation Notices
 * eal: The function ``rte_eal_remote_launch`` will return new error codes
   after read or write error on the pipe, instead of calling ``rte_panic``.
 
-* eal: The ``rte_logs`` struct and global symbol will be made private to
-  remove it from the externally visible ABI and allow it to be updated in the
-  future.
-
 * eal: The ``rte_dev_event`` structure will be made private to the EAL as no
   public API makes use of it.
 
doc/guides/rel_notes/release_20_11.rst +2 -0
index df227a1773b8..e422ac790912 100644
@@ -84,6 +84,8 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* eal: The ``rte_logs`` struct and global symbol was made private
+  and is no longer part of the API.
 
 ABI Changes
 -----------
lib/librte_eal/common/eal_common_log.c +8 -3
index 8835c8fff897..a25766de181a 100644
@@ -17,11 +17,16 @@
 
 #include "eal_private.h"
 
-/* global log structure */
-struct rte_logs rte_logs = {
+/** The rte_log structure. */
+static struct rte_logs {
+	uint32_t type;  /**< Bitfield with enabled logs. */
+	uint32_t level; /**< Log level. */
+	FILE *file;     /**< Output file set by rte_openlog_stream, or NULL. */
+	size_t dynamic_types_len;
+	struct rte_log_dynamic_type *dynamic_types;
+} rte_logs = {
 	.type = ~0,
 	.level = RTE_LOG_DEBUG,
-	.file = NULL,
 };
 
 struct rte_eal_opt_loglevel {
lib/librte_eal/include/rte_log.h +2 -14
index 7fe0968383db..adc5c83d4250 100644
@@ -29,18 +29,6 @@ extern "C" {
 
 struct rte_log_dynamic_type;
 
-/** The rte_log structure. */
-struct rte_logs {
-	uint32_t type;  /**< Bitfield with enabled logs. */
-	uint32_t level; /**< Log level. */
-	FILE *file;     /**< Output file set by rte_openlog_stream, or NULL. */
-	size_t dynamic_types_len;
-	struct rte_log_dynamic_type *dynamic_types;
-};
-
-/** Global log information */
-extern struct rte_logs rte_logs;
-
 /* SDK log type */
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
 #define RTE_LOGTYPE_MALLOC     1 /**< Log related to malloc. */
@@ -273,7 +261,7 @@ void rte_log_dump(FILE *f);
  * to rte_openlog_stream().
  *
  * The level argument determines if the log should be displayed or
- * not, depending on the global rte_logs variable.
+ * not, depending on the loglevel settings.
  *
  * The preferred alternative is the RTE_LOG() because it adds the
  * level and type in the logged string.
@@ -304,7 +292,7 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...)
  * to rte_openlog_stream().
  *
  * The level argument determines if the log should be displayed or
- * not, depending on the global rte_logs variable. A trailing
+ * not, depending on the loglevel settings. A trailing
  * newline may be added if needed.
  *
  * The preferred alternative is the RTE_LOG() because it adds the
lib/librte_eal/rte_eal_version.map +0 -1
index 0564f2fdc7aa..eba868ee0f38 100644
@@ -115,7 +115,6 @@ DPDK_21 {
 	rte_log_set_level;
 	rte_log_set_level_pattern;
 	rte_log_set_level_regexp;
-	rte_logs;
 	rte_malloc;
 	rte_malloc_dump_stats;
 	rte_malloc_get_socket_stats;
Signature · 1 line
2.27.0
#9 lore raw
Quoted 6 lines · On Mon, 14 Sep 2020 10:13:29 +0200 David Marchand <[email protected]>…
Quoted 4 lines · Stephen Hemminger

As announced in earlier releases, rte_logs can now be made internal to eal_common_log.

Quoted 8 lines
Quoted 2 lines

Same comment as before, the rte_log_dynamic_type struct fwd declaration can be removed from the rte_log.h header. I will fix it while applying.

Thanks