From: Naga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>
To: dev@dpdk.org
Cc: pablo.de.lara.guarch@intel.com, reshma.pattan@intel.com,
Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>
Subject: [dpdk-dev] [PATCH v2] crypto/aesni_gcm: add dynamic logging
Date: Thu, 28 Jun 2018 15:47:12 +0100 [thread overview]
Message-ID: <1530197232-24387-1-git-send-email-naga.sureshx.somarowthu@intel.com> (raw)
In-Reply-To: <1528786244-24821-1-git-send-email-naga.sureshx.somarowthu@intel.com>
From: Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>
1.added new logtype for aesni_gcm driver.
2.registered new logtype.
3.GCM_LOG_ERR and CDEV_LOG_ERR are replaced with
new logtype name AESNI_GCM_PMD_LOG.
Signed-off-by: Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>
Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
Reviewed-by: Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>
---
v2:
Changed suggested macro name and title
Removed unused CONFIG_RTE_LIBRTE_PMD_AESNI_GCM_DEBUG=n from config file
---
config/common_base | 1 -
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 29 ++++++++++++++++--------
drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c | 15 ++++++------
drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h | 25 +++++---------------
4 files changed, 32 insertions(+), 38 deletions(-)
diff --git a/config/common_base b/config/common_base
index 6b0d1cbbb..c6cf14572 100644
--- a/config/common_base
+++ b/config/common_base
@@ -526,7 +526,6 @@ CONFIG_RTE_LIBRTE_PMD_OPENSSL_DEBUG=n
# Compile PMD for AESNI GCM device
#
CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=n
-CONFIG_RTE_LIBRTE_PMD_AESNI_GCM_DEBUG=n
#
# Compile PMD for SNOW 3G device
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index 80360dd9c..d196826f0 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -31,8 +31,8 @@ aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *gcm_ops,
if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH) {
auth_xform = xform;
if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_AES_GMAC) {
- GCM_LOG_ERR("Only AES GMAC is supported as an "
- "authentication only algorithm");
+ AESNI_GCM_LOG(ERR, "Only AES GMAC is supported as an "
+ "authentication only algorithm");
return -ENOTSUP;
}
/* Set IV parameters */
@@ -54,7 +54,7 @@ aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *gcm_ops,
aead_xform = xform;
if (aead_xform->aead.algo != RTE_CRYPTO_AEAD_AES_GCM) {
- GCM_LOG_ERR("The only combined operation "
+ AESNI_GCM_LOG(ERR, "The only combined operation "
"supported is AES GCM");
return -ENOTSUP;
}
@@ -75,7 +75,7 @@ aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *gcm_ops,
sess->aad_length = aead_xform->aead.aad_length;
digest_length = aead_xform->aead.digest_length;
} else {
- GCM_LOG_ERR("Wrong xform type, has to be AEAD or authentication");
+ AESNI_GCM_LOG(ERR, "Wrong xform type, has to be AEAD or authentication");
return -ENOTSUP;
}
@@ -83,7 +83,7 @@ aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *gcm_ops,
/* IV check */
if (sess->iv.length != 16 && sess->iv.length != 12 &&
sess->iv.length != 0) {
- GCM_LOG_ERR("Wrong IV length");
+ AESNI_GCM_LOG(ERR, "Wrong IV length");
return -EINVAL;
}
@@ -99,7 +99,7 @@ aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *gcm_ops,
sess->key = AESNI_GCM_KEY_256;
break;
default:
- GCM_LOG_ERR("Invalid key length");
+ AESNI_GCM_LOG(ERR, "Invalid key length");
return -EINVAL;
}
@@ -109,7 +109,7 @@ aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *gcm_ops,
if (digest_length != 16 &&
digest_length != 12 &&
digest_length != 8) {
- GCM_LOG_ERR("digest");
+ AESNI_GCM_LOG(ERR, "Invalid digest length");
return -EINVAL;
}
sess->digest_length = digest_length;
@@ -464,13 +464,13 @@ aesni_gcm_create(const char *name,
/* Check CPU for support for AES instruction set */
if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_AES)) {
- GCM_LOG_ERR("AES instructions not supported by CPU");
+ AESNI_GCM_LOG(ERR, "AES instructions not supported by CPU");
return -EFAULT;
}
-
dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
if (dev == NULL) {
- GCM_LOG_ERR("driver %s: create failed", init_params->name);
+ AESNI_GCM_LOG(ERR, "driver %s: create failed",
+ init_params->name);
return -ENODEV;
}
@@ -572,3 +572,12 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_GCM_PMD,
"socket_id=<int>");
RTE_PMD_REGISTER_CRYPTO_DRIVER(aesni_gcm_crypto_drv, aesni_gcm_pmd_drv.driver,
cryptodev_driver_id);
+
+
+RTE_INIT(aesni_gcm_init_log);
+static void
+aesni_gcm_init_log(void)
+{
+ aesni_gcm_logtype_driver = rte_log_register("pmd.crypto.aesni_gcm");
+
+}
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
index 6f542137c..eacbdc09a 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c
@@ -183,12 +183,11 @@ aesni_gcm_pmd_qp_create_processed_pkts_ring(struct aesni_gcm_qp *qp,
r = rte_ring_lookup(qp->name);
if (r) {
if (rte_ring_get_size(r) >= ring_size) {
- GCM_LOG_INFO("Reusing existing ring %s for processed"
- " packets", qp->name);
+ AESNI_GCM_LOG(INFO, "Reusing existing ring %s for processed"
+ " packets", qp->name);
return r;
}
-
- GCM_LOG_ERR("Unable to reuse existing ring %s for processed"
+ AESNI_GCM_LOG(ERR, "Unable to reuse existing ring %s for processed"
" packets", qp->name);
return NULL;
}
@@ -284,19 +283,19 @@ aesni_gcm_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
struct aesni_gcm_private *internals = dev->data->dev_private;
if (unlikely(sess == NULL)) {
- GCM_LOG_ERR("invalid session struct");
+ AESNI_GCM_LOG(ERR, "invalid session struct");
return -EINVAL;
}
if (rte_mempool_get(mempool, &sess_private_data)) {
- CDEV_LOG_ERR(
- "Couldn't get object from session mempool");
+ AESNI_GCM_LOG(ERR,
+ "Couldn't get object from session mempool");
return -ENOMEM;
}
ret = aesni_gcm_set_session_parameters(gcm_ops[internals->vector_mode],
sess_private_data, xform);
if (ret != 0) {
- GCM_LOG_ERR("failed configure session parameters");
+ AESNI_GCM_LOG(ERR, "failed configure session parameters");
/* Return session to mempool */
rte_mempool_put(mempool, sess_private_data);
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
index 3d60583b0..2b9c251c0 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h
@@ -10,25 +10,12 @@
#define CRYPTODEV_NAME_AESNI_GCM_PMD crypto_aesni_gcm
/**< AES-NI GCM PMD device name */
-#define GCM_LOG_ERR(fmt, args...) \
- RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
- RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), \
- __func__, __LINE__, ## args)
-
-#ifdef RTE_LIBRTE_AESNI_MB_DEBUG
-#define GCM_LOG_INFO(fmt, args...) \
- RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
- RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), \
- __func__, __LINE__, ## args)
-
-#define GCM_LOG_DBG(fmt, args...) \
- RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
- RTE_STR(CRYPTODEV_NAME_AESNI_GCM_PMD), \
- __func__, __LINE__, ## args)
-#else
-#define GCM_LOG_INFO(fmt, args...)
-#define GCM_LOG_DBG(fmt, args...)
-#endif
+/** AES-NI GCM PMD LOGTYPE DRIVER */
+int aesni_gcm_logtype_driver;
+#define AESNI_GCM_LOG(level, fmt, ...) \
+ rte_log(RTE_LOG_ ## level, aesni_gcm_logtype_driver, \
+ "%s() line %u: "fmt "\n", __func__, __LINE__, \
+ ## __VA_ARGS__)
/* Maximum length for digest */
#define DIGEST_LENGTH_MAX 16
--
2.13.6
next prev parent reply other threads:[~2018-06-28 14:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 6:50 [dpdk-dev] [PATCH] crypto/aesni_gcm: add dynamic logging to aesni_gcm Naga Suresh Somarowthu
2018-06-27 15:13 ` De Lara Guarch, Pablo
2018-06-28 14:47 ` Naga Suresh Somarowthu [this message]
2018-07-03 8:37 ` [dpdk-dev] [PATCH v2] crypto/aesni_gcm: add dynamic logging De Lara Guarch, Pablo
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=1530197232-24387-1-git-send-email-naga.sureshx.somarowthu@intel.com \
--to=naga.sureshx.somarowthu@intel.com \
--cc=dev@dpdk.org \
--cc=pablo.de.lara.guarch@intel.com \
--cc=reshma.pattan@intel.com \
--cc=tallurix.chaitanya.babu@intel.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).