Skip to contentSkip to conversation

Replace static logtypes with static

RFC Superseded Stephen Hemminger 8 participants 255 messages Feb 7, 2023 – Mar 29, 2023 Arm/Amlogic Meson SoC support Page 3 of 3

lore
Share & tools
lore
#193 lore raw

PATCH v9 14/22 sched: replace RTE_LOGTYPE_SCHED with dynamic type

In reply to Stephen Hemminger

Also can remove unused RTE_LOGTYPE_METER

---
 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
lib/eal/common/eal_common_log.c +0 -2
index 70d5bb7b1951..d4b7088b5cbb 100644
@@ -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"},
lib/eal/include/rte_log.h +2 -2
index dc2454a0d9de..f185fcbc5a94 100644
@@ -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. */
lib/sched/rte_pie.c +1 -0
index 947e2a059f6f..cce0ce762da8 100644
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "rte_sched_log.h"
 #include "rte_pie.h"
 
 #ifdef __INTEL_COMPILER
lib/sched/rte_sched.c +5 -0
index 19768d8c38b0..27e98e46df7a 100644
@@ -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);
lib/sched/rte_sched_log.h new file +4 -0
new file mode 100644
index 000000000000..fde051f49d62
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int sched_logtype;
+#define RTE_LOGTYPE_SCHED sched_logtype
Signature · 1 line
2.39.1
#194 lore raw

PATCH v9 15/22 examples/ipsecgw: replace RTE_LOGTYPE_PORT

In reply to Stephen Hemminger

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")
---
 examples/ipsec-secgw/sa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
examples/ipsec-secgw/sa.c +3 -3
index 7da9444a7b8a..67327fda8dbc 100644
@@ -1127,7 +1127,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;
 		}
@@ -1135,13 +1135,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;
 		}
Signature · 1 line
2.39.1
Acked-by on v9 15/22
#195 lore raw

RE: [EXT] [PATCH v9 15/22] examples/ipsecgw: replace RTE_LOGTYPE_PORT

Quoted 2 lines

Subject: [EXT] [PATCH v9 15/22] examples/ipsecgw: replace RTE_LOGTYPE_PORT

Title should be
examples/ipsec-secgw: replace RTE_LOGTYPE_PORT

Quoted 8 lines

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")
#196 lore raw

PATCH v9 16/22 port: replace RTE_LOGTYPE_PORT with dynamic type

In reply to Stephen Hemminger

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

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index d4b7088b5cbb..7f1d2c8a256d 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index f185fcbc5a94..b11aec69af78 100644
@@ -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 */
lib/port/rte_port_ethdev.c +3 -0
index 0da7890261e9..6685d304a6e9 100644
@@ -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
  */
lib/port/rte_port_eventdev.c +4 -0
index fd7dac9a5661..04447bd7f7bc 100644
@@ -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
  */
lib/port/rte_port_fd.c +3 -0
index 932ecd324e05..b2412e7706ee 100644
@@ -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
  */
lib/port/rte_port_frag.c +3 -0
index e1f1892176c4..9adcbba47da1 100644
@@ -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
 
lib/port/rte_port_kni.c +3 -0
index 1c7a6cb200ea..d4ac08b4cff0 100644
@@ -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
  */
lib/port/rte_port_ras.c +3 -0
index e5de57da42ea..5a610b1ba5b5 100644
@@ -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
lib/port/rte_port_ring.c +3 -0
index 52b2d8e557f0..32a90e836579 100644
@@ -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
  */
lib/port/rte_port_sched.c +3 -0
index 8a7d815ef323..6e0a8aba5419 100644
@@ -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
  */
lib/port/rte_port_source_sink.c +3 -0
index 7d73adc1e79e..e9cdadbceb8f 100644
@@ -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
  */
lib/port/rte_port_sym_crypto.c +3 -0
index 295984d025cb..77a2f04d65f6 100644
@@ -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
  */
Signature · 1 line
2.39.1
#197 lore raw

PATCH v9 17/22 table: convert RTE_LOGTYPE_TABLE to dynamic logtype

In reply to Stephen Hemminger

Use logtype suffixes for various components of this library.

---
 lib/eal/common/eal_common_log.c   | 1 -
 lib/eal/include/rte_log.h         | 2 +-
 lib/table/rte_table_acl.c         | 3 +++
 lib/table/rte_table_array.c       | 3 +++
 lib/table/rte_table_hash_cuckoo.c | 3 +++
 lib/table/rte_table_hash_ext.c    | 3 +++
 lib/table/rte_table_hash_key16.c  | 3 +++
 lib/table/rte_table_hash_key32.c  | 5 ++++-
 lib/table/rte_table_hash_key8.c   | 5 ++++-
 lib/table/rte_table_hash_lru.c    | 3 +++
 lib/table/rte_table_lpm.c         | 3 +++
 lib/table/rte_table_lpm_ipv6.c    | 3 +++
 lib/table/rte_table_stub.c        | 3 +++
 13 files changed, 36 insertions(+), 4 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
index 7f1d2c8a256d..d640ed3c88b9 100644
@@ -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_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
lib/eal/include/rte_log.h +1 -1
index b11aec69af78..934bddff9dfa 100644
@@ -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. */
lib/table/rte_table_acl.c +3 -0
index 53fd5c66adb5..f44a25a89405 100644
@@ -11,6 +11,9 @@
 
 #include "rte_table_acl.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_acl_logtype, acl, INFO);
+#define RTE_LOGTYPE_TABLE table_acl_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_ACL_STATS_PKTS_IN_ADD(table, val) \
lib/table/rte_table_array.c +3 -0
index 54a0c42f7dd2..a7849beaecd6 100644
@@ -11,6 +11,9 @@
 
 #include "rte_table_array.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_array_logtype, array, INFO);
+#define RTE_LOGTYPE_TABLE table_array_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_ARRAY_STATS_PKTS_IN_ADD(table, val) \
lib/table/rte_table_hash_cuckoo.c +3 -0
index c77eccf52722..12db0b84142f 100644
@@ -10,6 +10,9 @@
 
 #include "rte_table_hash_cuckoo.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_hash_logtype, hash, INFO);
+#define RTE_LOGTYPE_TABLE table_hash_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_HASH_CUCKOO_STATS_PKTS_IN_ADD(table, val) \
lib/table/rte_table_hash_ext.c +3 -0
index 70ea84fa2e51..147ecdf082cb 100644
@@ -11,6 +11,9 @@
 
 #include "rte_table_hash.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_hash_ext_logtype, hash.ext, INFO);
+#define RTE_LOGTYPE_TABLE table_hash_ext_logtype
+
 #define KEYS_PER_BUCKET	4
 
 struct bucket {
lib/table/rte_table_hash_key16.c +3 -0
index 04d7fd64bd97..09fef5f14ce7 100644
@@ -11,6 +11,9 @@
 #include "rte_table_hash.h"
 #include "rte_lru.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_hash16_logtype, hash16, INFO);
+#define RTE_LOGTYPE_TABLE table_hash16_logtype
+
 #define KEY_SIZE						16
 
 #define KEYS_PER_BUCKET					4
lib/table/rte_table_hash_key32.c +4 -1
index 88d8f69c72ed..1abc459eee87 100644
@@ -11,7 +11,10 @@
 #include "rte_table_hash.h"
 #include "rte_lru.h"
 
-#define KEY_SIZE						32
+RTE_LOG_REGISTER_SUFFIX(table_hash32_logtype, hash32, INFO);
+#define RTE_LOGTYPE_TABLE table_hash32_logtype
+
+#define KEY_SIZE					32
 
 #define KEYS_PER_BUCKET					4
 
lib/table/rte_table_hash_key8.c +4 -1
index 035d24276946..d4ccccbcdf9e 100644
@@ -11,7 +11,10 @@
 #include "rte_table_hash.h"
 #include "rte_lru.h"
 
-#define KEY_SIZE						8
+RTE_LOG_REGISTER_SUFFIX(table_hash8_logtype, hash8, INFO);
+#define RTE_LOGTYPE_TABLE table_hash8_logtype
+
+#define KEY_SIZE					8
 
 #define KEYS_PER_BUCKET					4
 
lib/table/rte_table_hash_lru.c +3 -0
index c31acc11cf23..d0d2c8ba44df 100644
@@ -14,6 +14,9 @@
 
 #define KEYS_PER_BUCKET	4
 
+RTE_LOG_REGISTER_SUFFIX(table_hash_lru_logtype, hash_lru, INFO);
+#define RTE_LOGTYPE_TABLE table_hash_lru_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(table, val) \
lib/table/rte_table_lpm.c +3 -0
index 9de9e8a20d77..4a5c4a343c77 100644
@@ -13,6 +13,9 @@
 
 #include "rte_table_lpm.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_lpm_logtype, lpm, INFO);
+#define RTE_LOGTYPE_TABLE table_lpm_logtype
+
 #ifndef RTE_TABLE_LPM_MAX_NEXT_HOPS
 #define RTE_TABLE_LPM_MAX_NEXT_HOPS                        65536
 #endif
lib/table/rte_table_lpm_ipv6.c +3 -0
index 8fde2c012f7c..236eac4238d9 100644
@@ -12,6 +12,9 @@
 
 #include "rte_table_lpm_ipv6.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_lpm6_logtype, lpm6, INFO);
+#define RTE_LOGTYPE_TABLE table_lpm6_logtype
+
 #define RTE_TABLE_LPM_MAX_NEXT_HOPS                        256
 
 #ifdef RTE_TABLE_STATS_COLLECT
lib/table/rte_table_stub.c +3 -0
index 23d0de5c79b0..e74044032f7d 100644
@@ -8,6 +8,9 @@
 
 #include "rte_table_stub.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_stub_logtype, stub, INFO);
+#define RTE_LOGTYPE_TABLE table_stub_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_LPM_STATS_PKTS_IN_ADD(table, val) \
Signature · 1 line
2.39.1
#198 lore raw

PATCH v9 18/22 app/test: remove use of RTE_LOGTYPE_PIPELINE

In reply to Stephen Hemminger

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.

---
 app/test/test_table_acl.c      | 50 ++++++++++++++++------------------
 app/test/test_table_pipeline.c | 40 +++++++++++++--------------
 2 files changed, 43 insertions(+), 47 deletions(-)
app/test/test_table_acl.c +23 -27
index e66f06b84d0a..dff9bddfb948 100644
@@ -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;
 	}
