cryptodev: convert to dynamic logtype

Message ID 20231211201733.127771-1-stephen@networkplumber.org (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series cryptodev: convert to dynamic logtype |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Stephen Hemminger Dec. 11, 2023, 8:17 p.m. UTC
  The cryptodev logs are all referenced via rte_crytpodev.h
so make it dynamic there.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/cryptodev/rte_cryptodev.c | 2 ++
 lib/cryptodev/rte_cryptodev.h | 2 ++
 lib/cryptodev/version.map     | 1 +
 lib/log/log.c                 | 1 -
 lib/log/rte_log.h             | 2 +-
 5 files changed, 6 insertions(+), 2 deletions(-)
  

Comments

David Marchand Dec. 12, 2023, 7:50 a.m. UTC | #1
On Mon, Dec 11, 2023 at 9:18 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> The cryptodev logs are all referenced via rte_crytpodev.h

crypto*

> so make it dynamic there.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

I would add a comment in the header that this exported logtype
variable is for internal use.
Otherwise it lgtm.

Akhil, do you mind if I take this directly in main?
  
Akhil Goyal Dec. 12, 2023, 8:14 a.m. UTC | #2
> On Mon, Dec 11, 2023 at 9:18 PM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > The cryptodev logs are all referenced via rte_crytpodev.h
> 
> crypto*
> 
> > so make it dynamic there.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> I would add a comment in the header that this exported logtype
> variable is for internal use.
> Otherwise it lgtm.
> 
> Akhil, do you mind if I take this directly in main?
No issues, you can take it directly in main.

Acked-by: Akhil Goyal <gakhil@marvell.com>
  
David Marchand Dec. 12, 2023, 1:01 p.m. UTC | #3
On Mon, Dec 11, 2023 at 9:18 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> The cryptodev logs are all referenced via rte_crytpodev.h
> so make it dynamic there.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Applied, thanks.
  

Patch

diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index b25882773421..25e3ec12d1df 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -49,6 +49,8 @@  struct rte_crypto_fp_ops rte_crypto_fp_ops[RTE_CRYPTO_MAX_DEVS];
 /* spinlock for crypto device callbacks */
 static rte_spinlock_t rte_cryptodev_cb_lock = RTE_SPINLOCK_INITIALIZER;
 
+RTE_LOG_REGISTER_DEFAULT(rte_cryptodev_logtype, INFO);
+
 /**
  * The user application callback description.
  *
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index aaeaf294e6bb..82b711395a5b 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -29,6 +29,8 @@  extern "C" {
 extern const char **rte_cyptodev_names;
 
 /* Logging Macros */
+extern int rte_cryptodev_logtype;
+#define RTE_LOGTYPE_CRYPTODEV	rte_cryptodev_logtype
 
 #define CDEV_LOG_ERR(...) \
 	RTE_LOG(ERR, CRYPTODEV, \
diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map
index c39199be54f5..54360a5da538 100644
--- a/lib/cryptodev/version.map
+++ b/lib/cryptodev/version.map
@@ -44,6 +44,7 @@  DPDK_24 {
 	rte_cryptodev_get_sec_ctx;
 	rte_cryptodev_info_get;
 	rte_cryptodev_is_valid_dev;
+	rte_cryptodev_logtype;
 	rte_cryptodev_name_get;
 	rte_cryptodev_queue_pair_count;
 	rte_cryptodev_queue_pair_setup;
diff --git a/lib/log/log.c b/lib/log/log.c
index e3cd4cff0fbc..ab06132a98a1 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -356,7 +356,6 @@  static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_PORT,       "lib.port"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
-	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
 	{RTE_LOGTYPE_USER2,      "user2"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 27fb6129a7aa..2d5eb23eeedf 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -43,7 +43,7 @@  extern "C" {
 #define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
 				 /* was RTE_LOGTYPE_MBUF */
-#define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
+			         /* was RTE_LOGTYPE_CRYPTODEV */
 				 /* was RTE_LOGTYPE_EFD */
 #define RTE_LOGTYPE_EVENTDEV  19 /**< Log related to eventdev. */
 				 /* was RTE_LOGTYPE_GSO */