From e5dc404d33ac1c6cea5c62a88489746c5cb5e35e Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 11 Dec 2023 12:17:32 -0800 Subject: [PATCH] cryptodev: use a dynamic logtype The cryptodev logs are all referenced via rte_cryptodev.h, so make it dynamic there. Signed-off-by: Stephen Hemminger Acked-by: Akhil Goyal --- lib/cryptodev/rte_cryptodev.c | 2 ++ lib/cryptodev/rte_cryptodev.h | 7 ++++++- lib/cryptodev/version.map | 1 + lib/log/log.c | 1 - lib/log/rte_log.h | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index b2588277342..25e3ec12d1d 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 aaeaf294e6b..30ad2d9a950 100644 --- a/lib/cryptodev/rte_cryptodev.h +++ b/lib/cryptodev/rte_cryptodev.h @@ -28,8 +28,13 @@ extern "C" { extern const char **rte_cyptodev_names; -/* Logging Macros */ +/** + * @internal Logtype used for cryptodev related messages. + */ +extern int rte_cryptodev_logtype; +#define RTE_LOGTYPE_CRYPTODEV rte_cryptodev_logtype +/* Logging Macros */ #define CDEV_LOG_ERR(...) \ RTE_LOG(ERR, CRYPTODEV, \ RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map index c39199be54f..54360a5da53 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 e3cd4cff0fb..ab06132a98a 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 27fb6129a7a..3394746103d 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 */