app/test/test_table_pipeline.c +20 -20
index 7adbbffbf55d..960f730cf20d 100644
@@ -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;
 	}
 
Signature · 1 line
2.39.1
#199 lore raw

PATCH v9 19/22 pipeline: replace RTE_LOGTYPE_PIPELINE with dynamic type

In reply to Stephen Hemminger

Use a dynamically allocated logtype.

---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 lib/pipeline/rte_pipeline.c     | 3 +++
 3 files changed, 4 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
index d640ed3c88b9..a3498d1a2faf 100644
@@ -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_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
lib/eal/include/rte_log.h +1 -1
index 934bddff9dfa..7473fd53505a 100644
@@ -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 */
lib/pipeline/rte_pipeline.c +3 -0
index ff86c7cf96bf..30919cd9fe30 100644
@@ -12,6 +12,9 @@
 
 #include "rte_pipeline.h"
 
+RTE_LOG_REGISTER_DEFAULT(pipeline_logtype, INFO);
+#define RTE_LOGTYPE_PIPELINE pipeline_logtype
+
 #define RTE_TABLE_INVALID                                 UINT32_MAX
 
 #ifdef RTE_PIPELINE_STATS_COLLECT
Signature · 1 line
2.39.1
#200 lore raw

PATCH v9 20/22 hash: move rte_thash_gfni stubs out of header file

In reply to Stephen Hemminger

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

---
 lib/hash/meson.build      |  8 ++++++-
 lib/hash/rte_thash_gfni.c | 47 +++++++++++++++++++++++++++++++++++++++
 lib/hash/rte_thash_gfni.h | 28 +++++------------------
 lib/hash/version.map      |  4 ++++
 4 files changed, 63 insertions(+), 24 deletions(-)
 create mode 100644 lib/hash/rte_thash_gfni.c
lib/hash/meson.build +7 -1
index 2f757d45f9bc..e56ee8572564 100644
@@ -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']
lib/hash/rte_thash_gfni.c new file +47 -0

47 lines not on this page · raw message

lib/hash/rte_thash_gfni.h +5 -23
index ef90faa302d1..86208eb45ebb 100644
@@ -9,13 +9,8 @@
 extern "C" {
 #endif
 
-#include <rte_compat.h>
-#include <rte_log.h>
-
 #ifdef RTE_ARCH_X86
-
 #include <rte_thash_x86_gfni.h>
-
 #endif
 
 #ifndef RTE_THASH_GFNI_DEFINED
@@ -38,13 +33,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 +57,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 */
 
lib/hash/version.map +4 -0
index bdcebd19c29b..f03b047b2eec 100644
@@ -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;
 };
Signature · 1 line
2.39.1
#201 lore raw

PATCH v9 21/22 hash: move rte_hash_set_alg out header

In reply to Stephen Hemminger

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.

---
 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
lib/hash/meson.build +1 -0
index e56ee8572564..c345c6f561fc 100644
@@ -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'
lib/hash/rte_crc_arm64.h +4 -4
index c9f52510871b..414fe065caa8 100644
@@ -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);
lib/hash/rte_crc_x86.h +5 -5
index 205bc182be77..3b865e251db2 100644
@@ -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);
lib/hash/rte_hash_crc.c new file +68 -0

68 lines not on this page · raw message

lib/hash/rte_hash_crc.h +3 -45

66 lines not on this page · raw message

lib/hash/version.map +7 -0
index f03b047b2eec..8b22aad5626b 100644
@@ -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;
+};
Signature · 1 line
2.39.1
#202 lore raw

PATCH v9 22/22 hash: convert RTE_LOGTYPE_HASH to dynamic type

In reply to Stephen Hemminger

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

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index a3498d1a2faf..704924e822d0 100644
@@ -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_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
lib/eal/include/rte_log.h +1 -1
index 7473fd53505a..29db07881a5a 100644
@@ -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 */
lib/hash/rte_cuckoo_hash.c +5 -0
index 829b79c89a27..e2b07bfbad71 100644
@@ -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 */
lib/hash/rte_fbk_hash.c +5 -0
index 538b23a4030a..b4c4c191abdc 100644
@@ -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 = {
lib/hash/rte_thash.c +3 -0
index 0249883b8d07..c1fd2e34c9d4 100644
@@ -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
 
lib/hash/rte_thash_gfni.c +3 -0
index eb334185725c..35206d575153 100644
@@ -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)
Signature · 1 line
2.39.1
#203 lore raw

v10 cover Convert static log type values in libraries

In reply to 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.

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: replace RTE_LOGTYPE_EFD with dynamic type
mbuf: replace RTE_LOGTYPE_MBUF with dynamic type
acl: replace LOGTYPE_ACL with dynamic type examples/power: replace use of RTE_LOGTYPE_POWER examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
power: replace RTE_LOGTYPE_POWER with dynamic type
ring: replace RTE_LOGTYPE_RING with dynamic type
mempool: replace RTE_LOGTYPE_MEMPOOL with dynamic type
lpm: replace RTE_LOGTYPE_LPM with dynamic types
kni: replace RTE_LOGTYPE_KNI with dynamic type
sched: replace RTE_LOGTYPE_SCHED with dynamic type examples/ipsecgw: replace RTE_LOGTYPE_PORT
port: replace RTE_LOGTYPE_PORT with dynamic type
table: convert RTE_LOGTYPE_TABLE to dynamic logtype app/test: remove use of RTE_LOGTYPE_PIPELINE
pipeline: replace RTE_LOGTYPE_PIPELINE with 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

 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       | 15 +++----
 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                 |  5 +--
 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         | 29 +++----------
 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       |  3 ++
 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/rte_table_acl.c         |  3 ++
 lib/table/rte_table_array.c       |  3 ++
 lib/table/rte_table_hash_cuckoo.c |  3 ++
 lib/table/rte_table_hash_ext.c    |  3 ++
 lib/table/rte_table_hash_key16.c  |  3 ++
 lib/table/rte_table_hash_key32.c  |  5 ++-
 lib/table/rte_table_hash_key8.c   |  5 ++-
 lib/table/rte_table_hash_lru.c    |  3 ++
 lib/table/rte_table_lpm.c         |  3 ++
 lib/table/rte_table_lpm_ipv6.c    |  3 ++
 lib/table/rte_table_stub.c        |  3 ++
 75 files changed, 406 insertions(+), 179 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
Signature · 1 line
2.39.1
#204 lore raw

PATCH v10 1/22 gso: don't log message on non TCP/UDP

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")
---
 lib/gso/rte_gso.c | 5 ++---
 lib/gso/rte_gso.h | 1 +
 2 files changed, 3 insertions(+), 3 deletions(-)
