DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] crypto/kasumi: add dynamic logging to kasumi
@ 2018-06-25  5:23 Naga Suresh Somarowthu
  2018-06-27 15:15 ` De Lara Guarch, Pablo
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Naga Suresh Somarowthu @ 2018-06-25  5:23 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch, reshma.pattan, Naga Suresh Somarowthu

1.added new logtype for kasumi driver.
2.registered new logtype.
3.KASUMI_LOG_ERR and CDEV_LOG_ERR are
  replaced with new logtype name KASUMI_PMD_LOG.

Signed-off-by: Naga Suresh Somarowthu <naga.sureshx.somarowthu@intel.com>
Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
---
 drivers/crypto/kasumi/rte_kasumi_pmd.c         | 29 +++++++++++++++++---------
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c     | 14 ++++++-------
 drivers/crypto/kasumi/rte_kasumi_pmd_private.h | 26 +++++++----------------
 3 files changed, 33 insertions(+), 36 deletions(-)

diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 205dc1de7..bf48b7006 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016-2017 Intel Corporation
+ * Copyright(c) 2016-2018 Intel Corporation
  */
 
 #include <rte_common.h>
@@ -79,18 +79,19 @@ kasumi_set_session_parameters(struct kasumi_session *sess,
 		break;
 	case KASUMI_OP_NOT_SUPPORTED:
 	default:
-		KASUMI_LOG_ERR("Unsupported operation chain order parameter");
+		KASUMI_PMD_LOG(ERR, "Unsupported operation chain order parameter");
 		return -ENOTSUP;
 	}
 
 	if (cipher_xform) {
 		/* Only KASUMI F8 supported */
 		if (cipher_xform->cipher.algo != RTE_CRYPTO_CIPHER_KASUMI_F8)
+			KASUMI_PMD_LOG(ERR, "Unsupported cipher algorithm ");
 			return -ENOTSUP;
 
 		sess->cipher_iv_offset = cipher_xform->cipher.iv.offset;
 		if (cipher_xform->cipher.iv.length != KASUMI_IV_LENGTH) {
-			KASUMI_LOG_ERR("Wrong IV length");
+			KASUMI_PMD_LOG(ERR, "Wrong IV length");
 			return -EINVAL;
 		}
 
@@ -102,10 +103,11 @@ kasumi_set_session_parameters(struct kasumi_session *sess,
 	if (auth_xform) {
 		/* Only KASUMI F9 supported */
 		if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_KASUMI_F9)
+			KASUMI_PMD_LOG(ERR, "Unsupported authentication");
 			return -ENOTSUP;
 
 		if (auth_xform->auth.digest_length != KASUMI_DIGEST_LENGTH) {
-			KASUMI_LOG_ERR("Wrong digest length");
+			KASUMI_PMD_LOG(ERR, "Wrong digest length");
 			return -EINVAL;
 		}
 
@@ -213,7 +215,7 @@ process_kasumi_cipher_op_bit(struct rte_crypto_op *op,
 	src = rte_pktmbuf_mtod(op->sym->m_src, uint8_t *);
 	if (op->sym->m_dst == NULL) {
 		op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
-		KASUMI_LOG_ERR("bit-level in-place not supported\n");
+		KASUMI_PMD_LOG(ERR, "bit-level in-place not supported");
 		return 0;
 	}
 	dst = rte_pktmbuf_mtod(op->sym->m_dst, uint8_t *);
@@ -244,7 +246,7 @@ process_kasumi_hash_op(struct kasumi_qp *qp, struct rte_crypto_op **ops,
 		/* Data must be byte aligned */
 		if ((ops[i]->sym->auth.data.offset % BYTE_LEN) != 0) {
 			ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
-			KASUMI_LOG_ERR("offset");
+			KASUMI_PMD_LOG(ERR, "Invalid Offset");
 			break;
 		}
 
@@ -409,9 +411,9 @@ kasumi_pmd_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops,
 				(curr_c_op->sym->m_dst != NULL &&
 				!rte_pktmbuf_is_contiguous(
 						curr_c_op->sym->m_dst))) {
-			KASUMI_LOG_ERR("PMD supports only contiguous mbufs, "
+			KASUMI_PMD_LOG(ERR, "PMD supports only contiguous mbufs, "
 				"op (%p) provides noncontiguous mbuf as "
-				"source/destination buffer.\n", curr_c_op);
+				"source/destination buffer.", curr_c_op);
 			curr_c_op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
 			break;
 		}
@@ -531,7 +533,7 @@ cryptodev_kasumi_create(const char *name,
 
 	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
-		KASUMI_LOG_ERR("failed to create cryptodev vdev");
+		KASUMI_PMD_LOG(ERR, "failed to create cryptodev vdev");
 		goto init_error;
 	}
 
@@ -559,7 +561,7 @@ cryptodev_kasumi_create(const char *name,
 
 	return 0;
 init_error:
-	KASUMI_LOG_ERR("driver %s: cryptodev_kasumi_create failed",
+	KASUMI_PMD_LOG(ERR, "driver %s: failed",
 			init_params->name);
 
 	cryptodev_kasumi_remove(vdev);
@@ -621,3 +623,10 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_KASUMI_PMD,
 	"socket_id=<int>");
 RTE_PMD_REGISTER_CRYPTO_DRIVER(kasumi_crypto_drv,
 		cryptodev_kasumi_pmd_drv.driver, cryptodev_driver_id);
+
+RTE_INIT(kasumi_init_log);
+static void
+kasumi_init_log(void)
+{
+	kasumi_logtype_driver = rte_log_register("pmd.crypto.kasumi");
+}
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
index a388dbb63..7a0f26ab2 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016-2017 Intel Corporation
+ * Copyright(c) 2016-2018 Intel Corporation
  */
 
 #include <string.h>
@@ -171,13 +171,13 @@ kasumi_pmd_qp_create_processed_ops_ring(struct kasumi_qp *qp,
 	r = rte_ring_lookup(qp->name);
 	if (r) {
 		if (rte_ring_get_size(r) == ring_size) {
-			KASUMI_LOG_INFO("Reusing existing ring %s"
+			KASUMI_PMD_LOG(INFO, "Reusing existing ring %s"
 					" for processed packets",
 					 qp->name);
 			return r;
 		}
 
-		KASUMI_LOG_ERR("Unable to reuse existing ring %s"
+		KASUMI_PMD_LOG(ERR, "Unable to reuse existing ring %s"
 				" for processed packets",
 				 qp->name);
 		return NULL;
@@ -269,19 +269,19 @@ kasumi_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
 	int ret;
 
 	if (unlikely(sess == NULL)) {
-		KASUMI_LOG_ERR("invalid session struct");
+		KASUMI_PMD_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");
+		KASUMI_PMD_LOG(ERR,
+				"Couldn't get object from session mempool");
 		return -ENOMEM;
 	}
 
 	ret = kasumi_set_session_parameters(sess_private_data, xform);
 	if (ret != 0) {
-		KASUMI_LOG_ERR("failed configure session parameters");
+		KASUMI_PMD_LOG(ERR, "failed configure session parameters");
 
 		/* Return session to mempool */
 		rte_mempool_put(mempool, sess_private_data);
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
index a397bee65..13223980c 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016-2017 Intel Corporation
+ * Copyright(c) 2016-2018 Intel Corporation
  */
 
 #ifndef _RTE_KASUMI_PMD_PRIVATE_H_
@@ -10,25 +10,13 @@
 #define CRYPTODEV_NAME_KASUMI_PMD	crypto_kasumi
 /**< KASUMI PMD device name */
 
-#define KASUMI_LOG_ERR(fmt, args...) \
-	RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n",  \
-			RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), \
-			__func__, __LINE__, ## args)
+/** KASUMI PMD LOGTYPE DRIVER */
+int kasumi_logtype_driver;
 
-#ifdef RTE_LIBRTE_KASUMI_DEBUG
-#define KASUMI_LOG_INFO(fmt, args...) \
-	RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
-			RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), \
-			__func__, __LINE__, ## args)
-
-#define KASUMI_LOG_DBG(fmt, args...) \
-	RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
-			RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), \
-			__func__, __LINE__, ## args)
-#else
-#define KASUMI_LOG_INFO(fmt, args...)
-#define KASUMI_LOG_DBG(fmt, args...)
-#endif
+#define KASUMI_PMD_LOG(level, fmt, ...)  \
+	rte_log(RTE_LOG_ ## level, kasumi_logtype_driver,  \
+			"%s() line %u: " fmt "\n", __func__, __LINE__,  \
+					## __VA_ARGS__)
 
 #define KASUMI_DIGEST_LENGTH 4
 
-- 
2.13.6

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] crypto/kasumi: add dynamic logging to kasumi
  2018-06-25  5:23 [dpdk-dev] [PATCH] crypto/kasumi: add dynamic logging to kasumi Naga Suresh Somarowthu
@ 2018-06-27 15:15 ` De Lara Guarch, Pablo
  2018-06-27 15:38 ` De Lara Guarch, Pablo
  2018-06-29  9:47 ` [dpdk-dev] [PATCH v2] crypto/kasumi: add dynamic logging Naga Suresh Somarowthu
  2 siblings, 0 replies; 5+ messages in thread
