Skip to contentSkip to conversation

Convert us of RTE_LOGTYPE_USER1 in libraries

PATCH Superseded Stephen Hemminger 1 participant 6 messages Feb 21, 2023 1 message not in the archive Crypto API

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

v7 cover Convert us of RTE_LOGTYPE_USER1 in libraries

The DPDK libraries and drivers should not be using the USER1 logtype.

v7 - fix review comments. Replace USER1 in ip_frag and vhost crypto.

Stephen Hemminger (5):
ip_frag: use a dynamic logtype
reorder: use a dynamic logtype
latencystats: use dynamic logtype
vhost: use logtype instead of RTE_LOGTYPE_USER1
ipsec: fix usage of RTE_LOGTYPE_USER1

 drivers/crypto/ipsec_mb/ipsec_mb_ops.c |  3 ++-
 lib/ip_frag/ip_frag_common.h           |  5 ++++-
 lib/ip_frag/rte_ip_frag_common.c       |  8 +++++---
 lib/latencystats/rte_latencystats.c    |  3 ++-
 lib/reorder/rte_reorder.c              |  6 +++---
 lib/vhost/fd_man.c                     |  4 ++--
 lib/vhost/vhost_crypto.c               | 22 +++++++++++-----------
 7 files changed, 29 insertions(+), 22 deletions(-)
Signature · 1 line
2.39.1
#2 lore raw

PATCH v7 1/5 ip_frag: use a dynamic logtype

DPDK libraries should not be reusing RTE_LOGTYPE_USER1 in lieu of doing proper logtype registration.

Fixes 416707812c03 ("ip_frag: refactor reassembly code into a proper library")
---
 lib/ip_frag/ip_frag_common.h     | 5 ++++-
 lib/ip_frag/rte_ip_frag_common.c | 8 +++++---
 2 files changed, 9 insertions(+), 4 deletions(-)
lib/ip_frag/ip_frag_common.h +4 -1
index 9c0dbdeb6eb9..95f1689d476d 100644
@@ -8,9 +8,12 @@
 #include "rte_ip_frag.h"
 #include "ip_reassembly.h"
 
+extern int ipfrag_logtype;
+#define RTE_LOGTYPE_IPFRAG	ipfrag_logtype
+
 /* logging macros. */
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
-#define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, USER1, fmt, ##args)
+#define	IP_FRAG_LOG(lvl, fmt, args...)	RTE_LOG(lvl, IPFRAG, fmt, ##args)
 #else
 #define	IP_FRAG_LOG(lvl, fmt, args...)	do {} while(0)
 #endif /* IP_FRAG_DEBUG */
lib/ip_frag/rte_ip_frag_common.c +5 -3
index c1de2e81b6d0..eed399da6bc5 100644
@@ -7,6 +7,8 @@
 
 #include <rte_log.h>
 
+RTE_LOG_REGISTER_DEFAULT(ipfrag_logtype, INFO);
+
 #include "ip_frag_common.h"
 
 #define	IP_FRAG_HASH_FNUM	2
