DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v12 00/22] Covert static log types in libraries to dynamic
@ 2023-03-29 23:40 Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 01/22] gso: don't log message on non TCP/UDP Stephen Hemminger
                   ` (23 more replies)
  0 siblings, 24 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

This patchset removes the main uses of static LOGTYPE's in DPDK
libraries. It starts with the easy one and goes on to the more complex ones.

There are several options on how to treat the old static types:
leave them there, mark as deprecated, or remove them.
This version removes them since there is no guarantee in current
DPDK policies that says they can't be removed.

Note: there is one patch in this series that will get
flagged incorrectly as an ABI change.

v12 - rebase and add table and pipeline libraries

v11 - fix include check on arm cross build

v10 - add necessary rte_compat.h in thash_gfni stub for arm

v9 - fix handling of crc32 alg in lib/hash.
     make it an internal global variable.
     fix gfni stubs for case where they are not used.

Stephen Hemminger (22):
  gso: don't log message on non TCP/UDP
  eal: drop no longer used GSO logtype
  log: drop unused RTE_LOGTYPE_TIMER
  efd: convert RTE_LOGTYPE_EFD to dynamic type
  mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
  acl: convert RTE_LOGTYPE_ACL to dynamic type
  examples/power: replace use of RTE_LOGTYPE_POWER
  examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
  power: convert RTE_LOGTYPE_POWER to dynamic type
  ring: convert RTE_LOGTYPE_RING to dynamic type
  mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
  lpm: convert RTE_LOGTYPE_LPM to dynamic types
  kni: convert RTE_LOGTYPE_KNI to dynamic type
  sched: convert RTE_LOGTYPE_SCHED to dynamic type
  examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
  port: convert RTE_LOGTYPE_PORT to dynamic type
  hash: move rte_thash_gfni stubs out of header file
  hash: move rte_hash_set_alg out header
  hash: convert RTE_LOGTYPE_HASH to dynamic type
  table: convert RTE_LOGTYPE_TABLE to dynamic type
  app/test: remove use of RTE_LOGTYPE_PIPELINE
  pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type

 app/test/test_acl.c             |  3 +-
 app/test/test_table_acl.c       | 50 +++++++++++-------------
 app/test/test_table_pipeline.c  | 40 +++++++++----------
 examples/distributor/main.c     |  2 +-
 examples/ipsec-secgw/sa.c       |  6 +--
 examples/l3fwd-power/main.c     | 17 +++++----
 lib/acl/acl_bld.c               |  1 +
 lib/acl/acl_gen.c               |  1 +
 lib/acl/acl_log.h               |  4 ++
 lib/acl/rte_acl.c               |  4 ++
 lib/acl/tb_mem.c                |  3 +-
 lib/eal/common/eal_common_log.c | 17 ---------
 lib/eal/include/rte_log.h       | 34 ++++++++---------
 lib/efd/rte_efd.c               |  4 ++
 lib/fib/fib_log.h               |  4 ++
 lib/fib/rte_fib.c               |  3 ++
 lib/fib/rte_fib6.c              |  2 +
 lib/gso/rte_gso.c               |  4 +-
 lib/gso/rte_gso.h               |  1 +
 lib/hash/meson.build            |  9 ++++-
 lib/hash/rte_crc_arm64.h        |  8 ++--
 lib/hash/rte_crc_x86.h          | 10 ++---
 lib/hash/rte_cuckoo_hash.c      |  5 +++
 lib/hash/rte_fbk_hash.c         |  5 +++
 lib/hash/rte_hash_crc.c         | 68 +++++++++++++++++++++++++++++++++
 lib/hash/rte_hash_crc.h         | 48 ++---------------------
 lib/hash/rte_thash.c            |  3 ++
 lib/hash/rte_thash_gfni.c       | 50 ++++++++++++++++++++++++
 lib/hash/rte_thash_gfni.h       | 30 +++++----------
 lib/hash/version.map            | 11 ++++++
 lib/kni/rte_kni.c               |  3 ++
 lib/lpm/lpm_log.h               |  4 ++
 lib/lpm/rte_lpm.c               |  3 ++
 lib/lpm/rte_lpm6.c              |  1 +
 lib/mbuf/mbuf_log.h             |  4 ++
 lib/mbuf/rte_mbuf.c             |  4 ++
 lib/mbuf/rte_mbuf_dyn.c         |  2 +
 lib/mbuf/rte_mbuf_pool_ops.c    |  2 +
 lib/mempool/rte_mempool.c       |  2 +
 lib/mempool/rte_mempool.h       |  8 ++++
 lib/mempool/version.map         |  3 ++
 lib/pipeline/rte_pipeline.c     |  2 +
 lib/pipeline/rte_pipeline.h     |  5 +++
 lib/port/rte_port_ethdev.c      |  3 ++
 lib/port/rte_port_eventdev.c    |  4 ++
 lib/port/rte_port_fd.c          |  3 ++
 lib/port/rte_port_frag.c        |  3 ++
 lib/port/rte_port_kni.c         |  3 ++
 lib/port/rte_port_ras.c         |  3 ++
 lib/port/rte_port_ring.c        |  3 ++
 lib/port/rte_port_sched.c       |  3 ++
 lib/port/rte_port_source_sink.c |  3 ++
 lib/port/rte_port_sym_crypto.c  |  3 ++
 lib/power/guest_channel.c       |  3 +-
 lib/power/power_common.c        |  2 +
 lib/power/power_common.h        |  3 +-
 lib/power/power_kvm_vm.c        |  1 +
 lib/power/rte_power.c           |  1 +
 lib/rib/rib_log.h               |  4 ++
 lib/rib/rte_rib.c               |  3 ++
 lib/rib/rte_rib6.c              |  3 ++
 lib/ring/rte_ring.c             |  3 ++
 lib/sched/rte_pie.c             |  1 +
 lib/sched/rte_sched.c           |  5 +++
 lib/sched/rte_sched_log.h       |  4 ++
 lib/table/meson.build           |  1 +
 lib/table/rte_table.c           |  8 ++++
 lib/table/rte_table.h           |  4 ++
 68 files changed, 391 insertions(+), 176 deletions(-)
 create mode 100644 lib/acl/acl_log.h
 create mode 100644 lib/fib/fib_log.h
 create mode 100644 lib/hash/rte_hash_crc.c
 create mode 100644 lib/hash/rte_thash_gfni.c
 create mode 100644 lib/lpm/lpm_log.h
 create mode 100644 lib/mbuf/mbuf_log.h
 create mode 100644 lib/rib/rib_log.h
 create mode 100644 lib/sched/rte_sched_log.h
 create mode 100644 lib/table/rte_table.c

-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 01/22] gso: don't log message on non TCP/UDP
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 02/22] eal: drop no longer used GSO logtype Stephen Hemminger
                   ` (22 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Jiayu Hu, Mark Kavanagh

If a large packet is passed into GSO routines of unknown protocol
then library would log a message.
Better to tell the application instead of logging.

Fixes: 119583797b6a ("gso: support TCP/IPv4 GSO")
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/gso/rte_gso.c | 4 +---
 lib/gso/rte_gso.h | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/gso/rte_gso.c b/lib/gso/rte_gso.c
index 4b59217c16ee..e29c7d884aed 100644
--- a/lib/gso/rte_gso.c
+++ b/lib/gso/rte_gso.c
@@ -80,9 +80,7 @@ rte_gso_segment(struct rte_mbuf *pkt,
 		ret = gso_udp4_segment(pkt, gso_size, direct_pool,
 				indirect_pool, pkts_out, nb_pkts_out);
 	} else {
-		/* unsupported packet, skip */
-		RTE_LOG(DEBUG, GSO, "Unsupported packet type\n");
-		ret = 0;
+		ret = -ENOTSUP;	/* only UDP or TCP allowed */
 	}
 
 	if (ret < 0) {
diff --git a/lib/gso/rte_gso.h b/lib/gso/rte_gso.h
index 40922524df42..c0f9a1b66ff2 100644
--- a/lib/gso/rte_gso.h
+++ b/lib/gso/rte_gso.h
@@ -114,6 +114,7 @@ struct rte_gso_ctx {
  *  - The number of GSO segments filled in pkts_out on success.
  *  - Return 0 if it does not need to be GSO'd.
  *  - Return -ENOMEM if run out of memory in MBUF pools.
+ *  - Return -ENOTSUP for protocols that can not be segmented
  *  - Return -EINVAL for invalid parameters.
  */
 int rte_gso_segment(struct rte_mbuf *pkt,
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 02/22] eal: drop no longer used GSO logtype
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 01/22] gso: don't log message on non TCP/UDP Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 03/22] log: drop unused RTE_LOGTYPE_TIMER Stephen Hemminger
                   ` (21 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The message that used this was replaced in previous patch.

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

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index bd7b188ceb4a..894701e8c19c 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -368,7 +368,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EFD,        "lib.efd"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
-	{RTE_LOGTYPE_GSO,        "lib.gso"},
 	{RTE_LOGTYPE_USER1,      "user1"},
 	{RTE_LOGTYPE_USER2,      "user2"},
 	{RTE_LOGTYPE_USER3,      "user3"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 6d2b0856a565..11d517806054 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -46,7 +46,7 @@ extern "C" {
 #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
 #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. */
+				 /* was RTE_LOGTYPE_GSO */
 
 /* these log types can be used in an application */
 #define RTE_LOGTYPE_USER1     24 /**< User-defined log type 1. */
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 03/22] log: drop unused RTE_LOGTYPE_TIMER
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 01/22] gso: don't log message on non TCP/UDP Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 02/22] eal: drop no longer used GSO logtype Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 04/22] efd: convert RTE_LOGTYPE_EFD to dynamic type Stephen Hemminger
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The timer code does not use rte_log.

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

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 894701e8c19c..5421da008f5b 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -352,7 +352,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_MALLOC,     "lib.malloc"},
 	{RTE_LOGTYPE_RING,       "lib.ring"},
 	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
-	{RTE_LOGTYPE_TIMER,      "lib.timer"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 11d517806054..16d6ea31583d 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -30,7 +30,7 @@ extern "C" {
 #define RTE_LOGTYPE_MALLOC     1 /**< Log related to malloc. */
 #define RTE_LOGTYPE_RING       2 /**< Log related to ring. */
 #define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
-#define RTE_LOGTYPE_TIMER      4 /**< Log related to timers. */
+				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
 #define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 04/22] efd: convert RTE_LOGTYPE_EFD to dynamic type
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (2 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 03/22] log: drop unused RTE_LOGTYPE_TIMER Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 05/22] mbuf: convert RTE_LOGTYPE_MBUF " Stephen Hemminger
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Byron Marohn, Yipeng Wang

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(-)

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) \
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 05/22] mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (3 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 04/22] efd: convert RTE_LOGTYPE_EFD to dynamic type Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 06/22] acl: convert RTE_LOGTYPE_ACL " Stephen Hemminger
                   ` (18 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Olivier Matz

Introduce a new dynamic logtype for mbuf related messages.
Since this is used in multiple files put one macro in mbuf_log.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 lib/mbuf/mbuf_log.h             | 4 ++++
 lib/mbuf/rte_mbuf.c             | 4 ++++
 lib/mbuf/rte_mbuf_dyn.c         | 2 ++
 lib/mbuf/rte_mbuf_pool_ops.c    | 2 ++
 6 files changed, 13 insertions(+), 2 deletions(-)
 create mode 100644 lib/mbuf/mbuf_log.h

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 25bb17938cc1..d4389e436913 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -363,7 +363,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_PORT,       "lib.port"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
-	{RTE_LOGTYPE_MBUF,       "lib.mbuf"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 0b39795b4d06..941fbe51fd30 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -42,7 +42,7 @@ extern "C" {
 #define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
 #define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
-#define RTE_LOGTYPE_MBUF      16 /**< Log related to mbuf. */
+				 /* was RTE_LOGTYPE_MBUF */
 #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
 				 /* was RTE_LOGTYPE_EFD */
 #define RTE_LOGTYPE_EVENTDEV  19 /**< Log related to eventdev. */
diff --git a/lib/mbuf/mbuf_log.h b/lib/mbuf/mbuf_log.h
new file mode 100644
index 000000000000..d759a9a25501
--- /dev/null
+++ b/lib/mbuf/mbuf_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int mbuf_logtype;
+#define RTE_LOGTYPE_MBUF	mbuf_logtype
diff --git a/lib/mbuf/rte_mbuf.c b/lib/mbuf/rte_mbuf.c
index 686e797c80c4..3eccc618270b 100644
--- a/lib/mbuf/rte_mbuf.c
+++ b/lib/mbuf/rte_mbuf.c
@@ -20,6 +20,10 @@
 #include <rte_errno.h>
 #include <rte_memcpy.h>
 
+#include "mbuf_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(mbuf_logtype, INFO);
+
 /*
  * pktmbuf pool constructor, given as a callback function to
  * rte_mempool_create(), or called directly if using
diff --git a/lib/mbuf/rte_mbuf_dyn.c b/lib/mbuf/rte_mbuf_dyn.c
index 5049508bea6e..4fb1863a1043 100644
--- a/lib/mbuf/rte_mbuf_dyn.c
+++ b/lib/mbuf/rte_mbuf_dyn.c
@@ -17,6 +17,8 @@
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
 
+#include "mbuf_log.h"
+
 #define RTE_MBUF_DYN_MZNAME "rte_mbuf_dyn"
 
 struct mbuf_dynfield_elt {
diff --git a/lib/mbuf/rte_mbuf_pool_ops.c b/lib/mbuf/rte_mbuf_pool_ops.c
index 4c91f4ce8569..5318430126cb 100644
--- a/lib/mbuf/rte_mbuf_pool_ops.c
+++ b/lib/mbuf/rte_mbuf_pool_ops.c
@@ -8,6 +8,8 @@
 #include <rte_errno.h>
 #include <rte_mbuf_pool_ops.h>
 
+#include "mbuf_log.h"
+
 int
 rte_mbuf_set_platform_mempool_ops(const char *ops_name)
 {
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 06/22] acl: convert RTE_LOGTYPE_ACL to dynamic type
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (4 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 05/22] mbuf: convert RTE_LOGTYPE_MBUF " Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-06-05 13:40   ` Константин Ананьев
  2023-03-29 23:40 ` [PATCH v12 07/22] examples/power: replace use of RTE_LOGTYPE_POWER Stephen Hemminger
                   ` (17 subsequent siblings)
  23 siblings, 1 reply; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Konstantin Ananyev

Get rid of RTE_LOGTYPE_ACL and RTE_LOGTYPE_MALLOC.
For ACL library use a dynamic type.
The one message using RTE_LOGTYPE_MALLOC should have been
under the ACL logtype anyway.

The test code should not have been using fixed log type
so just change that to stderr.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_acl.c             | 3 ++-
 lib/acl/acl_bld.c               | 1 +
 lib/acl/acl_gen.c               | 1 +
 lib/acl/acl_log.h               | 4 ++++
 lib/acl/rte_acl.c               | 4 ++++
 lib/acl/tb_mem.c                | 3 ++-
 lib/eal/common/eal_common_log.c | 2 --
 lib/eal/include/rte_log.h       | 4 ++--
 8 files changed, 16 insertions(+), 6 deletions(-)
 create mode 100644 lib/acl/acl_log.h

diff --git a/app/test/test_acl.c b/app/test/test_acl.c
index 623f34682e69..75588978a720 100644
--- a/app/test/test_acl.c
+++ b/app/test/test_acl.c
@@ -154,7 +154,8 @@ rte_acl_ipv4vlan_add_rules(struct rte_acl_ctx *ctx,
 	for (i = 0; i != num; i++) {
 		rc = acl_ipv4vlan_check_rule(rules + i);
 		if (rc != 0) {
-			RTE_LOG(ERR, ACL, "%s: rule #%u is invalid\n",
+			fprintf(stderr,
+				"%s: rule #%u is invalid\n",
 				__func__, i + 1);
 			return rc;
 		}
diff --git a/lib/acl/acl_bld.c b/lib/acl/acl_bld.c
index 2816632803bd..f38e6478315f 100644
--- a/lib/acl/acl_bld.c
+++ b/lib/acl/acl_bld.c
@@ -5,6 +5,7 @@
 #include <rte_acl.h>
 #include "tb_mem.h"
 #include "acl.h"
+#include "acl_log.h"
 
 #define	ACL_POOL_ALIGN		8
 #define	ACL_POOL_ALLOC_MIN	0x800000
diff --git a/lib/acl/acl_gen.c b/lib/acl/acl_gen.c
index e759a2ca1598..54ec485d0c58 100644
--- a/lib/acl/acl_gen.c
+++ b/lib/acl/acl_gen.c
@@ -4,6 +4,7 @@
 
 #include <rte_acl.h>
 #include "acl.h"
+#include "acl_log.h"
 
 #define	QRANGE_MIN	((uint8_t)INT8_MIN)
 
diff --git a/lib/acl/acl_log.h b/lib/acl/acl_log.h
new file mode 100644
index 000000000000..b55573cbe207
--- /dev/null
+++ b/lib/acl/acl_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int acl_logtype;
+#define RTE_LOGTYPE_ACL	acl_logtype
diff --git a/lib/acl/rte_acl.c b/lib/acl/rte_acl.c
index a61c3ba188da..a29decb1f6ca 100644
--- a/lib/acl/rte_acl.c
+++ b/lib/acl/rte_acl.c
@@ -6,8 +6,12 @@
 #include <rte_string_fns.h>
 #include <rte_acl.h>
 #include <rte_tailq.h>
+#include <rte_log.h>
 
 #include "acl.h"
+#include "acl_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(acl_logtype, INFO);
 
 TAILQ_HEAD(rte_acl_list, rte_tailq_entry);
 
diff --git a/lib/acl/tb_mem.c b/lib/acl/tb_mem.c
index f14d7b4fa26e..6a9d96aaeda2 100644
--- a/lib/acl/tb_mem.c
+++ b/lib/acl/tb_mem.c
@@ -3,6 +3,7 @@
  */
 
 #include "tb_mem.h"
+#include "acl_log.h"
 
 /*
  *  Memory management routines for temporary memory.
@@ -25,7 +26,7 @@ tb_pool(struct tb_mem_pool *pool, size_t sz)
 	size = sz + pool->alignment - 1;
 	block = calloc(1, size + sizeof(*pool->block));
 	if (block == NULL) {
-		RTE_LOG(ERR, MALLOC, "%s(%zu)\n failed, currently allocated "
+		RTE_LOG(ERR, ACL, "%s(%zu)\n failed, currently allocated "
 			"by pool: %zu bytes\n", __func__, sz, pool->alloc);
 		siglongjmp(pool->fail, -ENOMEM);
 		return NULL;
diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index d4389e436913..9e853addb717 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -349,14 +349,12 @@ struct logtype {
 
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
-	{RTE_LOGTYPE_MALLOC,     "lib.malloc"},
 	{RTE_LOGTYPE_RING,       "lib.ring"},
 	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
 	{RTE_LOGTYPE_KNI,        "lib.kni"},
-	{RTE_LOGTYPE_ACL,        "lib.acl"},
 	{RTE_LOGTYPE_POWER,      "lib.power"},
 	{RTE_LOGTYPE_METER,      "lib.meter"},
 	{RTE_LOGTYPE_SCHED,      "lib.sched"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 941fbe51fd30..1408722b2c2f 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -27,7 +27,7 @@ extern "C" {
 
 /* SDK log type */
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
-#define RTE_LOGTYPE_MALLOC     1 /**< Log related to malloc. */
+				 /* was RTE_LOGTYPE_MALLOC */
 #define RTE_LOGTYPE_RING       2 /**< Log related to ring. */
 #define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
 				 /* was RTE_LOGTYPE_TIMER */
@@ -35,7 +35,7 @@ extern "C" {
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
 #define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
 #define RTE_LOGTYPE_KNI        8 /**< Log related to KNI. */
-#define RTE_LOGTYPE_ACL        9 /**< Log related to ACL. */
+				 /* was RTE_LOGTYPE_ACL */
 #define RTE_LOGTYPE_POWER     10 /**< Log related to power. */
 #define RTE_LOGTYPE_METER     11 /**< Log related to QoS meter. */
 #define RTE_LOGTYPE_SCHED     12 /**< Log related to QoS port scheduler. */
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 07/22] examples/power: replace use of RTE_LOGTYPE_POWER
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (5 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 06/22] acl: convert RTE_LOGTYPE_ACL " Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 08/22] examples/l3fwd-power: " Stephen Hemminger
                   ` (16 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, David Hunt

Don't use static logtype in sample application.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Hunt <david.hunt@intel.com>
---
 examples/distributor/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 21304d661873..542f76cf9664 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -679,7 +679,7 @@ init_power_library(void)
 		/* init power management library */
 		ret = rte_power_init(lcore_id);
 		if (ret) {
-			RTE_LOG(ERR, POWER,
+			fprintf(stderr,
 				"Library initialization failed on core %u\n",
 				lcore_id);
 			/*
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 08/22] examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (6 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 07/22] examples/power: replace use of RTE_LOGTYPE_POWER Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 09/22] power: convert RTE_LOGTYPE_POWER to dynamic type Stephen Hemminger
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, David Hunt

Convert to using a dynamic logtype for the application.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Hunt <david.hunt@intel.com>
---
 examples/l3fwd-power/main.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 3f01cbd9e277..f3330fd735dd 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -51,7 +51,8 @@
 #include "perf_core.h"
 #include "main.h"
 
-#define RTE_LOGTYPE_L3FWD_POWER RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER(l3fwd_power_logtype, l3fwd.power, INFO);
+#define RTE_LOGTYPE_L3FWD_POWER l3fwd_power_logtype
 
 #define MAX_PKT_BURST 32
 
@@ -2236,7 +2237,7 @@ init_power_library(void)
 		/* init power management library */
 		ret = rte_power_init(lcore_id);
 		if (ret) {
-			RTE_LOG(ERR, POWER,
+			RTE_LOG(ERR, L3FWD_POWER,
 				"Library initialization failed on core %u\n",
 				lcore_id);
 			return ret;
@@ -2246,8 +2247,8 @@ init_power_library(void)
 		if (env != PM_ENV_ACPI_CPUFREQ &&
 				env != PM_ENV_PSTATE_CPUFREQ &&
 				env != PM_ENV_CPPC_CPUFREQ) {
-			RTE_LOG(ERR, POWER,
-				"Only ACPI, PSTATE and CPPC mode are supported\n");
+			RTE_LOG(ERR, L3FWD_POWER,
+				"Only ACPI and PSTATE mode are supported\n");
 			return -1;
 		}
 	}
@@ -2264,7 +2265,7 @@ deinit_power_library(void)
 		/* deinit power management library */
 		ret = rte_power_exit(lcore_id);
 		if (ret) {
-			RTE_LOG(ERR, POWER,
+			RTE_LOG(ERR, L3FWD_POWER,
 				"Library deinitialization failed on core %u\n",
 				lcore_id);
 			return ret;
@@ -2333,7 +2334,7 @@ update_telemetry(__rte_unused struct rte_timer *tim,
 	ret = rte_metrics_update_values(RTE_METRICS_GLOBAL, telstats_index,
 					values, RTE_DIM(values));
 	if (ret < 0)
-		RTE_LOG(WARNING, POWER, "failed to update metrics\n");
+		RTE_LOG(WARNING, L3FWD_POWER, "failed to update metrics\n");
 }
 
 static int
@@ -2382,7 +2383,7 @@ launch_timer(unsigned int lcore_id)
 				rte_get_main_lcore());
 	}
 
-	RTE_LOG(INFO, POWER, "Bring up the Timer\n");
+	RTE_LOG(INFO, L3FWD_POWER, "Bring up the Timer\n");
 
 	telemetry_setup_timer();
 
@@ -2398,7 +2399,7 @@ launch_timer(unsigned int lcore_id)
 		}
 	}
 
-	RTE_LOG(INFO, POWER, "Timer_subsystem is done\n");
+	RTE_LOG(INFO, L3FWD_POWER, "Timer_subsystem is done\n");
 
 	return 0;
 }
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 09/22] power: convert RTE_LOGTYPE_POWER to dynamic type
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (7 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 08/22] examples/l3fwd-power: " Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 10/22] ring: convert RTE_LOGTYPE_RING " Stephen Hemminger
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, David Hunt

Use dynamic log type for power library.
Also replace use of RTE_LOGTYPE_USER1 with lib.power.guest.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Hunt <david.hunt@intel.com>
---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 lib/power/guest_channel.c       | 3 ++-
 lib/power/power_common.c        | 2 ++
 lib/power/power_common.h        | 3 ++-
 lib/power/power_kvm_vm.c        | 1 +
 lib/power/rte_power.c           | 1 +
 7 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 9e853addb717..39e1e6680dea 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -355,7 +355,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
 	{RTE_LOGTYPE_KNI,        "lib.kni"},
-	{RTE_LOGTYPE_POWER,      "lib.power"},
 	{RTE_LOGTYPE_METER,      "lib.meter"},
 	{RTE_LOGTYPE_SCHED,      "lib.sched"},
 	{RTE_LOGTYPE_PORT,       "lib.port"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 1408722b2c2f..7d4345acceca 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -36,7 +36,7 @@ extern "C" {
 #define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
 #define RTE_LOGTYPE_KNI        8 /**< Log related to KNI. */
 				 /* was RTE_LOGTYPE_ACL */
-#define RTE_LOGTYPE_POWER     10 /**< Log related to power. */
+				 /* was RTE_LOGTYPE_POWER */
 #define RTE_LOGTYPE_METER     11 /**< Log related to QoS meter. */
 #define RTE_LOGTYPE_SCHED     12 /**< Log related to QoS port scheduler. */
 #define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c
index 7b2ae0b6506f..4932a0528691 100644
--- a/lib/power/guest_channel.c
+++ b/lib/power/guest_channel.c
@@ -17,7 +17,8 @@
 
 #include "guest_channel.h"
 
-#define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_SUFFIX(guest_channel_logtype, guest, INFO);
+#define RTE_LOGTYPE_GUEST_CHANNEL guest_channel_logtype
 
 /* Timeout for incoming message in milliseconds. */
 #define TIMEOUT 10
diff --git a/lib/power/power_common.c b/lib/power/power_common.c
index 1e09facb863f..bf77eafa886b 100644
--- a/lib/power/power_common.c
+++ b/lib/power/power_common.c
@@ -12,6 +12,8 @@
 
 #include "power_common.h"
 
+RTE_LOG_REGISTER_DEFAULT(power_logtype, INFO);
+
 #define POWER_SYSFILE_SCALING_DRIVER   \
 		"/sys/devices/system/cpu/cpu%u/cpufreq/scaling_driver"
 #define POWER_SYSFILE_GOVERNOR  \
diff --git a/lib/power/power_common.h b/lib/power/power_common.h
index c1c713927621..63a3a443509e 100644
--- a/lib/power/power_common.h
+++ b/lib/power/power_common.h
@@ -5,11 +5,12 @@
 #ifndef _POWER_COMMON_H_
 #define _POWER_COMMON_H_
 
-
 #include <rte_common.h>
 
 #define RTE_POWER_INVALID_FREQ_INDEX (~0)
 
+extern int power_logtype;
+#define RTE_LOGTYPE_POWER power_logtype
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
 #define POWER_DEBUG_TRACE(fmt, args...) \
diff --git a/lib/power/power_kvm_vm.c b/lib/power/power_kvm_vm.c
index 6a8109d44959..db031f43105a 100644
--- a/lib/power/power_kvm_vm.c
+++ b/lib/power/power_kvm_vm.c
@@ -8,6 +8,7 @@
 
 #include "rte_power_guest_channel.h"
 #include "guest_channel.h"
+#include "power_common.h"
 #include "power_kvm_vm.h"
 
 #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
diff --git a/lib/power/rte_power.c b/lib/power/rte_power.c
index 63a43bd8f5ae..db0e7705a9ef 100644
--- a/lib/power/rte_power.c
+++ b/lib/power/rte_power.c
@@ -10,6 +10,7 @@
 #include "rte_power.h"
 #include "power_acpi_cpufreq.h"
 #include "power_cppc_cpufreq.h"
+#include "power_common.h"
 #include "power_kvm_vm.h"
 #include "power_pstate_cpufreq.h"
 
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 10/22] ring: convert RTE_LOGTYPE_RING to dynamic type
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (8 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 09/22] power: convert RTE_LOGTYPE_POWER to dynamic type Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-06-05 13:41   ` Константин Ананьев
  2023-03-29 23:40 ` [PATCH v12 11/22] mempool: convert RTE_LOGTYPE_MEMPOOL " Stephen Hemminger
                   ` (13 subsequent siblings)
  23 siblings, 1 reply; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Honnappa Nagarahalli, Konstantin Ananyev

The logtype for ring only used in library.

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

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 39e1e6680dea..5f15e312f15b 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -349,7 +349,6 @@ struct logtype {
 
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
-	{RTE_LOGTYPE_RING,       "lib.ring"},
 	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 7d4345acceca..31a2ee2f6b6f 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -28,7 +28,7 @@ extern "C" {
 /* SDK log type */
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
 				 /* was RTE_LOGTYPE_MALLOC */
-#define RTE_LOGTYPE_RING       2 /**< Log related to ring. */
+				 /* was RTE_LOGTYPE_RING */
 #define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c
index 8ed455043dee..ae57acd7cd11 100644
--- a/lib/ring/rte_ring.c
+++ b/lib/ring/rte_ring.c
@@ -26,6 +26,9 @@
 #include "rte_ring.h"
 #include "rte_ring_elem.h"
 
+RTE_LOG_REGISTER_DEFAULT(ring_logtype, INFO);
+#define RTE_LOGTYPE_RING ring_logtype
+
 TAILQ_HEAD(rte_ring_list, rte_tailq_entry);
 
 static struct rte_tailq_elem rte_ring_tailq = {
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 11/22] mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (9 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 10/22] ring: convert RTE_LOGTYPE_RING " Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 12/22] lpm: convert RTE_LOGTYPE_LPM to dynamic types Stephen Hemminger
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Olivier Matz, Andrew Rybchenko

Convert from RTE_LOGTYPE_MEMPOOL to logtype_mempool.

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

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 5f15e312f15b..4025d2039d55 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -349,7 +349,6 @@ struct logtype {
 
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
-	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 31a2ee2f6b6f..9f86bfdd0198 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -29,7 +29,7 @@ extern "C" {
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
 				 /* was RTE_LOGTYPE_MALLOC */
 				 /* was RTE_LOGTYPE_RING */
-#define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
+				 /* was RTE_LOGTYPE_MEMPOOL */
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index cf5dea2304a7..b609a94fdf9d 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -31,6 +31,8 @@
 #include "mempool_trace.h"
 #include "rte_mempool.h"
 
+RTE_LOG_REGISTER_DEFAULT(rte_mempool_logtype, INFO);
+
 TAILQ_HEAD(rte_mempool_list, rte_tailq_entry);
 
 static struct rte_tailq_elem rte_mempool_tailq = {
diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
index 9f530db24ba1..db01acc19b02 100644
--- a/lib/mempool/rte_mempool.h
+++ b/lib/mempool/rte_mempool.h
@@ -43,6 +43,7 @@
 #include <rte_spinlock.h>
 #include <rte_debug.h>
 #include <rte_lcore.h>
+#include <rte_log.h>
 #include <rte_branch_prediction.h>
 #include <rte_ring.h>
 #include <rte_memcpy.h>
@@ -175,6 +176,13 @@ struct rte_mempool_objtlr {
 
 #endif
 
+
+/**
+ * @internal Logtype used for mempool related messages.
+ */
+extern int rte_mempool_logtype;
+#define RTE_LOGTYPE_MEMPOOL	rte_mempool_logtype
+
 /**
  * A list of memory where objects are stored
  */
diff --git a/lib/mempool/version.map b/lib/mempool/version.map
index dff2d1cb5555..eb2c12127560 100644
--- a/lib/mempool/version.map
+++ b/lib/mempool/version.map
@@ -57,4 +57,7 @@ INTERNAL {
 	# added in 21.11
 	rte_mempool_event_callback_register;
 	rte_mempool_event_callback_unregister;
+
+	# added in 23.07
+	rte_mempool_logtype;
 };
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 12/22] lpm: convert RTE_LOGTYPE_LPM to dynamic types
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (10 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 11/22] mempool: convert RTE_LOGTYPE_MEMPOOL " Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 13/22] kni: convert RTE_LOGTYPE_KNI to dynamic type Stephen Hemminger
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Vladimir Medvedkin, Bruce Richardson

Split lpm and lpm6 into separate log types since they
are in different files and user may want to change log
levels for IPv4 vs IPv6.

For rib and fib libraries give them own types as well.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 lib/fib/fib_log.h               | 4 ++++
 lib/fib/rte_fib.c               | 3 +++
 lib/fib/rte_fib6.c              | 2 ++
 lib/lpm/lpm_log.h               | 4 ++++
 lib/lpm/rte_lpm.c               | 3 +++
 lib/lpm/rte_lpm6.c              | 1 +
 lib/rib/rib_log.h               | 4 ++++
 lib/rib/rte_rib.c               | 3 +++
 lib/rib/rte_rib6.c              | 3 +++
 11 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 lib/fib/fib_log.h
 create mode 100644 lib/lpm/lpm_log.h
 create mode 100644 lib/rib/rib_log.h

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 4025d2039d55..6e2007e6ed4f 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -351,7 +351,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
-	{RTE_LOGTYPE_LPM,        "lib.lpm"},
 	{RTE_LOGTYPE_KNI,        "lib.kni"},
 	{RTE_LOGTYPE_METER,      "lib.meter"},
 	{RTE_LOGTYPE_SCHED,      "lib.sched"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 9f86bfdd0198..115a48bf05f5 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -33,7 +33,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
-#define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
+				 /* was RTE_LOGTYPE_LPM */
 #define RTE_LOGTYPE_KNI        8 /**< Log related to KNI. */
 				 /* was RTE_LOGTYPE_ACL */
 				 /* was RTE_LOGTYPE_POWER */
diff --git a/lib/fib/fib_log.h b/lib/fib/fib_log.h
new file mode 100644
index 000000000000..c731c820f621
--- /dev/null
+++ b/lib/fib/fib_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int fib_logtype;
+#define RTE_LOGTYPE_LPM fib_logtype
diff --git a/lib/fib/rte_fib.c b/lib/fib/rte_fib.c
index 0c3b20e00a5a..f88e71a59d5a 100644
--- a/lib/fib/rte_fib.c
+++ b/lib/fib/rte_fib.c
@@ -17,6 +17,9 @@
 #include <rte_fib.h>
 
 #include "dir24_8.h"
+#include "fib_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(fib_logtype, INFO);
 
 TAILQ_HEAD(rte_fib_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_fib_tailq = {
diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c
index 28c69b38999f..ab1d9604796f 100644
--- a/lib/fib/rte_fib6.c
+++ b/lib/fib/rte_fib6.c
@@ -10,6 +10,7 @@
 #include <rte_eal_memconfig.h>
 #include <rte_tailq.h>
 #include <rte_errno.h>
+#include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_string_fns.h>
 
@@ -17,6 +18,7 @@
 #include <rte_fib6.h>
 
 #include "trie.h"
+#include "fib_log.h"
 
 TAILQ_HEAD(rte_fib6_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_fib6_tailq = {
diff --git a/lib/lpm/lpm_log.h b/lib/lpm/lpm_log.h
new file mode 100644
index 000000000000..a0621b70a5fe
--- /dev/null
+++ b/lib/lpm/lpm_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int lpm_logtype;
+#define RTE_LOGTYPE_LPM lpm_logtype
diff --git a/lib/lpm/rte_lpm.c b/lib/lpm/rte_lpm.c
index cdcd1b7f9e47..0ca82147866a 100644
--- a/lib/lpm/rte_lpm.c
+++ b/lib/lpm/rte_lpm.c
@@ -18,6 +18,9 @@
 #include <rte_tailq.h>
 
 #include "rte_lpm.h"
+#include "lpm_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(lpm_logtype, INFO);
 
 TAILQ_HEAD(rte_lpm_list, rte_tailq_entry);
 
diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c
index 8d21aeddb83c..873cc8bc267d 100644
--- a/lib/lpm/rte_lpm6.c
+++ b/lib/lpm/rte_lpm6.c
@@ -20,6 +20,7 @@
 #include <rte_tailq.h>
 
 #include "rte_lpm6.h"
+#include "lpm_log.h"
 
 #define RTE_LPM6_TBL24_NUM_ENTRIES        (1 << 24)
 #define RTE_LPM6_TBL8_GROUP_NUM_ENTRIES         256
diff --git a/lib/rib/rib_log.h b/lib/rib/rib_log.h
new file mode 100644
index 000000000000..f3ee513ca854
--- /dev/null
+++ b/lib/rib/rib_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int rib_logtype;
+#define RTE_LOGTYPE_LPM rib_logtype
diff --git a/lib/rib/rte_rib.c b/lib/rib/rte_rib.c
index 812a2597d117..a62e951a8e0e 100644
--- a/lib/rib/rte_rib.c
+++ b/lib/rib/rte_rib.c
@@ -16,6 +16,9 @@
 
 #include <rte_rib.h>
 
+RTE_LOG_REGISTER_DEFAULT(rib_logtype, INFO);
+#define RTE_LOGTYPE_LPM rib_logtype
+
 TAILQ_HEAD(rte_rib_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_rib_tailq = {
 	.name = "RTE_RIB",
diff --git a/lib/rib/rte_rib6.c b/lib/rib/rte_rib6.c
index ae44281ae105..5765995197f8 100644
--- a/lib/rib/rte_rib6.c
+++ b/lib/rib/rte_rib6.c
@@ -9,6 +9,7 @@
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
+#include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_string_fns.h>
@@ -16,6 +17,8 @@
 
 #include <rte_rib6.h>
 
+#include "rib_log.h"
+
 #define RTE_RIB_VALID_NODE	1
 #define RIB6_MAXDEPTH		128
 /* Maximum length of a RIB6 name. */
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 13/22] kni: convert RTE_LOGTYPE_KNI to dynamic type
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (11 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 12/22] lpm: convert RTE_LOGTYPE_LPM to dynamic types Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 14/22] sched: convert RTE_LOGTYPE_SCHED " Stephen Hemminger
                   ` (10 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

Even though KNI will eventually disappear, fix the
logtype now.

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

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 6e2007e6ed4f..70d5bb7b1951 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -351,7 +351,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
-	{RTE_LOGTYPE_KNI,        "lib.kni"},
 	{RTE_LOGTYPE_METER,      "lib.meter"},
 	{RTE_LOGTYPE_SCHED,      "lib.sched"},
 	{RTE_LOGTYPE_PORT,       "lib.port"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 115a48bf05f5..dc2454a0d9de 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -34,7 +34,7 @@ extern "C" {
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
 				 /* was RTE_LOGTYPE_LPM */
-#define RTE_LOGTYPE_KNI        8 /**< Log related to KNI. */
+				 /* was RTE_LOGTYPE_KNI */
 				 /* was RTE_LOGTYPE_ACL */
 				 /* was RTE_LOGTYPE_POWER */
 #define RTE_LOGTYPE_METER     11 /**< Log related to QoS meter. */
diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c
index bfa6a001ff59..b327bb28c45b 100644
--- a/lib/kni/rte_kni.c
+++ b/lib/kni/rte_kni.c
@@ -23,6 +23,9 @@
 #include <rte_kni_common.h>
 #include "rte_kni_fifo.h"
 
+RTE_LOG_REGISTER_DEFAULT(kni_logtype, INFO);
+#define RTE_LOGTYPE_KNI kni_logtype
+
 #define MAX_MBUF_BURST_NUM            32
 
 /* Maximum number of ring entries */
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 14/22] sched: convert RTE_LOGTYPE_SCHED to dynamic type
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (12 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 13/22] kni: convert RTE_LOGTYPE_KNI to dynamic type Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 15/22] examples/ipsec-secgw: replace RTE_LOGTYPE_PORT Stephen Hemminger
                   ` (9 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu

Also can remove unused RTE_LOGTYPE_METER

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/eal_common_log.c | 2 --
 lib/eal/include/rte_log.h       | 4 ++--
 lib/sched/rte_pie.c             | 1 +
 lib/sched/rte_sched.c           | 5 +++++
 lib/sched/rte_sched_log.h       | 4 ++++
 5 files changed, 12 insertions(+), 4 deletions(-)
 create mode 100644 lib/sched/rte_sched_log.h

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 70d5bb7b1951..d4b7088b5cbb 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -351,8 +351,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
-	{RTE_LOGTYPE_METER,      "lib.meter"},
-	{RTE_LOGTYPE_SCHED,      "lib.sched"},
 	{RTE_LOGTYPE_PORT,       "lib.port"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index dc2454a0d9de..f185fcbc5a94 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -37,8 +37,8 @@ extern "C" {
 				 /* was RTE_LOGTYPE_KNI */
 				 /* was RTE_LOGTYPE_ACL */
 				 /* was RTE_LOGTYPE_POWER */
-#define RTE_LOGTYPE_METER     11 /**< Log related to QoS meter. */
-#define RTE_LOGTYPE_SCHED     12 /**< Log related to QoS port scheduler. */
+				 /* was RTE_LOGTYPE_METER */
+				 /* was RTE_LOGTYPE_SCHED */
 #define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
 #define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
diff --git a/lib/sched/rte_pie.c b/lib/sched/rte_pie.c
index 947e2a059f6f..cce0ce762da8 100644
--- a/lib/sched/rte_pie.c
+++ b/lib/sched/rte_pie.c
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "rte_sched_log.h"
 #include "rte_pie.h"
 
 #ifdef __INTEL_COMPILER
diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c
index 19768d8c38b0..27e98e46df7a 100644
--- a/lib/sched/rte_sched.c
+++ b/lib/sched/rte_sched.c
@@ -16,9 +16,12 @@
 #include <rte_reciprocal.h>
 
 #include "rte_sched.h"
+#include "rte_sched_log.h"
 #include "rte_sched_common.h"
+
 #include "rte_approx.h"
 
+
 #ifdef __INTEL_COMPILER
 #pragma warning(disable:2259) /* conversion may lose significant bits */
 #endif
@@ -3002,3 +3005,5 @@ rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint
 
 	return count;
 }
+
+RTE_LOG_REGISTER_DEFAULT(sched_logtype, INFO);
diff --git a/lib/sched/rte_sched_log.h b/lib/sched/rte_sched_log.h
new file mode 100644
index 000000000000..fde051f49d62
--- /dev/null
+++ b/lib/sched/rte_sched_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int sched_logtype;
+#define RTE_LOGTYPE_SCHED sched_logtype
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 15/22] examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (13 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 14/22] sched: convert RTE_LOGTYPE_SCHED " Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 16/22] port: convert RTE_LOGTYPE_PORT to dynamic type Stephen Hemminger
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Akhil Goyal, Radu Nicolau, Aviad Yehezkel,
	Boris Pismenny, Declan Doherty

Looks like some code got copy/paste in to the IPSEC gateway
example from another place. Shouldn't be using RTE_LOGTYPE_PORT
here.

Fixes: ec17993a145a ("examples/ipsec-secgw: support security offload")
Acked-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/ipsec-secgw/sa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 5f5d2685f64c..417bfb41cca5 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -1130,7 +1130,7 @@ check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso)
 	if (inbound) {
 		if ((dev_info.rx_offload_capa &
 				RTE_ETH_RX_OFFLOAD_SECURITY) == 0) {
-			RTE_LOG(WARNING, PORT,
+			RTE_LOG(WARNING, IPSEC,
 				"hardware RX IPSec offload is not supported\n");
 			return -EINVAL;
 		}
@@ -1138,13 +1138,13 @@ check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso)
 	} else { /* outbound */
 		if ((dev_info.tx_offload_capa &
 				RTE_ETH_TX_OFFLOAD_SECURITY) == 0) {
-			RTE_LOG(WARNING, PORT,
+			RTE_LOG(WARNING, IPSEC,
 				"hardware TX IPSec offload is not supported\n");
 			return -EINVAL;
 		}
 		if (tso && (dev_info.tx_offload_capa &
 				RTE_ETH_TX_OFFLOAD_TCP_TSO) == 0) {
-			RTE_LOG(WARNING, PORT,
+			RTE_LOG(WARNING, IPSEC,
 				"hardware TCP TSO offload is not supported\n");
 			return -EINVAL;
 		}
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 16/22] port: convert RTE_LOGTYPE_PORT to dynamic type
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (14 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 15/22] examples/ipsec-secgw: replace RTE_LOGTYPE_PORT Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 17/22] hash: move rte_thash_gfni stubs out of header file Stephen Hemminger
                   ` (7 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu

Split up the single static RTE_LOGTYPE_PORT into separate
sub types for each component: port.ethdev, port.evendev, ...

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 lib/port/rte_port_ethdev.c      | 3 +++
 lib/port/rte_port_eventdev.c    | 4 ++++
 lib/port/rte_port_fd.c          | 3 +++
 lib/port/rte_port_frag.c        | 3 +++
 lib/port/rte_port_kni.c         | 3 +++
 lib/port/rte_port_ras.c         | 3 +++
 lib/port/rte_port_ring.c        | 3 +++
 lib/port/rte_port_sched.c       | 3 +++
 lib/port/rte_port_source_sink.c | 3 +++
 lib/port/rte_port_sym_crypto.c  | 3 +++
 12 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index d4b7088b5cbb..7f1d2c8a256d 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -351,7 +351,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
-	{RTE_LOGTYPE_PORT,       "lib.port"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index f185fcbc5a94..b11aec69af78 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -39,7 +39,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_POWER */
 				 /* was RTE_LOGTYPE_METER */
 				 /* was RTE_LOGTYPE_SCHED */
-#define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
+				 /* was RTE_LOGTYPE_PORT */
 #define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
 				 /* was RTE_LOGTYPE_MBUF */
diff --git a/lib/port/rte_port_ethdev.c b/lib/port/rte_port_ethdev.c
index 0da7890261e9..6685d304a6e9 100644
--- a/lib/port/rte_port_ethdev.c
+++ b/lib/port/rte_port_ethdev.c
@@ -10,6 +10,9 @@
 
 #include "rte_port_ethdev.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_ethdev_logtype, ethdev, INFO);
+#define RTE_LOGTYPE_PORT port_ethdev_logtype
+
 /*
  * Port ETHDEV Reader
  */
diff --git a/lib/port/rte_port_eventdev.c b/lib/port/rte_port_eventdev.c
index fd7dac9a5661..04447bd7f7bc 100644
--- a/lib/port/rte_port_eventdev.c
+++ b/lib/port/rte_port_eventdev.c
@@ -5,11 +5,15 @@
 #include <string.h>
 #include <stdint.h>
 
+#include <rte_log.h>
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 
 #include "rte_port_eventdev.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_eventdev_logtype, eventdev, INFO);
+#define RTE_LOGTYPE_PORT port_eventdev_logtype
+
 /*
  * Port EVENTDEV Reader
  */
diff --git a/lib/port/rte_port_fd.c b/lib/port/rte_port_fd.c
index 932ecd324e05..b2412e7706ee 100644
--- a/lib/port/rte_port_fd.c
+++ b/lib/port/rte_port_fd.c
@@ -10,6 +10,9 @@
 
 #include "rte_port_fd.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_fd_logtype, fd, INFO);
+#define RTE_LOGTYPE_PORT port_fd_logtype
+
 /*
  * Port FD Reader
  */
diff --git a/lib/port/rte_port_frag.c b/lib/port/rte_port_frag.c
index e1f1892176c4..9adcbba47da1 100644
--- a/lib/port/rte_port_frag.c
+++ b/lib/port/rte_port_frag.c
@@ -7,6 +7,9 @@
 
 #include "rte_port_frag.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_frag_logtype, frag, INFO);
+#define RTE_LOGTYPE_PORT port_frag_logtype
+
 /* Max number of fragments per packet allowed */
 #define	RTE_PORT_FRAG_MAX_FRAGS_PER_PACKET 0x80
 
diff --git a/lib/port/rte_port_kni.c b/lib/port/rte_port_kni.c
index 1c7a6cb200ea..d4ac08b4cff0 100644
--- a/lib/port/rte_port_kni.c
+++ b/lib/port/rte_port_kni.c
@@ -9,6 +9,9 @@
 
 #include "rte_port_kni.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_kni_logtype, kni, INFO);
+#define RTE_LOGTYPE_PORT port_kni_logtype
+
 /*
  * Port KNI Reader
  */
diff --git a/lib/port/rte_port_ras.c b/lib/port/rte_port_ras.c
index e5de57da42ea..5a610b1ba5b5 100644
--- a/lib/port/rte_port_ras.c
+++ b/lib/port/rte_port_ras.c
@@ -9,6 +9,9 @@
 
 #include "rte_port_ras.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_ras_logtype, ras, INFO);
+#define RTE_LOGTYPE_PORT port_ras_logtype
+
 #ifndef RTE_PORT_RAS_N_BUCKETS
 #define RTE_PORT_RAS_N_BUCKETS                                 4094
 #endif
diff --git a/lib/port/rte_port_ring.c b/lib/port/rte_port_ring.c
index 52b2d8e557f0..32a90e836579 100644
--- a/lib/port/rte_port_ring.c
+++ b/lib/port/rte_port_ring.c
@@ -10,6 +10,9 @@
 
 #include "rte_port_ring.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_ring_logtype, ring, INFO);
+#define RTE_LOGTYPE_PORT port_ring_logtype
+
 /*
  * Port RING Reader
  */
diff --git a/lib/port/rte_port_sched.c b/lib/port/rte_port_sched.c
index 8a7d815ef323..6e0a8aba5419 100644
--- a/lib/port/rte_port_sched.c
+++ b/lib/port/rte_port_sched.c
@@ -7,6 +7,9 @@
 
 #include "rte_port_sched.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_sched_logtype, sched, INFO);
+#define RTE_LOGTYPE_PORT port_sched_logtype
+
 /*
  * Reader
  */
diff --git a/lib/port/rte_port_source_sink.c b/lib/port/rte_port_source_sink.c
index 7d73adc1e79e..e9cdadbceb8f 100644
--- a/lib/port/rte_port_source_sink.c
+++ b/lib/port/rte_port_source_sink.c
@@ -15,6 +15,9 @@
 
 #include "rte_port_source_sink.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_source_logtype, source, INFO);
+#define RTE_LOGTYPE_PORT port_source_logtype
+
 /*
  * Port SOURCE
  */
diff --git a/lib/port/rte_port_sym_crypto.c b/lib/port/rte_port_sym_crypto.c
index 295984d025cb..77a2f04d65f6 100644
--- a/lib/port/rte_port_sym_crypto.c
+++ b/lib/port/rte_port_sym_crypto.c
@@ -8,6 +8,9 @@
 
 #include "rte_port_sym_crypto.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_crypto_logtype, crypto, INFO);
+#define RTE_LOGTYPE_PORT port_crypto_logtype
+
 /*
  * Port Crypto Reader
  */
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 17/22] hash: move rte_thash_gfni stubs out of header file
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (15 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 16/22] port: convert RTE_LOGTYPE_PORT to dynamic type Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 18/22] hash: move rte_hash_set_alg out header Stephen Hemminger
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Yipeng Wang, Sameh Gobriel, Bruce Richardson,
	Vladimir Medvedkin

Having stubs in header file makes it harder to update
RTE_LOG(). Also modify to only print warning once.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/hash/meson.build      |  8 ++++++-
 lib/hash/rte_thash_gfni.c | 47 +++++++++++++++++++++++++++++++++++++++
 lib/hash/rte_thash_gfni.h | 30 ++++++++-----------------
 lib/hash/version.map      |  4 ++++
 4 files changed, 67 insertions(+), 22 deletions(-)
 create mode 100644 lib/hash/rte_thash_gfni.c

diff --git a/lib/hash/meson.build b/lib/hash/meson.build
index 2f757d45f9bc..e56ee8572564 100644
--- a/lib/hash/meson.build
+++ b/lib/hash/meson.build
@@ -17,7 +17,13 @@ indirect_headers += files(
         'rte_thash_x86_gfni.h',
 )
 
-sources = files('rte_cuckoo_hash.c', 'rte_fbk_hash.c', 'rte_thash.c')
+sources = files(
+    'rte_cuckoo_hash.c',
+    'rte_fbk_hash.c',
+    'rte_thash.c',
+    'rte_thash_gfni.c'
+)
+
 deps += ['net']
 deps += ['ring']
 deps += ['rcu']
diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c
new file mode 100644
index 000000000000..eb334185725c
--- /dev/null
+++ b/lib/hash/rte_thash_gfni.c
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2021 Intel Corporation
+ */
+
+#include <stdbool.h>
+
+#include <rte_compat.h>
+#include <rte_log.h>
+#include <rte_thash_gfni.h>
+
+#ifndef RTE_THASH_GFNI_DEFINED
+
+uint32_t
+rte_thash_gfni(const uint64_t *mtrx __rte_unused,
+	       const uint8_t *key __rte_unused, int len __rte_unused)
+{
+	static bool warned;
+
+	if (!warned) {
+		warned = true;
+		RTE_LOG(ERR, HASH,
+			"%s is undefined under given arch\n", __func__);
+	}
+
+	return 0;
+}
+
+void
+rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused,
+		    int len __rte_unused, uint8_t *tuple[] __rte_unused,
+		    uint32_t val[], uint32_t num)
+{
+	unsigned int i;
+
+	static bool warned;
+
+	if (!warned) {
+		warned = true;
+		RTE_LOG(ERR, HASH,
+			"%s is undefined under given arch\n", __func__);
+	}
+
+	for (i = 0; i < num; i++)
+		val[i] = 0;
+}
+
+#endif
diff --git a/lib/hash/rte_thash_gfni.h b/lib/hash/rte_thash_gfni.h
index ef90faa302d1..4fc92984077e 100644
--- a/lib/hash/rte_thash_gfni.h
+++ b/lib/hash/rte_thash_gfni.h
@@ -9,13 +9,14 @@
 extern "C" {
 #endif
 
+#include <stdint.h>
+
 #include <rte_compat.h>
-#include <rte_log.h>
+#include <rte_common.h>
+#include <rte_config.h>
 
 #ifdef RTE_ARCH_X86
-
 #include <rte_thash_x86_gfni.h>
-
 #endif
 
 #ifndef RTE_THASH_GFNI_DEFINED
@@ -38,13 +39,8 @@ extern "C" {
  *  Calculated Toeplitz hash value.
  */
 __rte_experimental
-static inline uint32_t
-rte_thash_gfni(const uint64_t *mtrx __rte_unused,
-	const uint8_t *key __rte_unused, int len __rte_unused)
-{
-	RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__);
-	return 0;
-}
+uint32_t
+rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len);
 
 /**
  * Bulk implementation for Toeplitz hash.
@@ -67,17 +63,9 @@ rte_thash_gfni(const uint64_t *mtrx __rte_unused,
  *  Number of tuples to hash.
  */
 __rte_experimental
-static inline void
-rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused,
-	int len __rte_unused, uint8_t *tuple[] __rte_unused,
-	uint32_t val[], uint32_t num)
-{
-	unsigned int i;
-
-	RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__);
-	for (i = 0; i < num; i++)
-		val[i] = 0;
-}
+void
+rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[],
+		    uint32_t val[], uint32_t num);
 
 #endif /* RTE_THASH_GFNI_DEFINED */
 
diff --git a/lib/hash/version.map b/lib/hash/version.map
index bdcebd19c29b..f03b047b2eec 100644
--- a/lib/hash/version.map
+++ b/lib/hash/version.map
@@ -51,4 +51,8 @@ EXPERIMENTAL {
 	rte_thash_complete_matrix;
 	rte_thash_get_gfni_matrices;
 	rte_thash_gfni_supported;
+
+	# added in 22.07
+	rte_thash_gfni;
+	rte_thash_gfni_bulk;
 };
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 18/22] hash: move rte_hash_set_alg out header
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (16 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 17/22] hash: move rte_thash_gfni stubs out of header file Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 19/22] hash: convert RTE_LOGTYPE_HASH to dynamic type Stephen Hemminger
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Ruifeng Wang, Yipeng Wang, Sameh Gobriel,
	Bruce Richardson, Vladimir Medvedkin

The code for setting algorithm for hash is not at all perf sensitive,
and doing it inline has a couple of problems. First, it means that if
multiple files include the header, then the initialization gets done
multiple times. But also, it makes it harder to fix usage of RTE_LOG().

Despite what the checking script say. This is not an ABI change, the
previous version inlined the same code; therefore both old and new code
will work the same.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/hash/meson.build     |  1 +
 lib/hash/rte_crc_arm64.h |  8 ++---
 lib/hash/rte_crc_x86.h   | 10 +++---
 lib/hash/rte_hash_crc.c  | 68 ++++++++++++++++++++++++++++++++++++++++
 lib/hash/rte_hash_crc.h  | 48 ++--------------------------
 lib/hash/version.map     |  7 +++++
 6 files changed, 88 insertions(+), 54 deletions(-)
 create mode 100644 lib/hash/rte_hash_crc.c

diff --git a/lib/hash/meson.build b/lib/hash/meson.build
index e56ee8572564..c345c6f561fc 100644
--- a/lib/hash/meson.build
+++ b/lib/hash/meson.build
@@ -19,6 +19,7 @@ indirect_headers += files(
 
 sources = files(
     'rte_cuckoo_hash.c',
+    'rte_hash_crc.c',
     'rte_fbk_hash.c',
     'rte_thash.c',
     'rte_thash_gfni.c'
diff --git a/lib/hash/rte_crc_arm64.h b/lib/hash/rte_crc_arm64.h
index c9f52510871b..414fe065caa8 100644
--- a/lib/hash/rte_crc_arm64.h
+++ b/lib/hash/rte_crc_arm64.h
@@ -53,7 +53,7 @@ crc32c_arm64_u64(uint64_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_1byte(uint8_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_ARM64))
+	if (likely(rte_hash_crc32_alg & CRC32_ARM64))
 		return crc32c_arm64_u8(data, init_val);
 
 	return crc32c_1byte(data, init_val);
@@ -67,7 +67,7 @@ rte_hash_crc_1byte(uint8_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_2byte(uint16_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_ARM64))
+	if (likely(rte_hash_crc32_alg & CRC32_ARM64))
 		return crc32c_arm64_u16(data, init_val);
 
 	return crc32c_2bytes(data, init_val);
@@ -81,7 +81,7 @@ rte_hash_crc_2byte(uint16_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_ARM64))
+	if (likely(rte_hash_crc32_alg & CRC32_ARM64))
 		return crc32c_arm64_u32(data, init_val);
 
 	return crc32c_1word(data, init_val);
@@ -95,7 +95,7 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_ARM64))
+	if (likely(rte_hash_crc32_alg & CRC32_ARM64))
 		return crc32c_arm64_u64(data, init_val);
 
 	return crc32c_2words(data, init_val);
diff --git a/lib/hash/rte_crc_x86.h b/lib/hash/rte_crc_x86.h
index 205bc182be77..3b865e251db2 100644
--- a/lib/hash/rte_crc_x86.h
+++ b/lib/hash/rte_crc_x86.h
@@ -67,7 +67,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)
 static inline uint32_t
 rte_hash_crc_1byte(uint8_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_SSE42))
+	if (likely(rte_hash_crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u8(data, init_val);
 
 	return crc32c_1byte(data, init_val);
@@ -81,7 +81,7 @@ rte_hash_crc_1byte(uint8_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_2byte(uint16_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_SSE42))
+	if (likely(rte_hash_crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u16(data, init_val);
 
 	return crc32c_2bytes(data, init_val);
@@ -95,7 +95,7 @@ rte_hash_crc_2byte(uint16_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_SSE42))
+	if (likely(rte_hash_crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u32(data, init_val);
 
 	return crc32c_1word(data, init_val);
@@ -110,11 +110,11 @@ static inline uint32_t
 rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
 {
 #ifdef RTE_ARCH_X86_64
-	if (likely(crc32_alg == CRC32_SSE42_x64))
+	if (likely(rte_hash_crc32_alg == CRC32_SSE42_x64))
 		return crc32c_sse42_u64(data, init_val);
 #endif
 
-	if (likely(crc32_alg & CRC32_SSE42))
+	if (likely(rte_hash_crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u64_mimic(data, init_val);
 
 	return crc32c_2words(data, init_val);
diff --git a/lib/hash/rte_hash_crc.c b/lib/hash/rte_hash_crc.c
new file mode 100644
index 000000000000..1439d8a71f6a
--- /dev/null
+++ b/lib/hash/rte_hash_crc.c
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
+ */
+
+#include <rte_cpuflags.h>
+#include <rte_log.h>
+
+#include "rte_hash_crc.h"
+
+RTE_LOG_REGISTER_SUFFIX(hash_crc_logtype, crc, INFO);
+#define RTE_LOGTYPE_HASH_CRC hash_crc_logtype
+
+uint8_t rte_hash_crc32_alg = CRC32_SW;
+
+/**
+ * Allow or disallow use of SSE4.2/ARMv8 intrinsics for CRC32 hash
+ * calculation.
+ *
+ * @param alg
+ *   An OR of following flags:
+ *   - (CRC32_SW) Don't use SSE4.2/ARMv8 intrinsics (default non-[x86/ARMv8])
+ *   - (CRC32_SSE42) Use SSE4.2 intrinsics if available
+ *   - (CRC32_SSE42_x64) Use 64-bit SSE4.2 intrinsic if available (default x86)
+ *   - (CRC32_ARM64) Use ARMv8 CRC intrinsic if available (default ARMv8)
+ *
+ */
+void
+rte_hash_crc_set_alg(uint8_t alg)
+{
+	rte_hash_crc32_alg = CRC32_SW;
+
+	if (alg == CRC32_SW)
+		return;
+
+#if defined RTE_ARCH_X86
+	if (!(alg & CRC32_SSE42_x64))
+		RTE_LOG(WARNING, HASH_CRC,
+			"Unsupported CRC32 algorithm requested using CRC32_x64/CRC32_SSE42\n");
+	if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_EM64T) || alg == CRC32_SSE42)
+		rte_hash_crc32_alg = CRC32_SSE42;
+	else
+		rte_hash_crc32_alg = CRC32_SSE42_x64;
+#endif
+
+#if defined RTE_ARCH_ARM64
+	if (!(alg & CRC32_ARM64))
+		RTE_LOG(WARNING, HASH_CRC,
+			"Unsupported CRC32 algorithm requested using CRC32_ARM64\n");
+	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_CRC32))
+		rte_hash_crc32_alg = CRC32_ARM64;
+#endif
+
+	if (rte_hash_crc32_alg == CRC32_SW)
+		RTE_LOG(WARNING, HASH_CRC,
+			"Unsupported CRC32 algorithm requested using CRC32_SW\n");
+}
+
+/* Setting the best available algorithm */
+RTE_INIT(rte_hash_crc_init_alg)
+{
+#if defined(RTE_ARCH_X86)
+	rte_hash_crc_set_alg(CRC32_SSE42_x64);
+#elif defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRC32)
+	rte_hash_crc_set_alg(CRC32_ARM64);
+#else
+	rte_hash_crc_set_alg(CRC32_SW);
+#endif
+}
diff --git a/lib/hash/rte_hash_crc.h b/lib/hash/rte_hash_crc.h
index 0249ad16c5b6..e8145ee44204 100644
--- a/lib/hash/rte_hash_crc.h
+++ b/lib/hash/rte_hash_crc.h
@@ -20,8 +20,6 @@ extern "C" {
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
 #include <rte_config.h>
-#include <rte_cpuflags.h>
-#include <rte_log.h>
 
 #include "rte_crc_sw.h"
 
@@ -31,7 +29,7 @@ extern "C" {
 #define CRC32_SSE42_x64     (CRC32_x64|CRC32_SSE42)
 #define CRC32_ARM64         (1U << 3)
 
-static uint8_t crc32_alg = CRC32_SW;
+extern uint8_t rte_hash_crc32_alg;
 
 #if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRC32)
 #include "rte_crc_arm64.h"
@@ -53,48 +51,8 @@ static uint8_t crc32_alg = CRC32_SW;
  *   - (CRC32_ARM64) Use ARMv8 CRC intrinsic if available (default ARMv8)
  *
  */
-static inline void
-rte_hash_crc_set_alg(uint8_t alg)
-{
-	crc32_alg = CRC32_SW;
-
-	if (alg == CRC32_SW)
-		return;
-
-#if defined RTE_ARCH_X86
-	if (!(alg & CRC32_SSE42_x64))
-		RTE_LOG(WARNING, HASH,
-			"Unsupported CRC32 algorithm requested using CRC32_x64/CRC32_SSE42\n");
-	if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_EM64T) || alg == CRC32_SSE42)
-		crc32_alg = CRC32_SSE42;
-	else
-		crc32_alg = CRC32_SSE42_x64;
-#endif
-
-#if defined RTE_ARCH_ARM64
-	if (!(alg & CRC32_ARM64))
-		RTE_LOG(WARNING, HASH,
-			"Unsupported CRC32 algorithm requested using CRC32_ARM64\n");
-	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_CRC32))
-		crc32_alg = CRC32_ARM64;
-#endif
-
-	if (crc32_alg == CRC32_SW)
-		RTE_LOG(WARNING, HASH,
-			"Unsupported CRC32 algorithm requested using CRC32_SW\n");
-}
-
-/* Setting the best available algorithm */
-RTE_INIT(rte_hash_crc_init_alg)
-{
-#if defined(RTE_ARCH_X86)
-	rte_hash_crc_set_alg(CRC32_SSE42_x64);
-#elif defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRC32)
-	rte_hash_crc_set_alg(CRC32_ARM64);
-#else
-	rte_hash_crc_set_alg(CRC32_SW);
-#endif
-}
+void
+rte_hash_crc_set_alg(uint8_t alg);
 
 #ifdef __DOXYGEN__
 
diff --git a/lib/hash/version.map b/lib/hash/version.map
index f03b047b2eec..8b22aad5626b 100644
--- a/lib/hash/version.map
+++ b/lib/hash/version.map
@@ -9,6 +9,7 @@ DPDK_23 {
 	rte_hash_add_key_with_hash;
 	rte_hash_add_key_with_hash_data;
 	rte_hash_count;
+	rte_hash_crc_set_alg;
 	rte_hash_create;
 	rte_hash_del_key;
 	rte_hash_del_key_with_hash;
@@ -56,3 +57,9 @@ EXPERIMENTAL {
 	rte_thash_gfni;
 	rte_thash_gfni_bulk;
 };
+
+INTERNAL {
+	global:
+
+	rte_hash_crc32_alg;
+};
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 19/22] hash: convert RTE_LOGTYPE_HASH to dynamic type
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (17 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 18/22] hash: move rte_hash_set_alg out header Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 20/22] table: convert RTE_LOGTYPE_TABLE " Stephen Hemminger
                   ` (4 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Yipeng Wang, Sameh Gobriel, Bruce Richardson,
	Vladimir Medvedkin

Use dynamic type for hash and add subtypes for crc and gfni.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 lib/hash/rte_cuckoo_hash.c      | 5 +++++
 lib/hash/rte_fbk_hash.c         | 5 +++++
 lib/hash/rte_thash.c            | 3 +++
 lib/hash/rte_thash_gfni.c       | 3 +++
 6 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 7f1d2c8a256d..58f9c0ce629b 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -350,7 +350,6 @@ struct logtype {
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
-	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index b11aec69af78..4d1b892ab689 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -32,7 +32,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_MEMPOOL */
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
-#define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
+				 /* was RTE_LOGTYPE_HASH */
 				 /* was RTE_LOGTYPE_LPM */
 				 /* was RTE_LOGTYPE_KNI */
 				 /* was RTE_LOGTYPE_ACL */
diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c
index 829b79c89a27..e2b07bfbad71 100644
--- a/lib/hash/rte_cuckoo_hash.c
+++ b/lib/hash/rte_cuckoo_hash.c
@@ -24,6 +24,11 @@
 #include <rte_tailq.h>
 
 #include "rte_hash.h"
+
+/* needs to be before rte_cuckoo_hash.h */
+RTE_LOG_REGISTER_DEFAULT(hash_logtype, INFO);
+#define RTE_LOGTYPE_HASH hash_logtype
+
 #include "rte_cuckoo_hash.h"
 
 /* Mask of all flags supported by this version */
diff --git a/lib/hash/rte_fbk_hash.c b/lib/hash/rte_fbk_hash.c
index 538b23a4030a..b4c4c191abdc 100644
--- a/lib/hash/rte_fbk_hash.c
+++ b/lib/hash/rte_fbk_hash.c
@@ -8,6 +8,8 @@
 #include <errno.h>
 
 #include <sys/queue.h>
+
+#include <rte_cpuflags.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 #include <rte_common.h>
@@ -18,6 +20,9 @@
 
 #include "rte_fbk_hash.h"
 
+RTE_LOG_REGISTER_SUFFIX(fbk_hash_logtype, fbk, INFO);
+#define RTE_LOGTYPE_HASH fbk_hash_logtype
+
 TAILQ_HEAD(rte_fbk_hash_list, rte_tailq_entry);
 
 static struct rte_tailq_elem rte_fbk_hash_tailq = {
diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c
index 0249883b8d07..c1fd2e34c9d4 100644
--- a/lib/hash/rte_thash.c
+++ b/lib/hash/rte_thash.c
@@ -13,6 +13,9 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 
+RTE_LOG_REGISTER_SUFFIX(thash_logtype, thash, INFO);
+#define RTE_LOGTYPE_HASH thash_logtype
+
 #define THASH_NAME_LEN		64
 #define TOEPLITZ_HASH_LEN	32
 
diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c
index eb334185725c..35206d575153 100644
--- a/lib/hash/rte_thash_gfni.c
+++ b/lib/hash/rte_thash_gfni.c
@@ -10,6 +10,9 @@
 
 #ifndef RTE_THASH_GFNI_DEFINED
 
+RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO);
+#define RTE_LOGTYPE_HASH hash_gfni_logtype
+
 uint32_t
 rte_thash_gfni(const uint64_t *mtrx __rte_unused,
 	       const uint8_t *key __rte_unused, int len __rte_unused)
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 20/22] table: convert RTE_LOGTYPE_TABLE to dynamic type
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (18 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 19/22] hash: convert RTE_LOGTYPE_HASH to dynamic type Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 21/22] app/test: remove use of RTE_LOGTYPE_PIPELINE Stephen Hemminger
                   ` (3 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu

Make an alias for RTE_LOGTYPE_TABLE in rte_table.h
and use it.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 lib/table/meson.build           | 1 +
 lib/table/rte_table.c           | 8 ++++++++
 lib/table/rte_table.h           | 4 ++++
 5 files changed, 14 insertions(+), 2 deletions(-)
 create mode 100644 lib/table/rte_table.c

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 58f9c0ce629b..6c2d9bfc1950 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -350,7 +350,6 @@ struct logtype {
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
-	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 4d1b892ab689..6418479ee266 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -40,7 +40,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_METER */
 				 /* was RTE_LOGTYPE_SCHED */
 				 /* was RTE_LOGTYPE_PORT */
-#define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
+				 /* was RTE_LOGTYPE_TABLE */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
 				 /* was RTE_LOGTYPE_MBUF */
 #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
diff --git a/lib/table/meson.build b/lib/table/meson.build
index f8cef24b5918..e753b6fb23d8 100644
--- a/lib/table/meson.build
+++ b/lib/table/meson.build
@@ -7,6 +7,7 @@ sources = files(
         'rte_swx_table_learner.c',
         'rte_swx_table_selector.c',
         'rte_swx_table_wm.c',
+        'rte_table.c',
         'rte_table_acl.c',
         'rte_table_array.c',
         'rte_table_hash_cuckoo.c',
diff --git a/lib/table/rte_table.c b/lib/table/rte_table.c
new file mode 100644
index 000000000000..4a083f4aaf0c
--- /dev/null
+++ b/lib/table/rte_table.c
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
+ */
+
+#include <rte_log.h>
+#include <rte_table.h>
+
+RTE_LOG_REGISTER_DEFAULT(table_logtype, INFO);
diff --git a/lib/table/rte_table.h b/lib/table/rte_table.h
index 096ab8a7c824..42e9b58fbea5 100644
--- a/lib/table/rte_table.h
+++ b/lib/table/rte_table.h
@@ -265,6 +265,10 @@ struct rte_table_ops {
 	rte_table_op_stats_read f_stats;              /**< Stats */
 };
 
+/** Internal Logtype used */
+extern int table_logtype;
+#define RTE_LOGTYPE_TABLE table_logtype
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 21/22] app/test: remove use of RTE_LOGTYPE_PIPELINE
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (19 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 20/22] table: convert RTE_LOGTYPE_TABLE " Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-03-29 23:40 ` [PATCH v12 22/22] pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type Stephen Hemminger
                   ` (2 subsequent siblings)
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu

Instead of using static type PIPELINE for logging in test application
use stderr instead.  If not testing RTE_LOG() better to not use
it since log also goes to syslog.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_table_acl.c      | 50 ++++++++++++++++------------------
 app/test/test_table_pipeline.c | 40 +++++++++++++--------------
 2 files changed, 43 insertions(+), 47 deletions(-)

diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c
index e66f06b84d0a..dff9bddfb948 100644
--- a/app/test/test_table_acl.c
+++ b/app/test/test_table_acl.c
@@ -165,7 +165,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v)
 		&v->field_value[SRC_FIELD_IPV4].value.u32,
 		&v->field_value[SRC_FIELD_IPV4].mask_range.u32);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read src address/mask: %s\n",
+		fprintf(stderr, "failed to read src address/mask: %s\n",
 			in[CB_FLD_SRC_ADDR]);
 		return rc;
 	}
@@ -178,7 +178,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v)
 		&v->field_value[DST_FIELD_IPV4].value.u32,
 		&v->field_value[DST_FIELD_IPV4].mask_range.u32);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read dest address/mask: %s\n",
+		fprintf(stderr, "failed to read dest address/mask: %s\n",
 			in[CB_FLD_DST_ADDR]);
 		return rc;
 	}
@@ -190,7 +190,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v)
 		&v->field_value[SRCP_FIELD_IPV4].value.u16,
 		&v->field_value[SRCP_FIELD_IPV4].mask_range.u16);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read source port range: %s\n",
+		fprintf(stderr, "failed to read source port range: %s\n",
 			in[CB_FLD_SRC_PORT_RANGE]);
 		return rc;
 	}
@@ -202,7 +202,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v)
 		&v->field_value[DSTP_FIELD_IPV4].value.u16,
 		&v->field_value[DSTP_FIELD_IPV4].mask_range.u16);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read dest port range: %s\n",
+		fprintf(stderr, "failed to read dest port range: %s\n",
 			in[CB_FLD_DST_PORT_RANGE]);
 		return rc;
 	}
@@ -254,7 +254,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
 		&v->field_value[SRC_FIELD_IPV4].value.u32,
 		&v->field_value[SRC_FIELD_IPV4].mask_range.u32);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read src address/mask: %s\n",
+		fprintf(stderr, "failed to read src address/mask: %s\n",
 			in[CB_FLD_SRC_ADDR]);
 		return rc;
 	}
@@ -267,7 +267,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
 		&v->field_value[DST_FIELD_IPV4].value.u32,
 		&v->field_value[DST_FIELD_IPV4].mask_range.u32);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read dest address/mask: %s\n",
+		fprintf(stderr, "failed to read dest address/mask: %s\n",
 			in[CB_FLD_DST_ADDR]);
 		return rc;
 	}
@@ -279,7 +279,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
 		&v->field_value[SRCP_FIELD_IPV4].value.u16,
 		&v->field_value[SRCP_FIELD_IPV4].mask_range.u16);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read source port range: %s\n",
+		fprintf(stderr, "failed to read source port range: %s\n",
 			in[CB_FLD_SRC_PORT_RANGE]);
 		return rc;
 	}
@@ -291,7 +291,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
 		&v->field_value[DSTP_FIELD_IPV4].value.u16,
 		&v->field_value[DSTP_FIELD_IPV4].mask_range.u16);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read dest port range: %s\n",
+		fprintf(stderr, "failed to read dest port range: %s\n",
 			in[CB_FLD_DST_PORT_RANGE]);
 		return rc;
 	}
@@ -346,7 +346,7 @@ setup_acl_pipeline(void)
 	/* Pipeline configuration */
 	p = rte_pipeline_create(&pipeline_params);
 	if (p == NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Failed to configure pipeline\n",
+		fprintf(stderr, "%s: Failed to configure pipeline\n",
 			__func__);
 		goto fail;
 	}
@@ -410,7 +410,7 @@ setup_acl_pipeline(void)
 		table_params.f_action_miss = NULL;
 		table_params.action_data_size = 0;
 
-		RTE_LOG(INFO, PIPELINE, "miss_action=%x\n",
+		printf("miss_action=%x\n",
 			table_entry_miss_action);
 
 		printf("RTE_ACL_RULE_SZ(%zu) = %zu\n", DIM(ipv4_defs),
@@ -471,9 +471,8 @@ setup_acl_pipeline(void)
 
 			ret = parser(line, &keys[n]);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE,
-					"line %u: parse_cb_ipv4vlan_rule"
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -513,9 +512,8 @@ setup_acl_pipeline(void)
 
 			ret = parse_cb_ipv4_rule_del(line, &keys[n]);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE,
-					"line %u: parse_cb_ipv4vlan_rule"
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -549,9 +547,8 @@ setup_acl_pipeline(void)
 
 			ret = parser(line, &rule_params);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE,
-					"line %u: parse_cb_ipv4vlan_rule"
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -575,8 +572,8 @@ setup_acl_pipeline(void)
 
 			ret = parser(line, &rule_params);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE, "line %u: parse rule "
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -602,8 +599,8 @@ setup_acl_pipeline(void)
 
 			ret = parser(line, &rule_params);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE, "line %u: parse rule"
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -667,7 +664,7 @@ test_pipeline_single_filter(int expected_count)
 
 			memcpy(rte_pktmbuf_mtod(mbuf, char *), &five_tuple,
 				sizeof(struct ipv4_5tuple));
-			RTE_LOG(INFO, PIPELINE, "%s: Enqueue onto ring %d\n",
+			printf("%s: Enqueue onto ring %d\n",
 				__func__, i);
 			rte_ring_enqueue(rings_rx[i], mbuf);
 		}
@@ -702,9 +699,8 @@ test_pipeline_single_filter(int expected_count)
 	}
 
 	if (tx_count != expected_count) {
-		RTE_LOG(INFO, PIPELINE,
-			"%s: Unexpected packets for ACL test, "
-			"expected %d, got %d\n",
+		fprintf(stderr,
+			"%s: Unexpected packets for ACL test, expected %d, got %d\n",
 			__func__, expected_count, tx_count);
 		goto fail;
 	}
diff --git a/app/test/test_table_pipeline.c b/app/test/test_table_pipeline.c
index 7adbbffbf55d..960f730cf20d 100644
--- a/app/test/test_table_pipeline.c
+++ b/app/test/test_table_pipeline.c
@@ -6,7 +6,6 @@
 
 #include <string.h>
 #include <rte_pipeline.h>
-#include <rte_log.h>
 #include <inttypes.h>
 #include <rte_hexdump.h>
 #include "test_table.h"
@@ -173,30 +172,31 @@ check_pipeline_invalid_params(void)
 
 	p = rte_pipeline_create(NULL);
 	if (p != NULL) {
-		RTE_LOG(INFO, PIPELINE,
+		fprintf(stderr,
 			"%s: configured pipeline with null params\n",
 			__func__);
 		goto fail;
 	}
 	p = rte_pipeline_create(&pipeline_params_1);
 	if (p != NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with NULL "
-			"name\n", __func__);
+		fprintf(stderr,
+			"%s: Configure pipeline with NULL name\n", __func__);
 		goto fail;
 	}
 
 	p = rte_pipeline_create(&pipeline_params_2);
 	if (p != NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with invalid "
-			"socket\n", __func__);
+		fprintf(stderr,
+			"%s: Configure pipeline with invalid socket\n", __func__);
 		goto fail;
 	}
 
 	if (rte_eal_has_hugepages()) {
 		p = rte_pipeline_create(&pipeline_params_3);
 		if (p != NULL) {
-			RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with "
-				"invalid socket\n", __func__);
+			fprintf(stderr,
+				"%s: Configure pipeline with invalid socket\n",
+				__func__);
 			goto fail;
 		}
 	}
@@ -224,20 +224,20 @@ setup_pipeline(int test_type)
 		.socket_id = 0,
 	};
 
-	RTE_LOG(INFO, PIPELINE, "%s: **** Setting up %s test\n",
+	fprintf(stderr, "%s: **** Setting up %s test\n",
 		__func__, pipeline_test_names[test_type]);
 
 	/* Pipeline configuration */
 	p = rte_pipeline_create(&pipeline_params);
 	if (p == NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Failed to configure pipeline\n",
+		fprintf(stderr, "%s: Failed to configure pipeline\n",
 			__func__);
 		goto fail;
 	}
 
 	ret = rte_pipeline_free(p);
 	if (ret != 0) {
-		RTE_LOG(INFO, PIPELINE, "%s: Failed to free pipeline\n",
+		fprintf(stderr, "%s: Failed to free pipeline\n",
 			__func__);
 		goto fail;
 	}
@@ -245,7 +245,7 @@ setup_pipeline(int test_type)
 	/* Pipeline configuration */
 	p = rte_pipeline_create(&pipeline_params);
 	if (p == NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Failed to configure pipeline\n",
+		fprintf(stderr, "%s: Failed to configure pipeline\n",
 			__func__);
 		goto fail;
 	}
@@ -411,7 +411,7 @@ test_pipeline_single_filter(int test_type, int expected_count)
 	int ret;
 	int tx_count;
 
-	RTE_LOG(INFO, PIPELINE, "%s: **** Running %s test\n",
+	fprintf(stderr, "%s: **** Running %s test\n",
 		__func__, pipeline_test_names[test_type]);
 	/* Run pipeline once */
 	for (i = 0; i < N_PORTS; i++)
@@ -420,7 +420,7 @@ test_pipeline_single_filter(int test_type, int expected_count)
 
 	ret = rte_pipeline_flush(NULL);
 	if (ret != -EINVAL) {
-		RTE_LOG(INFO, PIPELINE,
+		fprintf(stderr,
 			"%s: No pipeline flush error NULL pipeline (%d)\n",
 			__func__, ret);
 		goto fail;
@@ -445,7 +445,7 @@ test_pipeline_single_filter(int test_type, int expected_count)
 			k32 = (uint32_t *) key;
 			k32[0] = 0xadadadad >> (j % 2);
 
-			RTE_LOG(INFO, PIPELINE, "%s: Enqueue onto ring %d\n",
+			fprintf(stderr, "%s: Enqueue onto ring %d\n",
 				__func__, i);
 			rte_ring_enqueue(rings_rx[i], m);
 		}
@@ -487,9 +487,9 @@ test_pipeline_single_filter(int test_type, int expected_count)
 	}
 
 	if (tx_count != expected_count) {
-		RTE_LOG(INFO, PIPELINE,
-			"%s: Unexpected packets out for %s test, expected %d, "
-			"got %d\n", __func__, pipeline_test_names[test_type],
+		fprintf(stderr,
+			"%s: Unexpected packets out for %s test, expected %d, got %d\n",
+			__func__, pipeline_test_names[test_type],
 			expected_count, tx_count);
 		goto fail;
 	}
@@ -564,8 +564,8 @@ test_table_pipeline(void)
 	connect_miss_action_to_table = 0;
 
 	if (check_pipeline_invalid_params()) {
-		RTE_LOG(INFO, PIPELINE, "%s: Check pipeline invalid params "
-			"failed.\n", __func__);
+		fprintf(stderr, "%s: Check pipeline invalid params failed.\n",
+			__func__);
 		return -1;
 	}
 
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v12 22/22] pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (20 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 21/22] app/test: remove use of RTE_LOGTYPE_PIPELINE Stephen Hemminger
@ 2023-03-29 23:40 ` Stephen Hemminger
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
  23 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-03-29 23:40 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu

Convert RTE_LOGTYPE_PIPELINE to a dynamic value.

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

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 6c2d9bfc1950..704924e822d0 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -350,7 +350,6 @@ struct logtype {
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
-	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 6418479ee266..29db07881a5a 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -41,7 +41,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_SCHED */
 				 /* was RTE_LOGTYPE_PORT */
 				 /* was RTE_LOGTYPE_TABLE */
-#define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
+				 /* was RTE_LOGTYPE_PIPELINE */
 				 /* was RTE_LOGTYPE_MBUF */
 #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
 				 /* was RTE_LOGTYPE_EFD */
diff --git a/lib/pipeline/rte_pipeline.c b/lib/pipeline/rte_pipeline.c
index ff86c7cf96bf..3b9b083b390d 100644
--- a/lib/pipeline/rte_pipeline.c
+++ b/lib/pipeline/rte_pipeline.c
@@ -1612,3 +1612,5 @@ int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id,
 
 	return 0;
 }
+
+RTE_LOG_REGISTER_DEFAULT(pipeline_logtype, INFO);
diff --git a/lib/pipeline/rte_pipeline.h b/lib/pipeline/rte_pipeline.h
index 3cfb6868f727..ebae08de644f 100644
--- a/lib/pipeline/rte_pipeline.h
+++ b/lib/pipeline/rte_pipeline.h
@@ -841,6 +841,11 @@ int rte_pipeline_ah_packet_hijack(struct rte_pipeline *p,
 int rte_pipeline_ah_packet_drop(struct rte_pipeline *p,
 	uint64_t pkts_mask);
 
+
+/** Internal Logtype used */
+extern int pipeline_logtype;
+#define RTE_LOGTYPE_PIPELINE pipeline_logtype
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v12 06/22] acl: convert RTE_LOGTYPE_ACL to dynamic type
  2023-03-29 23:40 ` [PATCH v12 06/22] acl: convert RTE_LOGTYPE_ACL " Stephen Hemminger
@ 2023-06-05 13:40   ` Константин Ананьев
  0 siblings, 0 replies; 68+ messages in thread
From: Константин Ананьев @ 2023-06-05 13:40 UTC (permalink / raw)
  To: Stephen Hemminger, dev

[-- Attachment #1: Type: text/html, Size: 7416 bytes --]

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v12 10/22] ring: convert RTE_LOGTYPE_RING to dynamic type
  2023-03-29 23:40 ` [PATCH v12 10/22] ring: convert RTE_LOGTYPE_RING " Stephen Hemminger
@ 2023-06-05 13:41   ` Константин Ананьев
  0 siblings, 0 replies; 68+ messages in thread
From: Константин Ананьев @ 2023-06-05 13:41 UTC (permalink / raw)
  To: Stephen Hemminger, dev; +Cc: Honnappa Nagarahalli

[-- Attachment #1: Type: text/html, Size: 3378 bytes --]

^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 00/21] Convert static log types in libraries to dynamic types
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (21 preceding siblings ...)
  2023-03-29 23:40 ` [PATCH v12 22/22] pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type Stephen Hemminger
@ 2023-08-21 16:09 ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 01/21] gso: don't log message on non TCP/UDP Stephen Hemminger
                     ` (21 more replies)
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
  23 siblings, 22 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

This patchset removes most of the uses of static LOGTYPE's in DPDK
libraries. It starts with the easy one and goes on to the more complex ones.

There are several options on how to treat the old static types:
leave them there, mark as deprecated, or remove them.
This version removes them since there is no guarantee in current
DPDK policies that says they can't be removed.

Note: there is one patch in this series that will get
flagged incorrectly as an ABI change.

v13 - rebase because log now moved.

v12 - rebase and add table and pipeline libraries

v11 - fix include check on arm cross build

v10 - add necessary rte_compat.h in thash_gfni stub for arm

v9 - fix handling of crc32 alg in lib/hash.
     make it an internal global variable.
     fix gfni stubs for case where they are not used.

Stephen Hemminger (21):
  gso: don't log message on non TCP/UDP
  eal: drop no longer used GSO logtype
  log: drop unused RTE_LOGTYPE_TIMER
  efd: convert RTE_LOGTYPE_EFD to dynamic type
  mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
  acl: convert RTE_LOGTYPE_ACL to dynamic type
  examples/power: replace use of RTE_LOGTYPE_POWER
  examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
  power: convert RTE_LOGTYPE_POWER to dynamic type
  ring: convert RTE_LOGTYPE_RING to dynamic type
  mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
  lpm: convert RTE_LOGTYPE_LPM to dynamic types
  sched: convert RTE_LOGTYPE_SCHED to dynamic type
  examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
  port: convert RTE_LOGTYPE_PORT to dynamic type
  hash: move rte_thash_gfni stubs out of header file
  hash: move rte_hash_set_alg out header
  hash: convert RTE_LOGTYPE_HASH to dynamic type
  table: convert RTE_LOGTYPE_TABLE to dynamic type
  app/test: remove use of RTE_LOGTYPE_PIPELINE
  pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type

 app/test/test_acl.c             |  2 +-
 app/test/test_table_acl.c       | 50 +++++++++++-------------
 app/test/test_table_pipeline.c  | 40 +++++++++----------
 examples/distributor/main.c     |  2 +-
 examples/ipsec-secgw/sa.c       |  6 +--
 examples/l3fwd-power/main.c     | 17 +++++----
 lib/acl/acl.h                   |  1 +
 lib/acl/acl_bld.c               |  3 ++
 lib/acl/acl_gen.c               |  1 +
 lib/acl/acl_log.h               |  6 +++
 lib/acl/rte_acl.c               |  3 ++
 lib/acl/tb_mem.c                |  3 +-
 lib/efd/rte_efd.c               |  4 ++
 lib/fib/fib_log.h               |  4 ++
 lib/fib/rte_fib.c               |  3 ++
 lib/fib/rte_fib6.c              |  2 +
 lib/gso/rte_gso.c               |  4 +-
 lib/gso/rte_gso.h               |  1 +
 lib/hash/meson.build            |  9 ++++-
 lib/hash/rte_crc_arm64.h        |  8 ++--
 lib/hash/rte_crc_x86.h          | 10 ++---
 lib/hash/rte_cuckoo_hash.c      |  5 +++
 lib/hash/rte_fbk_hash.c         |  5 +++
 lib/hash/rte_hash_crc.c         | 68 +++++++++++++++++++++++++++++++++
 lib/hash/rte_hash_crc.h         | 48 ++---------------------
 lib/hash/rte_thash.c            |  3 ++
 lib/hash/rte_thash_gfni.c       | 50 ++++++++++++++++++++++++
 lib/hash/rte_thash_gfni.h       | 30 +++++----------
 lib/hash/version.map            | 11 ++++++
 lib/log/log.c                   | 16 --------
 lib/log/rte_log.h               | 32 ++++++++--------
 lib/lpm/lpm_log.h               |  4 ++
 lib/lpm/rte_lpm.c               |  3 ++
 lib/lpm/rte_lpm6.c              |  1 +
 lib/mbuf/mbuf_log.h             |  4 ++
 lib/mbuf/rte_mbuf.c             |  4 ++
 lib/mbuf/rte_mbuf_dyn.c         |  2 +
 lib/mbuf/rte_mbuf_pool_ops.c    |  2 +
 lib/mempool/rte_mempool.c       |  2 +
 lib/mempool/rte_mempool.h       |  8 ++++
 lib/mempool/version.map         |  3 ++
 lib/pipeline/rte_pipeline.c     |  2 +
 lib/pipeline/rte_pipeline.h     |  5 +++
 lib/port/rte_port_ethdev.c      |  3 ++
 lib/port/rte_port_eventdev.c    |  4 ++
 lib/port/rte_port_fd.c          |  3 ++
 lib/port/rte_port_frag.c        |  3 ++
 lib/port/rte_port_ras.c         |  3 ++
 lib/port/rte_port_ring.c        |  3 ++
 lib/port/rte_port_sched.c       |  3 ++
 lib/port/rte_port_source_sink.c |  3 ++
 lib/port/rte_port_sym_crypto.c  |  3 ++
 lib/power/guest_channel.c       |  3 +-
 lib/power/power_common.c        |  2 +
 lib/power/power_common.h        |  2 +
 lib/power/power_kvm_vm.c        |  1 +
 lib/power/rte_power.c           |  1 +
 lib/rib/rib_log.h               |  4 ++
 lib/rib/rte_rib.c               |  3 ++
 lib/rib/rte_rib6.c              |  3 ++
 lib/ring/rte_ring.c             |  3 ++
 lib/sched/rte_pie.c             |  1 +
 lib/sched/rte_sched.c           |  5 +++
 lib/sched/rte_sched_log.h       |  4 ++
 lib/table/meson.build           |  1 +
 lib/table/rte_table.c           |  8 ++++
 lib/table/rte_table.h           |  4 ++
 67 files changed, 387 insertions(+), 173 deletions(-)
 create mode 100644 lib/acl/acl_log.h
 create mode 100644 lib/fib/fib_log.h
 create mode 100644 lib/hash/rte_hash_crc.c
 create mode 100644 lib/hash/rte_thash_gfni.c
 create mode 100644 lib/lpm/lpm_log.h
 create mode 100644 lib/mbuf/mbuf_log.h
 create mode 100644 lib/rib/rib_log.h
 create mode 100644 lib/sched/rte_sched_log.h
 create mode 100644 lib/table/rte_table.c

-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 01/21] gso: don't log message on non TCP/UDP
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 02/21] eal: drop no longer used GSO logtype Stephen Hemminger
                     ` (20 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Jiayu Hu, Mark Kavanagh

If a large packet is passed into GSO routines of unknown protocol
then library would log a message.
Better to tell the application instead of logging.

Fixes: 119583797b6a ("gso: support TCP/IPv4 GSO")
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/gso/rte_gso.c | 4 +---
 lib/gso/rte_gso.h | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/gso/rte_gso.c b/lib/gso/rte_gso.c
index 4b59217c16ee..e29c7d884aed 100644
--- a/lib/gso/rte_gso.c
+++ b/lib/gso/rte_gso.c
@@ -80,9 +80,7 @@ rte_gso_segment(struct rte_mbuf *pkt,
 		ret = gso_udp4_segment(pkt, gso_size, direct_pool,
 				indirect_pool, pkts_out, nb_pkts_out);
 	} else {
-		/* unsupported packet, skip */
-		RTE_LOG(DEBUG, GSO, "Unsupported packet type\n");
-		ret = 0;
+		ret = -ENOTSUP;	/* only UDP or TCP allowed */
 	}
 
 	if (ret < 0) {
diff --git a/lib/gso/rte_gso.h b/lib/gso/rte_gso.h
index 40922524df42..c0f9a1b66ff2 100644
--- a/lib/gso/rte_gso.h
+++ b/lib/gso/rte_gso.h
@@ -114,6 +114,7 @@ struct rte_gso_ctx {
  *  - The number of GSO segments filled in pkts_out on success.
  *  - Return 0 if it does not need to be GSO'd.
  *  - Return -ENOMEM if run out of memory in MBUF pools.
+ *  - Return -ENOTSUP for protocols that can not be segmented
  *  - Return -EINVAL for invalid parameters.
  */
 int rte_gso_segment(struct rte_mbuf *pkt,
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 02/21] eal: drop no longer used GSO logtype
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 01/21] gso: don't log message on non TCP/UDP Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 03/21] log: drop unused RTE_LOGTYPE_TIMER Stephen Hemminger
                     ` (19 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The message that used this was replaced in previous patch.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c     | 1 -
 lib/log/rte_log.h | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/log/log.c b/lib/log/log.c
index 52c771fb6b84..b51beb1a7604 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -370,7 +370,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EFD,        "lib.efd"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
-	{RTE_LOGTYPE_GSO,        "lib.gso"},
 	{RTE_LOGTYPE_USER1,      "user1"},
 	{RTE_LOGTYPE_USER2,      "user2"},
 	{RTE_LOGTYPE_USER3,      "user3"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index bdefff2a5933..4ed11a80069a 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -46,7 +46,7 @@ extern "C" {
 #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
 #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. */
+				 /* was RTE_LOGTYPE_GSO */
 
 /* these log types can be used in an application */
 #define RTE_LOGTYPE_USER1     24 /**< User-defined log type 1. */
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 03/21] log: drop unused RTE_LOGTYPE_TIMER
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 01/21] gso: don't log message on non TCP/UDP Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 02/21] eal: drop no longer used GSO logtype Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 04/21] efd: convert RTE_LOGTYPE_EFD to dynamic type Stephen Hemminger
                     ` (18 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The timer code does not use rte_log.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c     | 1 -
 lib/log/rte_log.h | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/log/log.c b/lib/log/log.c
index b51beb1a7604..4a7ff738750b 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -355,7 +355,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_MALLOC,     "lib.malloc"},
 	{RTE_LOGTYPE_RING,       "lib.ring"},
 	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
-	{RTE_LOGTYPE_TIMER,      "lib.timer"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 4ed11a80069a..bc9d1fc8f106 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -30,7 +30,7 @@ extern "C" {
 #define RTE_LOGTYPE_MALLOC     1 /**< Log related to malloc. */
 #define RTE_LOGTYPE_RING       2 /**< Log related to ring. */
 #define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
-#define RTE_LOGTYPE_TIMER      4 /**< Log related to timers. */
+				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
 #define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 04/21] efd: convert RTE_LOGTYPE_EFD to dynamic type
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (2 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 03/21] log: drop unused RTE_LOGTYPE_TIMER Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 05/21] mbuf: convert RTE_LOGTYPE_MBUF " Stephen Hemminger
                     ` (17 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Byron Marohn, Yipeng Wang

Replace all uses of the global logtype with a dynamic log type.

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

diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
index dad962ce29bf..78fb9250ef87 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) \
diff --git a/lib/log/log.c b/lib/log/log.c
index 4a7ff738750b..7a6b5c335753 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -367,7 +367,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/log/rte_log.h b/lib/log/rte_log.h
index bc9d1fc8f106..6df66366608b 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/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 */
 
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 05/21] mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (3 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 04/21] efd: convert RTE_LOGTYPE_EFD to dynamic type Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 06/21] acl: convert RTE_LOGTYPE_ACL " Stephen Hemminger
                     ` (16 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Olivier Matz

Introduce a new dynamic logtype for mbuf related messages.
Since this is used in multiple files put one macro in mbuf_log.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c                | 1 -
 lib/log/rte_log.h            | 2 +-
 lib/mbuf/mbuf_log.h          | 4 ++++
 lib/mbuf/rte_mbuf.c          | 4 ++++
 lib/mbuf/rte_mbuf_dyn.c      | 2 ++
 lib/mbuf/rte_mbuf_pool_ops.c | 2 ++
 6 files changed, 13 insertions(+), 2 deletions(-)
 create mode 100644 lib/mbuf/mbuf_log.h

diff --git a/lib/log/log.c b/lib/log/log.c
index 7a6b5c335753..718922b5e5ac 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -365,7 +365,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_PORT,       "lib.port"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
-	{RTE_LOGTYPE_MBUF,       "lib.mbuf"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 6df66366608b..8cab1f11f7b8 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -42,7 +42,7 @@ extern "C" {
 #define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
 #define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
-#define RTE_LOGTYPE_MBUF      16 /**< Log related to mbuf. */
+				 /* was RTE_LOGTYPE_MBUF */
 #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
 				 /* was RTE_LOGTYPE_EFD */
 #define RTE_LOGTYPE_EVENTDEV  19 /**< Log related to eventdev. */
diff --git a/lib/mbuf/mbuf_log.h b/lib/mbuf/mbuf_log.h
new file mode 100644
index 000000000000..d759a9a25501
--- /dev/null
+++ b/lib/mbuf/mbuf_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int mbuf_logtype;
+#define RTE_LOGTYPE_MBUF	mbuf_logtype
diff --git a/lib/mbuf/rte_mbuf.c b/lib/mbuf/rte_mbuf.c
index 686e797c80c4..3eccc618270b 100644
--- a/lib/mbuf/rte_mbuf.c
+++ b/lib/mbuf/rte_mbuf.c
@@ -20,6 +20,10 @@
 #include <rte_errno.h>
 #include <rte_memcpy.h>
 
+#include "mbuf_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(mbuf_logtype, INFO);
+
 /*
  * pktmbuf pool constructor, given as a callback function to
  * rte_mempool_create(), or called directly if using
diff --git a/lib/mbuf/rte_mbuf_dyn.c b/lib/mbuf/rte_mbuf_dyn.c
index 5049508bea6e..4fb1863a1043 100644
--- a/lib/mbuf/rte_mbuf_dyn.c
+++ b/lib/mbuf/rte_mbuf_dyn.c
@@ -17,6 +17,8 @@
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
 
+#include "mbuf_log.h"
+
 #define RTE_MBUF_DYN_MZNAME "rte_mbuf_dyn"
 
 struct mbuf_dynfield_elt {
diff --git a/lib/mbuf/rte_mbuf_pool_ops.c b/lib/mbuf/rte_mbuf_pool_ops.c
index 4c91f4ce8569..5318430126cb 100644
--- a/lib/mbuf/rte_mbuf_pool_ops.c
+++ b/lib/mbuf/rte_mbuf_pool_ops.c
@@ -8,6 +8,8 @@
 #include <rte_errno.h>
 #include <rte_mbuf_pool_ops.h>
 
+#include "mbuf_log.h"
+
 int
 rte_mbuf_set_platform_mempool_ops(const char *ops_name)
 {
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 06/21] acl: convert RTE_LOGTYPE_ACL to dynamic type
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (4 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 05/21] mbuf: convert RTE_LOGTYPE_MBUF " Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 07/21] examples/power: replace use of RTE_LOGTYPE_POWER Stephen Hemminger
                     ` (15 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Konstantin Ananyev

Get rid of RTE_LOGTYPE_ACL and RTE_LOGTYPE_MALLOC.
For ACL library use a dynamic type.
The one message using RTE_LOGTYPE_MALLOC should have been
under the ACL logtype anyway.

The test code should not have been using fixed log type
so just change that to stderr.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_acl.c | 2 +-
 lib/acl/acl.h       | 1 +
 lib/acl/acl_bld.c   | 3 +++
 lib/acl/acl_gen.c   | 1 +
 lib/acl/acl_log.h   | 6 ++++++
 lib/acl/rte_acl.c   | 3 +++
 lib/acl/tb_mem.c    | 3 ++-
 lib/log/log.c       | 2 --
 lib/log/rte_log.h   | 4 ++--
 9 files changed, 19 insertions(+), 6 deletions(-)
 create mode 100644 lib/acl/acl_log.h

diff --git a/app/test/test_acl.c b/app/test/test_acl.c
index 623f34682e69..7de54d4c8901 100644
--- a/app/test/test_acl.c
+++ b/app/test/test_acl.c
@@ -154,7 +154,7 @@ rte_acl_ipv4vlan_add_rules(struct rte_acl_ctx *ctx,
 	for (i = 0; i != num; i++) {
 		rc = acl_ipv4vlan_check_rule(rules + i);
 		if (rc != 0) {
-			RTE_LOG(ERR, ACL, "%s: rule #%u is invalid\n",
+			fprintf(stderr,  "%s: rule #%u is invalid\n",
 				__func__, i + 1);
 			return rc;
 		}
diff --git a/lib/acl/acl.h b/lib/acl/acl.h
index c8e4e72fabfb..baed9513cb31 100644
--- a/lib/acl/acl.h
+++ b/lib/acl/acl.h
@@ -225,6 +225,7 @@ int
 rte_acl_classify_altivec(const struct rte_acl_ctx *ctx, const uint8_t **data,
 	uint32_t *results, uint32_t num, uint32_t categories);
 
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/lib/acl/acl_bld.c b/lib/acl/acl_bld.c
index 2816632803bd..22d909309a4c 100644
--- a/lib/acl/acl_bld.c
+++ b/lib/acl/acl_bld.c
@@ -3,8 +3,11 @@
  */
 
 #include <rte_acl.h>
+#include <rte_log.h>
+
 #include "tb_mem.h"
 #include "acl.h"
+#include "acl_log.h"
 
 #define	ACL_POOL_ALIGN		8
 #define	ACL_POOL_ALLOC_MIN	0x800000
diff --git a/lib/acl/acl_gen.c b/lib/acl/acl_gen.c
index 25e75fec3534..03a47ea231ec 100644
--- a/lib/acl/acl_gen.c
+++ b/lib/acl/acl_gen.c
@@ -4,6 +4,7 @@
 
 #include <rte_acl.h>
 #include "acl.h"
+#include "acl_log.h"
 
 #define	QRANGE_MIN	((uint8_t)INT8_MIN)
 
diff --git a/lib/acl/acl_log.h b/lib/acl/acl_log.h
new file mode 100644
index 000000000000..6147116d8d12
--- /dev/null
+++ b/lib/acl/acl_log.h
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+#include <rte_log.h>
+
+extern int acl_logtype;
+#define RTE_LOGTYPE_ACL	acl_logtype
diff --git a/lib/acl/rte_acl.c b/lib/acl/rte_acl.c
index a61c3ba188da..650d52a97c32 100644
--- a/lib/acl/rte_acl.c
+++ b/lib/acl/rte_acl.c
@@ -8,6 +8,9 @@
 #include <rte_tailq.h>
 
 #include "acl.h"
+#include "acl_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(acl_logtype, INFO);
 
 TAILQ_HEAD(rte_acl_list, rte_tailq_entry);
 
diff --git a/lib/acl/tb_mem.c b/lib/acl/tb_mem.c
index f14d7b4fa26e..6a9d96aaeda2 100644
--- a/lib/acl/tb_mem.c
+++ b/lib/acl/tb_mem.c
@@ -3,6 +3,7 @@
  */
 
 #include "tb_mem.h"
+#include "acl_log.h"
 
 /*
  *  Memory management routines for temporary memory.
@@ -25,7 +26,7 @@ tb_pool(struct tb_mem_pool *pool, size_t sz)
 	size = sz + pool->alignment - 1;
 	block = calloc(1, size + sizeof(*pool->block));
 	if (block == NULL) {
-		RTE_LOG(ERR, MALLOC, "%s(%zu)\n failed, currently allocated "
+		RTE_LOG(ERR, ACL, "%s(%zu)\n failed, currently allocated "
 			"by pool: %zu bytes\n", __func__, sz, pool->alloc);
 		siglongjmp(pool->fail, -ENOMEM);
 		return NULL;
diff --git a/lib/log/log.c b/lib/log/log.c
index 718922b5e5ac..6f04f75f9a25 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -352,13 +352,11 @@ struct logtype {
 
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
-	{RTE_LOGTYPE_MALLOC,     "lib.malloc"},
 	{RTE_LOGTYPE_RING,       "lib.ring"},
 	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
-	{RTE_LOGTYPE_ACL,        "lib.acl"},
 	{RTE_LOGTYPE_POWER,      "lib.power"},
 	{RTE_LOGTYPE_METER,      "lib.meter"},
 	{RTE_LOGTYPE_SCHED,      "lib.sched"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 8cab1f11f7b8..04dfb3443ea4 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -27,7 +27,7 @@ extern "C" {
 
 /* SDK log type */
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
-#define RTE_LOGTYPE_MALLOC     1 /**< Log related to malloc. */
+				 /* was RTE_LOGTYPE_MALLOC */
 #define RTE_LOGTYPE_RING       2 /**< Log related to ring. */
 #define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
 				 /* was RTE_LOGTYPE_TIMER */
@@ -35,7 +35,7 @@ extern "C" {
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
 #define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
 				 /* was RTE_LOGTYPE_KNI */
-#define RTE_LOGTYPE_ACL        9 /**< Log related to ACL. */
+				 /* was RTE_LOGTYPE_ACL */
 #define RTE_LOGTYPE_POWER     10 /**< Log related to power. */
 #define RTE_LOGTYPE_METER     11 /**< Log related to QoS meter. */
 #define RTE_LOGTYPE_SCHED     12 /**< Log related to QoS port scheduler. */
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 07/21] examples/power: replace use of RTE_LOGTYPE_POWER
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (5 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 06/21] acl: convert RTE_LOGTYPE_ACL " Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 08/21] examples/l3fwd-power: " Stephen Hemminger
                     ` (14 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, David Hunt

Don't use static logtype in sample application.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Hunt <david.hunt@intel.com>
---
 examples/distributor/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 21304d661873..542f76cf9664 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -679,7 +679,7 @@ init_power_library(void)
 		/* init power management library */
 		ret = rte_power_init(lcore_id);
 		if (ret) {
-			RTE_LOG(ERR, POWER,
+			fprintf(stderr,
 				"Library initialization failed on core %u\n",
 				lcore_id);
 			/*
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 08/21] examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (6 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 07/21] examples/power: replace use of RTE_LOGTYPE_POWER Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 09/21] power: convert RTE_LOGTYPE_POWER to dynamic type Stephen Hemminger
                     ` (13 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, David Hunt, Anatoly Burakov

Convert to using a dynamic logtype for the application.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Hunt <david.hunt@intel.com>
---
 examples/l3fwd-power/main.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 3f01cbd9e277..f3330fd735dd 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -51,7 +51,8 @@
 #include "perf_core.h"
 #include "main.h"
 
-#define RTE_LOGTYPE_L3FWD_POWER RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER(l3fwd_power_logtype, l3fwd.power, INFO);
+#define RTE_LOGTYPE_L3FWD_POWER l3fwd_power_logtype
 
 #define MAX_PKT_BURST 32
 
@@ -2236,7 +2237,7 @@ init_power_library(void)
 		/* init power management library */
 		ret = rte_power_init(lcore_id);
 		if (ret) {
-			RTE_LOG(ERR, POWER,
+			RTE_LOG(ERR, L3FWD_POWER,
 				"Library initialization failed on core %u\n",
 				lcore_id);
 			return ret;
@@ -2246,8 +2247,8 @@ init_power_library(void)
 		if (env != PM_ENV_ACPI_CPUFREQ &&
 				env != PM_ENV_PSTATE_CPUFREQ &&
 				env != PM_ENV_CPPC_CPUFREQ) {
-			RTE_LOG(ERR, POWER,
-				"Only ACPI, PSTATE and CPPC mode are supported\n");
+			RTE_LOG(ERR, L3FWD_POWER,
+				"Only ACPI and PSTATE mode are supported\n");
 			return -1;
 		}
 	}
@@ -2264,7 +2265,7 @@ deinit_power_library(void)
 		/* deinit power management library */
 		ret = rte_power_exit(lcore_id);
 		if (ret) {
-			RTE_LOG(ERR, POWER,
+			RTE_LOG(ERR, L3FWD_POWER,
 				"Library deinitialization failed on core %u\n",
 				lcore_id);
 			return ret;
@@ -2333,7 +2334,7 @@ update_telemetry(__rte_unused struct rte_timer *tim,
 	ret = rte_metrics_update_values(RTE_METRICS_GLOBAL, telstats_index,
 					values, RTE_DIM(values));
 	if (ret < 0)
-		RTE_LOG(WARNING, POWER, "failed to update metrics\n");
+		RTE_LOG(WARNING, L3FWD_POWER, "failed to update metrics\n");
 }
 
 static int
@@ -2382,7 +2383,7 @@ launch_timer(unsigned int lcore_id)
 				rte_get_main_lcore());
 	}
 
-	RTE_LOG(INFO, POWER, "Bring up the Timer\n");
+	RTE_LOG(INFO, L3FWD_POWER, "Bring up the Timer\n");
 
 	telemetry_setup_timer();
 
@@ -2398,7 +2399,7 @@ launch_timer(unsigned int lcore_id)
 		}
 	}
 
-	RTE_LOG(INFO, POWER, "Timer_subsystem is done\n");
+	RTE_LOG(INFO, L3FWD_POWER, "Timer_subsystem is done\n");
 
 	return 0;
 }
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 09/21] power: convert RTE_LOGTYPE_POWER to dynamic type
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (7 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 08/21] examples/l3fwd-power: " Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 10/21] ring: convert RTE_LOGTYPE_RING " Stephen Hemminger
                     ` (12 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, David Hunt, Anatoly Burakov

Use dynamic log type for power library.
Also replace use of RTE_LOGTYPE_USER1 with lib.power.guest.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Hunt <david.hunt@intel.com>
---
 lib/log/log.c             | 1 -
 lib/log/rte_log.h         | 2 +-
 lib/power/guest_channel.c | 3 ++-
 lib/power/power_common.c  | 2 ++
 lib/power/power_common.h  | 2 ++
 lib/power/power_kvm_vm.c  | 1 +
 lib/power/rte_power.c     | 1 +
 7 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/log/log.c b/lib/log/log.c
index 6f04f75f9a25..5ec3c16250f5 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -357,7 +357,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
-	{RTE_LOGTYPE_POWER,      "lib.power"},
 	{RTE_LOGTYPE_METER,      "lib.meter"},
 	{RTE_LOGTYPE_SCHED,      "lib.sched"},
 	{RTE_LOGTYPE_PORT,       "lib.port"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 04dfb3443ea4..a1949e606395 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -36,7 +36,7 @@ extern "C" {
 #define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
 				 /* was RTE_LOGTYPE_KNI */
 				 /* was RTE_LOGTYPE_ACL */
-#define RTE_LOGTYPE_POWER     10 /**< Log related to power. */
+				 /* was RTE_LOGTYPE_POWER */
 #define RTE_LOGTYPE_METER     11 /**< Log related to QoS meter. */
 #define RTE_LOGTYPE_SCHED     12 /**< Log related to QoS port scheduler. */
 #define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c
index 7b2ae0b6506f..4932a0528691 100644
--- a/lib/power/guest_channel.c
+++ b/lib/power/guest_channel.c
@@ -17,7 +17,8 @@
 
 #include "guest_channel.h"
 
-#define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_SUFFIX(guest_channel_logtype, guest, INFO);
+#define RTE_LOGTYPE_GUEST_CHANNEL guest_channel_logtype
 
 /* Timeout for incoming message in milliseconds. */
 #define TIMEOUT 10
diff --git a/lib/power/power_common.c b/lib/power/power_common.c
index 1e09facb863f..bf77eafa886b 100644
--- a/lib/power/power_common.c
+++ b/lib/power/power_common.c
@@ -12,6 +12,8 @@
 
 #include "power_common.h"
 
+RTE_LOG_REGISTER_DEFAULT(power_logtype, INFO);
+
 #define POWER_SYSFILE_SCALING_DRIVER   \
 		"/sys/devices/system/cpu/cpu%u/cpufreq/scaling_driver"
 #define POWER_SYSFILE_GOVERNOR  \
diff --git a/lib/power/power_common.h b/lib/power/power_common.h
index c1c713927621..c3fcbf4c1000 100644
--- a/lib/power/power_common.h
+++ b/lib/power/power_common.h
@@ -10,6 +10,8 @@
 
 #define RTE_POWER_INVALID_FREQ_INDEX (~0)
 
+extern int power_logtype;
+#define RTE_LOGTYPE_POWER power_logtype
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
 #define POWER_DEBUG_TRACE(fmt, args...) \
diff --git a/lib/power/power_kvm_vm.c b/lib/power/power_kvm_vm.c
index 6a8109d44959..db031f43105a 100644
--- a/lib/power/power_kvm_vm.c
+++ b/lib/power/power_kvm_vm.c
@@ -8,6 +8,7 @@
 
 #include "rte_power_guest_channel.h"
 #include "guest_channel.h"
+#include "power_common.h"
 #include "power_kvm_vm.h"
 
 #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
diff --git a/lib/power/rte_power.c b/lib/power/rte_power.c
index 63a43bd8f5ae..db0e7705a9ef 100644
--- a/lib/power/rte_power.c
+++ b/lib/power/rte_power.c
@@ -10,6 +10,7 @@
 #include "rte_power.h"
 #include "power_acpi_cpufreq.h"
 #include "power_cppc_cpufreq.h"
+#include "power_common.h"
 #include "power_kvm_vm.h"
 #include "power_pstate_cpufreq.h"
 
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 10/21] ring: convert RTE_LOGTYPE_RING to dynamic type
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (8 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 09/21] power: convert RTE_LOGTYPE_POWER to dynamic type Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 11/21] mempool: convert RTE_LOGTYPE_MEMPOOL " Stephen Hemminger
                     ` (11 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Honnappa Nagarahalli, Konstantin Ananyev

The logtype for ring only used in library.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c       | 1 -
 lib/log/rte_log.h   | 2 +-
 lib/ring/rte_ring.c | 3 +++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/log/log.c b/lib/log/log.c
index 5ec3c16250f5..212c5d7b8669 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -352,7 +352,6 @@ struct logtype {
 
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
-	{RTE_LOGTYPE_RING,       "lib.ring"},
 	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index a1949e606395..4a1310385cf4 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -28,7 +28,7 @@ extern "C" {
 /* SDK log type */
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
 				 /* was RTE_LOGTYPE_MALLOC */
-#define RTE_LOGTYPE_RING       2 /**< Log related to ring. */
+				 /* was RTE_LOGTYPE_RING */
 #define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c
index 057d25ff6f2f..12046419f194 100644
--- a/lib/ring/rte_ring.c
+++ b/lib/ring/rte_ring.c
@@ -26,6 +26,9 @@
 #include "rte_ring.h"
 #include "rte_ring_elem.h"
 
+RTE_LOG_REGISTER_DEFAULT(ring_logtype, INFO);
+#define RTE_LOGTYPE_RING ring_logtype
+
 TAILQ_HEAD(rte_ring_list, rte_tailq_entry);
 
 static struct rte_tailq_elem rte_ring_tailq = {
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 11/21] mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (9 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 10/21] ring: convert RTE_LOGTYPE_RING " Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 12/21] lpm: convert RTE_LOGTYPE_LPM to dynamic types Stephen Hemminger
                     ` (10 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Olivier Matz, Andrew Rybchenko

Convert from RTE_LOGTYPE_MEMPOOL to logtype_mempool.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c             | 1 -
 lib/log/rte_log.h         | 2 +-
 lib/mempool/rte_mempool.c | 2 ++
 lib/mempool/rte_mempool.h | 8 ++++++++
 lib/mempool/version.map   | 3 +++
 5 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/log/log.c b/lib/log/log.c
index 212c5d7b8669..58184548bb85 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -352,7 +352,6 @@ struct logtype {
 
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
-	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 4a1310385cf4..48976fea1c3e 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -29,7 +29,7 @@ extern "C" {
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
 				 /* was RTE_LOGTYPE_MALLOC */
 				 /* was RTE_LOGTYPE_RING */
-#define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
+				 /* was RTE_LOGTYPE_MEMPOOL */
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index 4d337fca8dcd..841666164797 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -31,6 +31,8 @@
 #include "mempool_trace.h"
 #include "rte_mempool.h"
 
+RTE_LOG_REGISTER_DEFAULT(rte_mempool_logtype, INFO);
+
 TAILQ_HEAD(rte_mempool_list, rte_tailq_entry);
 
 static struct rte_tailq_elem rte_mempool_tailq = {
diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
index a05b25d5b9e0..3cf5bcb5fd57 100644
--- a/lib/mempool/rte_mempool.h
+++ b/lib/mempool/rte_mempool.h
@@ -43,6 +43,7 @@
 #include <rte_spinlock.h>
 #include <rte_debug.h>
 #include <rte_lcore.h>
+#include <rte_log.h>
 #include <rte_branch_prediction.h>
 #include <rte_ring.h>
 #include <rte_memcpy.h>
@@ -175,6 +176,13 @@ struct rte_mempool_objtlr {
 
 #endif
 
+
+/**
+ * @internal Logtype used for mempool related messages.
+ */
+extern int rte_mempool_logtype;
+#define RTE_LOGTYPE_MEMPOOL	rte_mempool_logtype
+
 /**
  * A list of memory where objects are stored
  */
diff --git a/lib/mempool/version.map b/lib/mempool/version.map
index d0bfedd1d875..ca6cf89ce3ea 100644
--- a/lib/mempool/version.map
+++ b/lib/mempool/version.map
@@ -57,4 +57,7 @@ INTERNAL {
 	# added in 21.11
 	rte_mempool_event_callback_register;
 	rte_mempool_event_callback_unregister;
+
+	# added in 23.07
+	rte_mempool_logtype;
 };
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 12/21] lpm: convert RTE_LOGTYPE_LPM to dynamic types
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (10 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 11/21] mempool: convert RTE_LOGTYPE_MEMPOOL " Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 13/21] sched: convert RTE_LOGTYPE_SCHED to dynamic type Stephen Hemminger
                     ` (9 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Vladimir Medvedkin, Bruce Richardson

Split lpm and lpm6 into separate log types since they
are in different files and user may want to change log
levels for IPv4 vs IPv6.

For rib and fib libraries give them own types as well.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/fib/fib_log.h  | 4 ++++
 lib/fib/rte_fib.c  | 3 +++
 lib/fib/rte_fib6.c | 2 ++
 lib/log/log.c      | 1 -
 lib/log/rte_log.h  | 2 +-
 lib/lpm/lpm_log.h  | 4 ++++
 lib/lpm/rte_lpm.c  | 3 +++
 lib/lpm/rte_lpm6.c | 1 +
 lib/rib/rib_log.h  | 4 ++++
 lib/rib/rte_rib.c  | 3 +++
 lib/rib/rte_rib6.c | 3 +++
 11 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 lib/fib/fib_log.h
 create mode 100644 lib/lpm/lpm_log.h
 create mode 100644 lib/rib/rib_log.h

diff --git a/lib/fib/fib_log.h b/lib/fib/fib_log.h
new file mode 100644
index 000000000000..c731c820f621
--- /dev/null
+++ b/lib/fib/fib_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int fib_logtype;
+#define RTE_LOGTYPE_LPM fib_logtype
diff --git a/lib/fib/rte_fib.c b/lib/fib/rte_fib.c
index 0c3b20e00a5a..f88e71a59d5a 100644
--- a/lib/fib/rte_fib.c
+++ b/lib/fib/rte_fib.c
@@ -17,6 +17,9 @@
 #include <rte_fib.h>
 
 #include "dir24_8.h"
+#include "fib_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(fib_logtype, INFO);
 
 TAILQ_HEAD(rte_fib_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_fib_tailq = {
diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c
index 28c69b38999f..ab1d9604796f 100644
--- a/lib/fib/rte_fib6.c
+++ b/lib/fib/rte_fib6.c
@@ -10,6 +10,7 @@
 #include <rte_eal_memconfig.h>
 #include <rte_tailq.h>
 #include <rte_errno.h>
+#include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_string_fns.h>
 
@@ -17,6 +18,7 @@
 #include <rte_fib6.h>
 
 #include "trie.h"
+#include "fib_log.h"
 
 TAILQ_HEAD(rte_fib6_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_fib6_tailq = {
diff --git a/lib/log/log.c b/lib/log/log.c
index 58184548bb85..ab28edec11b8 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -354,7 +354,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
-	{RTE_LOGTYPE_LPM,        "lib.lpm"},
 	{RTE_LOGTYPE_METER,      "lib.meter"},
 	{RTE_LOGTYPE_SCHED,      "lib.sched"},
 	{RTE_LOGTYPE_PORT,       "lib.port"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 48976fea1c3e..dc2454a0d9de 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -33,7 +33,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
-#define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
+				 /* was RTE_LOGTYPE_LPM */
 				 /* was RTE_LOGTYPE_KNI */
 				 /* was RTE_LOGTYPE_ACL */
 				 /* was RTE_LOGTYPE_POWER */
diff --git a/lib/lpm/lpm_log.h b/lib/lpm/lpm_log.h
new file mode 100644
index 000000000000..a0621b70a5fe
--- /dev/null
+++ b/lib/lpm/lpm_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int lpm_logtype;
+#define RTE_LOGTYPE_LPM lpm_logtype
diff --git a/lib/lpm/rte_lpm.c b/lib/lpm/rte_lpm.c
index cdcd1b7f9e47..0ca82147866a 100644
--- a/lib/lpm/rte_lpm.c
+++ b/lib/lpm/rte_lpm.c
@@ -18,6 +18,9 @@
 #include <rte_tailq.h>
 
 #include "rte_lpm.h"
+#include "lpm_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(lpm_logtype, INFO);
 
 TAILQ_HEAD(rte_lpm_list, rte_tailq_entry);
 
diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c
index 8d21aeddb83c..873cc8bc267d 100644
--- a/lib/lpm/rte_lpm6.c
+++ b/lib/lpm/rte_lpm6.c
@@ -20,6 +20,7 @@
 #include <rte_tailq.h>
 
 #include "rte_lpm6.h"
+#include "lpm_log.h"
 
 #define RTE_LPM6_TBL24_NUM_ENTRIES        (1 << 24)
 #define RTE_LPM6_TBL8_GROUP_NUM_ENTRIES         256
diff --git a/lib/rib/rib_log.h b/lib/rib/rib_log.h
new file mode 100644
index 000000000000..f3ee513ca854
--- /dev/null
+++ b/lib/rib/rib_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int rib_logtype;
+#define RTE_LOGTYPE_LPM rib_logtype
diff --git a/lib/rib/rte_rib.c b/lib/rib/rte_rib.c
index 812a2597d117..a62e951a8e0e 100644
--- a/lib/rib/rte_rib.c
+++ b/lib/rib/rte_rib.c
@@ -16,6 +16,9 @@
 
 #include <rte_rib.h>
 
+RTE_LOG_REGISTER_DEFAULT(rib_logtype, INFO);
+#define RTE_LOGTYPE_LPM rib_logtype
+
 TAILQ_HEAD(rte_rib_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_rib_tailq = {
 	.name = "RTE_RIB",
diff --git a/lib/rib/rte_rib6.c b/lib/rib/rte_rib6.c
index ae44281ae105..5765995197f8 100644
--- a/lib/rib/rte_rib6.c
+++ b/lib/rib/rte_rib6.c
@@ -9,6 +9,7 @@
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
+#include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_string_fns.h>
@@ -16,6 +17,8 @@
 
 #include <rte_rib6.h>
 
+#include "rib_log.h"
+
 #define RTE_RIB_VALID_NODE	1
 #define RIB6_MAXDEPTH		128
 /* Maximum length of a RIB6 name. */
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 13/21] sched: convert RTE_LOGTYPE_SCHED to dynamic type
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (11 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 12/21] lpm: convert RTE_LOGTYPE_LPM to dynamic types Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 14/21] examples/ipsec-secgw: replace RTE_LOGTYPE_PORT Stephen Hemminger
                     ` (8 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu

Also can remove unused RTE_LOGTYPE_METER

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c             | 2 --
 lib/log/rte_log.h         | 4 ++--
 lib/sched/rte_pie.c       | 1 +
 lib/sched/rte_sched.c     | 5 +++++
 lib/sched/rte_sched_log.h | 4 ++++
 5 files changed, 12 insertions(+), 4 deletions(-)
 create mode 100644 lib/sched/rte_sched_log.h

diff --git a/lib/log/log.c b/lib/log/log.c
index ab28edec11b8..dfaf6f13b007 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -354,8 +354,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
-	{RTE_LOGTYPE_METER,      "lib.meter"},
-	{RTE_LOGTYPE_SCHED,      "lib.sched"},
 	{RTE_LOGTYPE_PORT,       "lib.port"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index dc2454a0d9de..f185fcbc5a94 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -37,8 +37,8 @@ extern "C" {
 				 /* was RTE_LOGTYPE_KNI */
 				 /* was RTE_LOGTYPE_ACL */
 				 /* was RTE_LOGTYPE_POWER */
-#define RTE_LOGTYPE_METER     11 /**< Log related to QoS meter. */
-#define RTE_LOGTYPE_SCHED     12 /**< Log related to QoS port scheduler. */
+				 /* was RTE_LOGTYPE_METER */
+				 /* was RTE_LOGTYPE_SCHED */
 #define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
 #define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
diff --git a/lib/sched/rte_pie.c b/lib/sched/rte_pie.c
index 947e2a059f6f..cce0ce762da8 100644
--- a/lib/sched/rte_pie.c
+++ b/lib/sched/rte_pie.c
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "rte_sched_log.h"
 #include "rte_pie.h"
 
 #ifdef __INTEL_COMPILER
diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c
index 751f6cf84197..96cd863b5467 100644
--- a/lib/sched/rte_sched.c
+++ b/lib/sched/rte_sched.c
@@ -16,9 +16,12 @@
 #include <rte_reciprocal.h>
 
 #include "rte_sched.h"
+#include "rte_sched_log.h"
 #include "rte_sched_common.h"
+
 #include "rte_approx.h"
 
+
 #ifdef __INTEL_COMPILER
 #pragma warning(disable:2259) /* conversion may lose significant bits */
 #endif
@@ -2999,3 +3002,5 @@ rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint
 
 	return count;
 }
+
+RTE_LOG_REGISTER_DEFAULT(sched_logtype, INFO);
diff --git a/lib/sched/rte_sched_log.h b/lib/sched/rte_sched_log.h
new file mode 100644
index 000000000000..fde051f49d62
--- /dev/null
+++ b/lib/sched/rte_sched_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int sched_logtype;
+#define RTE_LOGTYPE_SCHED sched_logtype
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 14/21] examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (12 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 13/21] sched: convert RTE_LOGTYPE_SCHED to dynamic type Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 15/21] port: convert RTE_LOGTYPE_PORT to dynamic type Stephen Hemminger
                     ` (7 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Akhil Goyal, Radu Nicolau, Boris Pismenny,
	Declan Doherty, Aviad Yehezkel

Looks like some code got copy/paste in to the IPSEC gateway
example from another place. Shouldn't be using RTE_LOGTYPE_PORT
here.

Fixes: ec17993a145a ("examples/ipsec-secgw: support security offload")
Acked-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/ipsec-secgw/sa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 6ae0e49fd7f8..c4bac17cd77c 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -1128,7 +1128,7 @@ check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso)
 	if (inbound) {
 		if ((dev_info.rx_offload_capa &
 				RTE_ETH_RX_OFFLOAD_SECURITY) == 0) {
-			RTE_LOG(WARNING, PORT,
+			RTE_LOG(WARNING, IPSEC,
 				"hardware RX IPSec offload is not supported\n");
 			return -EINVAL;
 		}
@@ -1136,13 +1136,13 @@ check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso)
 	} else { /* outbound */
 		if ((dev_info.tx_offload_capa &
 				RTE_ETH_TX_OFFLOAD_SECURITY) == 0) {
-			RTE_LOG(WARNING, PORT,
+			RTE_LOG(WARNING, IPSEC,
 				"hardware TX IPSec offload is not supported\n");
 			return -EINVAL;
 		}
 		if (tso && (dev_info.tx_offload_capa &
 				RTE_ETH_TX_OFFLOAD_TCP_TSO) == 0) {
-			RTE_LOG(WARNING, PORT,
+			RTE_LOG(WARNING, IPSEC,
 				"hardware TCP TSO offload is not supported\n");
 			return -EINVAL;
 		}
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 15/21] port: convert RTE_LOGTYPE_PORT to dynamic type
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (13 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 14/21] examples/ipsec-secgw: replace RTE_LOGTYPE_PORT Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 16/21] hash: move rte_thash_gfni stubs out of header file Stephen Hemminger
                     ` (6 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu

Split up the single static RTE_LOGTYPE_PORT into separate
sub types for each component: port.ethdev, port.evendev, ...

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c                   | 1 -
 lib/log/rte_log.h               | 2 +-
 lib/port/rte_port_ethdev.c      | 3 +++
 lib/port/rte_port_eventdev.c    | 4 ++++
 lib/port/rte_port_fd.c          | 3 +++
 lib/port/rte_port_frag.c        | 3 +++
 lib/port/rte_port_ras.c         | 3 +++
 lib/port/rte_port_ring.c        | 3 +++
 lib/port/rte_port_sched.c       | 3 +++
 lib/port/rte_port_source_sink.c | 3 +++
 lib/port/rte_port_sym_crypto.c  | 3 +++
 11 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/lib/log/log.c b/lib/log/log.c
index dfaf6f13b007..c089fc66affe 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -354,7 +354,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
-	{RTE_LOGTYPE_PORT,       "lib.port"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index f185fcbc5a94..b11aec69af78 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -39,7 +39,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_POWER */
 				 /* was RTE_LOGTYPE_METER */
 				 /* was RTE_LOGTYPE_SCHED */
-#define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
+				 /* was RTE_LOGTYPE_PORT */
 #define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
 				 /* was RTE_LOGTYPE_MBUF */
diff --git a/lib/port/rte_port_ethdev.c b/lib/port/rte_port_ethdev.c
index 0da7890261e9..6685d304a6e9 100644
--- a/lib/port/rte_port_ethdev.c
+++ b/lib/port/rte_port_ethdev.c
@@ -10,6 +10,9 @@
 
 #include "rte_port_ethdev.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_ethdev_logtype, ethdev, INFO);
+#define RTE_LOGTYPE_PORT port_ethdev_logtype
+
 /*
  * Port ETHDEV Reader
  */
diff --git a/lib/port/rte_port_eventdev.c b/lib/port/rte_port_eventdev.c
index fd7dac9a5661..04447bd7f7bc 100644
--- a/lib/port/rte_port_eventdev.c
+++ b/lib/port/rte_port_eventdev.c
@@ -5,11 +5,15 @@
 #include <string.h>
 #include <stdint.h>
 
+#include <rte_log.h>
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 
 #include "rte_port_eventdev.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_eventdev_logtype, eventdev, INFO);
+#define RTE_LOGTYPE_PORT port_eventdev_logtype
+
 /*
  * Port EVENTDEV Reader
  */
diff --git a/lib/port/rte_port_fd.c b/lib/port/rte_port_fd.c
index 932ecd324e05..b2412e7706ee 100644
--- a/lib/port/rte_port_fd.c
+++ b/lib/port/rte_port_fd.c
@@ -10,6 +10,9 @@
 
 #include "rte_port_fd.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_fd_logtype, fd, INFO);
+#define RTE_LOGTYPE_PORT port_fd_logtype
+
 /*
  * Port FD Reader
  */
diff --git a/lib/port/rte_port_frag.c b/lib/port/rte_port_frag.c
index e1f1892176c4..9adcbba47da1 100644
--- a/lib/port/rte_port_frag.c
+++ b/lib/port/rte_port_frag.c
@@ -7,6 +7,9 @@
 
 #include "rte_port_frag.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_frag_logtype, frag, INFO);
+#define RTE_LOGTYPE_PORT port_frag_logtype
+
 /* Max number of fragments per packet allowed */
 #define	RTE_PORT_FRAG_MAX_FRAGS_PER_PACKET 0x80
 
diff --git a/lib/port/rte_port_ras.c b/lib/port/rte_port_ras.c
index e5de57da42ea..5a610b1ba5b5 100644
--- a/lib/port/rte_port_ras.c
+++ b/lib/port/rte_port_ras.c
@@ -9,6 +9,9 @@
 
 #include "rte_port_ras.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_ras_logtype, ras, INFO);
+#define RTE_LOGTYPE_PORT port_ras_logtype
+
 #ifndef RTE_PORT_RAS_N_BUCKETS
 #define RTE_PORT_RAS_N_BUCKETS                                 4094
 #endif
diff --git a/lib/port/rte_port_ring.c b/lib/port/rte_port_ring.c
index 52b2d8e557f0..32a90e836579 100644
--- a/lib/port/rte_port_ring.c
+++ b/lib/port/rte_port_ring.c
@@ -10,6 +10,9 @@
 
 #include "rte_port_ring.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_ring_logtype, ring, INFO);
+#define RTE_LOGTYPE_PORT port_ring_logtype
+
 /*
  * Port RING Reader
  */
diff --git a/lib/port/rte_port_sched.c b/lib/port/rte_port_sched.c
index 8a7d815ef323..6e0a8aba5419 100644
--- a/lib/port/rte_port_sched.c
+++ b/lib/port/rte_port_sched.c
@@ -7,6 +7,9 @@
 
 #include "rte_port_sched.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_sched_logtype, sched, INFO);
+#define RTE_LOGTYPE_PORT port_sched_logtype
+
 /*
  * Reader
  */
diff --git a/lib/port/rte_port_source_sink.c b/lib/port/rte_port_source_sink.c
index 7d73adc1e79e..e9cdadbceb8f 100644
--- a/lib/port/rte_port_source_sink.c
+++ b/lib/port/rte_port_source_sink.c
@@ -15,6 +15,9 @@
 
 #include "rte_port_source_sink.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_source_logtype, source, INFO);
+#define RTE_LOGTYPE_PORT port_source_logtype
+
 /*
  * Port SOURCE
  */
diff --git a/lib/port/rte_port_sym_crypto.c b/lib/port/rte_port_sym_crypto.c
index 295984d025cb..77a2f04d65f6 100644
--- a/lib/port/rte_port_sym_crypto.c
+++ b/lib/port/rte_port_sym_crypto.c
@@ -8,6 +8,9 @@
 
 #include "rte_port_sym_crypto.h"
 
+RTE_LOG_REGISTER_SUFFIX(port_crypto_logtype, crypto, INFO);
+#define RTE_LOGTYPE_PORT port_crypto_logtype
+
 /*
  * Port Crypto Reader
  */
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 16/21] hash: move rte_thash_gfni stubs out of header file
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (14 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 15/21] port: convert RTE_LOGTYPE_PORT to dynamic type Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 17/21] hash: move rte_hash_set_alg out header Stephen Hemminger
                     ` (5 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Yipeng Wang, Sameh Gobriel, Bruce Richardson,
	Vladimir Medvedkin

Having stubs in header file makes it harder to update
RTE_LOG(). Also modify to only print warning once.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/hash/meson.build      |  8 ++++++-
 lib/hash/rte_thash_gfni.c | 47 +++++++++++++++++++++++++++++++++++++++
 lib/hash/rte_thash_gfni.h | 30 ++++++++-----------------
 lib/hash/version.map      |  4 ++++
 4 files changed, 67 insertions(+), 22 deletions(-)
 create mode 100644 lib/hash/rte_thash_gfni.c

diff --git a/lib/hash/meson.build b/lib/hash/meson.build
index 2f757d45f9bc..e56ee8572564 100644
--- a/lib/hash/meson.build
+++ b/lib/hash/meson.build
@@ -17,7 +17,13 @@ indirect_headers += files(
         'rte_thash_x86_gfni.h',
 )
 
-sources = files('rte_cuckoo_hash.c', 'rte_fbk_hash.c', 'rte_thash.c')
+sources = files(
+    'rte_cuckoo_hash.c',
+    'rte_fbk_hash.c',
+    'rte_thash.c',
+    'rte_thash_gfni.c'
+)
+
 deps += ['net']
 deps += ['ring']
 deps += ['rcu']
diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c
new file mode 100644
index 000000000000..eb334185725c
--- /dev/null
+++ b/lib/hash/rte_thash_gfni.c
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2021 Intel Corporation
+ */
+
+#include <stdbool.h>
+
+#include <rte_compat.h>
+#include <rte_log.h>
+#include <rte_thash_gfni.h>
+
+#ifndef RTE_THASH_GFNI_DEFINED
+
+uint32_t
+rte_thash_gfni(const uint64_t *mtrx __rte_unused,
+	       const uint8_t *key __rte_unused, int len __rte_unused)
+{
+	static bool warned;
+
+	if (!warned) {
+		warned = true;
+		RTE_LOG(ERR, HASH,
+			"%s is undefined under given arch\n", __func__);
+	}
+
+	return 0;
+}
+
+void
+rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused,
+		    int len __rte_unused, uint8_t *tuple[] __rte_unused,
+		    uint32_t val[], uint32_t num)
+{
+	unsigned int i;
+
+	static bool warned;
+
+	if (!warned) {
+		warned = true;
+		RTE_LOG(ERR, HASH,
+			"%s is undefined under given arch\n", __func__);
+	}
+
+	for (i = 0; i < num; i++)
+		val[i] = 0;
+}
+
+#endif
diff --git a/lib/hash/rte_thash_gfni.h b/lib/hash/rte_thash_gfni.h
index ef90faa302d1..4fc92984077e 100644
--- a/lib/hash/rte_thash_gfni.h
+++ b/lib/hash/rte_thash_gfni.h
@@ -9,13 +9,14 @@
 extern "C" {
 #endif
 
+#include <stdint.h>
+
 #include <rte_compat.h>
-#include <rte_log.h>
+#include <rte_common.h>
+#include <rte_config.h>
 
 #ifdef RTE_ARCH_X86
-
 #include <rte_thash_x86_gfni.h>
-
 #endif
 
 #ifndef RTE_THASH_GFNI_DEFINED
@@ -38,13 +39,8 @@ extern "C" {
  *  Calculated Toeplitz hash value.
  */
 __rte_experimental
-static inline uint32_t
-rte_thash_gfni(const uint64_t *mtrx __rte_unused,
-	const uint8_t *key __rte_unused, int len __rte_unused)
-{
-	RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__);
-	return 0;
-}
+uint32_t
+rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len);
 
 /**
  * Bulk implementation for Toeplitz hash.
@@ -67,17 +63,9 @@ rte_thash_gfni(const uint64_t *mtrx __rte_unused,
  *  Number of tuples to hash.
  */
 __rte_experimental
-static inline void
-rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused,
-	int len __rte_unused, uint8_t *tuple[] __rte_unused,
-	uint32_t val[], uint32_t num)
-{
-	unsigned int i;
-
-	RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__);
-	for (i = 0; i < num; i++)
-		val[i] = 0;
-}
+void
+rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[],
+		    uint32_t val[], uint32_t num);
 
 #endif /* RTE_THASH_GFNI_DEFINED */
 
diff --git a/lib/hash/version.map b/lib/hash/version.map
index daaa9a8901db..8288c6e7967e 100644
--- a/lib/hash/version.map
+++ b/lib/hash/version.map
@@ -51,4 +51,8 @@ EXPERIMENTAL {
 	rte_thash_complete_matrix;
 	rte_thash_get_gfni_matrices;
 	rte_thash_gfni_supported;
+
+	# added in 22.07
+	rte_thash_gfni;
+	rte_thash_gfni_bulk;
 };
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 17/21] hash: move rte_hash_set_alg out header
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (15 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 16/21] hash: move rte_thash_gfni stubs out of header file Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 18/21] hash: convert RTE_LOGTYPE_HASH to dynamic type Stephen Hemminger
                     ` (4 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Ruifeng Wang, Yipeng Wang, Sameh Gobriel,
	Bruce Richardson, Vladimir Medvedkin

The code for setting algorithm for hash is not at all perf sensitive,
and doing it inline has a couple of problems. First, it means that if
multiple files include the header, then the initialization gets done
multiple times. But also, it makes it harder to fix usage of RTE_LOG().

Despite what the checking script say. This is not an ABI change, the
previous version inlined the same code; therefore both old and new code
will work the same.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/hash/meson.build     |  1 +
 lib/hash/rte_crc_arm64.h |  8 ++---
 lib/hash/rte_crc_x86.h   | 10 +++---
 lib/hash/rte_hash_crc.c  | 68 ++++++++++++++++++++++++++++++++++++++++
 lib/hash/rte_hash_crc.h  | 48 ++--------------------------
 lib/hash/version.map     |  7 +++++
 6 files changed, 88 insertions(+), 54 deletions(-)
 create mode 100644 lib/hash/rte_hash_crc.c

diff --git a/lib/hash/meson.build b/lib/hash/meson.build
index e56ee8572564..c345c6f561fc 100644
--- a/lib/hash/meson.build
+++ b/lib/hash/meson.build
@@ -19,6 +19,7 @@ indirect_headers += files(
 
 sources = files(
     'rte_cuckoo_hash.c',
+    'rte_hash_crc.c',
     'rte_fbk_hash.c',
     'rte_thash.c',
     'rte_thash_gfni.c'
diff --git a/lib/hash/rte_crc_arm64.h b/lib/hash/rte_crc_arm64.h
index c9f52510871b..414fe065caa8 100644
--- a/lib/hash/rte_crc_arm64.h
+++ b/lib/hash/rte_crc_arm64.h
@@ -53,7 +53,7 @@ crc32c_arm64_u64(uint64_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_1byte(uint8_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_ARM64))
+	if (likely(rte_hash_crc32_alg & CRC32_ARM64))
 		return crc32c_arm64_u8(data, init_val);
 
 	return crc32c_1byte(data, init_val);
@@ -67,7 +67,7 @@ rte_hash_crc_1byte(uint8_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_2byte(uint16_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_ARM64))
+	if (likely(rte_hash_crc32_alg & CRC32_ARM64))
 		return crc32c_arm64_u16(data, init_val);
 
 	return crc32c_2bytes(data, init_val);
@@ -81,7 +81,7 @@ rte_hash_crc_2byte(uint16_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_ARM64))
+	if (likely(rte_hash_crc32_alg & CRC32_ARM64))
 		return crc32c_arm64_u32(data, init_val);
 
 	return crc32c_1word(data, init_val);
@@ -95,7 +95,7 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_ARM64))
+	if (likely(rte_hash_crc32_alg & CRC32_ARM64))
 		return crc32c_arm64_u64(data, init_val);
 
 	return crc32c_2words(data, init_val);
diff --git a/lib/hash/rte_crc_x86.h b/lib/hash/rte_crc_x86.h
index 205bc182be77..3b865e251db2 100644
--- a/lib/hash/rte_crc_x86.h
+++ b/lib/hash/rte_crc_x86.h
@@ -67,7 +67,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)
 static inline uint32_t
 rte_hash_crc_1byte(uint8_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_SSE42))
+	if (likely(rte_hash_crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u8(data, init_val);
 
 	return crc32c_1byte(data, init_val);
@@ -81,7 +81,7 @@ rte_hash_crc_1byte(uint8_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_2byte(uint16_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_SSE42))
+	if (likely(rte_hash_crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u16(data, init_val);
 
 	return crc32c_2bytes(data, init_val);
@@ -95,7 +95,7 @@ rte_hash_crc_2byte(uint16_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_SSE42))
+	if (likely(rte_hash_crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u32(data, init_val);
 
 	return crc32c_1word(data, init_val);
@@ -110,11 +110,11 @@ static inline uint32_t
 rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
 {
 #ifdef RTE_ARCH_X86_64
-	if (likely(crc32_alg == CRC32_SSE42_x64))
+	if (likely(rte_hash_crc32_alg == CRC32_SSE42_x64))
 		return crc32c_sse42_u64(data, init_val);
 #endif
 
-	if (likely(crc32_alg & CRC32_SSE42))
+	if (likely(rte_hash_crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u64_mimic(data, init_val);
 
 	return crc32c_2words(data, init_val);
diff --git a/lib/hash/rte_hash_crc.c b/lib/hash/rte_hash_crc.c
new file mode 100644
index 000000000000..1439d8a71f6a
--- /dev/null
+++ b/lib/hash/rte_hash_crc.c
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
+ */
+
+#include <rte_cpuflags.h>
+#include <rte_log.h>
+
+#include "rte_hash_crc.h"
+
+RTE_LOG_REGISTER_SUFFIX(hash_crc_logtype, crc, INFO);
+#define RTE_LOGTYPE_HASH_CRC hash_crc_logtype
+
+uint8_t rte_hash_crc32_alg = CRC32_SW;
+
+/**
+ * Allow or disallow use of SSE4.2/ARMv8 intrinsics for CRC32 hash
+ * calculation.
+ *
+ * @param alg
+ *   An OR of following flags:
+ *   - (CRC32_SW) Don't use SSE4.2/ARMv8 intrinsics (default non-[x86/ARMv8])
+ *   - (CRC32_SSE42) Use SSE4.2 intrinsics if available
+ *   - (CRC32_SSE42_x64) Use 64-bit SSE4.2 intrinsic if available (default x86)
+ *   - (CRC32_ARM64) Use ARMv8 CRC intrinsic if available (default ARMv8)
+ *
+ */
+void
+rte_hash_crc_set_alg(uint8_t alg)
+{
+	rte_hash_crc32_alg = CRC32_SW;
+
+	if (alg == CRC32_SW)
+		return;
+
+#if defined RTE_ARCH_X86
+	if (!(alg & CRC32_SSE42_x64))
+		RTE_LOG(WARNING, HASH_CRC,
+			"Unsupported CRC32 algorithm requested using CRC32_x64/CRC32_SSE42\n");
+	if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_EM64T) || alg == CRC32_SSE42)
+		rte_hash_crc32_alg = CRC32_SSE42;
+	else
+		rte_hash_crc32_alg = CRC32_SSE42_x64;
+#endif
+
+#if defined RTE_ARCH_ARM64
+	if (!(alg & CRC32_ARM64))
+		RTE_LOG(WARNING, HASH_CRC,
+			"Unsupported CRC32 algorithm requested using CRC32_ARM64\n");
+	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_CRC32))
+		rte_hash_crc32_alg = CRC32_ARM64;
+#endif
+
+	if (rte_hash_crc32_alg == CRC32_SW)
+		RTE_LOG(WARNING, HASH_CRC,
+			"Unsupported CRC32 algorithm requested using CRC32_SW\n");
+}
+
+/* Setting the best available algorithm */
+RTE_INIT(rte_hash_crc_init_alg)
+{
+#if defined(RTE_ARCH_X86)
+	rte_hash_crc_set_alg(CRC32_SSE42_x64);
+#elif defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRC32)
+	rte_hash_crc_set_alg(CRC32_ARM64);
+#else
+	rte_hash_crc_set_alg(CRC32_SW);
+#endif
+}
diff --git a/lib/hash/rte_hash_crc.h b/lib/hash/rte_hash_crc.h
index 60bf42ce1d97..8ad2422ec333 100644
--- a/lib/hash/rte_hash_crc.h
+++ b/lib/hash/rte_hash_crc.h
@@ -20,8 +20,6 @@ extern "C" {
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
 #include <rte_config.h>
-#include <rte_cpuflags.h>
-#include <rte_log.h>
 
 #include "rte_crc_sw.h"
 
@@ -31,7 +29,7 @@ extern "C" {
 #define CRC32_SSE42_x64     (CRC32_x64|CRC32_SSE42)
 #define CRC32_ARM64         (1U << 3)
 
-static uint8_t crc32_alg = CRC32_SW;
+extern uint8_t rte_hash_crc32_alg;
 
 #if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRC32)
 #include "rte_crc_arm64.h"
@@ -52,48 +50,8 @@ static uint8_t crc32_alg = CRC32_SW;
  *   - (CRC32_SSE42_x64) Use 64-bit SSE4.2 intrinsic if available (default x86)
  *   - (CRC32_ARM64) Use ARMv8 CRC intrinsic if available (default ARMv8)
  */
-static inline void
-rte_hash_crc_set_alg(uint8_t alg)
-{
-	crc32_alg = CRC32_SW;
-
-	if (alg == CRC32_SW)
-		return;
-
-#if defined RTE_ARCH_X86
-	if (!(alg & CRC32_SSE42_x64))
-		RTE_LOG(WARNING, HASH,
-			"Unsupported CRC32 algorithm requested using CRC32_x64/CRC32_SSE42\n");
-	if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_EM64T) || alg == CRC32_SSE42)
-		crc32_alg = CRC32_SSE42;
-	else
-		crc32_alg = CRC32_SSE42_x64;
-#endif
-
-#if defined RTE_ARCH_ARM64
-	if (!(alg & CRC32_ARM64))
-		RTE_LOG(WARNING, HASH,
-			"Unsupported CRC32 algorithm requested using CRC32_ARM64\n");
-	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_CRC32))
-		crc32_alg = CRC32_ARM64;
-#endif
-
-	if (crc32_alg == CRC32_SW)
-		RTE_LOG(WARNING, HASH,
-			"Unsupported CRC32 algorithm requested using CRC32_SW\n");
-}
-
-/* Setting the best available algorithm */
-RTE_INIT(rte_hash_crc_init_alg)
-{
-#if defined(RTE_ARCH_X86)
-	rte_hash_crc_set_alg(CRC32_SSE42_x64);
-#elif defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRC32)
-	rte_hash_crc_set_alg(CRC32_ARM64);
-#else
-	rte_hash_crc_set_alg(CRC32_SW);
-#endif
-}
+void
+rte_hash_crc_set_alg(uint8_t alg);
 
 #ifdef __DOXYGEN__
 
diff --git a/lib/hash/version.map b/lib/hash/version.map
index 8288c6e7967e..a1e68036c5b8 100644
--- a/lib/hash/version.map
+++ b/lib/hash/version.map
@@ -9,6 +9,7 @@ DPDK_24 {
 	rte_hash_add_key_with_hash;
 	rte_hash_add_key_with_hash_data;
 	rte_hash_count;
+	rte_hash_crc_set_alg;
 	rte_hash_create;
 	rte_hash_del_key;
 	rte_hash_del_key_with_hash;
@@ -56,3 +57,9 @@ EXPERIMENTAL {
 	rte_thash_gfni;
 	rte_thash_gfni_bulk;
 };
+
+INTERNAL {
+	global:
+
+	rte_hash_crc32_alg;
+};
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 18/21] hash: convert RTE_LOGTYPE_HASH to dynamic type
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (16 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 17/21] hash: move rte_hash_set_alg out header Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 19/21] table: convert RTE_LOGTYPE_TABLE " Stephen Hemminger
                     ` (3 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Yipeng Wang, Sameh Gobriel, Bruce Richardson,
	Vladimir Medvedkin

Use dynamic type for hash and add subtypes for crc and gfni.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/hash/rte_cuckoo_hash.c | 5 +++++
 lib/hash/rte_fbk_hash.c    | 5 +++++
 lib/hash/rte_thash.c       | 3 +++
 lib/hash/rte_thash_gfni.c  | 3 +++
 lib/log/log.c              | 1 -
 lib/log/rte_log.h          | 2 +-
 6 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c
index d92a903bb39b..98d4366770d4 100644
--- a/lib/hash/rte_cuckoo_hash.c
+++ b/lib/hash/rte_cuckoo_hash.c
@@ -24,6 +24,11 @@
 #include <rte_tailq.h>
 
 #include "rte_hash.h"
+
+/* needs to be before rte_cuckoo_hash.h */
+RTE_LOG_REGISTER_DEFAULT(hash_logtype, INFO);
+#define RTE_LOGTYPE_HASH hash_logtype
+
 #include "rte_cuckoo_hash.h"
 
 /* Mask of all flags supported by this version */
diff --git a/lib/hash/rte_fbk_hash.c b/lib/hash/rte_fbk_hash.c
index 538b23a4030a..b4c4c191abdc 100644
--- a/lib/hash/rte_fbk_hash.c
+++ b/lib/hash/rte_fbk_hash.c
@@ -8,6 +8,8 @@
 #include <errno.h>
 
 #include <sys/queue.h>
+
+#include <rte_cpuflags.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 #include <rte_common.h>
@@ -18,6 +20,9 @@
 
 #include "rte_fbk_hash.h"
 
+RTE_LOG_REGISTER_SUFFIX(fbk_hash_logtype, fbk, INFO);
+#define RTE_LOGTYPE_HASH fbk_hash_logtype
+
 TAILQ_HEAD(rte_fbk_hash_list, rte_tailq_entry);
 
 static struct rte_tailq_elem rte_fbk_hash_tailq = {
diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c
index 2228af576bb9..fbee0b2188e5 100644
--- a/lib/hash/rte_thash.c
+++ b/lib/hash/rte_thash.c
@@ -13,6 +13,9 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 
+RTE_LOG_REGISTER_SUFFIX(thash_logtype, thash, INFO);
+#define RTE_LOGTYPE_HASH thash_logtype
+
 #define THASH_NAME_LEN		64
 #define TOEPLITZ_HASH_LEN	32
 
diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c
index eb334185725c..35206d575153 100644
--- a/lib/hash/rte_thash_gfni.c
+++ b/lib/hash/rte_thash_gfni.c
@@ -10,6 +10,9 @@
 
 #ifndef RTE_THASH_GFNI_DEFINED
 
+RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO);
+#define RTE_LOGTYPE_HASH hash_gfni_logtype
+
 uint32_t
 rte_thash_gfni(const uint64_t *mtrx __rte_unused,
 	       const uint8_t *key __rte_unused, int len __rte_unused)
diff --git a/lib/log/log.c b/lib/log/log.c
index c089fc66affe..3ce9300754dd 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -353,7 +353,6 @@ struct logtype {
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
-	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index b11aec69af78..4d1b892ab689 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -32,7 +32,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_MEMPOOL */
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
-#define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
+				 /* was RTE_LOGTYPE_HASH */
 				 /* was RTE_LOGTYPE_LPM */
 				 /* was RTE_LOGTYPE_KNI */
 				 /* was RTE_LOGTYPE_ACL */
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 19/21] table: convert RTE_LOGTYPE_TABLE to dynamic type
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (17 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 18/21] hash: convert RTE_LOGTYPE_HASH to dynamic type Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 20/21] app/test: remove use of RTE_LOGTYPE_PIPELINE Stephen Hemminger
                     ` (2 subsequent siblings)
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu

Make an alias for RTE_LOGTYPE_TABLE in rte_table.h
and use it.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c         | 1 -
 lib/log/rte_log.h     | 2 +-
 lib/table/meson.build | 1 +
 lib/table/rte_table.c | 8 ++++++++
 lib/table/rte_table.h | 4 ++++
 5 files changed, 14 insertions(+), 2 deletions(-)
 create mode 100644 lib/table/rte_table.c

diff --git a/lib/log/log.c b/lib/log/log.c
index 3ce9300754dd..1ad2f80e67cc 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -353,7 +353,6 @@ struct logtype {
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
-	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 4d1b892ab689..6418479ee266 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -40,7 +40,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_METER */
 				 /* was RTE_LOGTYPE_SCHED */
 				 /* was RTE_LOGTYPE_PORT */
-#define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
+				 /* was RTE_LOGTYPE_TABLE */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
 				 /* was RTE_LOGTYPE_MBUF */
 #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
diff --git a/lib/table/meson.build b/lib/table/meson.build
index f8cef24b5918..e753b6fb23d8 100644
--- a/lib/table/meson.build
+++ b/lib/table/meson.build
@@ -7,6 +7,7 @@ sources = files(
         'rte_swx_table_learner.c',
         'rte_swx_table_selector.c',
         'rte_swx_table_wm.c',
+        'rte_table.c',
         'rte_table_acl.c',
         'rte_table_array.c',
         'rte_table_hash_cuckoo.c',
diff --git a/lib/table/rte_table.c b/lib/table/rte_table.c
new file mode 100644
index 000000000000..4a083f4aaf0c
--- /dev/null
+++ b/lib/table/rte_table.c
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
+ */
+
+#include <rte_log.h>
+#include <rte_table.h>
+
+RTE_LOG_REGISTER_DEFAULT(table_logtype, INFO);
diff --git a/lib/table/rte_table.h b/lib/table/rte_table.h
index 9a5faf0e323a..39654e51e8b2 100644
--- a/lib/table/rte_table.h
+++ b/lib/table/rte_table.h
@@ -264,6 +264,10 @@ struct rte_table_ops {
 	rte_table_op_stats_read f_stats;              /**< Stats */
 };
 
+/** Internal Logtype used */
+extern int table_logtype;
+#define RTE_LOGTYPE_TABLE table_logtype
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 20/21] app/test: remove use of RTE_LOGTYPE_PIPELINE
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (18 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 19/21] table: convert RTE_LOGTYPE_TABLE " Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-08-21 16:09   ` [PATCH v13 21/21] pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type Stephen Hemminger
  2023-12-04 12:32   ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types David Marchand
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu

Instead of using static type PIPELINE for logging in test application
use stderr instead.  If not testing RTE_LOG() better to not use
it since log also goes to syslog.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_table_acl.c      | 50 ++++++++++++++++------------------
 app/test/test_table_pipeline.c | 40 +++++++++++++--------------
 2 files changed, 43 insertions(+), 47 deletions(-)

diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c
index e66f06b84d0a..dff9bddfb948 100644
--- a/app/test/test_table_acl.c
+++ b/app/test/test_table_acl.c
@@ -165,7 +165,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v)
 		&v->field_value[SRC_FIELD_IPV4].value.u32,
 		&v->field_value[SRC_FIELD_IPV4].mask_range.u32);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read src address/mask: %s\n",
+		fprintf(stderr, "failed to read src address/mask: %s\n",
 			in[CB_FLD_SRC_ADDR]);
 		return rc;
 	}
@@ -178,7 +178,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v)
 		&v->field_value[DST_FIELD_IPV4].value.u32,
 		&v->field_value[DST_FIELD_IPV4].mask_range.u32);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read dest address/mask: %s\n",
+		fprintf(stderr, "failed to read dest address/mask: %s\n",
 			in[CB_FLD_DST_ADDR]);
 		return rc;
 	}
@@ -190,7 +190,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v)
 		&v->field_value[SRCP_FIELD_IPV4].value.u16,
 		&v->field_value[SRCP_FIELD_IPV4].mask_range.u16);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read source port range: %s\n",
+		fprintf(stderr, "failed to read source port range: %s\n",
 			in[CB_FLD_SRC_PORT_RANGE]);
 		return rc;
 	}
@@ -202,7 +202,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v)
 		&v->field_value[DSTP_FIELD_IPV4].value.u16,
 		&v->field_value[DSTP_FIELD_IPV4].mask_range.u16);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read dest port range: %s\n",
+		fprintf(stderr, "failed to read dest port range: %s\n",
 			in[CB_FLD_DST_PORT_RANGE]);
 		return rc;
 	}
@@ -254,7 +254,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
 		&v->field_value[SRC_FIELD_IPV4].value.u32,
 		&v->field_value[SRC_FIELD_IPV4].mask_range.u32);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read src address/mask: %s\n",
+		fprintf(stderr, "failed to read src address/mask: %s\n",
 			in[CB_FLD_SRC_ADDR]);
 		return rc;
 	}
@@ -267,7 +267,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
 		&v->field_value[DST_FIELD_IPV4].value.u32,
 		&v->field_value[DST_FIELD_IPV4].mask_range.u32);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read dest address/mask: %s\n",
+		fprintf(stderr, "failed to read dest address/mask: %s\n",
 			in[CB_FLD_DST_ADDR]);
 		return rc;
 	}
@@ -279,7 +279,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
 		&v->field_value[SRCP_FIELD_IPV4].value.u16,
 		&v->field_value[SRCP_FIELD_IPV4].mask_range.u16);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read source port range: %s\n",
+		fprintf(stderr, "failed to read source port range: %s\n",
 			in[CB_FLD_SRC_PORT_RANGE]);
 		return rc;
 	}
@@ -291,7 +291,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
 		&v->field_value[DSTP_FIELD_IPV4].value.u16,
 		&v->field_value[DSTP_FIELD_IPV4].mask_range.u16);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read dest port range: %s\n",
+		fprintf(stderr, "failed to read dest port range: %s\n",
 			in[CB_FLD_DST_PORT_RANGE]);
 		return rc;
 	}