From: De Lara Guarch, Pablo @ 2018-06-27 15:15 UTC (permalink / raw)
  To: Somarowthu, Naga SureshX, dev; +Cc: Pattan, Reshma

Hi Naga,

> -----Original Message-----
> From: Somarowthu, Naga SureshX
> Sent: Monday, June 25, 2018 6:23 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>; Somarowthu, Naga SureshX
> <naga.sureshx.somarowthu@intel.com>
> Subject: [PATCH] crypto/kasumi: add dynamic logging to kasumi
> 
> 1.added new logtype for kasumi driver.
> 2.registered new logtype.
> 3.KASUMI_LOG_ERR and CDEV_LOG_ERR are
>   replaced with new logtype name KASUMI_PMD_LOG.
> 
> Signed-off-by: Naga Suresh Somarowthu
> <naga.sureshx.somarowthu@intel.com>
> Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
>  drivers/crypto/kasumi/rte_kasumi_pmd.c         | 29 +++++++++++++++++---------
>  drivers/crypto/kasumi/rte_kasumi_pmd_ops.c     | 14 ++++++-------
>  drivers/crypto/kasumi/rte_kasumi_pmd_private.h | 26 +++++++----------------
>  3 files changed, 33 insertions(+), 36 deletions(-)

Could you make the following changes?

