DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Chenbo Xia <chenbo.xia@intel.com>,
	Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [PATCH v2 4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1
Date: Thu,  9 Feb 2023 09:11:41 -0800	[thread overview]
Message-ID: <20230209171142.94938-5-stephen@networkplumber.org> (raw)
In-Reply-To: <20230209171142.94938-1-stephen@networkplumber.org>

Fix instances of USER1 logtype in fdset and crypto
sections.

Acked-by: Chenbo Xia <chenbo.xia@intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/vhost/fd_man.c       | 16 +++++++++-------
 lib/vhost/vhost_crypto.c | 25 +++++++++++--------------
 2 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
index 1876fada3354..172f7dc03ab2 100644
--- a/lib/vhost/fd_man.c
+++ b/lib/vhost/fd_man.c
@@ -10,8 +10,10 @@
 
 #include "fd_man.h"
 
-
-#define RTE_LOGTYPE_VHOST_FDMAN RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO);
+#define FDSET_LOG(level, fmt, args...)		\
+	rte_log(RTE_LOG_ ## level, vhost_fdset_logtype,	\
+		"%s(): " fmt "\n", __func__, ## args)
 
 #define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
 
@@ -334,8 +336,8 @@ fdset_pipe_init(struct fdset *fdset)
 	int ret;
 
 	if (pipe(fdset->u.pipefd) < 0) {
-		RTE_LOG(ERR, VHOST_FDMAN,
-			"failed to create pipe for vhost fdset\n");
+		FDSET_LOG(ERR,
+			"failed to create pipe for vhost fdset");
 		return -1;
 	}
 
@@ -343,9 +345,9 @@ fdset_pipe_init(struct fdset *fdset)
 			fdset_pipe_read_cb, NULL, NULL);
 
 	if (ret < 0) {
-		RTE_LOG(ERR, VHOST_FDMAN,
-			"failed to add pipe readfd %d into vhost server fdset\n",
-			fdset->u.readfd);
+		FDSET_LOG(ERR,
+			  "failed to add pipe readfd %d into vhost server fdset",
+			  fdset->u.readfd);
 
 		fdset_pipe_uninit(fdset);
 		return -1;
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index f02bf865c349..3be46614c22a 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -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,18 @@
 #define IV_OFFSET		(sizeof(struct rte_crypto_op) + \
 				sizeof(struct rte_crypto_sym_op))
 
+RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
+
+#define VC_LOG(level, fmt, args...)				\
+	rte_log(RTE_LOG_ ## level, vhost_crypto_logtype,	\
+		"%s():%u: " fmt "\n", __func__, __LINE__, ## args)
+
+#define VC_LOG_ERR(fmt, args...)	VC_LOG(ERR, fmt, ## args)
+#define VC_LOG_INFO(fmt, args...)	VC_LOG(INFO, fmt, ## args)
+
 #ifdef RTE_LIBRTE_VHOST_DEBUG
-#define VC_LOG_ERR(fmt, args...)				\
-	RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n",	\
-		"Vhost-Crypto",	__func__, __LINE__, ## args)
-#define VC_LOG_INFO(fmt, args...)				\
-	RTE_LOG(INFO, USER1, "[%s] %s() line %u: " fmt "\n",	\
-		"Vhost-Crypto",	__func__, __LINE__, ## args)
-
-#define VC_LOG_DBG(fmt, args...)				\
-	RTE_LOG(DEBUG, USER1, "[%s] %s() line %u: " fmt "\n",	\
-		"Vhost-Crypto",	__func__, __LINE__, ## args)
+#define VC_LOG_DBG(fmt, args...)	VC_LOG(DEBUG, fmt, ## 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
 
-- 
2.39.1


  parent reply	other threads:[~2023-02-09 17:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <^[[200~https://inbox.dpdk.org/dev/20230208044825.1682620-1-stephen@networkplumber.org>
2023-02-09 17:11 ` [PATCH v2 0/5] Replace use of RTE_LOGTYPE_USER1 in libraries Stephen Hemminger
2023-02-09 17:11   ` [PATCH v2 1/5] ip_frag: use a dynamic logtype Stephen Hemminger
2023-02-09 17:11   ` [PATCH v2 2/5] reorder: " Stephen Hemminger
2023-02-09 17:11   ` [PATCH v2 3/5] latencystats: use " Stephen Hemminger
2023-02-09 17:11   ` Stephen Hemminger [this message]
2023-02-09 17:11   ` [PATCH v2 5/5] ipsec: fix usage of RTE_LOGTYPE_USER1 Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230209171142.94938-5-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).