crypto/null: add dynamic logging
Registered new dynamic logtype for driver and replaced NULL_CRYPTO_LOG_ERR and CDEV_LOG_ERR with the new NULL_LOG macro, which uses the new logtype. Signed-off-by: Pallantla Poornima <pallantlax.poornima@intel.com> Reviewed-by: Reshma Pattan <reshma.pattan@intel.com> Reviewed-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
This commit is contained in:
parent
094b2386f4
commit
735b783d8c
@ -161,10 +161,9 @@ cryptodev_null_create(const char *name,
|
|||||||
{
|
{
|
||||||
struct rte_cryptodev *dev;
|
struct rte_cryptodev *dev;
|
||||||
struct null_crypto_private *internals;
|
struct null_crypto_private *internals;
|
||||||
|
|
||||||
dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
|
dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
NULL_CRYPTO_LOG_ERR("failed to create cryptodev vdev");
|
NULL_LOG(ERR, "failed to create cryptodev vdev");
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,8 +208,9 @@ cryptodev_null_probe(struct rte_vdev_device *dev)
|
|||||||
|
|
||||||
retval = rte_cryptodev_pmd_parse_input_args(&init_params, args);
|
retval = rte_cryptodev_pmd_parse_input_args(&init_params, args);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
RTE_LOG(ERR, PMD,
|
NULL_LOG(ERR,
|
||||||
"Failed to parse initialisation arguments[%s]\n", args);
|
"Failed to parse initialisation arguments[%s]",
|
||||||
|
args);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,3 +249,10 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_NULL_PMD,
|
|||||||
"socket_id=<int>");
|
"socket_id=<int>");
|
||||||
RTE_PMD_REGISTER_CRYPTO_DRIVER(null_crypto_drv, cryptodev_null_pmd_drv.driver,
|
RTE_PMD_REGISTER_CRYPTO_DRIVER(null_crypto_drv, cryptodev_null_pmd_drv.driver,
|
||||||
cryptodev_driver_id);
|
cryptodev_driver_id);
|
||||||
|
|
||||||
|
RTE_INIT(null_init_log);
|
||||||
|
static void
|
||||||
|
null_init_log(void)
|
||||||
|
{
|
||||||
|
null_logtype_driver = rte_log_register("pmd.crypto.null");
|
||||||
|
}
|
||||||
|
@ -163,15 +163,15 @@ null_crypto_pmd_qp_create_processed_pkts_ring(struct null_crypto_qp *qp,
|
|||||||
r = rte_ring_lookup(qp->name);
|
r = rte_ring_lookup(qp->name);
|
||||||
if (r) {
|
if (r) {
|
||||||
if (rte_ring_get_size(r) >= ring_size) {
|
if (rte_ring_get_size(r) >= ring_size) {
|
||||||
NULL_CRYPTO_LOG_INFO(
|
NULL_LOG(INFO,
|
||||||
"Reusing existing ring %s for processed packets",
|
"Reusing existing ring %s for "
|
||||||
qp->name);
|
" processed packets", qp->name);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
NULL_CRYPTO_LOG_INFO(
|
NULL_LOG(INFO,
|
||||||
"Unable to reuse existing ring %s for processed packets",
|
"Unable to reuse existing ring %s for "
|
||||||
qp->name);
|
" processed packets", qp->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
|
|||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
if (qp_id >= internals->max_nb_qpairs) {
|
if (qp_id >= internals->max_nb_qpairs) {
|
||||||
NULL_CRYPTO_LOG_ERR("Invalid qp_id %u, greater than maximum "
|
NULL_LOG(ERR, "Invalid qp_id %u, greater than maximum "
|
||||||
"number of queue pairs supported (%u).",
|
"number of queue pairs supported (%u).",
|
||||||
qp_id, internals->max_nb_qpairs);
|
qp_id, internals->max_nb_qpairs);
|
||||||
return (-EINVAL);
|
return (-EINVAL);
|
||||||
@ -204,7 +204,7 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
|
|||||||
qp = rte_zmalloc_socket("Null Crypto PMD Queue Pair", sizeof(*qp),
|
qp = rte_zmalloc_socket("Null Crypto PMD Queue Pair", sizeof(*qp),
|
||||||
RTE_CACHE_LINE_SIZE, socket_id);
|
RTE_CACHE_LINE_SIZE, socket_id);
|
||||||
if (qp == NULL) {
|
if (qp == NULL) {
|
||||||
NULL_CRYPTO_LOG_ERR("Failed to allocate queue pair memory");
|
NULL_LOG(ERR, "Failed to allocate queue pair memory");
|
||||||
return (-ENOMEM);
|
return (-ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,15 +213,16 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
|
|||||||
|
|
||||||
retval = null_crypto_pmd_qp_set_unique_name(dev, qp);
|
retval = null_crypto_pmd_qp_set_unique_name(dev, qp);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
NULL_CRYPTO_LOG_ERR("Failed to create unique name for null "
|
NULL_LOG(ERR, "Failed to create unique name for null "
|
||||||
"crypto device");
|
"crypto device");
|
||||||
|
|
||||||
goto qp_setup_cleanup;
|
goto qp_setup_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
qp->processed_pkts = null_crypto_pmd_qp_create_processed_pkts_ring(qp,
|
qp->processed_pkts = null_crypto_pmd_qp_create_processed_pkts_ring(qp,
|
||||||
qp_conf->nb_descriptors, socket_id);
|
qp_conf->nb_descriptors, socket_id);
|
||||||
if (qp->processed_pkts == NULL) {
|
if (qp->processed_pkts == NULL) {
|
||||||
NULL_CRYPTO_LOG_ERR("Failed to create unique name for null "
|
NULL_LOG(ERR, "Failed to create unique name for null "
|
||||||
"crypto device");
|
"crypto device");
|
||||||
goto qp_setup_cleanup;
|
goto qp_setup_cleanup;
|
||||||
}
|
}
|
||||||
@ -280,19 +281,19 @@ null_crypto_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (unlikely(sess == NULL)) {
|
if (unlikely(sess == NULL)) {
|
||||||
NULL_CRYPTO_LOG_ERR("invalid session struct");
|
NULL_LOG(ERR, "invalid session struct");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rte_mempool_get(mp, &sess_private_data)) {
|
if (rte_mempool_get(mp, &sess_private_data)) {
|
||||||
CDEV_LOG_ERR(
|
NULL_LOG(ERR,
|
||||||
"Couldn't get object from session mempool");
|
"Couldn't get object from session mempool");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = null_crypto_set_session_parameters(sess_private_data, xform);
|
ret = null_crypto_set_session_parameters(sess_private_data, xform);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
NULL_CRYPTO_LOG_ERR("failed configure session parameters");
|
NULL_LOG(ERR, "failed configure session parameters");
|
||||||
|
|
||||||
/* Return session to mempool */
|
/* Return session to mempool */
|
||||||
rte_mempool_put(mp, sess_private_data);
|
rte_mempool_put(mp, sess_private_data);
|
||||||
|
@ -8,25 +8,12 @@
|
|||||||
#define CRYPTODEV_NAME_NULL_PMD crypto_null
|
#define CRYPTODEV_NAME_NULL_PMD crypto_null
|
||||||
/**< Null crypto PMD device name */
|
/**< Null crypto PMD device name */
|
||||||
|
|
||||||
#define NULL_CRYPTO_LOG_ERR(fmt, args...) \
|
int null_logtype_driver;
|
||||||
RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
|
|
||||||
RTE_STR(CRYPTODEV_NAME_NULL_PMD), \
|
|
||||||
__func__, __LINE__, ## args)
|
|
||||||
|
|
||||||
#ifdef RTE_LIBRTE_NULL_CRYPTO_DEBUG
|
#define NULL_LOG(level, fmt, ...) \
|
||||||
#define NULL_CRYPTO_LOG_INFO(fmt, args...) \
|
rte_log(RTE_LOG_ ## level, null_logtype_driver, \
|
||||||
RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
|
"%s() line %u: "fmt "\n", __func__, __LINE__, \
|
||||||
RTE_STR(CRYPTODEV_NAME_NULL_PMD), \
|
## __VA_ARGS__)
|
||||||
__func__, __LINE__, ## args)
|
|
||||||
|
|
||||||
#define NULL_CRYPTO_LOG_DBG(fmt, args...) \
|
|
||||||
RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
|
|
||||||
RTE_STR(CRYPTODEV_NAME_NULL_PMD), \
|
|
||||||
__func__, __LINE__, ## args)
|
|
||||||
#else
|
|
||||||
#define NULL_CRYPTO_LOG_INFO(fmt, args...)
|
|
||||||
#define NULL_CRYPTO_LOG_DBG(fmt, args...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/** private data structure for each NULL crypto device */
|
/** private data structure for each NULL crypto device */
|
||||||
|
Loading…
Reference in New Issue
Block a user