- Change the macro to KASUMI_LOG, to make it shorter.
- Change title to: crypto/kasumi: add dynamic logging
- Remove unused "CONFIG_RTE_LIBRTE_PMD_KASUMI_DEBUG=n"
from config file.
- Set log level of the new type to INFO (see isal_compress_pmd.c)

Thanks,
Pablo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] crypto/kasumi: add dynamic logging to kasumi
  2018-06-25  5:23 [dpdk-dev] [PATCH] crypto/kasumi: add dynamic logging to kasumi Naga Suresh Somarowthu
  2018-06-27 15:15 ` De Lara Guarch, Pablo
@ 2018-06-27 15:38 ` De Lara Guarch, Pablo
  2018-06-29  9:47 ` [dpdk-dev] [PATCH v2] crypto/kasumi: add dynamic logging Naga Suresh Somarowthu
  2 siblings, 0 replies; 5+ messages in thread
From: De Lara Guarch, Pablo @ 2018-06-27 15:38 UTC (permalink / raw)
  To: Somarowthu, Naga SureshX, dev; +Cc: Pattan, Reshma

Hi Naga,

Two last comments below.

> -----Original Message-----
> From: Somarowthu, Naga SureshX
> Sent: Monday, June 25, 2018 6:23 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>; Somarowthu, Naga SureshX
> <naga.sureshx.somarowthu@intel.com>
> Subject: [PATCH] crypto/kasumi: add dynamic logging to kasumi
> 
> 1.added new logtype for kasumi driver.
> 2.registered new logtype.
> 3.KASUMI_LOG_ERR and CDEV_LOG_ERR are
>   replaced with new logtype name KASUMI_PMD_LOG.
> 
> Signed-off-by: Naga Suresh Somarowthu
> <naga.sureshx.somarowthu@intel.com>
> Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
> ---

...

>  	if (cipher_xform) {
>  		/* Only KASUMI F8 supported */
>  		if (cipher_xform->cipher.algo !=
> RTE_CRYPTO_CIPHER_KASUMI_F8)
> +			KASUMI_PMD_LOG(ERR, "Unsupported cipher
> algorithm ");
>  			return -ENOTSUP;

Missing braces, as there are two lines inside the if statement.

> 
>  		sess->cipher_iv_offset = cipher_xform->cipher.iv.offset;
>  		if (cipher_xform->cipher.iv.length != KASUMI_IV_LENGTH) {
> -			KASUMI_LOG_ERR("Wrong IV length");
> +			KASUMI_PMD_LOG(ERR, "Wrong IV length");
>  			return -EINVAL;
>  		}
> 
> @@ -102,10 +103,11 @@ kasumi_set_session_parameters(struct
> kasumi_session *sess,
>  	if (auth_xform) {
>  		/* Only KASUMI F9 supported */
>  		if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_KASUMI_F9)
> +			KASUMI_PMD_LOG(ERR, "Unsupported
> authentication");
>  			return -ENOTSUP;

Missing braces, as there are two lines inside the if statement.

> 
>  		if (auth_xform->auth.digest_length !=

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v2] crypto/kasumi: add dynamic logging
  2018-06-25  5:23 [dpdk-dev] [PATCH] crypto/kasumi: add dynamic logging to kasumi Naga Suresh Somarowthu
  2018-06-27 15:15 ` De Lara Guarch, Pablo
  2018-06-27 15:38 ` De Lara Guarch, Pablo
@ 2018-06-29  9:47 ` Naga Suresh Somarowthu
  2018-07-03  8:34   ` De Lara Guarch, Pablo
  2 siblings, 1 reply; 5+ messages in thread
From: Naga Suresh Somarowthu @ 2018-06-29  9:47 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch, reshma.pattan, Naga Suresh Somarowthu

1.added new logtype for kasumi driver.
2.registered new logtype.
3.KASUMI_LOG_ERR and CDEV_LOG_ERR are
  replaced with new logtype name KASUMI_PMD_LOG.

Signed-off-by: Naga Suresh Somarowthu <naga.sureshx.somarowthu@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_KASUMI_DEBUG=n from config file
---
 config/common_base                             |  1 -
 drivers/crypto/kasumi/rte_kasumi_pmd.c         | 35 +++++++++++++++++---------
 drivers/crypto/kasumi/rte_kasumi_pmd_ops.c     | 14 +++++------
 drivers/crypto/kasumi/rte_kasumi_pmd_private.h | 26 ++++++-------------
 4 files changed, 37 insertions(+), 39 deletions(-)

diff --git a/config/common_base b/config/common_base
index 6541ad5b2..facd2f86b 100644
--- a/config/common_base
+++ b/config/common_base
@@ -532,7 +532,6 @@ CONFIG_RTE_LIBRTE_PMD_SNOW3G_DEBUG=n
 # Compile PMD for KASUMI device
 #
 CONFIG_RTE_LIBRTE_PMD_KASUMI=n
-CONFIG_RTE_LIBRTE_PMD_KASUMI_DEBUG=n
 
 #
 # Compile PMD for ZUC device
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 205dc1de7..0e783ed9b 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016-2017 Intel Corporation
+ * Copyright(c) 2016-2018 Intel Corporation
  */
 
 #include <rte_common.h>
@@ -79,18 +79,20 @@ kasumi_set_session_parameters(struct kasumi_session *sess,
 		break;
 	case KASUMI_OP_NOT_SUPPORTED:
 	default:
-		KASUMI_LOG_ERR("Unsupported operation chain order parameter");
+		KASUMI_LOG(ERR, "Unsupported operation chain order parameter");
 		return -ENOTSUP;
 	}
 
 	if (cipher_xform) {
 		/* Only KASUMI F8 supported */
-		if (cipher_xform->cipher.algo != RTE_CRYPTO_CIPHER_KASUMI_F8)
+		if (cipher_xform->cipher.algo != RTE_CRYPTO_CIPHER_KASUMI_F8) {
+			KASUMI_LOG(ERR, "Unsupported cipher algorithm ");
 			return -ENOTSUP;
+		}
 
 		sess->cipher_iv_offset = cipher_xform->cipher.iv.offset;
 		if (cipher_xform->cipher.iv.length != KASUMI_IV_LENGTH) {
-			KASUMI_LOG_ERR("Wrong IV length");
+			KASUMI_LOG(ERR, "Wrong IV length");
 			return -EINVAL;
 		}
 
@@ -101,11 +103,13 @@ kasumi_set_session_parameters(struct kasumi_session *sess,
 
 	if (auth_xform) {
 		/* Only KASUMI F9 supported */
-		if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_KASUMI_F9)
+		if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_KASUMI_F9) {
+			KASUMI_LOG(ERR, "Unsupported authentication");
 			return -ENOTSUP;
+		}
 
 		if (auth_xform->auth.digest_length != KASUMI_DIGEST_LENGTH) {
-			KASUMI_LOG_ERR("Wrong digest length");
+			KASUMI_LOG(ERR, "Wrong digest length");
 			return -EINVAL;
 		}
 
@@ -213,7 +217,7 @@ process_kasumi_cipher_op_bit(struct rte_crypto_op *op,
 	src = rte_pktmbuf_mtod(op->sym->m_src, uint8_t *);
 	if (op->sym->m_dst == NULL) {
 		op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
-		KASUMI_LOG_ERR("bit-level in-place not supported\n");
+		KASUMI_LOG(ERR, "bit-level in-place not supported");
 		return 0;
 	}
 	dst = rte_pktmbuf_mtod(op->sym->m_dst, uint8_t *);
@@ -244,7 +248,7 @@ process_kasumi_hash_op(struct kasumi_qp *qp, struct rte_crypto_op **ops,
 		/* Data must be byte aligned */
 		if ((ops[i]->sym->auth.data.offset % BYTE_LEN) != 0) {
 			ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
-			KASUMI_LOG_ERR("offset");
+			KASUMI_LOG(ERR, "Invalid Offset");
 			break;
 		}
 
@@ -409,9 +413,9 @@ kasumi_pmd_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops,
 				(curr_c_op->sym->m_dst != NULL &&
 				!rte_pktmbuf_is_contiguous(
 						curr_c_op->sym->m_dst))) {
-			KASUMI_LOG_ERR("PMD supports only contiguous mbufs, "
+			KASUMI_LOG(ERR, "PMD supports only contiguous mbufs, "
 				"op (%p) provides noncontiguous mbuf as "
-				"source/destination buffer.\n", curr_c_op);
+				"source/destination buffer.", curr_c_op);
 			curr_c_op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
 			break;
 		}
@@ -531,7 +535,7 @@ cryptodev_kasumi_create(const char *name,
 
 	dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
 	if (dev == NULL) {
-		KASUMI_LOG_ERR("failed to create cryptodev vdev");
+		KASUMI_LOG(ERR, "failed to create cryptodev vdev");
 		goto init_error;
 	}
 
@@ -559,7 +563,7 @@ cryptodev_kasumi_create(const char *name,
 
 	return 0;
 init_error:
-	KASUMI_LOG_ERR("driver %s: cryptodev_kasumi_create failed",
+	KASUMI_LOG(ERR, "driver %s: failed",
 			init_params->name);
 
 	cryptodev_kasumi_remove(vdev);
@@ -621,3 +625,10 @@ RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_KASUMI_PMD,
 	"socket_id=<int>");
 RTE_PMD_REGISTER_CRYPTO_DRIVER(kasumi_crypto_drv,
 		cryptodev_kasumi_pmd_drv.driver, cryptodev_driver_id);
+
+RTE_INIT(kasumi_init_log);
+static void
+kasumi_init_log(void)
+{
+	kasumi_logtype_driver = rte_log_register("pmd.crypto.kasumi");
+}
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
index a388dbb63..d087eabe4 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016-2017 Intel Corporation
+ * Copyright(c) 2016-2018 Intel Corporation
  */
 
 #include <string.h>
@@ -171,13 +171,13 @@ kasumi_pmd_qp_create_processed_ops_ring(struct kasumi_qp *qp,
 	r = rte_ring_lookup(qp->name);
 	if (r) {
 		if (rte_ring_get_size(r) == ring_size) {
-			KASUMI_LOG_INFO("Reusing existing ring %s"
+			KASUMI_LOG(INFO, "Reusing existing ring %s"
 					" for processed packets",
 					 qp->name);
 			return r;
 		}
 
-		KASUMI_LOG_ERR("Unable to reuse existing ring %s"
+		KASUMI_LOG(ERR, "Unable to reuse existing ring %s"
 				" for processed packets",
 				 qp->name);
 		return NULL;
@@ -269,19 +269,19 @@ kasumi_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
 	int ret;
 
 	if (unlikely(sess == NULL)) {
-		KASUMI_LOG_ERR("invalid session struct");
+		KASUMI_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");
+		KASUMI_LOG(ERR,
+				"Couldn't get object from session mempool");
 		return -ENOMEM;
 	}
 
 	ret = kasumi_set_session_parameters(sess_private_data, xform);
 	if (ret != 0) {
-		KASUMI_LOG_ERR("failed configure session parameters");
+		KASUMI_LOG(ERR, "failed configure session parameters");
 
 		/* Return session to mempool */
 		rte_mempool_put(mempool, sess_private_data);
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
index a397bee65..102334e0a 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2016-2017 Intel Corporation
+ * Copyright(c) 2016-2018 Intel Corporation
  */
 
 #ifndef _RTE_KASUMI_PMD_PRIVATE_H_
@@ -10,25 +10,13 @@
 #define CRYPTODEV_NAME_KASUMI_PMD	crypto_kasumi
 /**< KASUMI PMD device name */
 
-#define KASUMI_LOG_ERR(fmt, args...) \
-	RTE_LOG(ERR, CRYPTODEV, "[%s] %s() line %u: " fmt "\n",  \
-			RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), \
-			__func__, __LINE__, ## args)
+/** KASUMI PMD LOGTYPE DRIVER */
+int kasumi_logtype_driver;
 
-#ifdef RTE_LIBRTE_KASUMI_DEBUG
-#define KASUMI_LOG_INFO(fmt, args...) \
-	RTE_LOG(INFO, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
-			RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), \
-			__func__, __LINE__, ## args)
-
-#define KASUMI_LOG_DBG(fmt, args...) \
-	RTE_LOG(DEBUG, CRYPTODEV, "[%s] %s() line %u: " fmt "\n", \
-			RTE_STR(CRYPTODEV_NAME_KASUMI_PMD), \
-			__func__, __LINE__, ## args)
-#else
-#define KASUMI_LOG_INFO(fmt, args...)
-#define KASUMI_LOG_DBG(fmt, args...)
-#endif
+#define KASUMI_LOG(level, fmt, ...)  \
+	rte_log(RTE_LOG_ ## level, kasumi_logtype_driver,  \
+			"%s() line %u: " fmt "\n", __func__, __LINE__,  \
+					## __VA_ARGS__)
 
 #define KASUMI_DIGEST_LENGTH 4
 
-- 
2.13.6

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] crypto/kasumi: add dynamic logging
  2018-06-29  9:47 ` [dpdk-dev] [PATCH v2] crypto/kasumi: add dynamic logging Naga Suresh Somarowthu