@@ -52,20 +54,20 @@ rte_ip_frag_table_create(uint32_t bucket_num, uint32_t bucket_entries,
 	if (rte_is_power_of_2(bucket_entries) == 0 ||
 			nb_entries > UINT32_MAX || nb_entries == 0 ||
 			nb_entries < max_entries) {
-		RTE_LOG(ERR, USER1, "%s: invalid input parameter\n", __func__);
+		RTE_LOG(ERR, IPFRAG, "%s: invalid input parameter\n", __func__);
 		return NULL;
 	}
 
 	sz = sizeof (*tbl) + nb_entries * sizeof (tbl->pkt[0]);
 	if ((tbl = rte_zmalloc_socket(__func__, sz, RTE_CACHE_LINE_SIZE,
 			socket_id)) == NULL) {
-		RTE_LOG(ERR, USER1,
+		RTE_LOG(ERR, IPFRAG,
 			"%s: allocation of %zu bytes at socket %d failed do\n",
 			__func__, sz, socket_id);
 		return NULL;
 	}
 
-	RTE_LOG(INFO, USER1, "%s: allocated of %zu bytes at socket %d\n",
+	RTE_LOG(INFO, IPFRAG, "%s: allocated of %zu bytes at socket %d\n",
 		__func__, sz, socket_id);
 
 	tbl->max_cycles = max_cycles;
Signature · 1 line
2.39.1
#3 lore raw

PATCH v7 2/5 reorder: use a dynamic logtype

In reply to Stephen Hemminger

Libraries should not be reusing RTE_LOGTYPE_USER1 instead of doing proper logtype registration.

Fixes b70b56032bff ("reorder: new library")
---
 lib/reorder/rte_reorder.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/reorder/rte_reorder.c +3 -3
index 6e029c9e02fd..7a3a97972cb7 100644
@@ -15,6 +15,9 @@
 
 #include "rte_reorder.h"
 
+RTE_LOG_REGISTER_DEFAULT(reorder_logtype, INFO);
+#define RTE_LOGTYPE_REORDER reorder_logtype
+
 TAILQ_HEAD(rte_reorder_list, rte_tailq_entry);
 
 static struct rte_tailq_elem rte_reorder_tailq = {
@@ -26,9 +29,6 @@ EAL_REGISTER_TAILQ(rte_reorder_tailq)
 #define RTE_REORDER_PREFIX "RO_"
 #define RTE_REORDER_NAMESIZE 32
 
-/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_REORDER	RTE_LOGTYPE_USER1
-
 #define RTE_REORDER_SEQN_DYNFIELD_NAME "rte_reorder_seqn_dynfield"
 int rte_reorder_seqn_dynfield_offset = -1;
 
Signature · 1 line
2.39.1
#4 lore raw

PATCH v7 3/5 latencystats: use dynamic logtype

In reply to Stephen Hemminger

Libraries should not reuse RTE_LOGTYPE_USER1 for their logging. Instead they should register their own type.

Fixes 5cd3cac9ed22 ("latency: added new library for latency stats")
---
 lib/latencystats/rte_latencystats.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/latencystats/rte_latencystats.c +2 -1
index 8985a377db4e..f3c1746cca00 100644
@@ -26,7 +26,8 @@ latencystat_cycles_per_ns(void)
 }
 
 /* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_LATENCY_STATS RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_DEFAULT(latencystat_logtype, INFO);
+#define RTE_LOGTYPE_LATENCY_STATS latencystat_logtype
 
 static uint64_t timestamp_dynflag;
 static int timestamp_dynfield_offset = -1;
Signature · 1 line
2.39.1
#5 lore raw

PATCH v7 4/5 vhost: use logtype instead of RTE_LOGTYPE_USER1

In reply to Stephen Hemminger

Fix instances of USER1 logtype in fdset and crypto sections.

---
 lib/vhost/fd_man.c       |  4 ++--
 lib/vhost/vhost_crypto.c | 22 +++++++++++-----------
 2 files changed, 13 insertions(+), 13 deletions(-)
lib/vhost/fd_man.c +2 -2
index 1876fada3354..46037d02784e 100644
@@ -10,8 +10,8 @@
 
 #include "fd_man.h"
 
-
-#define RTE_LOGTYPE_VHOST_FDMAN RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO);
+#define RTE_LOGTYPE_VHOST_FDMAN vhost_fdset_logtype
 
 #define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
 
lib/vhost/vhost_crypto.c +11 -11
index f02bf865c349..fa49ffa07099 100644
@@ -4,6 +4,7 @@
 #include <rte_malloc.h>
 #include <rte_hash.h>
 #include <rte_jhash.h>
+#include <rte_log.h>
 #include <rte_mbuf.h>
 #include <rte_cryptodev.h>
 
@@ -16,22 +17,21 @@
 #define IV_OFFSET		(sizeof(struct rte_crypto_op) + \
 				sizeof(struct rte_crypto_sym_op))
 
-#ifdef RTE_LIBRTE_VHOST_DEBUG
+RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
+#define RTE_LOGTYPE_VHOST_CRYPTO	vhost_crypto_logtype
+
 #define VC_LOG_ERR(fmt, args...)				\
-	RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n",	\
-		"Vhost-Crypto",	__func__, __LINE__, ## args)
+	RTE_LOG(ERR, VHOST_CRYPTO, "%s() line %u: " fmt "\n",	\
+		__func__, __LINE__, ## args)
 #define VC_LOG_INFO(fmt, args...)				\
-	RTE_LOG(INFO, USER1, "[%s] %s() line %u: " fmt "\n",	\
-		"Vhost-Crypto",	__func__, __LINE__, ## args)
+	RTE_LOG(INFO, VHOST_CRYPTO, "%s() line %u: " fmt "\n",	\
+		__func__, __LINE__, ## args)
 
+#ifdef RTE_LIBRTE_VHOST_DEBUG
 #define VC_LOG_DBG(fmt, args...)				\
-	RTE_LOG(DEBUG, USER1, "[%s] %s() line %u: " fmt "\n",	\
-		"Vhost-Crypto",	__func__, __LINE__, ## args)
+	RTE_LOG(DEBUG, VHOST_CRYPTO, "%s() line %u: " fmt "\n",	\
+		__func__, __LINE__, ## args)
 #else
-#define VC_LOG_ERR(fmt, args...)				\
-	RTE_LOG(ERR, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
-#define VC_LOG_INFO(fmt, args...)				\
-	RTE_LOG(INFO, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
 #define VC_LOG_DBG(fmt, args...)
 #endif
 
Signature · 1 line
2.39.1
#6 lore raw

PATCH v7 5/5 ipsec: fix usage of RTE_LOGTYPE_USER1

In reply to Stephen Hemminger

There already is a logtype in this driver, use it!

Fixes b35848bc01f6 ("crypto/ipsec_mb: add multi-process IPC request handler")
---
 drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/ipsec_mb/ipsec_mb_ops.c +2 -1
index 3e52f9567401..e9eb0d15b794 100644
@@ -7,6 +7,7 @@
 
 #include <rte_common.h>
 #include <rte_malloc.h>
+#include <rte_log.h>
 
 #include "ipsec_mb_private.h"
 
@@ -125,7 +126,7 @@ ipsec_mb_secondary_qp_op(int dev_id, int qp_id,
 	qp_req_msg.num_fds = 0;
 	ret = rte_mp_request_sync(&qp_req_msg, &qp_resp, &ts);
 	if (ret) {
-		RTE_LOG(ERR, USER1, "Create MR request to primary process failed.");
+		IPSEC_MB_LOG(ERR, "Create MR request to primary process failed.");
 		return -1;
 	}
 	qp_resp_msg = &qp_resp.msgs[0];
Signature · 1 line
2.39.1