lib/gso/rte_gso.c +2 -3
index 4b59217c16ee..c8e67c2d4b48 100644
@@ -80,9 +80,8 @@ 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) {
lib/gso/rte_gso.h +1 -0
index 40922524df42..23d6980aff9f 100644
@@ -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 segmentd (not UDP or TCP)
  *  - Return -EINVAL for invalid parameters.
  */
 int rte_gso_segment(struct rte_mbuf *pkt,
Signature · 1 line
2.39.1
#205 lore raw

PATCH v10 2/22 eal: drop no longer used GSO logtype

In reply to Stephen Hemminger

The message that used this was replaced in previous patch.

---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
index bd7b188ceb4a..894701e8c19c 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 6d2b0856a565..11d517806054 100644
@@ -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. */
Signature · 1 line
2.39.1
#206 lore raw

PATCH v10 3/22 log: drop unused RTE_LOGTYPE_TIMER

In reply to Stephen Hemminger

The timer code does not use rte_log.

---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
index 894701e8c19c..5421da008f5b 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 11d517806054..16d6ea31583d 100644
@@ -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. */
Signature · 1 line
2.39.1
#207 lore raw

PATCH v10 4/22 efd: replace RTE_LOGTYPE_EFD with dynamic type

In reply to Stephen Hemminger

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

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index 5421da008f5b..25bb17938cc1 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 16d6ea31583d..0b39795b4d06 100644
@@ -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 */
 
lib/efd/rte_efd.c +4 -0
index 686a13775742..9edb11799c89 100644
@@ -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) \
Signature · 1 line
2.39.1
#208 lore raw

PATCH v10 5/22 mbuf: replace RTE_LOGTYPE_MBUF with dynamic type

In reply to 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

---
 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
lib/eal/common/eal_common_log.c +0 -1
index 25bb17938cc1..d4389e436913 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 0b39795b4d06..941fbe51fd30 100644
@@ -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. */
lib/mbuf/mbuf_log.h new file +4 -0
new file mode 100644
index 000000000000..d759a9a25501
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int mbuf_logtype;
+#define RTE_LOGTYPE_MBUF	mbuf_logtype
lib/mbuf/rte_mbuf.c +4 -0
index cfd8062f1e6a..4a379a5185d5 100644
@@ -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
lib/mbuf/rte_mbuf_dyn.c +2 -0
index 35839e938cc5..01654db03fc8 100644
@@ -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 {
lib/mbuf/rte_mbuf_pool_ops.c +2 -0
index 4c91f4ce8569..5318430126cb 100644
@@ -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)
 {
Signature · 1 line
2.39.1
#209 lore raw

PATCH v10 6/22 acl: replace LOGTYPE_ACL with dynamic type

In reply to Stephen Hemminger

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.

---
 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
app/test/test_acl.c +2 -1
index 623f34682e69..75588978a720 100644
@@ -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;
 		}
lib/acl/acl_bld.c +1 -0
index 2816632803bd..f38e6478315f 100644
@@ -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
lib/acl/acl_gen.c +1 -0
index e759a2ca1598..54ec485d0c58 100644
@@ -4,6 +4,7 @@
 
 #include <rte_acl.h>
 #include "acl.h"
+#include "acl_log.h"
 
 #define	QRANGE_MIN	((uint8_t)INT8_MIN)
 
lib/acl/acl_log.h new file +4 -0
new file mode 100644
index 000000000000..b55573cbe207
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int acl_logtype;
+#define RTE_LOGTYPE_ACL	acl_logtype
lib/acl/rte_acl.c +4 -0
index a61c3ba188da..a29decb1f6ca 100644
@@ -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);
 
lib/acl/tb_mem.c +2 -1
index f14d7b4fa26e..6a9d96aaeda2 100644
@@ -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;
lib/eal/common/eal_common_log.c +0 -2
index d4389e436913..9e853addb717 100644
@@ -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"},
lib/eal/include/rte_log.h +2 -2
index 941fbe51fd30..1408722b2c2f 100644
@@ -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. */
Signature · 1 line
2.39.1
#210 lore raw

PATCH v10 7/22 examples/power: replace use of RTE_LOGTYPE_POWER

In reply to Stephen Hemminger

Don't use static logtype in sample application.

---
 examples/distributor/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/distributor/main.c +1 -1
index 21304d661873..542f76cf9664 100644
@@ -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);
 			/*
Signature · 1 line
2.39.1
Acked-by on v10 7/22
#211 lore raw

Re: [PATCH v10 07/22] examples/power: replace use of RTE_LOGTYPE_POWER

Quoted 12 lines · Stephen Hemminger

Don't use static logtype in sample application.

---
  examples/distributor/main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
examples/distributor/main.c +0 -0
index 21304d661873..542f76cf9664 100644

examples/distributor/main.c init_power_library(void) · line 685

Quoted 8 lines
examples/distributor/main.c +1 -1
@@ -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);
  			/*
#212 lore raw

PATCH v10 8/22 examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER

In reply to Stephen Hemminger

Convert to using a dynamic logtype for the application.

---
 examples/l3fwd-power/main.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
examples/l3fwd-power/main.c +8 -7
index f57c54d2b57c..76b890b76c88 100644
@@ -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;
@@ -2245,7 +2246,7 @@ init_power_library(void)
 		env = rte_power_get_env();
 		if (env != PM_ENV_ACPI_CPUFREQ &&
 				env != PM_ENV_PSTATE_CPUFREQ) {
-			RTE_LOG(ERR, POWER,
+			RTE_LOG(ERR, L3FWD_POWER,
 				"Only ACPI and PSTATE mode are supported\n");
 			return -1;
 		}
@@ -2263,7 +2264,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;
@@ -2332,7 +2333,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
@@ -2381,7 +2382,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();
 
@@ -2397,7 +2398,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;
 }
Signature · 1 line
2.39.1
Acked-by on v10 8/22
#213 lore raw

Re: [PATCH v10 08/22] examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER

Quoted 67 lines · Stephen Hemminger

Convert to using a dynamic logtype for the application.

---
  examples/l3fwd-power/main.c | 15 ++++++++-------
  1 file changed, 8 insertions(+), 7 deletions(-)
examples/l3fwd-power/main.c +7 -6
index f57c54d2b57c..76b890b76c88 100644
@@ -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;
@@ -2245,7 +2246,7 @@ init_power_library(void)
  		env = rte_power_get_env();
  		if (env != PM_ENV_ACPI_CPUFREQ &&
  				env != PM_ENV_PSTATE_CPUFREQ) {
-			RTE_LOG(ERR, POWER,
+			RTE_LOG(ERR, L3FWD_POWER,
  				"Only ACPI and PSTATE mode are supported\n");
  			return -1;
  		}
@@ -2263,7 +2264,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;
@@ -2332,7 +2333,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
@@ -2381,7 +2382,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();
 

examples/l3fwd-power/main.c launch_timer(unsigned int lcore_id) · line 2404

Quoted 8 lines
examples/l3fwd-power/main.c +1 -1
@@ -2397,7 +2398,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;
  }
#214 lore raw

PATCH v10 9/22 power: replace RTE_LOGTYPE_POWER with dynamic type

In reply to Stephen Hemminger

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

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index 9e853addb717..39e1e6680dea 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 1408722b2c2f..7d4345acceca 100644
@@ -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. */
lib/power/guest_channel.c +2 -1
index 969a9e5aaa06..efc326d520ca 100644
@@ -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
lib/power/power_common.c +2 -0
index 1e09facb863f..bf77eafa886b 100644
@@ -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  \
lib/power/power_common.h +2 -1
index c1c713927621..63a3a443509e 100644
@@ -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...) \
lib/power/power_kvm_vm.c +1 -0
index 6a8109d44959..db031f43105a 100644
@@ -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"
lib/power/rte_power.c +1 -0
index 63a43bd8f5ae..db0e7705a9ef 100644
@@ -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"
 
Signature · 1 line
2.39.1
Acked-by on v10 9/22
#215 lore raw

Re: [PATCH v10 09/22] power: replace RTE_LOGTYPE_POWER with dynamic type

Quoted 101 lines · Stephen Hemminger

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

---
  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(-)
lib/eal/common/eal_common_log.c +0 -1
index 9e853addb717..39e1e6680dea 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 1408722b2c2f..7d4345acceca 100644
@@ -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. */
lib/power/guest_channel.c +2 -1
index 969a9e5aaa06..efc326d520ca 100644
@@ -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
lib/power/power_common.c +2 -0
index 1e09facb863f..bf77eafa886b 100644
@@ -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  \
lib/power/power_common.h +2 -1
index c1c713927621..63a3a443509e 100644
@@ -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...) \
lib/power/power_kvm_vm.c +1 -0
index 6a8109d44959..db031f43105a 100644
@@ -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"
lib/power/rte_power.c +0 -0
index 63a43bd8f5ae..db0e7705a9ef 100644

lib/power/rte_power.c line 15

Quoted 6 lines
lib/power/rte_power.c +1 -0
@@ -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"
Quoted 1 line
#216 lore raw

PATCH v10 10/22 ring: replace RTE_LOGTYPE_RING with dynamic type

In reply to Stephen Hemminger