@ 2018-07-03  8:34   ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 5+ messages in thread
From: De Lara Guarch, Pablo @ 2018-07-03  8:34 UTC (permalink / raw)
  To: Somarowthu, Naga SureshX, dev; +Cc: Pattan, Reshma

> -----Original Message-----
> From: Somarowthu, Naga SureshX
> Sent: Friday, June 29, 2018 10:48 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>; Somarowthu, Naga SureshX
> <naga.sureshx.somarowthu@intel.com>
> Subject: [PATCH v2] crypto/kasumi: add dynamic logging
> 
> 1.added new logtype for kasumi driver.
> 2.registered new logtype.
> 3.KASUMI_LOG_ERR and CDEV_LOG_ERR are
>   replaced with new logtype name KASUMI_PMD_LOG.
> 
> Signed-off-by: Naga Suresh Somarowthu
> <naga.sureshx.somarowthu@intel.com>
> Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
> Reviewed-by: Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>

Applied to dpdk-next-crypto.
Thanks,

Pablo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-03  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-25  5:23 [dpdk-dev] [PATCH] crypto/kasumi: add dynamic logging to kasumi Naga Suresh Somarowthu
2018-06-27 15:15 ` De Lara Guarch, Pablo
2018-06-27 15:38 ` De Lara Guarch, Pablo
2018-06-29  9:47 ` [dpdk-dev] [PATCH v2] crypto/kasumi: add dynamic logging Naga Suresh Somarowthu
2018-07-03  8:34   ` De Lara Guarch, Pablo

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).