[v8,04/22] efd: replace RTE_LOGTYPE_EFD with dynamic type

Message ID 20230220233556.168553-5-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Convert static logtypes in libraries |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Feb. 20, 2023, 11:35 p.m. UTC
  Replace all uses of the global logtype with a dynamic log type.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 lib/efd/rte_efd.c               | 4 ++++
 3 files changed, 5 insertions(+), 2 deletions(-)
  

Comments

David Marchand Feb. 21, 2023, 2:55 p.m. UTC | #1
On Tue, Feb 21, 2023 at 12:36 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> Replace all uses of the global logtype with a dynamic log type.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/eal/common/eal_common_log.c | 1 -
>  lib/eal/include/rte_log.h       | 2 +-
>  lib/efd/rte_efd.c               | 4 ++++
>  3 files changed, 5 insertions(+), 2 deletions(-)

[snip]

> diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
> index 686a13775742..9edb11799c89 100644
> --- a/lib/efd/rte_efd.c
> +++ b/lib/efd/rte_efd.c
> @@ -9,6 +9,7 @@
>  #include <errno.h>
>  #include <sys/queue.h>
>
> +#include <rte_cpuflags.h>
>  #include <rte_string_fns.h>
>  #include <rte_log.h>
>  #include <rte_eal_memconfig.h>

This is unrelated, isn't it?
  
Stephen Hemminger Feb. 21, 2023, 5:07 p.m. UTC | #2
On Tue, 21 Feb 2023 15:55:29 +0100
David Marchand <david.marchand@redhat.com> wrote:

> On Tue, Feb 21, 2023 at 12:36 AM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > Replace all uses of the global logtype with a dynamic log type.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  lib/eal/common/eal_common_log.c | 1 -
> >  lib/eal/include/rte_log.h       | 2 +-
> >  lib/efd/rte_efd.c               | 4 ++++
> >  3 files changed, 5 insertions(+), 2 deletions(-)  
> 
> [snip]
> 
> > diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
> > index 686a13775742..9edb11799c89 100644
> > --- a/lib/efd/rte_efd.c
> > +++ b/lib/efd/rte_efd.c
> > @@ -9,6 +9,7 @@
> >  #include <errno.h>
> >  #include <sys/queue.h>
> >
> > +#include <rte_cpuflags.h>
> >  #include <rte_string_fns.h>
> >  #include <rte_log.h>
> >  #include <rte_eal_memconfig.h>  
> 
> This is unrelated, isn't it?

Not really, the old code worked only because it would get rte_cpuflags.h
included via rte_hash_crc.h.  When rte_hash_crc.h was fixed to not
do per-cpu setup in inline, then the cpu flags did not need to be
included there.
  
Stephen Hemminger March 29, 2023, 11:31 p.m. UTC | #3
On Tue, 21 Feb 2023 15:55:29 +0100
David Marchand <david.marchand@redhat.com> wrote:

> On Tue, Feb 21, 2023 at 12:36 AM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > Replace all uses of the global logtype with a dynamic log type.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  lib/eal/common/eal_common_log.c | 1 -
> >  lib/eal/include/rte_log.h       | 2 +-
> >  lib/efd/rte_efd.c               | 4 ++++
> >  3 files changed, 5 insertions(+), 2 deletions(-)  
> 
> [snip]
> 
> > diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
> > index 686a13775742..9edb11799c89 100644
> > --- a/lib/efd/rte_efd.c
> > +++ b/lib/efd/rte_efd.c
> > @@ -9,6 +9,7 @@
> >  #include <errno.h>
> >  #include <sys/queue.h>
> >
> > +#include <rte_cpuflags.h>
> >  #include <rte_string_fns.h>
> >  #include <rte_log.h>
> >  #include <rte_eal_memconfig.h>  
> 
> This is unrelated, isn't it?

Not really, previously the hash library would cause cpuflags to be included.
But that doesn't happen now that the hash function is not inline there.
  

Patch

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 5421da008f5b..25bb17938cc1 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -365,7 +365,6 @@  static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_MBUF,       "lib.mbuf"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
-	{RTE_LOGTYPE_EFD,        "lib.efd"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
 	{RTE_LOGTYPE_USER2,      "user2"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 16d6ea31583d..0b39795b4d06 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -44,7 +44,7 @@  extern "C" {
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
 #define RTE_LOGTYPE_MBUF      16 /**< Log related to mbuf. */
 #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
-#define RTE_LOGTYPE_EFD       18 /**< Log related to EFD. */
+				 /* was RTE_LOGTYPE_EFD */
 #define RTE_LOGTYPE_EVENTDEV  19 /**< Log related to eventdev. */
 				 /* was RTE_LOGTYPE_GSO */
 
diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
index 686a13775742..9edb11799c89 100644
--- a/lib/efd/rte_efd.c
+++ b/lib/efd/rte_efd.c
@@ -9,6 +9,7 @@ 
 #include <errno.h>
 #include <sys/queue.h>
 
+#include <rte_cpuflags.h>
 #include <rte_string_fns.h>
 #include <rte_log.h>
 #include <rte_eal_memconfig.h>
@@ -28,6 +29,9 @@ 
 #include "rte_efd_arm64.h"
 #endif
 
+RTE_LOG_REGISTER_DEFAULT(efd_logtype, INFO);
+#define RTE_LOGTYPE_EFD	efd_logtype
+
 #define EFD_KEY(key_idx, table) (table->keys + ((key_idx) * table->key_len))
 /** Hash function used to determine chunk_id and bin_id for a group */
 #define EFD_HASH(key, table) \