The logtype for ring only used in library.

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index 39e1e6680dea..5f15e312f15b 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 7d4345acceca..31a2ee2f6b6f 100644
@@ -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. */
lib/ring/rte_ring.c +3 -0
index cddaf6b2876f..8c5f2575d6ef 100644
@@ -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 = {
Signature · 1 line
2.39.1
#217 lore raw

PATCH v10 11/22 mempool: replace RTE_LOGTYPE_MEMPOOL with dynamic type

In reply to Stephen Hemminger

Convert from RTE_LOGTYPE_MEMPOOL to logtype_mempool.

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index 5f15e312f15b..4025d2039d55 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 31a2ee2f6b6f..9f86bfdd0198 100644
@@ -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. */
lib/mempool/rte_mempool.c +2 -0
index cf5dea2304a7..b609a94fdf9d 100644
@@ -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 = {
lib/mempool/rte_mempool.h +8 -0
index 9f530db24ba1..db01acc19b02 100644
@@ -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
  */
lib/mempool/version.map +3 -0
index dff2d1cb5555..eb2c12127560 100644
@@ -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;
 };
Signature · 1 line
2.39.1
#218 lore raw

PATCH v10 12/22 lpm: replace RTE_LOGTYPE_LPM with dynamic types

In reply to Stephen Hemminger

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.

---
 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
lib/eal/common/eal_common_log.c +0 -1
index 4025d2039d55..6e2007e6ed4f 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 9f86bfdd0198..115a48bf05f5 100644
@@ -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 */
lib/fib/fib_log.h new file +4 -0
new file mode 100644
index 000000000000..c731c820f621
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int fib_logtype;
+#define RTE_LOGTYPE_LPM fib_logtype
lib/fib/rte_fib.c +3 -0
index 8af4c4091908..5b1815881415 100644
@@ -16,6 +16,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 = {
lib/fib/rte_fib6.c +2 -0
index 4b8e22b142b9..762d195fb798 100644
@@ -9,6 +9,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>
 
@@ -16,6 +17,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 = {
lib/lpm/lpm_log.h new file +4 -0
new file mode 100644
index 000000000000..a0621b70a5fe
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int lpm_logtype;
+#define RTE_LOGTYPE_LPM lpm_logtype
lib/lpm/rte_lpm.c +3 -0
index cdcd1b7f9e47..0ca82147866a 100644
@@ -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);
 
lib/lpm/rte_lpm6.c +1 -0
index 8d21aeddb83c..873cc8bc267d 100644
@@ -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
lib/rib/rib_log.h new file +4 -0
new file mode 100644
index 000000000000..f3ee513ca854
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int rib_logtype;
+#define RTE_LOGTYPE_LPM rib_logtype
lib/rib/rte_rib.c +3 -0
index b0794edf66f5..5597c8b899c8 100644
@@ -15,6 +15,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",
lib/rib/rte_rib6.c +3 -0
index 19e4ff97c479..917bede27d24 100644
@@ -8,6 +8,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>
@@ -15,6 +16,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. */
Signature · 1 line
2.39.1
#219 lore raw

PATCH v10 13/22 kni: replace RTE_LOGTYPE_KNI with dynamic type

In reply to Stephen Hemminger

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

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index 6e2007e6ed4f..70d5bb7b1951 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 115a48bf05f5..dc2454a0d9de 100644
@@ -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. */
lib/kni/rte_kni.c +3 -0
index 8ab6c4715314..9c37bcabcadd 100644
@@ -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 */
Signature · 1 line
2.39.1
#220 lore raw

PATCH v10 14/22 sched: replace RTE_LOGTYPE_SCHED with dynamic type

In reply to Stephen Hemminger

Also can remove unused RTE_LOGTYPE_METER

---
 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
lib/eal/common/eal_common_log.c +0 -2
index 70d5bb7b1951..d4b7088b5cbb 100644
@@ -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"},
lib/eal/include/rte_log.h +2 -2
index dc2454a0d9de..f185fcbc5a94 100644
@@ -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. */
lib/sched/rte_pie.c +1 -0
index 947e2a059f6f..cce0ce762da8 100644
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "rte_sched_log.h"
 #include "rte_pie.h"
 
 #ifdef __INTEL_COMPILER
lib/sched/rte_sched.c +5 -0
index 19768d8c38b0..27e98e46df7a 100644
@@ -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);
lib/sched/rte_sched_log.h new file +4 -0
new file mode 100644
index 000000000000..fde051f49d62
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int sched_logtype;
+#define RTE_LOGTYPE_SCHED sched_logtype
Signature · 1 line
2.39.1
#221 lore raw

PATCH v10 15/22 examples/ipsecgw: replace RTE_LOGTYPE_PORT

In reply to Stephen Hemminger

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")
---
 examples/ipsec-secgw/sa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
examples/ipsec-secgw/sa.c +3 -3
index 7da9444a7b8a..67327fda8dbc 100644
@@ -1127,7 +1127,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;
 		}
@@ -1135,13 +1135,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;
 		}
Signature · 1 line
2.39.1
#222 lore raw

PATCH v10 16/22 port: replace RTE_LOGTYPE_PORT with dynamic type

In reply to Stephen Hemminger

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

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index d4b7088b5cbb..7f1d2c8a256d 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index f185fcbc5a94..b11aec69af78 100644
@@ -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 */
lib/port/rte_port_ethdev.c +3 -0
index 0da7890261e9..6685d304a6e9 100644
@@ -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
  */
lib/port/rte_port_eventdev.c +4 -0
index fd7dac9a5661..04447bd7f7bc 100644
@@ -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
  */
lib/port/rte_port_fd.c +3 -0
index 932ecd324e05..b2412e7706ee 100644
@@ -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
  */
lib/port/rte_port_frag.c +3 -0
index e1f1892176c4..9adcbba47da1 100644
@@ -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
 
lib/port/rte_port_kni.c +3 -0
index 1c7a6cb200ea..d4ac08b4cff0 100644
@@ -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
  */
lib/port/rte_port_ras.c +3 -0
index e5de57da42ea..5a610b1ba5b5 100644
@@ -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
lib/port/rte_port_ring.c +3 -0
index 52b2d8e557f0..32a90e836579 100644
@@ -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
  */
lib/port/rte_port_sched.c +3 -0
index 8a7d815ef323..6e0a8aba5419 100644
@@ -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
  */
lib/port/rte_port_source_sink.c +3 -0
index 7d73adc1e79e..e9cdadbceb8f 100644
@@ -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
  */
lib/port/rte_port_sym_crypto.c +3 -0
index 295984d025cb..77a2f04d65f6 100644
@@ -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
  */
Signature · 1 line
2.39.1
#223 lore raw

PATCH v10 17/22 table: convert RTE_LOGTYPE_TABLE to dynamic logtype

In reply to Stephen Hemminger

Use logtype suffixes for various components of this library.

---
 lib/eal/common/eal_common_log.c   | 1 -
 lib/eal/include/rte_log.h         | 2 +-
 lib/table/rte_table_acl.c         | 3 +++
 lib/table/rte_table_array.c       | 3 +++
 lib/table/rte_table_hash_cuckoo.c | 3 +++
 lib/table/rte_table_hash_ext.c    | 3 +++
 lib/table/rte_table_hash_key16.c  | 3 +++
 lib/table/rte_table_hash_key32.c  | 5 ++++-
 lib/table/rte_table_hash_key8.c   | 5 ++++-
 lib/table/rte_table_hash_lru.c    | 3 +++
 lib/table/rte_table_lpm.c         | 3 +++
 lib/table/rte_table_lpm_ipv6.c    | 3 +++
 lib/table/rte_table_stub.c        | 3 +++
 13 files changed, 36 insertions(+), 4 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
index 7f1d2c8a256d..d640ed3c88b9 100644
@@ -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_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
lib/eal/include/rte_log.h +1 -1
index b11aec69af78..934bddff9dfa 100644
@@ -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. */
lib/table/rte_table_acl.c +3 -0
index 53fd5c66adb5..f44a25a89405 100644
@@ -11,6 +11,9 @@
 
 #include "rte_table_acl.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_acl_logtype, acl, INFO);
+#define RTE_LOGTYPE_TABLE table_acl_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_ACL_STATS_PKTS_IN_ADD(table, val) \
lib/table/rte_table_array.c +3 -0
index 54a0c42f7dd2..a7849beaecd6 100644
@@ -11,6 +11,9 @@
 
 #include "rte_table_array.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_array_logtype, array, INFO);
+#define RTE_LOGTYPE_TABLE table_array_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_ARRAY_STATS_PKTS_IN_ADD(table, val) \
lib/table/rte_table_hash_cuckoo.c +3 -0
index c77eccf52722..12db0b84142f 100644
@@ -10,6 +10,9 @@
 
 #include "rte_table_hash_cuckoo.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_hash_logtype, hash, INFO);
+#define RTE_LOGTYPE_TABLE table_hash_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_HASH_CUCKOO_STATS_PKTS_IN_ADD(table, val) \
lib/table/rte_table_hash_ext.c +3 -0
index 70ea84fa2e51..147ecdf082cb 100644
@@ -11,6 +11,9 @@
 
 #include "rte_table_hash.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_hash_ext_logtype, hash.ext, INFO);