@@ -346,7 +346,7 @@ setup_acl_pipeline(void)
 	/* Pipeline configuration */
 	p = rte_pipeline_create(&pipeline_params);
 	if (p == NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Failed to configure pipeline\n",
+		fprintf(stderr, "%s: Failed to configure pipeline\n",
 			__func__);
 		goto fail;
 	}
@@ -410,7 +410,7 @@ setup_acl_pipeline(void)
 		table_params.f_action_miss = NULL;
 		table_params.action_data_size = 0;
 
-		RTE_LOG(INFO, PIPELINE, "miss_action=%x\n",
+		printf("miss_action=%x\n",
 			table_entry_miss_action);
 
 		printf("RTE_ACL_RULE_SZ(%zu) = %zu\n", DIM(ipv4_defs),
@@ -471,9 +471,8 @@ setup_acl_pipeline(void)
 
 			ret = parser(line, &keys[n]);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE,
-					"line %u: parse_cb_ipv4vlan_rule"
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -513,9 +512,8 @@ setup_acl_pipeline(void)
 
 			ret = parse_cb_ipv4_rule_del(line, &keys[n]);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE,
-					"line %u: parse_cb_ipv4vlan_rule"
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -549,9 +547,8 @@ setup_acl_pipeline(void)
 
 			ret = parser(line, &rule_params);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE,
-					"line %u: parse_cb_ipv4vlan_rule"
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -575,8 +572,8 @@ setup_acl_pipeline(void)
 
 			ret = parser(line, &rule_params);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE, "line %u: parse rule "
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -602,8 +599,8 @@ setup_acl_pipeline(void)
 
 			ret = parser(line, &rule_params);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE, "line %u: parse rule"
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -667,7 +664,7 @@ test_pipeline_single_filter(int expected_count)
 
 			memcpy(rte_pktmbuf_mtod(mbuf, char *), &five_tuple,
 				sizeof(struct ipv4_5tuple));
-			RTE_LOG(INFO, PIPELINE, "%s: Enqueue onto ring %d\n",
+			printf("%s: Enqueue onto ring %d\n",
 				__func__, i);
 			rte_ring_enqueue(rings_rx[i], mbuf);
 		}
@@ -702,9 +699,8 @@ test_pipeline_single_filter(int expected_count)
 	}
 
 	if (tx_count != expected_count) {
-		RTE_LOG(INFO, PIPELINE,
-			"%s: Unexpected packets for ACL test, "
-			"expected %d, got %d\n",
+		fprintf(stderr,
+			"%s: Unexpected packets for ACL test, expected %d, got %d\n",
 			__func__, expected_count, tx_count);
 		goto fail;
 	}
diff --git a/app/test/test_table_pipeline.c b/app/test/test_table_pipeline.c
index 7adbbffbf55d..960f730cf20d 100644
--- a/app/test/test_table_pipeline.c
+++ b/app/test/test_table_pipeline.c
@@ -6,7 +6,6 @@
 
 #include <string.h>
 #include <rte_pipeline.h>
-#include <rte_log.h>
 #include <inttypes.h>
 #include <rte_hexdump.h>
 #include "test_table.h"
@@ -173,30 +172,31 @@ check_pipeline_invalid_params(void)
 
 	p = rte_pipeline_create(NULL);
 	if (p != NULL) {
-		RTE_LOG(INFO, PIPELINE,
+		fprintf(stderr,
 			"%s: configured pipeline with null params\n",
 			__func__);
 		goto fail;
 	}
 	p = rte_pipeline_create(&pipeline_params_1);
 	if (p != NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with NULL "
-			"name\n", __func__);
+		fprintf(stderr,
+			"%s: Configure pipeline with NULL name\n", __func__);
 		goto fail;
 	}
 
 	p = rte_pipeline_create(&pipeline_params_2);
 	if (p != NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with invalid "
-			"socket\n", __func__);
+		fprintf(stderr,
+			"%s: Configure pipeline with invalid socket\n", __func__);
 		goto fail;
 	}
 
 	if (rte_eal_has_hugepages()) {
 		p = rte_pipeline_create(&pipeline_params_3);
 		if (p != NULL) {
-			RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with "
-				"invalid socket\n", __func__);
+			fprintf(stderr,
+				"%s: Configure pipeline with invalid socket\n",
+				__func__);
 			goto fail;
 		}
 	}
