Skip to content

Commit

Permalink
cryptodev: use a dynamic logtype
Browse files Browse the repository at this point in the history
The cryptodev logs are all referenced via rte_cryptodev.h,
so make it dynamic there.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Akhil Goyal <gakhil@marvell.com>
  • Loading branch information
shemminger authored and david-marchand committed Dec 12, 2023
1 parent 620b269 commit e5dc404
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/cryptodev/rte_cryptodev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
7 changes: 6 additions & 1 deletion lib/cryptodev/rte_cryptodev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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", \
Expand Down
1 change: 1 addition & 0 deletions lib/cryptodev/version.map
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion lib/log/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
2 changes: 1 addition & 1 deletion lib/log/rte_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit e5dc404

Please sign in to comment.