+#define RTE_LOGTYPE_TABLE table_hash_ext_logtype
+
 #define KEYS_PER_BUCKET	4
 
 struct bucket {
lib/table/rte_table_hash_key16.c +3 -0
index 04d7fd64bd97..09fef5f14ce7 100644
@@ -11,6 +11,9 @@
 #include "rte_table_hash.h"
 #include "rte_lru.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_hash16_logtype, hash16, INFO);
+#define RTE_LOGTYPE_TABLE table_hash16_logtype
+
 #define KEY_SIZE						16
 
 #define KEYS_PER_BUCKET					4
lib/table/rte_table_hash_key32.c +4 -1
index 88d8f69c72ed..1abc459eee87 100644
@@ -11,7 +11,10 @@
 #include "rte_table_hash.h"
 #include "rte_lru.h"
 
-#define KEY_SIZE						32
+RTE_LOG_REGISTER_SUFFIX(table_hash32_logtype, hash32, INFO);
+#define RTE_LOGTYPE_TABLE table_hash32_logtype
+
+#define KEY_SIZE					32
 
 #define KEYS_PER_BUCKET					4
 
lib/table/rte_table_hash_key8.c +4 -1
index 035d24276946..d4ccccbcdf9e 100644
@@ -11,7 +11,10 @@
 #include "rte_table_hash.h"
 #include "rte_lru.h"
 
-#define KEY_SIZE						8
+RTE_LOG_REGISTER_SUFFIX(table_hash8_logtype, hash8, INFO);
+#define RTE_LOGTYPE_TABLE table_hash8_logtype
+
+#define KEY_SIZE					8
 
 #define KEYS_PER_BUCKET					4
 
lib/table/rte_table_hash_lru.c +3 -0
index c31acc11cf23..d0d2c8ba44df 100644
@@ -14,6 +14,9 @@
 
 #define KEYS_PER_BUCKET	4
 
+RTE_LOG_REGISTER_SUFFIX(table_hash_lru_logtype, hash_lru, INFO);
+#define RTE_LOGTYPE_TABLE table_hash_lru_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(table, val) \
lib/table/rte_table_lpm.c +3 -0
index 9de9e8a20d77..4a5c4a343c77 100644
@@ -13,6 +13,9 @@
 
 #include "rte_table_lpm.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_lpm_logtype, lpm, INFO);
+#define RTE_LOGTYPE_TABLE table_lpm_logtype
+
 #ifndef RTE_TABLE_LPM_MAX_NEXT_HOPS
 #define RTE_TABLE_LPM_MAX_NEXT_HOPS                        65536
 #endif
lib/table/rte_table_lpm_ipv6.c +3 -0
index 8fde2c012f7c..236eac4238d9 100644
@@ -12,6 +12,9 @@
 
 #include "rte_table_lpm_ipv6.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_lpm6_logtype, lpm6, INFO);
+#define RTE_LOGTYPE_TABLE table_lpm6_logtype
+
 #define RTE_TABLE_LPM_MAX_NEXT_HOPS                        256
 
 #ifdef RTE_TABLE_STATS_COLLECT
lib/table/rte_table_stub.c +3 -0
index 23d0de5c79b0..e74044032f7d 100644
@@ -8,6 +8,9 @@
 
 #include "rte_table_stub.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_stub_logtype, stub, INFO);
+#define RTE_LOGTYPE_TABLE table_stub_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_LPM_STATS_PKTS_IN_ADD(table, val) \
Signature · 1 line
2.39.1
#224 lore raw

PATCH v10 18/22 app/test: remove use of RTE_LOGTYPE_PIPELINE

In reply to Stephen Hemminger

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.

---
 app/test/test_table_acl.c      | 50 ++++++++++++++++------------------
 app/test/test_table_pipeline.c | 40 +++++++++++++--------------
 2 files changed, 43 insertions(+), 47 deletions(-)
app/test/test_table_acl.c +23 -27
index e66f06b84d0a..dff9bddfb948 100644
@@ -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;
 	}
app/test/test_table_pipeline.c +20 -20
index 7adbbffbf55d..960f730cf20d 100644
@@ -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;
 	}
 
Signature · 1 line
2.39.1
#225 lore raw

PATCH v10 19/22 pipeline: replace RTE_LOGTYPE_PIPELINE with dynamic type

In reply to Stephen Hemminger

Use a dynamically allocated logtype.

---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 lib/pipeline/rte_pipeline.c     | 3 +++
 3 files changed, 4 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
index d640ed3c88b9..a3498d1a2faf 100644
@@ -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_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
lib/eal/include/rte_log.h +1 -1
index 934bddff9dfa..7473fd53505a 100644
@@ -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 */
lib/pipeline/rte_pipeline.c +3 -0
index ff86c7cf96bf..30919cd9fe30 100644
@@ -12,6 +12,9 @@
 
 #include "rte_pipeline.h"
 
+RTE_LOG_REGISTER_DEFAULT(pipeline_logtype, INFO);
+#define RTE_LOGTYPE_PIPELINE pipeline_logtype
+
 #define RTE_TABLE_INVALID                                 UINT32_MAX
 
 #ifdef RTE_PIPELINE_STATS_COLLECT
Signature · 1 line
2.39.1
#226 lore raw

PATCH v10 20/22 hash: move rte_thash_gfni stubs out of header file

In reply to Stephen Hemminger

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

---
 lib/hash/meson.build      |  8 ++++++-
 lib/hash/rte_thash_gfni.c | 47 +++++++++++++++++++++++++++++++++++++++
 lib/hash/rte_thash_gfni.h | 29 +++++-------------------
 lib/hash/version.map      |  4 ++++
 4 files changed, 64 insertions(+), 24 deletions(-)
 create mode 100644 lib/hash/rte_thash_gfni.c
lib/hash/meson.build +7 -1
index 2f757d45f9bc..e56ee8572564 100644
@@ -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']
lib/hash/rte_thash_gfni.c new file +47 -0

47 lines not on this page · raw message

lib/hash/rte_thash_gfni.h +6 -23
index ef90faa302d1..6127f5533873 100644
@@ -9,16 +9,12 @@
 extern "C" {
 #endif
 
-#include <rte_compat.h>
-#include <rte_log.h>
-
 #ifdef RTE_ARCH_X86
-
 #include <rte_thash_x86_gfni.h>
-
 #endif
 
 #ifndef RTE_THASH_GFNI_DEFINED
+#include <rte_compat.h>
 
 /**
  * Calculate Toeplitz hash.
@@ -38,13 +34,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 +58,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 */
 
lib/hash/version.map +4 -0
index bdcebd19c29b..f03b047b2eec 100644
@@ -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;
 };
Signature · 1 line
2.39.1
#227 lore raw

PATCH v10 21/22 hash: move rte_hash_set_alg out header

In reply to Stephen Hemminger

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.

---
 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
lib/hash/meson.build +1 -0
index e56ee8572564..c345c6f561fc 100644
@@ -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'
lib/hash/rte_crc_arm64.h +4 -4
index c9f52510871b..414fe065caa8 100644
@@ -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);
lib/hash/rte_crc_x86.h +5 -5
index 205bc182be77..3b865e251db2 100644
@@ -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);
lib/hash/rte_hash_crc.c new file +68 -0

68 lines not on this page · raw message

lib/hash/rte_hash_crc.h +3 -45

66 lines not on this page · raw message

lib/hash/version.map +7 -0
index f03b047b2eec..8b22aad5626b 100644
@@ -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;
+};
Signature · 1 line
2.39.1
#228 lore raw

PATCH v10 22/22 hash: convert RTE_LOGTYPE_HASH to dynamic type

In reply to Stephen Hemminger

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

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index a3498d1a2faf..704924e822d0 100644
@@ -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_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
lib/eal/include/rte_log.h +1 -1
index 7473fd53505a..29db07881a5a 100644
@@ -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 */
lib/hash/rte_cuckoo_hash.c +5 -0
index 829b79c89a27..e2b07bfbad71 100644
@@ -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 */
lib/hash/rte_fbk_hash.c +5 -0
index 538b23a4030a..b4c4c191abdc 100644
@@ -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 = {
lib/hash/rte_thash.c +3 -0
index 0249883b8d07..c1fd2e34c9d4 100644
@@ -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
 
lib/hash/rte_thash_gfni.c +3 -0
index eb334185725c..35206d575153 100644
@@ -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)
Signature · 1 line
2.39.1
#229 lore raw

v11 cover Convert static log type values in libraries

In reply to 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.

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: replace RTE_LOGTYPE_EFD with dynamic type
mbuf: replace RTE_LOGTYPE_MBUF with dynamic type
acl: replace LOGTYPE_ACL with dynamic type examples/power: replace use of RTE_LOGTYPE_POWER examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER
power: replace RTE_LOGTYPE_POWER with dynamic type
ring: replace RTE_LOGTYPE_RING with dynamic type
mempool: replace RTE_LOGTYPE_MEMPOOL with dynamic type
lpm: replace RTE_LOGTYPE_LPM with dynamic types
kni: replace RTE_LOGTYPE_KNI with dynamic type
sched: replace RTE_LOGTYPE_SCHED with dynamic type examples/ipsecgw: replace RTE_LOGTYPE_PORT
port: replace RTE_LOGTYPE_PORT with dynamic type
table: convert RTE_LOGTYPE_TABLE to dynamic logtype app/test: remove use of RTE_LOGTYPE_PIPELINE
pipeline: replace RTE_LOGTYPE_PIPELINE with 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

 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       | 15 +++----
 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                 |  5 +--
 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       |  3 ++
 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/rte_table_acl.c         |  3 ++
 lib/table/rte_table_array.c       |  3 ++
 lib/table/rte_table_hash_cuckoo.c |  3 ++
 lib/table/rte_table_hash_ext.c    |  3 ++
 lib/table/rte_table_hash_key16.c  |  3 ++
 lib/table/rte_table_hash_key32.c  |  5 ++-
 lib/table/rte_table_hash_key8.c   |  5 ++-
 lib/table/rte_table_hash_lru.c    |  3 ++
 lib/table/rte_table_lpm.c         |  3 ++
 lib/table/rte_table_lpm_ipv6.c    |  3 ++
 lib/table/rte_table_stub.c        |  3 ++
 75 files changed, 409 insertions(+), 177 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
Signature · 1 line
2.39.1
#230 lore raw

PATCH v11 1/22 gso: don't log message on non TCP/UDP

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")
---
 lib/gso/rte_gso.c | 5 ++---
 lib/gso/rte_gso.h | 1 +
 2 files changed, 3 insertions(+), 3 deletions(-)