@@ -224,20 +224,20 @@ setup_pipeline(int test_type)
 		.socket_id = 0,
 	};
 
-	RTE_LOG(INFO, PIPELINE, "%s: **** Setting up %s test\n",
+	fprintf(stderr, "%s: **** Setting up %s test\n",
 		__func__, pipeline_test_names[test_type]);
 
 	/* Pipeline configuration */
 	p = rte_pipeline_create(&pipeline_params);
 	if (p == NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Failed to configure pipeline\n",
+		fprintf(stderr, "%s: Failed to configure pipeline\n",
 			__func__);
 		goto fail;
 	}
 
 	ret = rte_pipeline_free(p);
 	if (ret != 0) {
-		RTE_LOG(INFO, PIPELINE, "%s: Failed to free pipeline\n",
+		fprintf(stderr, "%s: Failed to free pipeline\n",
 			__func__);
 		goto fail;
 	}
@@ -245,7 +245,7 @@ setup_pipeline(int test_type)
 	/* Pipeline configuration */
 	p = rte_pipeline_create(&pipeline_params);
 	if (p == NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Failed to configure pipeline\n",
+		fprintf(stderr, "%s: Failed to configure pipeline\n",
 			__func__);
 		goto fail;
 	}
@@ -411,7 +411,7 @@ test_pipeline_single_filter(int test_type, int expected_count)
 	int ret;
 	int tx_count;
 
-	RTE_LOG(INFO, PIPELINE, "%s: **** Running %s test\n",
+	fprintf(stderr, "%s: **** Running %s test\n",
 		__func__, pipeline_test_names[test_type]);
 	/* Run pipeline once */
 	for (i = 0; i < N_PORTS; i++)
@@ -420,7 +420,7 @@ test_pipeline_single_filter(int test_type, int expected_count)
 
 	ret = rte_pipeline_flush(NULL);
 	if (ret != -EINVAL) {
-		RTE_LOG(INFO, PIPELINE,
+		fprintf(stderr,
 			"%s: No pipeline flush error NULL pipeline (%d)\n",
 			__func__, ret);
 		goto fail;
@@ -445,7 +445,7 @@ test_pipeline_single_filter(int test_type, int expected_count)
 			k32 = (uint32_t *) key;
 			k32[0] = 0xadadadad >> (j % 2);
 
-			RTE_LOG(INFO, PIPELINE, "%s: Enqueue onto ring %d\n",
+			fprintf(stderr, "%s: Enqueue onto ring %d\n",
 				__func__, i);
 			rte_ring_enqueue(rings_rx[i], m);
 		}
@@ -487,9 +487,9 @@ test_pipeline_single_filter(int test_type, int expected_count)
 	}
 
 	if (tx_count != expected_count) {
-		RTE_LOG(INFO, PIPELINE,
-			"%s: Unexpected packets out for %s test, expected %d, "
-			"got %d\n", __func__, pipeline_test_names[test_type],
+		fprintf(stderr,
+			"%s: Unexpected packets out for %s test, expected %d, got %d\n",
+			__func__, pipeline_test_names[test_type],
 			expected_count, tx_count);
 		goto fail;
 	}
@@ -564,8 +564,8 @@ test_table_pipeline(void)
 	connect_miss_action_to_table = 0;
 
 	if (check_pipeline_invalid_params()) {
-		RTE_LOG(INFO, PIPELINE, "%s: Check pipeline invalid params "
-			"failed.\n", __func__);
+		fprintf(stderr, "%s: Check pipeline invalid params failed.\n",
+			__func__);
 		return -1;
 	}
 
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH v13 21/21] pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (19 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 20/21] app/test: remove use of RTE_LOGTYPE_PIPELINE Stephen Hemminger
@ 2023-08-21 16:09   ` Stephen Hemminger
  2023-12-04 12:32   ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types David Marchand
  21 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-08-21 16:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu

Convert RTE_LOGTYPE_PIPELINE to a dynamic value.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c               | 1 -
 lib/log/rte_log.h           | 2 +-
 lib/pipeline/rte_pipeline.c | 2 ++
 lib/pipeline/rte_pipeline.h | 5 +++++
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/log/log.c b/lib/log/log.c
index 1ad2f80e67cc..f58e40e6a9f8 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -353,7 +353,6 @@ struct logtype {
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
-	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 6418479ee266..29db07881a5a 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -41,7 +41,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_SCHED */
 				 /* was RTE_LOGTYPE_PORT */
 				 /* was RTE_LOGTYPE_TABLE */
-#define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
+				 /* was RTE_LOGTYPE_PIPELINE */
 				 /* was RTE_LOGTYPE_MBUF */
 #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
 				 /* was RTE_LOGTYPE_EFD */
diff --git a/lib/pipeline/rte_pipeline.c b/lib/pipeline/rte_pipeline.c
index 1fa9f9c47eda..6b937cf782ac 100644
--- a/lib/pipeline/rte_pipeline.c
+++ b/lib/pipeline/rte_pipeline.c
@@ -1608,3 +1608,5 @@ int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id,
 
 	return 0;
 }
+
+RTE_LOG_REGISTER_DEFAULT(pipeline_logtype, INFO);
diff --git a/lib/pipeline/rte_pipeline.h b/lib/pipeline/rte_pipeline.h
index ec51b9bfaadd..9fd40566a80f 100644
--- a/lib/pipeline/rte_pipeline.h
+++ b/lib/pipeline/rte_pipeline.h
@@ -833,6 +833,11 @@ int rte_pipeline_ah_packet_hijack(struct rte_pipeline *p,
 int rte_pipeline_ah_packet_drop(struct rte_pipeline *p,
 	uint64_t pkts_mask);
 
+
+/** Internal Logtype used */
+extern int pipeline_logtype;
+#define RTE_LOGTYPE_PIPELINE pipeline_logtype
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.39.2


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH v13 00/21] Convert static log types in libraries to dynamic types
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
                     ` (20 preceding siblings ...)
  2023-08-21 16:09   ` [PATCH v13 21/21] pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type Stephen Hemminger
@ 2023-12-04 12:32   ` David Marchand
  21 siblings, 0 replies; 68+ messages in thread
From: David Marchand @ 2023-12-04 12:32 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Mon, Aug 21, 2023 at 6:09 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> This patchset removes most of the uses of static LOGTYPE's in DPDK
> libraries. It starts with the easy one and goes on to the more complex ones.
>
> There are several options on how to treat the old static types:
> leave them there, mark as deprecated, or remove them.
> This version removes them since there is no guarantee in current
> DPDK policies that says they can't be removed.
>
> Note: there is one patch in this series that will get
> flagged incorrectly as an ABI change.
>
> v13 - rebase because log now moved.
>
> v12 - rebase and add table and pipeline libraries
>
> v11 - fix include check on arm cross build
>
> v10 - add necessary rte_compat.h in thash_gfni stub for arm
>
> v9 - fix handling of crc32 alg in lib/hash.
>      make it an internal global variable.
>      fix gfni stubs for case where they are not used.
>
> Stephen Hemminger (21):
>   gso: don't log message on non TCP/UDP
>   eal: drop no longer used GSO logtype
>   log: drop unused RTE_LOGTYPE_TIMER
>   efd: convert RTE_LOGTYPE_EFD to dynamic type
>   mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
>   acl: convert RTE_LOGTYPE_ACL to dynamic type
>   examples/power: replace use of RTE_LOGTYPE_POWER
>   examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
>   power: convert RTE_LOGTYPE_POWER to dynamic type
>   ring: convert RTE_LOGTYPE_RING to dynamic type
>   mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
>   lpm: convert RTE_LOGTYPE_LPM to dynamic types
>   sched: convert RTE_LOGTYPE_SCHED to dynamic type
>   examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
>   port: convert RTE_LOGTYPE_PORT to dynamic type
>   hash: move rte_thash_gfni stubs out of header file
>   hash: move rte_hash_set_alg out header
>   hash: convert RTE_LOGTYPE_HASH to dynamic type
>   table: convert RTE_LOGTYPE_TABLE to dynamic type
>   app/test: remove use of RTE_LOGTYPE_PIPELINE
>   pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type
>

This series needs some rebase.
Thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 00/18] Convert static log types in libraries to dynamic
  2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
                   ` (22 preceding siblings ...)
  2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
@ 2023-12-05  2:09 ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 01/18] gso: don't log message on non TCP/UDP Stephen Hemminger
                     ` (18 more replies)
  23 siblings, 19 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

This patchset removes most of the uses of static LOGTYPE's in DPDK
libraries. It starts with the easy one and goes on to the more complex ones.

There are several options on how to treat the old static types:
leave them there, mark as deprecated, or remove them.
This version removes them since there is no guarantee in current
DPDK policies that says they can't be removed.

Note: there is one patch in this series that will get
flagged incorrectly as an ABI change.

v14 - rebase on 24.03-rc0
      skip port, table and pipeline libraries since lots of
      to be deprecated code.

v13 - rebase because log now moved.

v12 - rebase and add table and pipeline libraries

v11 - fix include check on arm cross build

v10 - add necessary rte_compat.h in thash_gfni stub for arm

v9 - fix handling of crc32 alg in lib/hash.
     make it an internal global variable.
     fix gfni stubs for case where they are not used.

Stephen Hemminger (18):
  gso: don't log message on non TCP/UDP
  eal: drop no longer used GSO logtype
  log: drop unused RTE_LOGTYPE_TIMER
  efd: convert RTE_LOGTYPE_EFD to dynamic type
  mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
  acl: convert RTE_LOGTYPE_ACL to dynamic type
  examples/power: replace use of RTE_LOGTYPE_POWER
  examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
  power: convert RTE_LOGTYPE_POWER to dynamic type
  ring: convert RTE_LOGTYPE_RING to dynamic type
  mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
  lpm: convert RTE_LOGTYPE_LPM to dynamic types
  sched: convert RTE_LOGTYPE_SCHED to dynamic type
  examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
  app/test: remove use of RTE_LOGTYPE_PIPELINE
  hash: mover rte_thash_gfni stubs out of header file
  hash: move rte_hash_set_alg out of header file
  hash: convert RTE_LOGTYPE_HASH to dynamic type

 app/test/test_acl.c            |  2 +-
 app/test/test_table_acl.c      | 50 ++++++++++++-------------
 app/test/test_table_pipeline.c | 40 ++++++++++----------
 examples/distributor/main.c    |  2 +-
 examples/ipsec-secgw/sa.c      |  6 +--
 examples/l3fwd-power/main.c    | 17 +++++----
 lib/acl/acl.h                  |  1 +
 lib/acl/acl_bld.c              |  3 ++
 lib/acl/acl_gen.c              |  1 +
 lib/acl/acl_log.h              |  6 +++
 lib/acl/rte_acl.c              |  3 ++
 lib/acl/tb_mem.c               |  3 +-
 lib/efd/rte_efd.c              |  4 ++
 lib/fib/fib_log.h              |  4 ++
 lib/fib/rte_fib.c              |  3 ++
 lib/fib/rte_fib6.c             |  2 +
 lib/gso/rte_gso.c              |  4 +-
 lib/gso/rte_gso.h              |  1 +
 lib/hash/meson.build           |  9 ++++-
 lib/hash/rte_crc_arm64.h       |  8 ++--
 lib/hash/rte_crc_x86.h         | 10 ++---
 lib/hash/rte_cuckoo_hash.c     |  5 +++
 lib/hash/rte_fbk_hash.c        |  5 +++
 lib/hash/rte_hash_crc.c        | 68 ++++++++++++++++++++++++++++++++++
 lib/hash/rte_hash_crc.h        | 48 ++----------------------
 lib/hash/rte_thash.c           |  3 ++
 lib/hash/rte_thash_gfni.c      | 50 +++++++++++++++++++++++++
 lib/hash/rte_thash_gfni.h      | 23 +++---------
 lib/hash/version.map           |  9 +++++
 lib/log/log.c                  | 13 -------
 lib/log/rte_log.h              | 26 ++++++-------
 lib/lpm/lpm_log.h              |  4 ++
 lib/lpm/rte_lpm.c              |  3 ++
 lib/lpm/rte_lpm6.c             |  1 +
 lib/mbuf/mbuf_log.h            |  4 ++
 lib/mbuf/rte_mbuf.c            |  4 ++
 lib/mbuf/rte_mbuf_dyn.c        |  2 +
 lib/mbuf/rte_mbuf_pool_ops.c   |  2 +
 lib/mempool/rte_mempool.c      |  2 +
 lib/mempool/rte_mempool.h      |  8 ++++
 lib/mempool/version.map        |  3 ++
 lib/power/power_common.c       |  2 +
 lib/power/power_common.h       |  2 +
 lib/power/power_kvm_vm.c       |  1 +
 lib/power/rte_power.c          |  1 +
 lib/power/rte_power_uncore.c   |  1 +
 lib/rib/rib_log.h              |  4 ++
 lib/rib/rte_rib.c              |  3 ++
 lib/rib/rte_rib6.c             |  3 ++
 lib/ring/rte_ring.c            |  3 ++
 lib/sched/rte_pie.c            |  1 +
 lib/sched/rte_sched.c          |  5 +++
 lib/sched/rte_sched_log.h      |  4 ++
 53 files changed, 329 insertions(+), 163 deletions(-)
 create mode 100644 lib/acl/acl_log.h
 create mode 100644 lib/fib/fib_log.h
 create mode 100644 lib/hash/rte_hash_crc.c
 create mode 100644 lib/hash/rte_thash_gfni.c
 create mode 100644 lib/lpm/lpm_log.h
 create mode 100644 lib/mbuf/mbuf_log.h
 create mode 100644 lib/rib/rib_log.h
 create mode 100644 lib/sched/rte_sched_log.h

-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 01/18] gso: don't log message on non TCP/UDP
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 02/18] eal: drop no longer used GSO logtype Stephen Hemminger
                     ` (17 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Jiayu Hu, Jiayu Hu, Mark Kavanagh

If a large packet is passed into GSO routines of unknown protocol
then library would log a message.
Better to tell the application instead of logging.

Fixes: 119583797b6a ("gso: support TCP/IPv4 GSO")
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/gso/rte_gso.c | 4 +---
 lib/gso/rte_gso.h | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/gso/rte_gso.c b/lib/gso/rte_gso.c
index 4b59217c16ee..e29c7d884aed 100644
--- a/lib/gso/rte_gso.c
+++ b/lib/gso/rte_gso.c
@@ -80,9 +80,7 @@ rte_gso_segment(struct rte_mbuf *pkt,
 		ret = gso_udp4_segment(pkt, gso_size, direct_pool,
 				indirect_pool, pkts_out, nb_pkts_out);
 	} else {
-		/* unsupported packet, skip */
-		RTE_LOG(DEBUG, GSO, "Unsupported packet type\n");
-		ret = 0;
+		ret = -ENOTSUP;	/* only UDP or TCP allowed */
 	}
 
 	if (ret < 0) {
diff --git a/lib/gso/rte_gso.h b/lib/gso/rte_gso.h
index 40922524df42..c0f9a1b66ff2 100644
--- a/lib/gso/rte_gso.h
+++ b/lib/gso/rte_gso.h
@@ -114,6 +114,7 @@ struct rte_gso_ctx {
  *  - The number of GSO segments filled in pkts_out on success.
  *  - Return 0 if it does not need to be GSO'd.
  *  - Return -ENOMEM if run out of memory in MBUF pools.
+ *  - Return -ENOTSUP for protocols that can not be segmented
  *  - Return -EINVAL for invalid parameters.
  */
 int rte_gso_segment(struct rte_mbuf *pkt,
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 02/18] eal: drop no longer used GSO logtype
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 01/18] gso: don't log message on non TCP/UDP Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 03/18] log: drop unused RTE_LOGTYPE_TIMER Stephen Hemminger
                     ` (16 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The message that used this was replaced in previous patch.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c     | 1 -
 lib/log/rte_log.h | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/log/log.c b/lib/log/log.c
index b80725a5cf24..111a40932170 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -370,7 +370,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EFD,        "lib.efd"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
-	{RTE_LOGTYPE_GSO,        "lib.gso"},
 	{RTE_LOGTYPE_USER1,      "user1"},
 	{RTE_LOGTYPE_USER2,      "user2"},
 	{RTE_LOGTYPE_USER3,      "user3"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index f7a8405de969..0ac10f580bc1 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -46,7 +46,7 @@ extern "C" {
 #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
 #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. */
+				 /* was RTE_LOGTYPE_GSO */
 
 /* these log types can be used in an application */
 #define RTE_LOGTYPE_USER1     24 /**< User-defined log type 1. */
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 03/18] log: drop unused RTE_LOGTYPE_TIMER
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 01/18] gso: don't log message on non TCP/UDP Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 02/18] eal: drop no longer used GSO logtype Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 04/18] efd: convert RTE_LOGTYPE_EFD to dynamic type Stephen Hemminger
                     ` (15 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The timer code does not use rte_log.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c     | 1 -
 lib/log/rte_log.h | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/log/log.c b/lib/log/log.c
index 111a40932170..c05a7cf5a2dd 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -355,7 +355,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_MALLOC,     "lib.malloc"},
 	{RTE_LOGTYPE_RING,       "lib.ring"},
 	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
-	{RTE_LOGTYPE_TIMER,      "lib.timer"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 0ac10f580bc1..fe8188302125 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -30,7 +30,7 @@ extern "C" {
 #define RTE_LOGTYPE_MALLOC     1 /**< Log related to malloc. */
 #define RTE_LOGTYPE_RING       2 /**< Log related to ring. */
 #define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
-#define RTE_LOGTYPE_TIMER      4 /**< Log related to timers. */
+				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
 #define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 04/18] efd: convert RTE_LOGTYPE_EFD to dynamic type
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (2 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 03/18] log: drop unused RTE_LOGTYPE_TIMER Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 05/18] mbuf: convert RTE_LOGTYPE_MBUF " Stephen Hemminger
                     ` (14 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Byron Marohn, Yipeng Wang

Replace all uses of the global logtype with a dynamic log type.

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

diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c
index dad962ce29bf..78fb9250ef87 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) \
diff --git a/lib/log/log.c b/lib/log/log.c
index c05a7cf5a2dd..c256709b8586 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -367,7 +367,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/log/rte_log.h b/lib/log/rte_log.h
index fe8188302125..c6594e0509a5 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/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 */
 
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 05/18] mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (3 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 04/18] efd: convert RTE_LOGTYPE_EFD to dynamic type Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 06/18] acl: convert RTE_LOGTYPE_ACL " Stephen Hemminger
                     ` (13 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

Introduce a new dynamic logtype for mbuf related messages.
Since this is used in multiple files put one macro in mbuf_log.h

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c                | 1 -
 lib/log/rte_log.h            | 2 +-
 lib/mbuf/mbuf_log.h          | 4 ++++
 lib/mbuf/rte_mbuf.c          | 4 ++++
 lib/mbuf/rte_mbuf_dyn.c      | 2 ++
 lib/mbuf/rte_mbuf_pool_ops.c | 2 ++
 6 files changed, 13 insertions(+), 2 deletions(-)
 create mode 100644 lib/mbuf/mbuf_log.h

diff --git a/lib/log/log.c b/lib/log/log.c
index c256709b8586..0718b84dcb04 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -365,7 +365,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_PORT,       "lib.port"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
-	{RTE_LOGTYPE_MBUF,       "lib.mbuf"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index c6594e0509a5..bd10e32fe164 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -42,7 +42,7 @@ extern "C" {
 #define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
 #define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
-#define RTE_LOGTYPE_MBUF      16 /**< Log related to mbuf. */
+				 /* was RTE_LOGTYPE_MBUF */
 #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
 				 /* was RTE_LOGTYPE_EFD */
 #define RTE_LOGTYPE_EVENTDEV  19 /**< Log related to eventdev. */
diff --git a/lib/mbuf/mbuf_log.h b/lib/mbuf/mbuf_log.h
new file mode 100644
index 000000000000..d759a9a25501
--- /dev/null
+++ b/lib/mbuf/mbuf_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int mbuf_logtype;
+#define RTE_LOGTYPE_MBUF	mbuf_logtype
diff --git a/lib/mbuf/rte_mbuf.c b/lib/mbuf/rte_mbuf.c
index 686e797c80c4..3eccc618270b 100644
--- a/lib/mbuf/rte_mbuf.c
+++ b/lib/mbuf/rte_mbuf.c
@@ -20,6 +20,10 @@
 #include <rte_errno.h>
 #include <rte_memcpy.h>
 
+#include "mbuf_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(mbuf_logtype, INFO);
+
 /*
  * pktmbuf pool constructor, given as a callback function to
  * rte_mempool_create(), or called directly if using
diff --git a/lib/mbuf/rte_mbuf_dyn.c b/lib/mbuf/rte_mbuf_dyn.c
index 5049508bea6e..4fb1863a1043 100644
--- a/lib/mbuf/rte_mbuf_dyn.c
+++ b/lib/mbuf/rte_mbuf_dyn.c
@@ -17,6 +17,8 @@
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
 
+#include "mbuf_log.h"
+
 #define RTE_MBUF_DYN_MZNAME "rte_mbuf_dyn"
 
 struct mbuf_dynfield_elt {
diff --git a/lib/mbuf/rte_mbuf_pool_ops.c b/lib/mbuf/rte_mbuf_pool_ops.c
index 4c91f4ce8569..5318430126cb 100644
--- a/lib/mbuf/rte_mbuf_pool_ops.c
+++ b/lib/mbuf/rte_mbuf_pool_ops.c
@@ -8,6 +8,8 @@
 #include <rte_errno.h>
 #include <rte_mbuf_pool_ops.h>
 
+#include "mbuf_log.h"
+
 int
 rte_mbuf_set_platform_mempool_ops(const char *ops_name)
 {
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 06/18] acl: convert RTE_LOGTYPE_ACL to dynamic type
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (4 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 05/18] mbuf: convert RTE_LOGTYPE_MBUF " Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 07/18] examples/power: replace use of RTE_LOGTYPE_POWER Stephen Hemminger
                     ` (12 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Konstantin Ananyev

Get rid of RTE_LOGTYPE_ACL and RTE_LOGTYPE_MALLOC.
For ACL library use a dynamic type.
The one message using RTE_LOGTYPE_MALLOC should have been
under the ACL logtype anyway.

The test code should not have been using fixed log type
so just change that to stderr.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_acl.c | 2 +-
 lib/acl/acl.h       | 1 +
 lib/acl/acl_bld.c   | 3 +++
 lib/acl/acl_gen.c   | 1 +
 lib/acl/acl_log.h   | 6 ++++++
 lib/acl/rte_acl.c   | 3 +++
 lib/acl/tb_mem.c    | 3 ++-
 lib/log/log.c       | 2 --
 lib/log/rte_log.h   | 4 ++--
 9 files changed, 19 insertions(+), 6 deletions(-)
 create mode 100644 lib/acl/acl_log.h

diff --git a/app/test/test_acl.c b/app/test/test_acl.c
index 8011639ddd1f..503ff0889405 100644
--- a/app/test/test_acl.c
+++ b/app/test/test_acl.c
@@ -154,7 +154,7 @@ rte_acl_ipv4vlan_add_rules(struct rte_acl_ctx *ctx,
 	for (i = 0; i != num; i++) {
 		rc = acl_ipv4vlan_check_rule(rules + i);
 		if (rc != 0) {
-			RTE_LOG(ERR, ACL, "%s: rule #%u is invalid\n",
+			fprintf(stderr,  "%s: rule #%u is invalid\n",
 				__func__, i + 1);
 			return rc;
 		}
diff --git a/lib/acl/acl.h b/lib/acl/acl.h
index c8e4e72fabfb..baed9513cb31 100644
--- a/lib/acl/acl.h
+++ b/lib/acl/acl.h
@@ -225,6 +225,7 @@ int
 rte_acl_classify_altivec(const struct rte_acl_ctx *ctx, const uint8_t **data,
 	uint32_t *results, uint32_t num, uint32_t categories);
 
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/lib/acl/acl_bld.c b/lib/acl/acl_bld.c
index 418751e9f4c7..eaf8770415a5 100644
--- a/lib/acl/acl_bld.c
+++ b/lib/acl/acl_bld.c
@@ -3,8 +3,11 @@
  */
 
 #include <rte_acl.h>
+#include <rte_log.h>
+
 #include "tb_mem.h"
 #include "acl.h"
+#include "acl_log.h"
 
 #define	ACL_POOL_ALIGN		8
 #define	ACL_POOL_ALLOC_MIN	0x800000
diff --git a/lib/acl/acl_gen.c b/lib/acl/acl_gen.c
index 25e75fec3534..03a47ea231ec 100644
--- a/lib/acl/acl_gen.c
+++ b/lib/acl/acl_gen.c
@@ -4,6 +4,7 @@
 
 #include <rte_acl.h>
 #include "acl.h"
+#include "acl_log.h"
 
 #define	QRANGE_MIN	((uint8_t)INT8_MIN)
 
diff --git a/lib/acl/acl_log.h b/lib/acl/acl_log.h
new file mode 100644
index 000000000000..6147116d8d12
--- /dev/null
+++ b/lib/acl/acl_log.h
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+#include <rte_log.h>
+
+extern int acl_logtype;
+#define RTE_LOGTYPE_ACL	acl_logtype
diff --git a/lib/acl/rte_acl.c b/lib/acl/rte_acl.c
index 4182006d1d1c..760c3587d4dc 100644
--- a/lib/acl/rte_acl.c
+++ b/lib/acl/rte_acl.c
@@ -8,6 +8,9 @@
 #include <rte_tailq.h>
 
 #include "acl.h"
+#include "acl_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(acl_logtype, INFO);
 
 TAILQ_HEAD(rte_acl_list, rte_tailq_entry);
 
diff --git a/lib/acl/tb_mem.c b/lib/acl/tb_mem.c
index f14d7b4fa26e..6a9d96aaeda2 100644
--- a/lib/acl/tb_mem.c
+++ b/lib/acl/tb_mem.c
@@ -3,6 +3,7 @@
  */
 
 #include "tb_mem.h"
+#include "acl_log.h"
 
 /*
  *  Memory management routines for temporary memory.
@@ -25,7 +26,7 @@ tb_pool(struct tb_mem_pool *pool, size_t sz)
 	size = sz + pool->alignment - 1;
 	block = calloc(1, size + sizeof(*pool->block));
 	if (block == NULL) {
-		RTE_LOG(ERR, MALLOC, "%s(%zu)\n failed, currently allocated "
+		RTE_LOG(ERR, ACL, "%s(%zu)\n failed, currently allocated "
 			"by pool: %zu bytes\n", __func__, sz, pool->alloc);
 		siglongjmp(pool->fail, -ENOMEM);
 		return NULL;
diff --git a/lib/log/log.c b/lib/log/log.c
index 0718b84dcb04..49ee89ffdd97 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -352,13 +352,11 @@ struct logtype {
 
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
-	{RTE_LOGTYPE_MALLOC,     "lib.malloc"},
 	{RTE_LOGTYPE_RING,       "lib.ring"},
 	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
-	{RTE_LOGTYPE_ACL,        "lib.acl"},
 	{RTE_LOGTYPE_POWER,      "lib.power"},
 	{RTE_LOGTYPE_METER,      "lib.meter"},
 	{RTE_LOGTYPE_SCHED,      "lib.sched"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index bd10e32fe164..0c651f58b58e 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -27,7 +27,7 @@ extern "C" {
 
 /* SDK log type */
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
-#define RTE_LOGTYPE_MALLOC     1 /**< Log related to malloc. */
+				 /* was RTE_LOGTYPE_MALLOC */
 #define RTE_LOGTYPE_RING       2 /**< Log related to ring. */
 #define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
 				 /* was RTE_LOGTYPE_TIMER */
@@ -35,7 +35,7 @@ extern "C" {
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
 #define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
 				 /* was RTE_LOGTYPE_KNI */
-#define RTE_LOGTYPE_ACL        9 /**< Log related to ACL. */
+				 /* was RTE_LOGTYPE_ACL */
 #define RTE_LOGTYPE_POWER     10 /**< Log related to power. */
 #define RTE_LOGTYPE_METER     11 /**< Log related to QoS meter. */
 #define RTE_LOGTYPE_SCHED     12 /**< Log related to QoS port scheduler. */
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 07/18] examples/power: replace use of RTE_LOGTYPE_POWER
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (5 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 06/18] acl: convert RTE_LOGTYPE_ACL " Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 08/18] examples/l3fwd-power: " Stephen Hemminger
                     ` (11 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, David Hunt

Don't use static logtype in sample application.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Hunt <david.hunt@intel.com>
---
 examples/distributor/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 21304d661873..542f76cf9664 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -679,7 +679,7 @@ init_power_library(void)
 		/* init power management library */
 		ret = rte_power_init(lcore_id);
 		if (ret) {
-			RTE_LOG(ERR, POWER,
+			fprintf(stderr,
 				"Library initialization failed on core %u\n",
 				lcore_id);
 			/*
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 08/18] examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (6 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 07/18] examples/power: replace use of RTE_LOGTYPE_POWER Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 09/18] power: convert RTE_LOGTYPE_POWER to dynamic type Stephen Hemminger
                     ` (10 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, David Hunt, Anatoly Burakov, Sivaprasad Tummala

Convert to using a dynamic logtype for the application.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Hunt <david.hunt@intel.com>
---
 examples/l3fwd-power/main.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 9c0dcd343bd9..f4adcf41b55f 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -51,7 +51,8 @@
 #include "perf_core.h"
 #include "main.h"
 
-#define RTE_LOGTYPE_L3FWD_POWER RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER(l3fwd_power_logtype, l3fwd.power, INFO);
+#define RTE_LOGTYPE_L3FWD_POWER l3fwd_power_logtype
 
 #define MAX_PKT_BURST 32
 
@@ -2242,7 +2243,7 @@ init_power_library(void)
 		/* init power management library */
 		ret = rte_power_init(lcore_id);
 		if (ret) {
-			RTE_LOG(ERR, POWER,
+			RTE_LOG(ERR, L3FWD_POWER,
 				"Library initialization failed on core %u\n",
 				lcore_id);
 			return ret;
@@ -2253,8 +2254,8 @@ init_power_library(void)
 				env != PM_ENV_PSTATE_CPUFREQ &&
 				env != PM_ENV_AMD_PSTATE_CPUFREQ &&
 				env != PM_ENV_CPPC_CPUFREQ) {
-			RTE_LOG(ERR, POWER,
-				"Only ACPI, PSTATE and CPPC mode are supported\n");
+			RTE_LOG(ERR, L3FWD_POWER,
+				"Only ACPI and PSTATE mode are supported\n");
 			return -1;
 		}
 	}
@@ -2271,7 +2272,7 @@ deinit_power_library(void)
 		/* deinit power management library */
 		ret = rte_power_exit(lcore_id);
 		if (ret) {
-			RTE_LOG(ERR, POWER,
+			RTE_LOG(ERR, L3FWD_POWER,
 				"Library deinitialization failed on core %u\n",
 				lcore_id);
 			return ret;
@@ -2340,7 +2341,7 @@ update_telemetry(__rte_unused struct rte_timer *tim,
 	ret = rte_metrics_update_values(RTE_METRICS_GLOBAL, telstats_index,
 					values, RTE_DIM(values));
 	if (ret < 0)
-		RTE_LOG(WARNING, POWER, "failed to update metrics\n");
+		RTE_LOG(WARNING, L3FWD_POWER, "failed to update metrics\n");
 }
 
 static int
@@ -2389,7 +2390,7 @@ launch_timer(unsigned int lcore_id)
 				rte_get_main_lcore());
 	}
 
-	RTE_LOG(INFO, POWER, "Bring up the Timer\n");
+	RTE_LOG(INFO, L3FWD_POWER, "Bring up the Timer\n");
 
 	telemetry_setup_timer();
 
@@ -2405,7 +2406,7 @@ launch_timer(unsigned int lcore_id)
 		}
 	}
 
-	RTE_LOG(INFO, POWER, "Timer_subsystem is done\n");
+	RTE_LOG(INFO, L3FWD_POWER, "Timer_subsystem is done\n");
 
 	return 0;
 }
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 09/18] power: convert RTE_LOGTYPE_POWER to dynamic type
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (7 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 08/18] examples/l3fwd-power: " Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 10/18] ring: convert RTE_LOGTYPE_RING " Stephen Hemminger
                     ` (9 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, David Hunt, Anatoly Burakov, Sivaprasad Tummala

Use dynamic log type for power library.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Hunt <david.hunt@intel.com>
---
 lib/log/log.c                | 1 -
 lib/log/rte_log.h            | 2 +-
 lib/power/power_common.c     | 2 ++
 lib/power/power_common.h     | 2 ++
 lib/power/power_kvm_vm.c     | 1 +
 lib/power/rte_power.c        | 1 +
 lib/power/rte_power_uncore.c | 1 +
 7 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/log/log.c b/lib/log/log.c
index 49ee89ffdd97..70b3a0995e2e 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -357,7 +357,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
-	{RTE_LOGTYPE_POWER,      "lib.power"},
 	{RTE_LOGTYPE_METER,      "lib.meter"},
 	{RTE_LOGTYPE_SCHED,      "lib.sched"},
 	{RTE_LOGTYPE_PORT,       "lib.port"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 0c651f58b58e..0cdff28e12d6 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -36,7 +36,7 @@ extern "C" {
 #define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
 				 /* was RTE_LOGTYPE_KNI */
 				 /* was RTE_LOGTYPE_ACL */
-#define RTE_LOGTYPE_POWER     10 /**< Log related to power. */
+				 /* was RTE_LOGTYPE_POWER */
 #define RTE_LOGTYPE_METER     11 /**< Log related to QoS meter. */
 #define RTE_LOGTYPE_SCHED     12 /**< Log related to QoS port scheduler. */
 #define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
diff --git a/lib/power/power_common.c b/lib/power/power_common.c
index 1e09facb863f..bf77eafa886b 100644
--- a/lib/power/power_common.c
+++ b/lib/power/power_common.c
@@ -12,6 +12,8 @@
 
 #include "power_common.h"
 
+RTE_LOG_REGISTER_DEFAULT(power_logtype, INFO);
+
 #define POWER_SYSFILE_SCALING_DRIVER   \
 		"/sys/devices/system/cpu/cpu%u/cpufreq/scaling_driver"
 #define POWER_SYSFILE_GOVERNOR  \
diff --git a/lib/power/power_common.h b/lib/power/power_common.h
index c1c713927621..c3fcbf4c1000 100644
--- a/lib/power/power_common.h
+++ b/lib/power/power_common.h
@@ -10,6 +10,8 @@
 
 #define RTE_POWER_INVALID_FREQ_INDEX (~0)
 
+extern int power_logtype;
+#define RTE_LOGTYPE_POWER power_logtype
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
 #define POWER_DEBUG_TRACE(fmt, args...) \
diff --git a/lib/power/power_kvm_vm.c b/lib/power/power_kvm_vm.c
index 6a8109d44959..db031f43105a 100644
--- a/lib/power/power_kvm_vm.c
+++ b/lib/power/power_kvm_vm.c
@@ -8,6 +8,7 @@
 
 #include "rte_power_guest_channel.h"
 #include "guest_channel.h"
+#include "power_common.h"
 #include "power_kvm_vm.h"
 
 #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
diff --git a/lib/power/rte_power.c b/lib/power/rte_power.c
index 48c2e6b428d8..1502612b0a15 100644
--- a/lib/power/rte_power.c
+++ b/lib/power/rte_power.c
@@ -10,6 +10,7 @@
 #include "rte_power.h"
 #include "power_acpi_cpufreq.h"
 #include "power_cppc_cpufreq.h"
+#include "power_common.h"
 #include "power_kvm_vm.h"
 #include "power_pstate_cpufreq.h"
 #include "power_amd_pstate_cpufreq.h"
diff --git a/lib/power/rte_power_uncore.c b/lib/power/rte_power_uncore.c
index ce027bbeb829..9c20fe150d46 100644
--- a/lib/power/rte_power_uncore.c
+++ b/lib/power/rte_power_uncore.c
@@ -8,6 +8,7 @@
 #include <rte_errno.h>
 #include <rte_spinlock.h>
 
+#include "power_common.h"
 #include "rte_power_uncore.h"
 #include "power_intel_uncore.h"
 
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 10/18] ring: convert RTE_LOGTYPE_RING to dynamic type
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (8 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 09/18] power: convert RTE_LOGTYPE_POWER to dynamic type Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 11/18] mempool: convert RTE_LOGTYPE_MEMPOOL " Stephen Hemminger
                     ` (8 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Honnappa Nagarahalli, Konstantin Ananyev

The logtype for ring only used in library.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c       | 1 -
 lib/log/rte_log.h   | 2 +-
 lib/ring/rte_ring.c | 3 +++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/log/log.c b/lib/log/log.c
index 70b3a0995e2e..f0ab92a3cb59 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -352,7 +352,6 @@ struct logtype {
 
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
-	{RTE_LOGTYPE_RING,       "lib.ring"},
 	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 0cdff28e12d6..f7cb85c7ab28 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -28,7 +28,7 @@ extern "C" {
 /* SDK log type */
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
 				 /* was RTE_LOGTYPE_MALLOC */
-#define RTE_LOGTYPE_RING       2 /**< Log related to ring. */
+				 /* was RTE_LOGTYPE_RING */
 #define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c
index 057d25ff6f2f..12046419f194 100644
--- a/lib/ring/rte_ring.c
+++ b/lib/ring/rte_ring.c
@@ -26,6 +26,9 @@
 #include "rte_ring.h"
 #include "rte_ring_elem.h"
 
+RTE_LOG_REGISTER_DEFAULT(ring_logtype, INFO);
+#define RTE_LOGTYPE_RING ring_logtype
+
 TAILQ_HEAD(rte_ring_list, rte_tailq_entry);
 
 static struct rte_tailq_elem rte_ring_tailq = {
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 11/18] mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (9 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 10/18] ring: convert RTE_LOGTYPE_RING " Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 12/18] lpm: convert RTE_LOGTYPE_LPM to dynamic types Stephen Hemminger
                     ` (7 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Andrew Rybchenko, Morten Brørup

Convert from RTE_LOGTYPE_MEMPOOL to logtype_mempool.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c             | 1 -
 lib/log/rte_log.h         | 2 +-
 lib/mempool/rte_mempool.c | 2 ++
 lib/mempool/rte_mempool.h | 8 ++++++++
 lib/mempool/version.map   | 3 +++
 5 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/log/log.c b/lib/log/log.c
index f0ab92a3cb59..f118e4c7fbaa 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -352,7 +352,6 @@ struct logtype {
 
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
-	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index f7cb85c7ab28..b0421a35954d 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -29,7 +29,7 @@ extern "C" {
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
 				 /* was RTE_LOGTYPE_MALLOC */
 				 /* was RTE_LOGTYPE_RING */
-#define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
+				 /* was RTE_LOGTYPE_MEMPOOL */
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index 7a7a9bf6db63..2f8adad5ca10 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -31,6 +31,8 @@
 #include "mempool_trace.h"
 #include "rte_mempool.h"
 
+RTE_LOG_REGISTER_DEFAULT(rte_mempool_logtype, INFO);
+
 TAILQ_HEAD(rte_mempool_list, rte_tailq_entry);
 
 static struct rte_tailq_elem rte_mempool_tailq = {
diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
index 95deade160c0..c6109732dfcf 100644
--- a/lib/mempool/rte_mempool.h
+++ b/lib/mempool/rte_mempool.h
@@ -43,6 +43,7 @@
 #include <rte_spinlock.h>
 #include <rte_debug.h>
 #include <rte_lcore.h>
+#include <rte_log.h>
 #include <rte_branch_prediction.h>
 #include <rte_ring.h>
 #include <rte_memcpy.h>
@@ -176,6 +177,13 @@ struct rte_mempool_objtlr {
 
 #endif
 
+
+/**
+ * @internal Logtype used for mempool related messages.
+ */
+extern int rte_mempool_logtype;
+#define RTE_LOGTYPE_MEMPOOL	rte_mempool_logtype
+
 /**
  * A list of memory where objects are stored
  */
diff --git a/lib/mempool/version.map b/lib/mempool/version.map
index d0bfedd1d875..ca6cf89ce3ea 100644
--- a/lib/mempool/version.map
+++ b/lib/mempool/version.map
@@ -57,4 +57,7 @@ INTERNAL {
 	# added in 21.11
 	rte_mempool_event_callback_register;
 	rte_mempool_event_callback_unregister;
+
+	# added in 23.07
+	rte_mempool_logtype;
 };
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 12/18] lpm: convert RTE_LOGTYPE_LPM to dynamic types
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (10 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 11/18] mempool: convert RTE_LOGTYPE_MEMPOOL " Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 13/18] sched: convert RTE_LOGTYPE_SCHED to dynamic type Stephen Hemminger
                     ` (6 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Vladimir Medvedkin, Bruce Richardson

Split lpm and lpm6 into separate log types since they
are in different files and user may want to change log
levels for IPv4 vs IPv6.

For rib and fib libraries give them own types as well.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/fib/fib_log.h  | 4 ++++
 lib/fib/rte_fib.c  | 3 +++
 lib/fib/rte_fib6.c | 2 ++
 lib/log/log.c      | 1 -
 lib/log/rte_log.h  | 2 +-
 lib/lpm/lpm_log.h  | 4 ++++
 lib/lpm/rte_lpm.c  | 3 +++
 lib/lpm/rte_lpm6.c | 1 +
 lib/rib/rib_log.h  | 4 ++++
 lib/rib/rte_rib.c  | 3 +++
 lib/rib/rte_rib6.c | 3 +++
 11 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 lib/fib/fib_log.h
 create mode 100644 lib/lpm/lpm_log.h
 create mode 100644 lib/rib/rib_log.h

diff --git a/lib/fib/fib_log.h b/lib/fib/fib_log.h
new file mode 100644
index 000000000000..c731c820f621
--- /dev/null
+++ b/lib/fib/fib_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int fib_logtype;
+#define RTE_LOGTYPE_LPM fib_logtype
diff --git a/lib/fib/rte_fib.c b/lib/fib/rte_fib.c
index 0c3b20e00a5a..f88e71a59d5a 100644
--- a/lib/fib/rte_fib.c
+++ b/lib/fib/rte_fib.c
@@ -17,6 +17,9 @@
 #include <rte_fib.h>
 
 #include "dir24_8.h"
+#include "fib_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(fib_logtype, INFO);
 
 TAILQ_HEAD(rte_fib_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_fib_tailq = {
diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c
index 28c69b38999f..ab1d9604796f 100644
--- a/lib/fib/rte_fib6.c
+++ b/lib/fib/rte_fib6.c
@@ -10,6 +10,7 @@
 #include <rte_eal_memconfig.h>
 #include <rte_tailq.h>
 #include <rte_errno.h>
+#include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_string_fns.h>
 
@@ -17,6 +18,7 @@
 #include <rte_fib6.h>
 
 #include "trie.h"
+#include "fib_log.h"
 
 TAILQ_HEAD(rte_fib6_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_fib6_tailq = {
diff --git a/lib/log/log.c b/lib/log/log.c
index f118e4c7fbaa..95e0ba1c6b51 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -354,7 +354,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
-	{RTE_LOGTYPE_LPM,        "lib.lpm"},
 	{RTE_LOGTYPE_METER,      "lib.meter"},
 	{RTE_LOGTYPE_SCHED,      "lib.sched"},
 	{RTE_LOGTYPE_PORT,       "lib.port"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index b0421a35954d..8d34ac902b39 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -33,7 +33,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
-#define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
+				 /* was RTE_LOGTYPE_LPM */
 				 /* was RTE_LOGTYPE_KNI */
 				 /* was RTE_LOGTYPE_ACL */
 				 /* was RTE_LOGTYPE_POWER */
diff --git a/lib/lpm/lpm_log.h b/lib/lpm/lpm_log.h
new file mode 100644
index 000000000000..a0621b70a5fe
--- /dev/null
+++ b/lib/lpm/lpm_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int lpm_logtype;
+#define RTE_LOGTYPE_LPM lpm_logtype
diff --git a/lib/lpm/rte_lpm.c b/lib/lpm/rte_lpm.c
index cdcd1b7f9e47..0ca82147866a 100644
--- a/lib/lpm/rte_lpm.c
+++ b/lib/lpm/rte_lpm.c
@@ -18,6 +18,9 @@
 #include <rte_tailq.h>
 
 #include "rte_lpm.h"
+#include "lpm_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(lpm_logtype, INFO);
 
 TAILQ_HEAD(rte_lpm_list, rte_tailq_entry);
 
diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c
index 8d21aeddb83c..873cc8bc267d 100644
--- a/lib/lpm/rte_lpm6.c
+++ b/lib/lpm/rte_lpm6.c
@@ -20,6 +20,7 @@
 #include <rte_tailq.h>
 
 #include "rte_lpm6.h"
+#include "lpm_log.h"
 
 #define RTE_LPM6_TBL24_NUM_ENTRIES        (1 << 24)
 #define RTE_LPM6_TBL8_GROUP_NUM_ENTRIES         256
diff --git a/lib/rib/rib_log.h b/lib/rib/rib_log.h
new file mode 100644
index 000000000000..f3ee513ca854
--- /dev/null
+++ b/lib/rib/rib_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int rib_logtype;
+#define RTE_LOGTYPE_LPM rib_logtype
diff --git a/lib/rib/rte_rib.c b/lib/rib/rte_rib.c
index 486e8216dfeb..251d0d4ef19e 100644
--- a/lib/rib/rte_rib.c
+++ b/lib/rib/rte_rib.c
@@ -16,6 +16,9 @@
 
 #include <rte_rib.h>
 
+RTE_LOG_REGISTER_DEFAULT(rib_logtype, INFO);
+#define RTE_LOGTYPE_LPM rib_logtype
+
 TAILQ_HEAD(rte_rib_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_rib_tailq = {
 	.name = "RTE_RIB",
diff --git a/lib/rib/rte_rib6.c b/lib/rib/rte_rib6.c
index 94ff434978b2..ad3d48ab8e1a 100644
--- a/lib/rib/rte_rib6.c
+++ b/lib/rib/rte_rib6.c
@@ -9,6 +9,7 @@
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
+#include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_string_fns.h>
@@ -16,6 +17,8 @@
 
 #include <rte_rib6.h>
 
+#include "rib_log.h"
+
 #define RTE_RIB_VALID_NODE	1
 #define RIB6_MAXDEPTH		128
 /* Maximum length of a RIB6 name. */
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 13/18] sched: convert RTE_LOGTYPE_SCHED to dynamic type
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (11 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 12/18] lpm: convert RTE_LOGTYPE_LPM to dynamic types Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 14/18] examples/ipsec-secgw: replace RTE_LOGTYPE_PORT Stephen Hemminger
                     ` (5 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu

Also can remove unused RTE_LOGTYPE_METER

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c             | 2 --
 lib/log/rte_log.h         | 4 ++--
 lib/sched/rte_pie.c       | 1 +
 lib/sched/rte_sched.c     | 5 +++++
 lib/sched/rte_sched_log.h | 4 ++++
 5 files changed, 12 insertions(+), 4 deletions(-)
 create mode 100644 lib/sched/rte_sched_log.h

diff --git a/lib/log/log.c b/lib/log/log.c
index 95e0ba1c6b51..56877d42e6b9 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -354,8 +354,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
-	{RTE_LOGTYPE_METER,      "lib.meter"},
-	{RTE_LOGTYPE_SCHED,      "lib.sched"},
 	{RTE_LOGTYPE_PORT,       "lib.port"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 8d34ac902b39..189ad2bbd2cf 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -37,8 +37,8 @@ extern "C" {
 				 /* was RTE_LOGTYPE_KNI */
 				 /* was RTE_LOGTYPE_ACL */
 				 /* was RTE_LOGTYPE_POWER */
-#define RTE_LOGTYPE_METER     11 /**< Log related to QoS meter. */
-#define RTE_LOGTYPE_SCHED     12 /**< Log related to QoS port scheduler. */
+				 /* was RTE_LOGTYPE_METER */
+				 /* was RTE_LOGTYPE_SCHED */
 #define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
 #define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
diff --git a/lib/sched/rte_pie.c b/lib/sched/rte_pie.c
index 947e2a059f6f..cce0ce762da8 100644
--- a/lib/sched/rte_pie.c
+++ b/lib/sched/rte_pie.c
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "rte_sched_log.h"
 #include "rte_pie.h"
 
 #ifdef __INTEL_COMPILER
diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c
index 1a6beb14f4ab..76dd8dd7388c 100644
--- a/lib/sched/rte_sched.c
+++ b/lib/sched/rte_sched.c
@@ -16,9 +16,12 @@
 #include <rte_reciprocal.h>
 
 #include "rte_sched.h"
+#include "rte_sched_log.h"
 #include "rte_sched_common.h"
+
 #include "rte_approx.h"
 
+
 #ifdef __INTEL_COMPILER
 #pragma warning(disable:2259) /* conversion may lose significant bits */
 #endif
@@ -2999,3 +3002,5 @@ rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint
 
 	return count;
 }
+
+RTE_LOG_REGISTER_DEFAULT(sched_logtype, INFO);
diff --git a/lib/sched/rte_sched_log.h b/lib/sched/rte_sched_log.h
new file mode 100644
index 000000000000..fde051f49d62
--- /dev/null
+++ b/lib/sched/rte_sched_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int sched_logtype;
+#define RTE_LOGTYPE_SCHED sched_logtype
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 14/18] examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (12 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 13/18] sched: convert RTE_LOGTYPE_SCHED to dynamic type Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 15/18] app/test: remove use of RTE_LOGTYPE_PIPELINE Stephen Hemminger
                     ` (4 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Akhil Goyal, Radu Nicolau, Aviad Yehezkel,
	Boris Pismenny, Declan Doherty

Looks like some code got copy/paste in to the IPSEC gateway
example from another place. Shouldn't be using RTE_LOGTYPE_PORT
here.

Fixes: ec17993a145a ("examples/ipsec-secgw: support security offload")
Acked-by: Akhil Goyal <gakhil@marvell.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/ipsec-secgw/sa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 6ae0e49fd7f8..c4bac17cd77c 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -1128,7 +1128,7 @@ check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso)
 	if (inbound) {
 		if ((dev_info.rx_offload_capa &
 				RTE_ETH_RX_OFFLOAD_SECURITY) == 0) {
-			RTE_LOG(WARNING, PORT,
+			RTE_LOG(WARNING, IPSEC,
 				"hardware RX IPSec offload is not supported\n");
 			return -EINVAL;
 		}
@@ -1136,13 +1136,13 @@ check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso)
 	} else { /* outbound */
 		if ((dev_info.tx_offload_capa &
 				RTE_ETH_TX_OFFLOAD_SECURITY) == 0) {
-			RTE_LOG(WARNING, PORT,
+			RTE_LOG(WARNING, IPSEC,
 				"hardware TX IPSec offload is not supported\n");
 			return -EINVAL;
 		}
 		if (tso && (dev_info.tx_offload_capa &
 				RTE_ETH_TX_OFFLOAD_TCP_TSO) == 0) {
-			RTE_LOG(WARNING, PORT,
+			RTE_LOG(WARNING, IPSEC,
 				"hardware TCP TSO offload is not supported\n");
 			return -EINVAL;
 		}
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 15/18] app/test: remove use of RTE_LOGTYPE_PIPELINE
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (13 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 14/18] examples/ipsec-secgw: replace RTE_LOGTYPE_PORT Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 16/18] hash: mover rte_thash_gfni stubs out of header file Stephen Hemminger
                     ` (3 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu

Instead of using static type PIPELINE for logging in test application
use stderr instead.  If not testing RTE_LOG() better to not use
it since log also goes to syslog.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_table_acl.c      | 50 ++++++++++++++++------------------
 app/test/test_table_pipeline.c | 40 +++++++++++++--------------
 2 files changed, 43 insertions(+), 47 deletions(-)

diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c
index e66f06b84d0a..dff9bddfb948 100644
--- a/app/test/test_table_acl.c
+++ b/app/test/test_table_acl.c
@@ -165,7 +165,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v)
 		&v->field_value[SRC_FIELD_IPV4].value.u32,
 		&v->field_value[SRC_FIELD_IPV4].mask_range.u32);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read src address/mask: %s\n",
+		fprintf(stderr, "failed to read src address/mask: %s\n",
 			in[CB_FLD_SRC_ADDR]);
 		return rc;
 	}
@@ -178,7 +178,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v)
 		&v->field_value[DST_FIELD_IPV4].value.u32,
 		&v->field_value[DST_FIELD_IPV4].mask_range.u32);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read dest address/mask: %s\n",
+		fprintf(stderr, "failed to read dest address/mask: %s\n",
 			in[CB_FLD_DST_ADDR]);
 		return rc;
 	}
@@ -190,7 +190,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v)
 		&v->field_value[SRCP_FIELD_IPV4].value.u16,
 		&v->field_value[SRCP_FIELD_IPV4].mask_range.u16);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read source port range: %s\n",
+		fprintf(stderr, "failed to read source port range: %s\n",
 			in[CB_FLD_SRC_PORT_RANGE]);
 		return rc;
 	}
@@ -202,7 +202,7 @@ parse_cb_ipv4_rule(char *str, struct rte_table_acl_rule_add_params *v)
 		&v->field_value[DSTP_FIELD_IPV4].value.u16,
 		&v->field_value[DSTP_FIELD_IPV4].mask_range.u16);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read dest port range: %s\n",
+		fprintf(stderr, "failed to read dest port range: %s\n",
 			in[CB_FLD_DST_PORT_RANGE]);
 		return rc;
 	}
@@ -254,7 +254,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
 		&v->field_value[SRC_FIELD_IPV4].value.u32,
 		&v->field_value[SRC_FIELD_IPV4].mask_range.u32);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read src address/mask: %s\n",
+		fprintf(stderr, "failed to read src address/mask: %s\n",
 			in[CB_FLD_SRC_ADDR]);
 		return rc;
 	}
@@ -267,7 +267,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
 		&v->field_value[DST_FIELD_IPV4].value.u32,
 		&v->field_value[DST_FIELD_IPV4].mask_range.u32);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read dest address/mask: %s\n",
+		fprintf(stderr, "failed to read dest address/mask: %s\n",
 			in[CB_FLD_DST_ADDR]);
 		return rc;
 	}
@@ -279,7 +279,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
 		&v->field_value[SRCP_FIELD_IPV4].value.u16,
 		&v->field_value[SRCP_FIELD_IPV4].mask_range.u16);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read source port range: %s\n",
+		fprintf(stderr, "failed to read source port range: %s\n",
 			in[CB_FLD_SRC_PORT_RANGE]);
 		return rc;
 	}
@@ -291,7 +291,7 @@ parse_cb_ipv4_rule_del(char *str, struct rte_table_acl_rule_delete_params *v)
 		&v->field_value[DSTP_FIELD_IPV4].value.u16,
 		&v->field_value[DSTP_FIELD_IPV4].mask_range.u16);
 	if (rc != 0) {
-		RTE_LOG(ERR, PIPELINE, "failed to read dest port range: %s\n",
+		fprintf(stderr, "failed to read dest port range: %s\n",
 			in[CB_FLD_DST_PORT_RANGE]);
 		return rc;
 	}
@@ -346,7 +346,7 @@ setup_acl_pipeline(void)
 	/* Pipeline configuration */
 	p = rte_pipeline_create(&pipeline_params);
 	if (p == NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Failed to configure pipeline\n",
+		fprintf(stderr, "%s: Failed to configure pipeline\n",
 			__func__);
 		goto fail;
 	}
@@ -410,7 +410,7 @@ setup_acl_pipeline(void)
 		table_params.f_action_miss = NULL;
 		table_params.action_data_size = 0;
 
-		RTE_LOG(INFO, PIPELINE, "miss_action=%x\n",
+		printf("miss_action=%x\n",
 			table_entry_miss_action);
 
 		printf("RTE_ACL_RULE_SZ(%zu) = %zu\n", DIM(ipv4_defs),
@@ -471,9 +471,8 @@ setup_acl_pipeline(void)
 
 			ret = parser(line, &keys[n]);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE,
-					"line %u: parse_cb_ipv4vlan_rule"
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -513,9 +512,8 @@ setup_acl_pipeline(void)
 
 			ret = parse_cb_ipv4_rule_del(line, &keys[n]);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE,
-					"line %u: parse_cb_ipv4vlan_rule"
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -549,9 +547,8 @@ setup_acl_pipeline(void)
 
 			ret = parser(line, &rule_params);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE,
-					"line %u: parse_cb_ipv4vlan_rule"
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse_cb_ipv4vlan_rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -575,8 +572,8 @@ setup_acl_pipeline(void)
 
 			ret = parser(line, &rule_params);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE, "line %u: parse rule "
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -602,8 +599,8 @@ setup_acl_pipeline(void)
 
 			ret = parser(line, &rule_params);
 			if (ret != 0) {
-				RTE_LOG(ERR, PIPELINE, "line %u: parse rule"
-					" failed, error code: %d (%s)\n",
+				fprintf(stderr,
+					"line %u: parse rule failed, error code: %d (%s)\n",
 					n, ret, strerror(-ret));
 				return ret;
 			}
@@ -667,7 +664,7 @@ test_pipeline_single_filter(int expected_count)
 
 			memcpy(rte_pktmbuf_mtod(mbuf, char *), &five_tuple,
 				sizeof(struct ipv4_5tuple));
-			RTE_LOG(INFO, PIPELINE, "%s: Enqueue onto ring %d\n",
+			printf("%s: Enqueue onto ring %d\n",
 				__func__, i);
 			rte_ring_enqueue(rings_rx[i], mbuf);
 		}
@@ -702,9 +699,8 @@ test_pipeline_single_filter(int expected_count)
 	}
 
 	if (tx_count != expected_count) {
-		RTE_LOG(INFO, PIPELINE,
-			"%s: Unexpected packets for ACL test, "
-			"expected %d, got %d\n",
+		fprintf(stderr,
+			"%s: Unexpected packets for ACL test, expected %d, got %d\n",
 			__func__, expected_count, tx_count);
 		goto fail;
 	}
diff --git a/app/test/test_table_pipeline.c b/app/test/test_table_pipeline.c
index 7adbbffbf55d..960f730cf20d 100644
--- a/app/test/test_table_pipeline.c
+++ b/app/test/test_table_pipeline.c
@@ -6,7 +6,6 @@
 
 #include <string.h>
 #include <rte_pipeline.h>
-#include <rte_log.h>
 #include <inttypes.h>
 #include <rte_hexdump.h>
 #include "test_table.h"
@@ -173,30 +172,31 @@ check_pipeline_invalid_params(void)
 
 	p = rte_pipeline_create(NULL);
 	if (p != NULL) {
-		RTE_LOG(INFO, PIPELINE,
+		fprintf(stderr,
 			"%s: configured pipeline with null params\n",
 			__func__);
 		goto fail;
 	}
 	p = rte_pipeline_create(&pipeline_params_1);
 	if (p != NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with NULL "
-			"name\n", __func__);
+		fprintf(stderr,
+			"%s: Configure pipeline with NULL name\n", __func__);
 		goto fail;
 	}
 
 	p = rte_pipeline_create(&pipeline_params_2);
 	if (p != NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with invalid "
-			"socket\n", __func__);
+		fprintf(stderr,
+			"%s: Configure pipeline with invalid socket\n", __func__);
 		goto fail;
 	}
 
 	if (rte_eal_has_hugepages()) {
 		p = rte_pipeline_create(&pipeline_params_3);
 		if (p != NULL) {
-			RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with "
-				"invalid socket\n", __func__);
+			fprintf(stderr,
+				"%s: Configure pipeline with invalid socket\n",
+				__func__);
 			goto fail;
 		}
 	}
@@ -224,20 +224,20 @@ setup_pipeline(int test_type)
 		.socket_id = 0,
 	};
 
-	RTE_LOG(INFO, PIPELINE, "%s: **** Setting up %s test\n",
+	fprintf(stderr, "%s: **** Setting up %s test\n",
 		__func__, pipeline_test_names[test_type]);
 
 	/* Pipeline configuration */
 	p = rte_pipeline_create(&pipeline_params);
 	if (p == NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Failed to configure pipeline\n",
+		fprintf(stderr, "%s: Failed to configure pipeline\n",
 			__func__);
 		goto fail;
 	}
 
 	ret = rte_pipeline_free(p);
 	if (ret != 0) {
-		RTE_LOG(INFO, PIPELINE, "%s: Failed to free pipeline\n",
+		fprintf(stderr, "%s: Failed to free pipeline\n",
 			__func__);
 		goto fail;
 	}
@@ -245,7 +245,7 @@ setup_pipeline(int test_type)
 	/* Pipeline configuration */
 	p = rte_pipeline_create(&pipeline_params);
 	if (p == NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Failed to configure pipeline\n",
+		fprintf(stderr, "%s: Failed to configure pipeline\n",
 			__func__);
 		goto fail;
 	}
@@ -411,7 +411,7 @@ test_pipeline_single_filter(int test_type, int expected_count)
 	int ret;
 	int tx_count;
 
-	RTE_LOG(INFO, PIPELINE, "%s: **** Running %s test\n",
+	fprintf(stderr, "%s: **** Running %s test\n",
 		__func__, pipeline_test_names[test_type]);
 	/* Run pipeline once */
 	for (i = 0; i < N_PORTS; i++)
@@ -420,7 +420,7 @@ test_pipeline_single_filter(int test_type, int expected_count)
 
 	ret = rte_pipeline_flush(NULL);
 	if (ret != -EINVAL) {
-		RTE_LOG(INFO, PIPELINE,
+		fprintf(stderr,
 			"%s: No pipeline flush error NULL pipeline (%d)\n",
 			__func__, ret);
 		goto fail;
@@ -445,7 +445,7 @@ test_pipeline_single_filter(int test_type, int expected_count)
 			k32 = (uint32_t *) key;
 			k32[0] = 0xadadadad >> (j % 2);
 
-			RTE_LOG(INFO, PIPELINE, "%s: Enqueue onto ring %d\n",
+			fprintf(stderr, "%s: Enqueue onto ring %d\n",
 				__func__, i);
 			rte_ring_enqueue(rings_rx[i], m);
 		}
@@ -487,9 +487,9 @@ test_pipeline_single_filter(int test_type, int expected_count)
 	}
 
 	if (tx_count != expected_count) {
-		RTE_LOG(INFO, PIPELINE,
-			"%s: Unexpected packets out for %s test, expected %d, "
-			"got %d\n", __func__, pipeline_test_names[test_type],
+		fprintf(stderr,
+			"%s: Unexpected packets out for %s test, expected %d, got %d\n",
+			__func__, pipeline_test_names[test_type],
 			expected_count, tx_count);
 		goto fail;
 	}
@@ -564,8 +564,8 @@ test_table_pipeline(void)
 	connect_miss_action_to_table = 0;
 
 	if (check_pipeline_invalid_params()) {
-		RTE_LOG(INFO, PIPELINE, "%s: Check pipeline invalid params "
-			"failed.\n", __func__);
+		fprintf(stderr, "%s: Check pipeline invalid params failed.\n",
+			__func__);
 		return -1;
 	}
 
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 16/18] hash: mover rte_thash_gfni stubs out of header file
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (14 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 15/18] app/test: remove use of RTE_LOGTYPE_PIPELINE Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 17/18] hash: move rte_hash_set_alg " Stephen Hemminger
                     ` (2 subsequent siblings)
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Yipeng Wang, Sameh Gobriel, Bruce Richardson,
	Vladimir Medvedkin

Having stubs in header file makes it harder to update
RTE_LOG(). Also modify to only print warning once.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/hash/meson.build      |  8 ++++++-
 lib/hash/rte_thash_gfni.c | 47 +++++++++++++++++++++++++++++++++++++++
 lib/hash/rte_thash_gfni.h | 23 +++++--------------
 lib/hash/version.map      |  2 ++
 4 files changed, 61 insertions(+), 19 deletions(-)
 create mode 100644 lib/hash/rte_thash_gfni.c

diff --git a/lib/hash/meson.build b/lib/hash/meson.build
index 2f757d45f9bc..e56ee8572564 100644
--- a/lib/hash/meson.build
+++ b/lib/hash/meson.build
@@ -17,7 +17,13 @@ indirect_headers += files(
         'rte_thash_x86_gfni.h',
 )
 
-sources = files('rte_cuckoo_hash.c', 'rte_fbk_hash.c', 'rte_thash.c')
+sources = files(
+    'rte_cuckoo_hash.c',
+    'rte_fbk_hash.c',
+    'rte_thash.c',
+    'rte_thash_gfni.c'
+)
+
 deps += ['net']
 deps += ['ring']
 deps += ['rcu']
diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c
new file mode 100644
index 000000000000..eb334185725c
--- /dev/null
+++ b/lib/hash/rte_thash_gfni.c
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2021 Intel Corporation
+ */
+
+#include <stdbool.h>
+
+#include <rte_compat.h>
+#include <rte_log.h>
+#include <rte_thash_gfni.h>
+
+#ifndef RTE_THASH_GFNI_DEFINED
+
+uint32_t
+rte_thash_gfni(const uint64_t *mtrx __rte_unused,
+	       const uint8_t *key __rte_unused, int len __rte_unused)
+{
+	static bool warned;
+
+	if (!warned) {
+		warned = true;
+		RTE_LOG(ERR, HASH,
+			"%s is undefined under given arch\n", __func__);
+	}
+
+	return 0;
+}
+
+void
+rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused,
+		    int len __rte_unused, uint8_t *tuple[] __rte_unused,
+		    uint32_t val[], uint32_t num)
+{
+	unsigned int i;
+
+	static bool warned;
+
+	if (!warned) {
+		warned = true;
+		RTE_LOG(ERR, HASH,
+			"%s is undefined under given arch\n", __func__);
+	}
+
+	for (i = 0; i < num; i++)
+		val[i] = 0;
+}
+
+#endif
diff --git a/lib/hash/rte_thash_gfni.h b/lib/hash/rte_thash_gfni.h
index cd253459e7da..4e5388a1bf65 100644
--- a/lib/hash/rte_thash_gfni.h
+++ b/lib/hash/rte_thash_gfni.h
@@ -33,13 +33,8 @@ extern "C" {
  * @return
  *  Calculated Toeplitz hash value.
  */
-static inline uint32_t
-rte_thash_gfni(const uint64_t *mtrx __rte_unused,
-	const uint8_t *key __rte_unused, int len __rte_unused)
-{
-	RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__);
-	return 0;
-}
+uint32_t
+rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len);
 
 /**
  * Bulk implementation for Toeplitz hash.
@@ -58,17 +53,9 @@ rte_thash_gfni(const uint64_t *mtrx __rte_unused,
  * @param num
  *  Number of tuples to hash.
  */
-static inline void
-rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused,
-	int len __rte_unused, uint8_t *tuple[] __rte_unused,
-	uint32_t val[], uint32_t num)
-{
-	unsigned int i;
-
-	RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__);
-	for (i = 0; i < num; i++)
-		val[i] = 0;
-}
+void
+rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[],
+		    uint32_t val[], uint32_t num);
 
 #endif /* RTE_THASH_GFNI_DEFINED */
 
diff --git a/lib/hash/version.map b/lib/hash/version.map
index b98b64a1638a..56a0cbd4b8a5 100644
--- a/lib/hash/version.map
+++ b/lib/hash/version.map
@@ -39,6 +39,8 @@ DPDK_24 {
 	rte_thash_get_gfni_matrices;
 	rte_thash_get_helper;
 	rte_thash_get_key;
+	rte_thash_gfni;
+	rte_thash_gfni_bulk;
 	rte_thash_gfni_supported;
 	rte_thash_init_ctx;
 
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 17/18] hash: move rte_hash_set_alg out of header file
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (15 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 16/18] hash: mover rte_thash_gfni stubs out of header file Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-05  2:09   ` [PATCH 18/18] hash: convert RTE_LOGTYPE_HASH to dynamic type Stephen Hemminger
  2023-12-06 10:08   ` [PATCH 00/18] Convert static log types in libraries to dynamic David Marchand
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Ruifeng Wang, Yipeng Wang, Sameh Gobriel,
	Bruce Richardson, Vladimir Medvedkin

The code for setting algorithm for hash is not at all perf sensitive,
and doing it inline has a couple of problems. First, it means that if
multiple files include the header, then the initialization gets done
multiple times. But also, it makes it harder to fix usage of RTE_LOG().

Despite what the checking script say. This is not an ABI change, the
previous version inlined the same code; therefore both old and new code
will work the same.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/hash/meson.build     |  1 +
 lib/hash/rte_crc_arm64.h |  8 ++---
 lib/hash/rte_crc_x86.h   | 10 +++---
 lib/hash/rte_hash_crc.c  | 68 ++++++++++++++++++++++++++++++++++++++++
 lib/hash/rte_hash_crc.h  | 48 ++--------------------------
 lib/hash/version.map     |  7 +++++
 6 files changed, 88 insertions(+), 54 deletions(-)
 create mode 100644 lib/hash/rte_hash_crc.c

diff --git a/lib/hash/meson.build b/lib/hash/meson.build
index e56ee8572564..c345c6f561fc 100644
--- a/lib/hash/meson.build
+++ b/lib/hash/meson.build
@@ -19,6 +19,7 @@ indirect_headers += files(
 
 sources = files(
     'rte_cuckoo_hash.c',
+    'rte_hash_crc.c',
     'rte_fbk_hash.c',
     'rte_thash.c',
     'rte_thash_gfni.c'
diff --git a/lib/hash/rte_crc_arm64.h b/lib/hash/rte_crc_arm64.h
index c9f52510871b..414fe065caa8 100644
--- a/lib/hash/rte_crc_arm64.h
+++ b/lib/hash/rte_crc_arm64.h
@@ -53,7 +53,7 @@ crc32c_arm64_u64(uint64_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_1byte(uint8_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_ARM64))
+	if (likely(rte_hash_crc32_alg & CRC32_ARM64))
 		return crc32c_arm64_u8(data, init_val);
 
 	return crc32c_1byte(data, init_val);
@@ -67,7 +67,7 @@ rte_hash_crc_1byte(uint8_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_2byte(uint16_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_ARM64))
+	if (likely(rte_hash_crc32_alg & CRC32_ARM64))
 		return crc32c_arm64_u16(data, init_val);
 
 	return crc32c_2bytes(data, init_val);
@@ -81,7 +81,7 @@ rte_hash_crc_2byte(uint16_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_ARM64))
+	if (likely(rte_hash_crc32_alg & CRC32_ARM64))
 		return crc32c_arm64_u32(data, init_val);
 
 	return crc32c_1word(data, init_val);
@@ -95,7 +95,7 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_ARM64))
+	if (likely(rte_hash_crc32_alg & CRC32_ARM64))
 		return crc32c_arm64_u64(data, init_val);
 
 	return crc32c_2words(data, init_val);
diff --git a/lib/hash/rte_crc_x86.h b/lib/hash/rte_crc_x86.h
index 205bc182be77..3b865e251db2 100644
--- a/lib/hash/rte_crc_x86.h
+++ b/lib/hash/rte_crc_x86.h
@@ -67,7 +67,7 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)
 static inline uint32_t
 rte_hash_crc_1byte(uint8_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_SSE42))
+	if (likely(rte_hash_crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u8(data, init_val);
 
 	return crc32c_1byte(data, init_val);
@@ -81,7 +81,7 @@ rte_hash_crc_1byte(uint8_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_2byte(uint16_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_SSE42))
+	if (likely(rte_hash_crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u16(data, init_val);
 
 	return crc32c_2bytes(data, init_val);
@@ -95,7 +95,7 @@ rte_hash_crc_2byte(uint16_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 {
-	if (likely(crc32_alg & CRC32_SSE42))
+	if (likely(rte_hash_crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u32(data, init_val);
 
 	return crc32c_1word(data, init_val);
@@ -110,11 +110,11 @@ static inline uint32_t
 rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
 {
 #ifdef RTE_ARCH_X86_64
-	if (likely(crc32_alg == CRC32_SSE42_x64))
+	if (likely(rte_hash_crc32_alg == CRC32_SSE42_x64))
 		return crc32c_sse42_u64(data, init_val);
 #endif
 
-	if (likely(crc32_alg & CRC32_SSE42))
+	if (likely(rte_hash_crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u64_mimic(data, init_val);
 
 	return crc32c_2words(data, init_val);
diff --git a/lib/hash/rte_hash_crc.c b/lib/hash/rte_hash_crc.c
new file mode 100644
index 000000000000..1439d8a71f6a
--- /dev/null
+++ b/lib/hash/rte_hash_crc.c
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
+ */
+
+#include <rte_cpuflags.h>
+#include <rte_log.h>
+
+#include "rte_hash_crc.h"
+
+RTE_LOG_REGISTER_SUFFIX(hash_crc_logtype, crc, INFO);
+#define RTE_LOGTYPE_HASH_CRC hash_crc_logtype
+
+uint8_t rte_hash_crc32_alg = CRC32_SW;
+
+/**
+ * Allow or disallow use of SSE4.2/ARMv8 intrinsics for CRC32 hash
+ * calculation.
+ *
+ * @param alg
+ *   An OR of following flags:
+ *   - (CRC32_SW) Don't use SSE4.2/ARMv8 intrinsics (default non-[x86/ARMv8])
+ *   - (CRC32_SSE42) Use SSE4.2 intrinsics if available
+ *   - (CRC32_SSE42_x64) Use 64-bit SSE4.2 intrinsic if available (default x86)
+ *   - (CRC32_ARM64) Use ARMv8 CRC intrinsic if available (default ARMv8)
+ *
+ */
+void
+rte_hash_crc_set_alg(uint8_t alg)
+{
+	rte_hash_crc32_alg = CRC32_SW;
+
+	if (alg == CRC32_SW)
+		return;
+
+#if defined RTE_ARCH_X86
+	if (!(alg & CRC32_SSE42_x64))
+		RTE_LOG(WARNING, HASH_CRC,
+			"Unsupported CRC32 algorithm requested using CRC32_x64/CRC32_SSE42\n");
+	if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_EM64T) || alg == CRC32_SSE42)
+		rte_hash_crc32_alg = CRC32_SSE42;
+	else
+		rte_hash_crc32_alg = CRC32_SSE42_x64;
+#endif
+
+#if defined RTE_ARCH_ARM64
+	if (!(alg & CRC32_ARM64))
+		RTE_LOG(WARNING, HASH_CRC,
+			"Unsupported CRC32 algorithm requested using CRC32_ARM64\n");
+	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_CRC32))
+		rte_hash_crc32_alg = CRC32_ARM64;
+#endif
+
+	if (rte_hash_crc32_alg == CRC32_SW)
+		RTE_LOG(WARNING, HASH_CRC,
+			"Unsupported CRC32 algorithm requested using CRC32_SW\n");
+}
+
+/* Setting the best available algorithm */
+RTE_INIT(rte_hash_crc_init_alg)
+{
+#if defined(RTE_ARCH_X86)
+	rte_hash_crc_set_alg(CRC32_SSE42_x64);
+#elif defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRC32)
+	rte_hash_crc_set_alg(CRC32_ARM64);
+#else
+	rte_hash_crc_set_alg(CRC32_SW);
+#endif
+}
diff --git a/lib/hash/rte_hash_crc.h b/lib/hash/rte_hash_crc.h
index 60bf42ce1d97..8ad2422ec333 100644
--- a/lib/hash/rte_hash_crc.h
+++ b/lib/hash/rte_hash_crc.h
@@ -20,8 +20,6 @@ extern "C" {
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
 #include <rte_config.h>
-#include <rte_cpuflags.h>
-#include <rte_log.h>
 
 #include "rte_crc_sw.h"
 
@@ -31,7 +29,7 @@ extern "C" {
 #define CRC32_SSE42_x64     (CRC32_x64|CRC32_SSE42)
 #define CRC32_ARM64         (1U << 3)
 
-static uint8_t crc32_alg = CRC32_SW;
+extern uint8_t rte_hash_crc32_alg;
 
 #if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRC32)
 #include "rte_crc_arm64.h"
@@ -52,48 +50,8 @@ static uint8_t crc32_alg = CRC32_SW;
  *   - (CRC32_SSE42_x64) Use 64-bit SSE4.2 intrinsic if available (default x86)
  *   - (CRC32_ARM64) Use ARMv8 CRC intrinsic if available (default ARMv8)
  */
-static inline void
-rte_hash_crc_set_alg(uint8_t alg)
-{
-	crc32_alg = CRC32_SW;
-
-	if (alg == CRC32_SW)
-		return;
-
-#if defined RTE_ARCH_X86
-	if (!(alg & CRC32_SSE42_x64))
-		RTE_LOG(WARNING, HASH,
-			"Unsupported CRC32 algorithm requested using CRC32_x64/CRC32_SSE42\n");
-	if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_EM64T) || alg == CRC32_SSE42)
-		crc32_alg = CRC32_SSE42;
-	else
-		crc32_alg = CRC32_SSE42_x64;
-#endif
-
-#if defined RTE_ARCH_ARM64
-	if (!(alg & CRC32_ARM64))
-		RTE_LOG(WARNING, HASH,
-			"Unsupported CRC32 algorithm requested using CRC32_ARM64\n");
-	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_CRC32))
-		crc32_alg = CRC32_ARM64;
-#endif
-
-	if (crc32_alg == CRC32_SW)
-		RTE_LOG(WARNING, HASH,
-			"Unsupported CRC32 algorithm requested using CRC32_SW\n");
-}
-
-/* Setting the best available algorithm */
-RTE_INIT(rte_hash_crc_init_alg)
-{
-#if defined(RTE_ARCH_X86)
-	rte_hash_crc_set_alg(CRC32_SSE42_x64);
-#elif defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_CRC32)
-	rte_hash_crc_set_alg(CRC32_ARM64);
-#else
-	rte_hash_crc_set_alg(CRC32_SW);
-#endif
-}
+void
+rte_hash_crc_set_alg(uint8_t alg);
 
 #ifdef __DOXYGEN__
 
diff --git a/lib/hash/version.map b/lib/hash/version.map
index 56a0cbd4b8a5..ed0743adedbb 100644
--- a/lib/hash/version.map
+++ b/lib/hash/version.map
@@ -9,6 +9,7 @@ DPDK_24 {
 	rte_hash_add_key_with_hash;
 	rte_hash_add_key_with_hash_data;
 	rte_hash_count;
+	rte_hash_crc_set_alg;
 	rte_hash_create;
 	rte_hash_del_key;
 	rte_hash_del_key_with_hash;
@@ -46,3 +47,9 @@ DPDK_24 {
 
 	local: *;
 };
+
+INTERNAL {
+	global:
+
+	rte_hash_crc32_alg;
+};
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 18/18] hash: convert RTE_LOGTYPE_HASH to dynamic type
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (16 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 17/18] hash: move rte_hash_set_alg " Stephen Hemminger
@ 2023-12-05  2:09   ` Stephen Hemminger
  2023-12-06 10:08   ` [PATCH 00/18] Convert static log types in libraries to dynamic David Marchand
  18 siblings, 0 replies; 68+ messages in thread
From: Stephen Hemminger @ 2023-12-05  2:09 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Yipeng Wang, Sameh Gobriel, Bruce Richardson,
	Vladimir Medvedkin

Use dynamic type for hash and add subtypes for crc and gfni.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/hash/rte_cuckoo_hash.c | 5 +++++
 lib/hash/rte_fbk_hash.c    | 5 +++++
 lib/hash/rte_thash.c       | 3 +++
 lib/hash/rte_thash_gfni.c  | 3 +++
 lib/log/log.c              | 1 -
 lib/log/rte_log.h          | 2 +-
 6 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c
index ccdc3b989489..8e4364f060a3 100644
--- a/lib/hash/rte_cuckoo_hash.c
+++ b/lib/hash/rte_cuckoo_hash.c
@@ -24,6 +24,11 @@
 #include <rte_tailq.h>
 
 #include "rte_hash.h"
+
+/* needs to be before rte_cuckoo_hash.h */
+RTE_LOG_REGISTER_DEFAULT(hash_logtype, INFO);
+#define RTE_LOGTYPE_HASH hash_logtype
+
 #include "rte_cuckoo_hash.h"
 
 /* Mask of all flags supported by this version */
diff --git a/lib/hash/rte_fbk_hash.c b/lib/hash/rte_fbk_hash.c
index 538b23a4030a..b4c4c191abdc 100644
--- a/lib/hash/rte_fbk_hash.c
+++ b/lib/hash/rte_fbk_hash.c
@@ -8,6 +8,8 @@
 #include <errno.h>
 
 #include <sys/queue.h>
+
+#include <rte_cpuflags.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 #include <rte_common.h>
@@ -18,6 +20,9 @@
 
 #include "rte_fbk_hash.h"
 
+RTE_LOG_REGISTER_SUFFIX(fbk_hash_logtype, fbk, INFO);
+#define RTE_LOGTYPE_HASH fbk_hash_logtype
+
 TAILQ_HEAD(rte_fbk_hash_list, rte_tailq_entry);
 
 static struct rte_tailq_elem rte_fbk_hash_tailq = {
diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c
index 4ff567ee5adf..d819dddd84f4 100644
--- a/lib/hash/rte_thash.c
+++ b/lib/hash/rte_thash.c
@@ -13,6 +13,9 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 
+RTE_LOG_REGISTER_SUFFIX(thash_logtype, thash, INFO);
+#define RTE_LOGTYPE_HASH thash_logtype
+
 #define THASH_NAME_LEN		64
 #define TOEPLITZ_HASH_LEN	32
 
diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c
index eb334185725c..35206d575153 100644
--- a/lib/hash/rte_thash_gfni.c
+++ b/lib/hash/rte_thash_gfni.c
@@ -10,6 +10,9 @@
 
 #ifndef RTE_THASH_GFNI_DEFINED
 
+RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO);
+#define RTE_LOGTYPE_HASH hash_gfni_logtype
+
 uint32_t
 rte_thash_gfni(const uint64_t *mtrx __rte_unused,
 	       const uint8_t *key __rte_unused, int len __rte_unused)
diff --git a/lib/log/log.c b/lib/log/log.c
index 56877d42e6b9..e3cd4cff0fbc 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -353,7 +353,6 @@ struct logtype {
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
-	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_PORT,       "lib.port"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 189ad2bbd2cf..27fb6129a7aa 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -32,7 +32,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_MEMPOOL */
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
-#define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
+				 /* was RTE_LOGTYPE_HASH */
 				 /* was RTE_LOGTYPE_LPM */
 				 /* was RTE_LOGTYPE_KNI */
 				 /* was RTE_LOGTYPE_ACL */
-- 
2.42.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 00/18] Convert static log types in libraries to dynamic
  2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
                     ` (17 preceding siblings ...)
  2023-12-05  2:09   ` [PATCH 18/18] hash: convert RTE_LOGTYPE_HASH to dynamic type Stephen Hemminger
@ 2023-12-06 10:08   ` David Marchand
  18 siblings, 0 replies; 68+ messages in thread
From: David Marchand @ 2023-12-06 10:08 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Tue, Dec 5, 2023 at 3:13 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> This patchset removes most of the uses of static LOGTYPE's in DPDK
> libraries. It starts with the easy one and goes on to the more complex ones.
>
> There are several options on how to treat the old static types:
> leave them there, mark as deprecated, or remove them.
> This version removes them since there is no guarantee in current
> DPDK policies that says they can't be removed.

Those logtypes were internal things that should not have been public
in the first place.

And switching to a dynamic logtype for external users (if any) is trivial.

>
> Note: there is one patch in this series that will get
> flagged incorrectly as an ABI change.

Adding such stable symbols is not a problem.
We can ignore this warning (which is there to force maintainers to
inspect such additions).

>
> v14 - rebase on 24.03-rc0
>       skip port, table and pipeline libraries since lots of
>       to be deprecated code.
>
> v13 - rebase because log now moved.
>
> v12 - rebase and add table and pipeline libraries
>
> v11 - fix include check on arm cross build
>
> v10 - add necessary rte_compat.h in thash_gfni stub for arm
>
> v9 - fix handling of crc32 alg in lib/hash.
>      make it an internal global variable.
>      fix gfni stubs for case where they are not used.
>
> Stephen Hemminger (18):
>   gso: don't log message on non TCP/UDP
>   eal: drop no longer used GSO logtype
>   log: drop unused RTE_LOGTYPE_TIMER
>   efd: convert RTE_LOGTYPE_EFD to dynamic type
>   mbuf: convert RTE_LOGTYPE_MBUF to dynamic type
>   acl: convert RTE_LOGTYPE_ACL to dynamic type
>   examples/power: replace use of RTE_LOGTYPE_POWER
>   examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
>   power: convert RTE_LOGTYPE_POWER to dynamic type
>   ring: convert RTE_LOGTYPE_RING to dynamic type
>   mempool: convert RTE_LOGTYPE_MEMPOOL to dynamic type
>   lpm: convert RTE_LOGTYPE_LPM to dynamic types
>   sched: convert RTE_LOGTYPE_SCHED to dynamic type
>   examples/ipsec-secgw: replace RTE_LOGTYPE_PORT
>   app/test: remove use of RTE_LOGTYPE_PIPELINE
>   hash: mover rte_thash_gfni stubs out of header file
>   hash: move rte_hash_set_alg out of header file
>   hash: convert RTE_LOGTYPE_HASH to dynamic type
>
>  app/test/test_acl.c            |  2 +-
>  app/test/test_table_acl.c      | 50 ++++++++++++-------------
>  app/test/test_table_pipeline.c | 40 ++++++++++----------
>  examples/distributor/main.c    |  2 +-
>  examples/ipsec-secgw/sa.c      |  6 +--
>  examples/l3fwd-power/main.c    | 17 +++++----
>  lib/acl/acl.h                  |  1 +
>  lib/acl/acl_bld.c              |  3 ++
>  lib/acl/acl_gen.c              |  1 +
>  lib/acl/acl_log.h              |  6 +++
>  lib/acl/rte_acl.c              |  3 ++
>  lib/acl/tb_mem.c               |  3 +-
>  lib/efd/rte_efd.c              |  4 ++
>  lib/fib/fib_log.h              |  4 ++
>  lib/fib/rte_fib.c              |  3 ++
>  lib/fib/rte_fib6.c             |  2 +
>  lib/gso/rte_gso.c              |  4 +-
>  lib/gso/rte_gso.h              |  1 +
>  lib/hash/meson.build           |  9 ++++-
>  lib/hash/rte_crc_arm64.h       |  8 ++--
>  lib/hash/rte_crc_x86.h         | 10 ++---
>  lib/hash/rte_cuckoo_hash.c     |  5 +++
>  lib/hash/rte_fbk_hash.c        |  5 +++
>  lib/hash/rte_hash_crc.c        | 68 ++++++++++++++++++++++++++++++++++
>  lib/hash/rte_hash_crc.h        | 48 ++----------------------
>  lib/hash/rte_thash.c           |  3 ++
>  lib/hash/rte_thash_gfni.c      | 50 +++++++++++++++++++++++++
>  lib/hash/rte_thash_gfni.h      | 23 +++---------
>  lib/hash/version.map           |  9 +++++
>  lib/log/log.c                  | 13 -------
>  lib/log/rte_log.h              | 26 ++++++-------
>  lib/lpm/lpm_log.h              |  4 ++
>  lib/lpm/rte_lpm.c              |  3 ++
>  lib/lpm/rte_lpm6.c             |  1 +
>  lib/mbuf/mbuf_log.h            |  4 ++
>  lib/mbuf/rte_mbuf.c            |  4 ++
>  lib/mbuf/rte_mbuf_dyn.c        |  2 +
>  lib/mbuf/rte_mbuf_pool_ops.c   |  2 +
>  lib/mempool/rte_mempool.c      |  2 +
>  lib/mempool/rte_mempool.h      |  8 ++++
>  lib/mempool/version.map        |  3 ++
>  lib/power/power_common.c       |  2 +
>  lib/power/power_common.h       |  2 +
>  lib/power/power_kvm_vm.c       |  1 +
>  lib/power/rte_power.c          |  1 +
>  lib/power/rte_power_uncore.c   |  1 +
>  lib/rib/rib_log.h              |  4 ++
>  lib/rib/rte_rib.c              |  3 ++
>  lib/rib/rte_rib6.c             |  3 ++
>  lib/ring/rte_ring.c            |  3 ++
>  lib/sched/rte_pie.c            |  1 +
>  lib/sched/rte_sched.c          |  5 +++
>  lib/sched/rte_sched_log.h      |  4 ++
>  53 files changed, 329 insertions(+), 163 deletions(-)
>  create mode 100644 lib/acl/acl_log.h
>  create mode 100644 lib/fib/fib_log.h
>  create mode 100644 lib/hash/rte_hash_crc.c
>  create mode 100644 lib/hash/rte_thash_gfni.c
>  create mode 100644 lib/lpm/lpm_log.h
>  create mode 100644 lib/mbuf/mbuf_log.h
>  create mode 100644 lib/rib/rib_log.h
>  create mode 100644 lib/sched/rte_sched_log.h

I fixed a few issues:
- added a release note update for the gso patch,
- fixed some styling issues in meson updates,
- reordered some hunks and patches,
- dropped some whitespace damage and typos,
- dropped unneeded include of rte_compat.h,
- fixed indent,
- marked exported variables as stable (such variable is part of the
application ABI),

Series applied.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 68+ messages in thread

end of thread, other threads:[~2023-12-06 10:08 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 23:40 [PATCH v12 00/22] Covert static log types in libraries to dynamic Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 01/22] gso: don't log message on non TCP/UDP Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 02/22] eal: drop no longer used GSO logtype Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 03/22] log: drop unused RTE_LOGTYPE_TIMER Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 04/22] efd: convert RTE_LOGTYPE_EFD to dynamic type Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 05/22] mbuf: convert RTE_LOGTYPE_MBUF " Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 06/22] acl: convert RTE_LOGTYPE_ACL " Stephen Hemminger
2023-06-05 13:40   ` Константин Ананьев
2023-03-29 23:40 ` [PATCH v12 07/22] examples/power: replace use of RTE_LOGTYPE_POWER Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 08/22] examples/l3fwd-power: " Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 09/22] power: convert RTE_LOGTYPE_POWER to dynamic type Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 10/22] ring: convert RTE_LOGTYPE_RING " Stephen Hemminger
2023-06-05 13:41   ` Константин Ананьев
2023-03-29 23:40 ` [PATCH v12 11/22] mempool: convert RTE_LOGTYPE_MEMPOOL " Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 12/22] lpm: convert RTE_LOGTYPE_LPM to dynamic types Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 13/22] kni: convert RTE_LOGTYPE_KNI to dynamic type Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 14/22] sched: convert RTE_LOGTYPE_SCHED " Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 15/22] examples/ipsec-secgw: replace RTE_LOGTYPE_PORT Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 16/22] port: convert RTE_LOGTYPE_PORT to dynamic type Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 17/22] hash: move rte_thash_gfni stubs out of header file Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 18/22] hash: move rte_hash_set_alg out header Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 19/22] hash: convert RTE_LOGTYPE_HASH to dynamic type Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 20/22] table: convert RTE_LOGTYPE_TABLE " Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 21/22] app/test: remove use of RTE_LOGTYPE_PIPELINE Stephen Hemminger
2023-03-29 23:40 ` [PATCH v12 22/22] pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type Stephen Hemminger
2023-08-21 16:09 ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 01/21] gso: don't log message on non TCP/UDP Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 02/21] eal: drop no longer used GSO logtype Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 03/21] log: drop unused RTE_LOGTYPE_TIMER Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 04/21] efd: convert RTE_LOGTYPE_EFD to dynamic type Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 05/21] mbuf: convert RTE_LOGTYPE_MBUF " Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 06/21] acl: convert RTE_LOGTYPE_ACL " Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 07/21] examples/power: replace use of RTE_LOGTYPE_POWER Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 08/21] examples/l3fwd-power: " Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 09/21] power: convert RTE_LOGTYPE_POWER to dynamic type Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 10/21] ring: convert RTE_LOGTYPE_RING " Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 11/21] mempool: convert RTE_LOGTYPE_MEMPOOL " Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 12/21] lpm: convert RTE_LOGTYPE_LPM to dynamic types Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 13/21] sched: convert RTE_LOGTYPE_SCHED to dynamic type Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 14/21] examples/ipsec-secgw: replace RTE_LOGTYPE_PORT Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 15/21] port: convert RTE_LOGTYPE_PORT to dynamic type Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 16/21] hash: move rte_thash_gfni stubs out of header file Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 17/21] hash: move rte_hash_set_alg out header Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 18/21] hash: convert RTE_LOGTYPE_HASH to dynamic type Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 19/21] table: convert RTE_LOGTYPE_TABLE " Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 20/21] app/test: remove use of RTE_LOGTYPE_PIPELINE Stephen Hemminger
2023-08-21 16:09   ` [PATCH v13 21/21] pipeline: convert RTE_LOGTYPE_PIPELINE to dynamic type Stephen Hemminger
2023-12-04 12:32   ` [PATCH v13 00/21] Convert static log types in libraries to dynamic types David Marchand
2023-12-05  2:09 ` [PATCH 00/18] Convert static log types in libraries to dynamic Stephen Hemminger
2023-12-05  2:09   ` [PATCH 01/18] gso: don't log message on non TCP/UDP Stephen Hemminger
2023-12-05  2:09   ` [PATCH 02/18] eal: drop no longer used GSO logtype Stephen Hemminger
2023-12-05  2:09   ` [PATCH 03/18] log: drop unused RTE_LOGTYPE_TIMER Stephen Hemminger
2023-12-05  2:09   ` [PATCH 04/18] efd: convert RTE_LOGTYPE_EFD to dynamic type Stephen Hemminger
2023-12-05  2:09   ` [PATCH 05/18] mbuf: convert RTE_LOGTYPE_MBUF " Stephen Hemminger
2023-12-05  2:09   ` [PATCH 06/18] acl: convert RTE_LOGTYPE_ACL " Stephen Hemminger
2023-12-05  2:09   ` [PATCH 07/18] examples/power: replace use of RTE_LOGTYPE_POWER Stephen Hemminger
2023-12-05  2:09   ` [PATCH 08/18] examples/l3fwd-power: " Stephen Hemminger
2023-12-05  2:09   ` [PATCH 09/18] power: convert RTE_LOGTYPE_POWER to dynamic type Stephen Hemminger
2023-12-05  2:09   ` [PATCH 10/18] ring: convert RTE_LOGTYPE_RING " Stephen Hemminger
2023-12-05  2:09   ` [PATCH 11/18] mempool: convert RTE_LOGTYPE_MEMPOOL " Stephen Hemminger
2023-12-05  2:09   ` [PATCH 12/18] lpm: convert RTE_LOGTYPE_LPM to dynamic types Stephen Hemminger
2023-12-05  2:09   ` [PATCH 13/18] sched: convert RTE_LOGTYPE_SCHED to dynamic type Stephen Hemminger
2023-12-05  2:09   ` [PATCH 14/18] examples/ipsec-secgw: replace RTE_LOGTYPE_PORT Stephen Hemminger
2023-12-05  2:09   ` [PATCH 15/18] app/test: remove use of RTE_LOGTYPE_PIPELINE Stephen Hemminger
2023-12-05  2:09   ` [PATCH 16/18] hash: mover rte_thash_gfni stubs out of header file Stephen Hemminger
2023-12-05  2:09   ` [PATCH 17/18] hash: move rte_hash_set_alg " Stephen Hemminger
2023-12-05  2:09   ` [PATCH 18/18] hash: convert RTE_LOGTYPE_HASH to dynamic type Stephen Hemminger
2023-12-06 10:08   ` [PATCH 00/18] Convert static log types in libraries to dynamic David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).