[v6,4/5] vhost: use logtype instead of RTE_LOGTYPE_USER1

Message ID 20230220185001.50714-5-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Replace use of RTE_LOGTYPE_USER1 in libraries |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Feb. 20, 2023, 6:50 p.m. UTC
  Fix instances of USER1 logtype in fdset and crypto
sections.

Acked-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/vhost/fd_man.c       | 4 ++--
 lib/vhost/vhost_crypto.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
  

Comments

David Marchand Feb. 21, 2023, 10:39 a.m. UTC | #1
On Mon, Feb 20, 2023 at 7:50 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> Fix instances of USER1 logtype in fdset and crypto
> sections.
>
> Acked-by: Chenbo Xia <chenbo.xia@intel.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/vhost/fd_man.c       | 4 ++--
>  lib/vhost/vhost_crypto.c | 4 ++++
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
> index 1876fada3354..46037d02784e 100644
> --- a/lib/vhost/fd_man.c
> +++ b/lib/vhost/fd_man.c
> @@ -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

Oh, I did not follow the previous revisions, but now that I see this, nice hack.

>
>  #define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL)
>
> diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
> index f02bf865c349..ad420ea012d0 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,6 +17,9 @@
>  #define IV_OFFSET              (sizeof(struct rte_crypto_op) + \
>                                 sizeof(struct rte_crypto_sym_op))
>
> +RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
> +#define RTE_LOGTYPE_VHOST_CRYPTO       vhost_crypto_logtype
> +
>  #ifdef RTE_LIBRTE_VHOST_DEBUG
>  #define VC_LOG_ERR(fmt, args...)                               \
>         RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n",     \

However, there is something missing here.

Existing code was directly using RTE_LOGTYPE_USER1.
We still need to update:

diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index ad420ea012..d2b4af1d1c 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -22,20 +22,20 @@ RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);

 #ifdef RTE_LIBRTE_VHOST_DEBUG
 #define VC_LOG_ERR(fmt, args...)                               \
-       RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n",     \
+       RTE_LOG(ERR, VHOST_CRYPTO, "[%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",    \
+       RTE_LOG(INFO, VHOST_CRYPTO, "[%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",   \
+       RTE_LOG(DEBUG, VHOST_CRYPTO, "[%s] %s() line %u: " fmt "\n",    \
                "Vhost-Crypto", __func__, __LINE__, ## args)
 #else
 #define VC_LOG_ERR(fmt, args...)                               \
-       RTE_LOG(ERR, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
+       RTE_LOG(ERR, VHOST_CRYPTO, "[VHOST-Crypto]: " fmt "\n", ## args)
 #define VC_LOG_INFO(fmt, args...)                              \
-       RTE_LOG(INFO, USER1, "[VHOST-Crypto]: " fmt "\n", ## args)
+       RTE_LOG(INFO, VHOST_CRYPTO, "[VHOST-Crypto]: " fmt "\n", ## args)
 #define VC_LOG_DBG(fmt, args...)
 #endif
  

Patch

diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
index 1876fada3354..46037d02784e 100644
--- a/lib/vhost/fd_man.c
+++ b/lib/vhost/fd_man.c
@@ -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)
 
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index f02bf865c349..ad420ea012d0 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,6 +17,9 @@ 
 #define IV_OFFSET		(sizeof(struct rte_crypto_op) + \
 				sizeof(struct rte_crypto_sym_op))
 
+RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO);
+#define RTE_LOGTYPE_VHOST_CRYPTO	vhost_crypto_logtype
+
 #ifdef RTE_LIBRTE_VHOST_DEBUG
 #define VC_LOG_ERR(fmt, args...)				\
 	RTE_LOG(ERR, USER1, "[%s] %s() line %u: " fmt "\n",	\