lib/gso/rte_gso.c +2 -3
index 4b59217c16ee..c8e67c2d4b48 100644
@@ -80,9 +80,8 @@ 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) {
lib/gso/rte_gso.h +1 -0
index 40922524df42..23d6980aff9f 100644
@@ -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 segmentd (not UDP or TCP)
  *  - Return -EINVAL for invalid parameters.
  */
 int rte_gso_segment(struct rte_mbuf *pkt,
Signature · 1 line
2.39.1
#231 lore raw

PATCH v11 2/22 eal: drop no longer used GSO logtype

In reply to Stephen Hemminger

The message that used this was replaced in previous patch.

---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
index bd7b188ceb4a..894701e8c19c 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 6d2b0856a565..11d517806054 100644
@@ -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. */
Signature · 1 line
2.39.1
#232 lore raw

PATCH v11 3/22 log: drop unused RTE_LOGTYPE_TIMER

In reply to Stephen Hemminger

The timer code does not use rte_log.

---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
index 894701e8c19c..5421da008f5b 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 11d517806054..16d6ea31583d 100644
@@ -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. */
Signature · 1 line
2.39.1
#233 lore raw

PATCH v11 4/22 efd: replace RTE_LOGTYPE_EFD with dynamic type

In reply to Stephen Hemminger

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

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index 5421da008f5b..25bb17938cc1 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 16d6ea31583d..0b39795b4d06 100644
@@ -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 */
 
lib/efd/rte_efd.c +4 -0
index 686a13775742..9edb11799c89 100644
@@ -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) \
Signature · 1 line
2.39.1
#234 lore raw

PATCH v11 5/22 mbuf: replace RTE_LOGTYPE_MBUF with dynamic type

In reply to 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

---
 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
lib/eal/common/eal_common_log.c +0 -1
index 25bb17938cc1..d4389e436913 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 0b39795b4d06..941fbe51fd30 100644
@@ -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. */
lib/mbuf/mbuf_log.h new file +4 -0
new file mode 100644
index 000000000000..d759a9a25501
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int mbuf_logtype;
+#define RTE_LOGTYPE_MBUF	mbuf_logtype
lib/mbuf/rte_mbuf.c +4 -0
index cfd8062f1e6a..4a379a5185d5 100644
@@ -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
lib/mbuf/rte_mbuf_dyn.c +2 -0
index 35839e938cc5..01654db03fc8 100644
@@ -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 {
lib/mbuf/rte_mbuf_pool_ops.c +2 -0
index 4c91f4ce8569..5318430126cb 100644
@@ -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)
 {
Signature · 1 line
2.39.1
#235 lore raw

PATCH v11 6/22 acl: replace LOGTYPE_ACL with dynamic type

In reply to Stephen Hemminger

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.

---
 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
app/test/test_acl.c +2 -1
index 623f34682e69..75588978a720 100644
@@ -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;
 		}
lib/acl/acl_bld.c +1 -0
index 2816632803bd..f38e6478315f 100644
@@ -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
lib/acl/acl_gen.c +1 -0
index e759a2ca1598..54ec485d0c58 100644
@@ -4,6 +4,7 @@
 
 #include <rte_acl.h>
 #include "acl.h"
+#include "acl_log.h"
 
 #define	QRANGE_MIN	((uint8_t)INT8_MIN)
 
lib/acl/acl_log.h new file +4 -0
new file mode 100644
index 000000000000..b55573cbe207
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int acl_logtype;
+#define RTE_LOGTYPE_ACL	acl_logtype
lib/acl/rte_acl.c +4 -0
index a61c3ba188da..a29decb1f6ca 100644
@@ -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);
 
lib/acl/tb_mem.c +2 -1
index f14d7b4fa26e..6a9d96aaeda2 100644
@@ -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;
lib/eal/common/eal_common_log.c +0 -2
index d4389e436913..9e853addb717 100644
@@ -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"},
lib/eal/include/rte_log.h +2 -2
index 941fbe51fd30..1408722b2c2f 100644
@@ -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. */
Signature · 1 line
2.39.1
#236 lore raw

PATCH v11 7/22 examples/power: replace use of RTE_LOGTYPE_POWER

In reply to Stephen Hemminger

Don't use static logtype in sample application.

---
 examples/distributor/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/distributor/main.c +1 -1
index 21304d661873..542f76cf9664 100644
@@ -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);
 			/*
Signature · 1 line
2.39.1
#237 lore raw

PATCH v11 8/22 examples/l3fwd-power: replace use of RTE_LOGTYPE_POWER

In reply to Stephen Hemminger

Convert to using a dynamic logtype for the application.

---
 examples/l3fwd-power/main.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
examples/l3fwd-power/main.c +8 -7
index f57c54d2b57c..76b890b76c88 100644
@@ -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;
@@ -2245,7 +2246,7 @@ init_power_library(void)
 		env = rte_power_get_env();
 		if (env != PM_ENV_ACPI_CPUFREQ &&
 				env != PM_ENV_PSTATE_CPUFREQ) {
-			RTE_LOG(ERR, POWER,
+			RTE_LOG(ERR, L3FWD_POWER,
 				"Only ACPI and PSTATE mode are supported\n");
 			return -1;
 		}
@@ -2263,7 +2264,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;
@@ -2332,7 +2333,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
@@ -2381,7 +2382,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();
 
@@ -2397,7 +2398,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;
 }
Signature · 1 line
2.39.1
#238 lore raw

PATCH v11 9/22 power: replace RTE_LOGTYPE_POWER with dynamic type

In reply to Stephen Hemminger

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

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index 9e853addb717..39e1e6680dea 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 1408722b2c2f..7d4345acceca 100644
@@ -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. */
lib/power/guest_channel.c +2 -1
index 969a9e5aaa06..efc326d520ca 100644
@@ -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
lib/power/power_common.c +2 -0
index 1e09facb863f..bf77eafa886b 100644
@@ -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  \
lib/power/power_common.h +2 -1
index c1c713927621..63a3a443509e 100644
@@ -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...) \
lib/power/power_kvm_vm.c +1 -0
index 6a8109d44959..db031f43105a 100644
@@ -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"
lib/power/rte_power.c +1 -0
index 63a43bd8f5ae..db0e7705a9ef 100644
@@ -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"
 
Signature · 1 line
2.39.1
#239 lore raw

PATCH v11 10/22 ring: replace RTE_LOGTYPE_RING with dynamic type

In reply to Stephen Hemminger

The logtype for ring only used in library.

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index 39e1e6680dea..5f15e312f15b 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 7d4345acceca..31a2ee2f6b6f 100644
@@ -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. */
lib/ring/rte_ring.c +3 -0
index cddaf6b2876f..8c5f2575d6ef 100644
@@ -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 = {
Signature · 1 line
2.39.1
#240 lore raw

PATCH v11 11/22 mempool: replace RTE_LOGTYPE_MEMPOOL with dynamic type

In reply to Stephen Hemminger

Convert from RTE_LOGTYPE_MEMPOOL to logtype_mempool.

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index 5f15e312f15b..4025d2039d55 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 31a2ee2f6b6f..9f86bfdd0198 100644
@@ -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. */
lib/mempool/rte_mempool.c +2 -0
index cf5dea2304a7..b609a94fdf9d 100644
@@ -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 = {
lib/mempool/rte_mempool.h +8 -0
index 9f530db24ba1..db01acc19b02 100644
@@ -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
  */
lib/mempool/version.map +3 -0
index dff2d1cb5555..eb2c12127560 100644
@@ -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;
 };
Signature · 1 line
2.39.1
#241 lore raw

PATCH v11 12/22 lpm: replace RTE_LOGTYPE_LPM with dynamic types

In reply to Stephen Hemminger

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.

---
 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
lib/eal/common/eal_common_log.c +0 -1
index 4025d2039d55..6e2007e6ed4f 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 9f86bfdd0198..115a48bf05f5 100644
@@ -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 */
lib/fib/fib_log.h new file +4 -0
new file mode 100644
index 000000000000..c731c820f621
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int fib_logtype;
+#define RTE_LOGTYPE_LPM fib_logtype
lib/fib/rte_fib.c +3 -0
index 8af4c4091908..5b1815881415 100644
@@ -16,6 +16,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 = {
lib/fib/rte_fib6.c +2 -0
index 4b8e22b142b9..762d195fb798 100644
@@ -9,6 +9,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>
 
@@ -16,6 +17,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 = {
lib/lpm/lpm_log.h new file +4 -0
new file mode 100644
index 000000000000..a0621b70a5fe
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int lpm_logtype;
+#define RTE_LOGTYPE_LPM lpm_logtype
lib/lpm/rte_lpm.c +3 -0
index cdcd1b7f9e47..0ca82147866a 100644
@@ -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);
 
lib/lpm/rte_lpm6.c +1 -0
index 8d21aeddb83c..873cc8bc267d 100644
@@ -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
lib/rib/rib_log.h new file +4 -0
new file mode 100644
index 000000000000..f3ee513ca854
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int rib_logtype;
+#define RTE_LOGTYPE_LPM rib_logtype
lib/rib/rte_rib.c +3 -0
index b0794edf66f5..5597c8b899c8 100644
@@ -15,6 +15,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",
lib/rib/rte_rib6.c +3 -0
index 19e4ff97c479..917bede27d24 100644
@@ -8,6 +8,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>
@@ -15,6 +16,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. */
Signature · 1 line
2.39.1
#242 lore raw

PATCH v11 13/22 kni: replace RTE_LOGTYPE_KNI with dynamic type

In reply to Stephen Hemminger

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

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index 6e2007e6ed4f..70d5bb7b1951 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index 115a48bf05f5..dc2454a0d9de 100644
@@ -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. */
lib/kni/rte_kni.c +3 -0
index 8ab6c4715314..9c37bcabcadd 100644
@@ -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 */
Signature · 1 line
2.39.1
#243 lore raw

PATCH v11 14/22 sched: replace RTE_LOGTYPE_SCHED with dynamic type

In reply to Stephen Hemminger

Also can remove unused RTE_LOGTYPE_METER

---
 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
lib/eal/common/eal_common_log.c +0 -2
index 70d5bb7b1951..d4b7088b5cbb 100644
@@ -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"},
lib/eal/include/rte_log.h +2 -2
index dc2454a0d9de..f185fcbc5a94 100644
@@ -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. */
lib/sched/rte_pie.c +1 -0
index 947e2a059f6f..cce0ce762da8 100644
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "rte_sched_log.h"
 #include "rte_pie.h"
 
 #ifdef __INTEL_COMPILER
lib/sched/rte_sched.c +5 -0
index 19768d8c38b0..27e98e46df7a 100644
@@ -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);
lib/sched/rte_sched_log.h new file +4 -0
new file mode 100644
index 000000000000..fde051f49d62
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int sched_logtype;
+#define RTE_LOGTYPE_SCHED sched_logtype
Signature · 1 line
2.39.1
#244 lore raw

PATCH v11 15/22 examples/ipsecgw: replace RTE_LOGTYPE_PORT

In reply to Stephen Hemminger

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")
---
 examples/ipsec-secgw/sa.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
examples/ipsec-secgw/sa.c +3 -3
index 7da9444a7b8a..67327fda8dbc 100644
@@ -1127,7 +1127,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;
 		}
