DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Sunil Uttarwar <sunilprakashrao.uttarwar@amd.com>
Subject: [PATCH 6/6] crypto/ccp: use a dynamic logtype
Date: Tue, 25 Jun 2024 14:24:14 +0200	[thread overview]
Message-ID: <20240625122414.1065829-7-david.marchand@redhat.com> (raw)
In-Reply-To: <20240625122414.1065829-1-david.marchand@redhat.com>

Register a logtype for this bus driver and stop logging as CRYPTODEV.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/crypto/ccp/ccp_crypto.c      |  4 ++--
 drivers/crypto/ccp/ccp_pmd_private.h | 15 +++++----------
 drivers/crypto/ccp/rte_ccp_pmd.c     |  2 ++
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c
index 4b84b3303e..5899d83bae 100644
--- a/drivers/crypto/ccp/ccp_crypto.c
+++ b/drivers/crypto/ccp/ccp_crypto.c
@@ -1829,7 +1829,7 @@ ccp_perform_sha3_hmac(struct rte_crypto_op *op,
 	append_ptr = (uint8_t *)rte_pktmbuf_append(op->sym->m_src,
 						session->auth.ctx_len);
 	if (!append_ptr) {
-		CCP_LOG_ERR("CCP MBUF append failed\n");
+		CCP_LOG_ERR("CCP MBUF append failed");
 		return -1;
 	}
 	dest_addr = (phys_addr_t)rte_mem_virt2iova((void *)append_ptr);
@@ -1966,7 +1966,7 @@ ccp_perform_sha3(struct rte_crypto_op *op,
 	append_ptr = (uint8_t *)rte_pktmbuf_append(op->sym->m_src,
 						session->auth.ctx_len);
 	if (!append_ptr) {
-		CCP_LOG_ERR("CCP MBUF append failed\n");
+		CCP_LOG_ERR("CCP MBUF append failed");
 		return -1;
 	}
 	dest_addr = (phys_addr_t)rte_mem_virt2iova((void *)append_ptr);
diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h
index 390442ff19..94c8fec46d 100644
--- a/drivers/crypto/ccp/ccp_pmd_private.h
+++ b/drivers/crypto/ccp/ccp_pmd_private.h
@@ -8,23 +8,18 @@
 #include <rte_cryptodev.h>
 #include "ccp_crypto.h"
 
-#define CRYPTODEV_NAME_CCP_PMD crypto_ccp
+extern int crypto_ccp_logtype;
+#define RTE_LOGTYPE_CRYPTO_CCP crypto_ccp_logtype
 
 #define CCP_LOG_ERR(fmt, args...) \
-	RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n",  \
-			RTE_STR(CRYPTODEV_NAME_CCP_PMD), \
-			__func__, __LINE__, ## args)
+	RTE_LOG_LINE(ERR, CRYPTO_CCP, "%s() line %u: " fmt, __func__, __LINE__, ## args)
 
 #ifdef RTE_LIBRTE_CCP_DEBUG
 #define CCP_LOG_INFO(fmt, args...) \
-	RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
-			RTE_STR(CRYPTODEV_NAME_CCP_PMD), \
-			__func__, __LINE__, ## args)
+	RTE_LOG_LINE(INFO, CRYPTO_CCP, "%s() line %u: " fmt, __func__, __LINE__, ## args)
 
 #define CCP_LOG_DBG(fmt, args...) \
-	RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
-			RTE_STR(CRYPTODEV_NAME_CCP_PMD), \
-			__func__, __LINE__, ## args)
+	RTE_LOG_LINE(DEBUG, CRYPTO_CCP, "%s() line %u: " fmt, __func__, __LINE__, ## args)
 #else
 #define CCP_LOG_INFO(fmt, args...)
 #define CCP_LOG_DBG(fmt, args...)
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 869399597e..022c1df182 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -22,6 +22,7 @@
 static unsigned int ccp_pmd_init_done;
 uint8_t ccp_cryptodev_driver_id;
 uint8_t cryptodev_cnt;
+int crypto_ccp_logtype;
 
 struct ccp_pmd_init_params {
 	struct rte_cryptodev_pmd_init_params def_p;
@@ -320,3 +321,4 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_CCP_PMD,
 	"ccp_auth_opt=<int>");
 RTE_PMD_REGISTER_CRYPTO_DRIVER(ccp_crypto_drv, cryptodev_ccp_pmd_drv.driver,
 			       ccp_cryptodev_driver_id);
+RTE_LOG_REGISTER_DEFAULT(crypto_ccp_logtype, NOTICE);
-- 
2.45.2


  parent reply	other threads:[~2024-06-25 12:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 12:24 [PATCH 0/6] Some drivers logging cleanups David Marchand
2024-06-25 12:24 ` [PATCH 1/6] vdpa/sfc: remove dead code David Marchand
2024-06-25 14:25   ` Andrew Rybchenko
2024-06-25 12:24 ` [PATCH 2/6] drivers: use dedicated log macros instead of EAL logtype David Marchand
2024-06-25 12:24 ` [PATCH 3/6] net/sfc: remove use " David Marchand
2024-06-25 14:26   ` Andrew Rybchenko
2024-06-25 12:24 ` [PATCH 4/6] vdpa/sfc: " David Marchand
2024-06-25 12:24 ` [PATCH 5/6] bus/pci: use a dynamic logtype David Marchand
2024-06-26  2:05   ` Chenbo Xia
2024-06-25 12:24 ` David Marchand [this message]
2024-06-28 11:57   ` [PATCH 6/6] crypto/ccp: " David Marchand

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=20240625122414.1065829-7-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=sunilprakashrao.uttarwar@amd.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).