@@ -1135,13 +1135,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;
 		}
Signature · 1 line
2.39.1
#245 lore raw

PATCH v11 16/22 port: replace RTE_LOGTYPE_PORT with dynamic type

In reply to Stephen Hemminger

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

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index d4b7088b5cbb..7f1d2c8a256d 100644
@@ -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"},
lib/eal/include/rte_log.h +1 -1
index f185fcbc5a94..b11aec69af78 100644
@@ -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 */
lib/port/rte_port_ethdev.c +3 -0
index 0da7890261e9..6685d304a6e9 100644
@@ -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
  */
lib/port/rte_port_eventdev.c +4 -0
index fd7dac9a5661..04447bd7f7bc 100644
@@ -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
  */
lib/port/rte_port_fd.c +3 -0
index 932ecd324e05..b2412e7706ee 100644
@@ -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
  */
lib/port/rte_port_frag.c +3 -0
index e1f1892176c4..9adcbba47da1 100644
@@ -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
 
lib/port/rte_port_kni.c +3 -0
index 1c7a6cb200ea..d4ac08b4cff0 100644
@@ -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
  */
lib/port/rte_port_ras.c +3 -0
index e5de57da42ea..5a610b1ba5b5 100644
@@ -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
lib/port/rte_port_ring.c +3 -0
index 52b2d8e557f0..32a90e836579 100644
@@ -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
  */
lib/port/rte_port_sched.c +3 -0
index 8a7d815ef323..6e0a8aba5419 100644
@@ -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
  */
lib/port/rte_port_source_sink.c +3 -0
index 7d73adc1e79e..e9cdadbceb8f 100644
@@ -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
  */
lib/port/rte_port_sym_crypto.c +3 -0
index 295984d025cb..77a2f04d65f6 100644
@@ -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
  */
Signature · 1 line
2.39.1
#246 lore raw

PATCH v11 17/22 table: convert RTE_LOGTYPE_TABLE to dynamic logtype

In reply to Stephen Hemminger

Use logtype suffixes for various components of this library.

---
 lib/eal/common/eal_common_log.c   | 1 -
 lib/eal/include/rte_log.h         | 2 +-
 lib/table/rte_table_acl.c         | 3 +++
 lib/table/rte_table_array.c       | 3 +++
 lib/table/rte_table_hash_cuckoo.c | 3 +++
 lib/table/rte_table_hash_ext.c    | 3 +++
 lib/table/rte_table_hash_key16.c  | 3 +++
 lib/table/rte_table_hash_key32.c  | 5 ++++-
 lib/table/rte_table_hash_key8.c   | 5 ++++-
 lib/table/rte_table_hash_lru.c    | 3 +++
 lib/table/rte_table_lpm.c         | 3 +++
 lib/table/rte_table_lpm_ipv6.c    | 3 +++
 lib/table/rte_table_stub.c        | 3 +++
 13 files changed, 36 insertions(+), 4 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
index 7f1d2c8a256d..d640ed3c88b9 100644
@@ -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_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
lib/eal/include/rte_log.h +1 -1
index b11aec69af78..934bddff9dfa 100644
@@ -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. */
lib/table/rte_table_acl.c +3 -0
index 53fd5c66adb5..f44a25a89405 100644
@@ -11,6 +11,9 @@
 
 #include "rte_table_acl.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_acl_logtype, acl, INFO);
+#define RTE_LOGTYPE_TABLE table_acl_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_ACL_STATS_PKTS_IN_ADD(table, val) \
lib/table/rte_table_array.c +3 -0
index 54a0c42f7dd2..a7849beaecd6 100644
@@ -11,6 +11,9 @@
 
 #include "rte_table_array.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_array_logtype, array, INFO);
+#define RTE_LOGTYPE_TABLE table_array_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_ARRAY_STATS_PKTS_IN_ADD(table, val) \
lib/table/rte_table_hash_cuckoo.c +3 -0
index c77eccf52722..12db0b84142f 100644
@@ -10,6 +10,9 @@
 
 #include "rte_table_hash_cuckoo.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_hash_logtype, hash, INFO);
+#define RTE_LOGTYPE_TABLE table_hash_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_HASH_CUCKOO_STATS_PKTS_IN_ADD(table, val) \
lib/table/rte_table_hash_ext.c +3 -0
index 70ea84fa2e51..147ecdf082cb 100644
@@ -11,6 +11,9 @@
 
 #include "rte_table_hash.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_hash_ext_logtype, hash.ext, INFO);
+#define RTE_LOGTYPE_TABLE table_hash_ext_logtype
+
 #define KEYS_PER_BUCKET	4
 
 struct bucket {
lib/table/rte_table_hash_key16.c +3 -0
index 04d7fd64bd97..09fef5f14ce7 100644
@@ -11,6 +11,9 @@
 #include "rte_table_hash.h"
 #include "rte_lru.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_hash16_logtype, hash16, INFO);
+#define RTE_LOGTYPE_TABLE table_hash16_logtype
+
 #define KEY_SIZE						16
 
 #define KEYS_PER_BUCKET					4
lib/table/rte_table_hash_key32.c +4 -1
index 88d8f69c72ed..1abc459eee87 100644
@@ -11,7 +11,10 @@
 #include "rte_table_hash.h"
 #include "rte_lru.h"
 
-#define KEY_SIZE						32
+RTE_LOG_REGISTER_SUFFIX(table_hash32_logtype, hash32, INFO);
+#define RTE_LOGTYPE_TABLE table_hash32_logtype
+
+#define KEY_SIZE					32
 
 #define KEYS_PER_BUCKET					4
 
lib/table/rte_table_hash_key8.c +4 -1
index 035d24276946..d4ccccbcdf9e 100644
@@ -11,7 +11,10 @@
 #include "rte_table_hash.h"
 #include "rte_lru.h"
 
-#define KEY_SIZE						8
+RTE_LOG_REGISTER_SUFFIX(table_hash8_logtype, hash8, INFO);
+#define RTE_LOGTYPE_TABLE table_hash8_logtype
+
+#define KEY_SIZE					8
 
 #define KEYS_PER_BUCKET					4
 
lib/table/rte_table_hash_lru.c +3 -0
index c31acc11cf23..d0d2c8ba44df 100644
@@ -14,6 +14,9 @@
 
 #define KEYS_PER_BUCKET	4
 
+RTE_LOG_REGISTER_SUFFIX(table_hash_lru_logtype, hash_lru, INFO);
+#define RTE_LOGTYPE_TABLE table_hash_lru_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_HASH_LRU_STATS_PKTS_IN_ADD(table, val) \
lib/table/rte_table_lpm.c +3 -0
index 9de9e8a20d77..4a5c4a343c77 100644
@@ -13,6 +13,9 @@
 
 #include "rte_table_lpm.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_lpm_logtype, lpm, INFO);
+#define RTE_LOGTYPE_TABLE table_lpm_logtype
+
 #ifndef RTE_TABLE_LPM_MAX_NEXT_HOPS
 #define RTE_TABLE_LPM_MAX_NEXT_HOPS                        65536
 #endif
lib/table/rte_table_lpm_ipv6.c +3 -0
index 8fde2c012f7c..236eac4238d9 100644
@@ -12,6 +12,9 @@
 
 #include "rte_table_lpm_ipv6.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_lpm6_logtype, lpm6, INFO);
+#define RTE_LOGTYPE_TABLE table_lpm6_logtype
+
 #define RTE_TABLE_LPM_MAX_NEXT_HOPS                        256
 
 #ifdef RTE_TABLE_STATS_COLLECT
lib/table/rte_table_stub.c +3 -0
index 23d0de5c79b0..e74044032f7d 100644
@@ -8,6 +8,9 @@
 
 #include "rte_table_stub.h"
 
+RTE_LOG_REGISTER_SUFFIX(table_stub_logtype, stub, INFO);
+#define RTE_LOGTYPE_TABLE table_stub_logtype
+
 #ifdef RTE_TABLE_STATS_COLLECT
 
 #define RTE_TABLE_LPM_STATS_PKTS_IN_ADD(table, val) \
Signature · 1 line
2.39.1
#247 lore raw

PATCH v11 18/22 app/test: remove use of RTE_LOGTYPE_PIPELINE

In reply to Stephen Hemminger

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.

---
 app/test/test_table_acl.c      | 50 ++++++++++++++++------------------
 app/test/test_table_pipeline.c | 40 +++++++++++++--------------
 2 files changed, 43 insertions(+), 47 deletions(-)
app/test/test_table_acl.c +23 -27
index e66f06b84d0a..dff9bddfb948 100644
@@ -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;
 	}
app/test/test_table_pipeline.c +20 -20
index 7adbbffbf55d..960f730cf20d 100644
@@ -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;
 	}
 
Signature · 1 line
2.39.1
#248 lore raw

PATCH v11 19/22 pipeline: replace RTE_LOGTYPE_PIPELINE with dynamic type

In reply to Stephen Hemminger

Use a dynamically allocated logtype.

---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 lib/pipeline/rte_pipeline.c     | 3 +++
 3 files changed, 4 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_log.c +0 -1
index d640ed3c88b9..a3498d1a2faf 100644
@@ -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_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
lib/eal/include/rte_log.h +1 -1
index 934bddff9dfa..7473fd53505a 100644
@@ -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 */
lib/pipeline/rte_pipeline.c +3 -0
index ff86c7cf96bf..30919cd9fe30 100644
@@ -12,6 +12,9 @@
 
 #include "rte_pipeline.h"
 
+RTE_LOG_REGISTER_DEFAULT(pipeline_logtype, INFO);
+#define RTE_LOGTYPE_PIPELINE pipeline_logtype
+
 #define RTE_TABLE_INVALID                                 UINT32_MAX
 
 #ifdef RTE_PIPELINE_STATS_COLLECT
Signature · 1 line
2.39.1
#249 lore raw

PATCH v11 20/22 hash: move rte_thash_gfni stubs out of header file

In reply to Stephen Hemminger

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

---
 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
lib/hash/meson.build +7 -1
index 2f757d45f9bc..e56ee8572564 100644
@@ -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']
lib/hash/rte_thash_gfni.c new file +47 -0

47 lines not on this page · raw message

lib/hash/rte_thash_gfni.h +9 -21
index ef90faa302d1..4fc92984077e 100644
@@ -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 */
 
lib/hash/version.map +4 -0
index bdcebd19c29b..f03b047b2eec 100644
@@ -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;
 };
Signature · 1 line
2.39.1
#250 lore raw

PATCH v11 21/22 hash: move rte_hash_set_alg out header

In reply to Stephen Hemminger

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.

---
 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
lib/hash/meson.build +1 -0
index e56ee8572564..c345c6f561fc 100644
@@ -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'
lib/hash/rte_crc_arm64.h +4 -4
index c9f52510871b..414fe065caa8 100644
@@ -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);
lib/hash/rte_crc_x86.h +5 -5
index 205bc182be77..3b865e251db2 100644
@@ -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);
lib/hash/rte_hash_crc.c new file +68 -0

68 lines not on this page · raw message

lib/hash/rte_hash_crc.h +3 -45

66 lines not on this page · raw message

lib/hash/version.map +7 -0
index f03b047b2eec..8b22aad5626b 100644
@@ -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;
+};
Signature · 1 line
2.39.1
#251 lore raw

RE: [PATCH v11 21/22] hash: move rte_hash_set_alg out header

Quoted 33 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Thursday, February 23, 2023 5:56 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Yipeng Wang <[email protected]>; Sameh Gobriel <[email protected]>; Bruce Richardson <[email protected]>; Vladimir Medvedkin <[email protected]>; Ruifeng Wang <[email protected]>
Subject: [PATCH v11 21/22] hash: move rte_hash_set_alg out header

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.

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

lib/hash/meson.build index e56ee8572564..c345c6f561fc renamed from lib/hash/meson.build +0 -0

100644

lib/hash/meson.build indirect_headers += files( · line 22

Quoted 4 lines
lib/hash/meson.build +1 -0
@@ -19,6 +19,7 @@ indirect_headers += files(
 
 sources = files(
     'rte_cuckoo_hash.c',
+    'rte_hash_crc.c',

I suppose this list is alphabetically ordered.

Quoted 3 lines
lib/hash/meson.build +0 -0
     'rte_fbk_hash.c',
     'rte_thash.c',
     'rte_thash_gfni.c'

<snip>

lib/hash/rte_hash_crc.h extern "C" { · line 23

Quoted 9 lines
lib/hash/rte_hash_crc.h index renamed from lib/hash/rte_hash_crc.h +0 -0

0249ad16c5b6..e8145ee44204 100644

lib/hash/rte_hash_crc.h +0 -1
@@ -20,8 +20,6 @@ extern "C" {
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
 #include <rte_config.h>
-#include <rte_cpuflags.h>

A couple of files need update with this change.
rte_cpuflags.h should be included in rte_fbk_hash.c (for ARM) and rte_efd.c.

Quoted 4 lines
lib/hash/rte_hash_crc.h +0 -1
-#include <rte_log.h>
 
 #include "rte_crc_sw.h"
 

<snip>

#252 lore raw

RE: [PATCH v11 21/22] hash: move rte_hash_set_alg out header

Quoted 57 lines

-----Original Message-----
From: Ruifeng Wang
Sent: Thursday, February 23, 2023 3:11 PM
To: Stephen Hemminger <[email protected]>; [email protected]
Cc: Yipeng Wang <[email protected]>; Sameh Gobriel <[email protected]>; Bruce Richardson <[email protected]>; Vladimir Medvedkin <[email protected]>; nd <[email protected]>
Subject: RE: [PATCH v11 21/22] hash: move rte_hash_set_alg out header

Quoted 10 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Thursday, February 23, 2023 5:56 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Yipeng Wang <[email protected]>; Sameh Gobriel <[email protected]>; Bruce Richardson <[email protected]>; Vladimir Medvedkin <[email protected]>; Ruifeng Wang <[email protected]>
Subject: [PATCH v11 21/22] hash: move rte_hash_set_alg out header

Quoted 7 lines

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.

Quoted 19 lines
---
 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

lib/hash/meson.build index renamed from lib/hash/meson.build +0 -0

e56ee8572564..c345c6f561fc
100644

lib/hash/meson.build indirect_headers += files( · line 22

Quoted 4 lines
lib/hash/meson.build +1 -0
@@ -19,6 +19,7 @@ indirect_headers += files(
 
 sources = files(
     'rte_cuckoo_hash.c',
+    'rte_hash_crc.c',

I suppose this list is alphabetically ordered.

Quoted 3 lines
lib/hash/meson.build +0 -0
     'rte_fbk_hash.c',
     'rte_thash.c',
     'rte_thash_gfni.c'

<snip>

Quoted 12 lines

lib/hash/rte_hash_crc.h extern "C" { · line 23

Quoted 9 lines
lib/hash/rte_hash_crc.h index renamed from lib/hash/rte_hash_crc.h +0 -0

0249ad16c5b6..e8145ee44204 100644

lib/hash/rte_hash_crc.h +0 -1
@@ -20,8 +20,6 @@ extern "C" {
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
 #include <rte_config.h>
-#include <rte_cpuflags.h>

A couple of files need update with this change.
rte_cpuflags.h should be included in rte_fbk_hash.c (for ARM) and rte_efd.c.

OK, I see the changes already there in other patches in the same series. Please ignore this comment.
Thanks.

Quoted 6 lines
Quoted 5 lines
lib/hash/rte_hash_crc.h +0 -1
-#include <rte_log.h>
 
 #include "rte_crc_sw.h"
 

<snip>

Acked-by on v11 21/22
#253 lore raw

RE: [PATCH v11 21/22] hash: move rte_hash_set_alg out header

In reply to Stephen Hemminger
Quoted 26 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Thursday, February 23, 2023 5:56 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Yipeng Wang <[email protected]>; Sameh Gobriel <[email protected]>; Bruce Richardson <[email protected]>; Vladimir Medvedkin <[email protected]>; Ruifeng Wang <[email protected]>
Subject: [PATCH v11 21/22] hash: move rte_hash_set_alg out header

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.

---
 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
Quoted 2 lines

lib/hash/rte_hash_crc.c

#254 lore raw

PATCH v11 22/22 hash: convert RTE_LOGTYPE_HASH to dynamic type

In reply to Stephen Hemminger

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

---
 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(-)
lib/eal/common/eal_common_log.c +0 -1
index a3498d1a2faf..704924e822d0 100644
@@ -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_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
lib/eal/include/rte_log.h +1 -1
index 7473fd53505a..29db07881a5a 100644
@@ -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 */
lib/hash/rte_cuckoo_hash.c +5 -0
index 829b79c89a27..e2b07bfbad71 100644
@@ -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 */
lib/hash/rte_fbk_hash.c +5 -0
index 538b23a4030a..b4c4c191abdc 100644
@@ -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 = {
lib/hash/rte_thash.c +3 -0
index 0249883b8d07..c1fd2e34c9d4 100644
@@ -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
 
lib/hash/rte_thash_gfni.c +3 -0
index eb334185725c..35206d575153 100644
@@ -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)
Signature · 1 line
2.39.1