DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] crypto/dpaa2_sec: rework debug code
@ 2024-10-07  8:43 Gagandeep Singh
  2024-10-07  8:48 ` David Marchand
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Gagandeep Singh @ 2024-10-07  8:43 UTC (permalink / raw)
  To: dev, gakhil, david.marchand; +Cc: Gagandeep Singh, Jun Yang

Output debug information according to various modes.

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 87 +++++++++++++++------
 1 file changed, 63 insertions(+), 24 deletions(-)

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 2cdf9308f8..1a897514e1 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1097,7 +1097,7 @@ build_auth_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 
 static int
 build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
-		struct qbman_fd *fd, __rte_unused uint16_t bpid)
+		struct qbman_fd *fd, uint16_t bpid)
 {
 	struct rte_crypto_sym_op *sym_op = op->sym;
 	struct qbman_fle *ip_fle, *op_fle, *sge, *fle;
@@ -1107,6 +1107,10 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	struct rte_mbuf *mbuf;
 	uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			sess->iv.offset);
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	char debug_str[1024];
+	int offset;
+#endif
 
 	data_len = sym_op->cipher.data.length;
 	data_offset = sym_op->cipher.data.offset;
@@ -1212,14 +1216,26 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	DPAA2_SET_FD_COMPOUND_FMT(fd);
 	DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc));
 
-	DPAA2_SEC_DP_DEBUG(
-		"CIPHER SG: fdaddr =%" PRIx64 " bpid =%d meta =%d"
-		" off =%d, len =%d",
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	offset = sprintf(debug_str,
+		"CIPHER SG: fdaddr =%" PRIx64 ", from %s pool ",
 		DPAA2_GET_FD_ADDR(fd),
-		DPAA2_GET_FD_BPID(fd),
-		rte_dpaa2_bpid_info[bpid].meta_data_size,
-		DPAA2_GET_FD_OFFSET(fd),
-		DPAA2_GET_FD_LEN(fd));
+		bpid < MAX_BPID ? "SW" : "BMAN");
+	if (bpid < MAX_BPID) {
+		offset += sprintf(&debug_str[offset],
+			"bpid = %d ", bpid);
+	}
+	offset += sprintf(&debug_str[offset],
+		"private size = %d ",
+		mbuf->pool->private_data_size);
+	offset += sprintf(&debug_str[offset],
+		"off =%d, len =%d",
+		DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
+	DPAA2_SEC_DP_DEBUG("%s", debug_str);
+#else
+	RTE_SET_USED(bpid);
+#endif
+
 	return 0;
 }
 
@@ -1235,6 +1251,10 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			sess->iv.offset);
 	struct rte_mbuf *dst;
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	char debug_str[1024];
+	int offset;
+#endif
 
 	data_len = sym_op->cipher.data.length;
 	data_offset = sym_op->cipher.data.offset;
@@ -1326,14 +1346,23 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	DPAA2_SET_FLE_FIN(sge);
 	DPAA2_SET_FLE_FIN(fle);
 
-	DPAA2_SEC_DP_DEBUG(
-		"CIPHER: fdaddr =%" PRIx64 " bpid =%d meta =%d"
-		" off =%d, len =%d",
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	offset = sprintf(debug_str,
+		"CIPHER: fdaddr =%" PRIx64 ", from %s pool ",
 		DPAA2_GET_FD_ADDR(fd),
-		DPAA2_GET_FD_BPID(fd),
-		rte_dpaa2_bpid_info[bpid].meta_data_size,
-		DPAA2_GET_FD_OFFSET(fd),
-		DPAA2_GET_FD_LEN(fd));
+		bpid < MAX_BPID ? "SW" : "BMAN");
+	if (bpid < MAX_BPID) {
+		offset += sprintf(&debug_str[offset],
+			"bpid = %d ", bpid);
+	}
+	offset += sprintf(&debug_str[offset],
+			"private size = %d ",
+			dst->pool->private_data_size);
+	offset += sprintf(&debug_str[offset],
+			"off =%d, len =%d",
+			DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
+	DPAA2_SEC_DP_DEBUG("%s", debug_str);
+#endif
 
 	return 0;
 }
@@ -1566,6 +1595,10 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 	struct qbman_fle *fle;
 	struct rte_crypto_op *op;
 	struct rte_mbuf *dst, *src;
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	char debug_str[1024];
+	int offset;
+#endif
 
 	if (DPAA2_FD_GET_FORMAT(fd) == qbman_fd_single)
 		return sec_simple_fd_to_mbuf(fd);
@@ -1604,15 +1637,21 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 		dst->data_len = len;
 	}
 
-	DPAA2_SEC_DP_DEBUG("mbuf %p BMAN buf addr %p,"
-		" fdaddr =%" PRIx64 " bpid =%d meta =%d off =%d, len =%d",
-		(void *)dst,
-		dst->buf_addr,
-		DPAA2_GET_FD_ADDR(fd),
-		DPAA2_GET_FD_BPID(fd),
-		rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size,
-		DPAA2_GET_FD_OFFSET(fd),
-		DPAA2_GET_FD_LEN(fd));
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	offset = sprintf(debug_str, "Mbuf %p from %s pool ",
+			dst, DPAA2_GET_FD_IVP(fd) ? "SW" : "BMAN");
+	if (!DPAA2_GET_FD_IVP(fd)) {
+		offset += sprintf(&debug_str[offset], "bpid = %d ",
+				DPAA2_GET_FD_BPID(fd));
+	}
+	offset += sprintf(&debug_str[offset],
+			"private size = %d ", dst->pool->private_data_size);
+	offset += sprintf(&debug_str[offset],
+			"addr %p, fdaddr =%" PRIx64 ", off =%d, len =%d",
+			dst->buf_addr, DPAA2_GET_FD_ADDR(fd),
+			DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
+	DPAA2_SEC_DP_DEBUG("%s", debug_str);
+#endif
 
 	/* free the fle memory */
 	if (likely(rte_pktmbuf_is_contiguous(src))) {
-- 
2.25.1


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

* Re: [PATCH] crypto/dpaa2_sec: rework debug code
  2024-10-07  8:43 [PATCH] crypto/dpaa2_sec: rework debug code Gagandeep Singh
@ 2024-10-07  8:48 ` David Marchand
  2024-10-07 15:25 ` Stephen Hemminger
  2024-10-09  5:07 ` [v2] " Gagandeep Singh
  2 siblings, 0 replies; 10+ messages in thread
From: David Marchand @ 2024-10-07  8:48 UTC (permalink / raw)
  To: Gagandeep Singh; +Cc: dev, gakhil, Jun Yang

On Mon, Oct 7, 2024 at 10:44 AM Gagandeep Singh <g.singh@nxp.com> wrote:
>
> Output debug information according to various modes.
>
> Signed-off-by: Jun Yang <jun.yang@nxp.com>
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 87 +++++++++++++++------
>  1 file changed, 63 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> index 2cdf9308f8..1a897514e1 100644
> --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> @@ -1097,7 +1097,7 @@ build_auth_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
>
>  static int
>  build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
> -               struct qbman_fd *fd, __rte_unused uint16_t bpid)
> +               struct qbman_fd *fd, uint16_t bpid)
>  {
>         struct rte_crypto_sym_op *sym_op = op->sym;
>         struct qbman_fle *ip_fle, *op_fle, *sge, *fle;
> @@ -1107,6 +1107,10 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
>         struct rte_mbuf *mbuf;
>         uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
>                         sess->iv.offset);
> +#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
> +       char debug_str[1024];
> +       int offset;
> +#endif
>
>         data_len = sym_op->cipher.data.length;
>         data_offset = sym_op->cipher.data.offset;
> @@ -1212,14 +1216,26 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
>         DPAA2_SET_FD_COMPOUND_FMT(fd);
>         DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc));
>
> -       DPAA2_SEC_DP_DEBUG(
> -               "CIPHER SG: fdaddr =%" PRIx64 " bpid =%d meta =%d"
> -               " off =%d, len =%d",
> +#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
> +       offset = sprintf(debug_str,
> +               "CIPHER SG: fdaddr =%" PRIx64 ", from %s pool ",
>                 DPAA2_GET_FD_ADDR(fd),
> -               DPAA2_GET_FD_BPID(fd),
> -               rte_dpaa2_bpid_info[bpid].meta_data_size,
> -               DPAA2_GET_FD_OFFSET(fd),
> -               DPAA2_GET_FD_LEN(fd));
> +               bpid < MAX_BPID ? "SW" : "BMAN");
> +       if (bpid < MAX_BPID) {
> +               offset += sprintf(&debug_str[offset],
> +                       "bpid = %d ", bpid);
> +       }
> +       offset += sprintf(&debug_str[offset],
> +               "private size = %d ",
> +               mbuf->pool->private_data_size);
> +       offset += sprintf(&debug_str[offset],
> +               "off =%d, len =%d",
> +               DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
> +       DPAA2_SEC_DP_DEBUG("%s", debug_str);
> +#else
> +       RTE_SET_USED(bpid);
> +#endif
> +
>         return 0;
>  }
>
> @@ -1235,6 +1251,10 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
>         uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
>                         sess->iv.offset);
>         struct rte_mbuf *dst;
> +#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
> +       char debug_str[1024];
> +       int offset;
> +#endif
>
>         data_len = sym_op->cipher.data.length;
>         data_offset = sym_op->cipher.data.offset;
> @@ -1326,14 +1346,23 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
>         DPAA2_SET_FLE_FIN(sge);
>         DPAA2_SET_FLE_FIN(fle);
>
> -       DPAA2_SEC_DP_DEBUG(
> -               "CIPHER: fdaddr =%" PRIx64 " bpid =%d meta =%d"
> -               " off =%d, len =%d",
> +#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
> +       offset = sprintf(debug_str,
> +               "CIPHER: fdaddr =%" PRIx64 ", from %s pool ",
>                 DPAA2_GET_FD_ADDR(fd),
> -               DPAA2_GET_FD_BPID(fd),
> -               rte_dpaa2_bpid_info[bpid].meta_data_size,
> -               DPAA2_GET_FD_OFFSET(fd),
> -               DPAA2_GET_FD_LEN(fd));
> +               bpid < MAX_BPID ? "SW" : "BMAN");
> +       if (bpid < MAX_BPID) {
> +               offset += sprintf(&debug_str[offset],
> +                       "bpid = %d ", bpid);
> +       }
> +       offset += sprintf(&debug_str[offset],
> +                       "private size = %d ",
> +                       dst->pool->private_data_size);
> +       offset += sprintf(&debug_str[offset],
> +                       "off =%d, len =%d",
> +                       DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
> +       DPAA2_SEC_DP_DEBUG("%s", debug_str);
> +#endif
>
>         return 0;
>  }
> @@ -1566,6 +1595,10 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
>         struct qbman_fle *fle;
>         struct rte_crypto_op *op;
>         struct rte_mbuf *dst, *src;
> +#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
> +       char debug_str[1024];
> +       int offset;
> +#endif
>
>         if (DPAA2_FD_GET_FORMAT(fd) == qbman_fd_single)
>                 return sec_simple_fd_to_mbuf(fd);
> @@ -1604,15 +1637,21 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
>                 dst->data_len = len;
>         }
>
> -       DPAA2_SEC_DP_DEBUG("mbuf %p BMAN buf addr %p,"
> -               " fdaddr =%" PRIx64 " bpid =%d meta =%d off =%d, len =%d",
> -               (void *)dst,
> -               dst->buf_addr,
> -               DPAA2_GET_FD_ADDR(fd),
> -               DPAA2_GET_FD_BPID(fd),
> -               rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size,
> -               DPAA2_GET_FD_OFFSET(fd),
> -               DPAA2_GET_FD_LEN(fd));
> +#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
> +       offset = sprintf(debug_str, "Mbuf %p from %s pool ",
> +                       dst, DPAA2_GET_FD_IVP(fd) ? "SW" : "BMAN");
> +       if (!DPAA2_GET_FD_IVP(fd)) {
> +               offset += sprintf(&debug_str[offset], "bpid = %d ",
> +                               DPAA2_GET_FD_BPID(fd));
> +       }
> +       offset += sprintf(&debug_str[offset],
> +                       "private size = %d ", dst->pool->private_data_size);
> +       offset += sprintf(&debug_str[offset],
> +                       "addr %p, fdaddr =%" PRIx64 ", off =%d, len =%d",
> +                       dst->buf_addr, DPAA2_GET_FD_ADDR(fd),
> +                       DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
> +       DPAA2_SEC_DP_DEBUG("%s", debug_str);
> +#endif
>
>         /* free the fle memory */
>         if (likely(rte_pktmbuf_is_contiguous(src))) {
> --
> 2.25.1
>

Thank you for the formatting changes on the logs.


-- 
David Marchand


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

* Re: [PATCH] crypto/dpaa2_sec: rework debug code
  2024-10-07  8:43 [PATCH] crypto/dpaa2_sec: rework debug code Gagandeep Singh
  2024-10-07  8:48 ` David Marchand
@ 2024-10-07 15:25 ` Stephen Hemminger
  2024-10-09  5:07 ` [v2] " Gagandeep Singh
  2 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2024-10-07 15:25 UTC (permalink / raw)
  To: Gagandeep Singh; +Cc: dev, gakhil, david.marchand, Jun Yang

On Mon,  7 Oct 2024 14:13:54 +0530
Gagandeep Singh <g.singh@nxp.com> wrote:

> +#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
> +	offset = sprintf(debug_str,
> +		"CIPHER SG: fdaddr =%" PRIx64 ", from %s pool ",
>  		DPAA2_GET_FD_ADDR(fd),
> -		DPAA2_GET_FD_BPID(fd),
> -		rte_dpaa2_bpid_info[bpid].meta_data_size,
> -		DPAA2_GET_FD_OFFSET(fd),
> -		DPAA2_GET_FD_LEN(fd));
> +		bpid < MAX_BPID ? "SW" : "BMAN");
> +	if (bpid < MAX_BPID) {
> +		offset += sprintf(&debug_str[offset],
> +			"bpid = %d ", bpid);
> +	}
> +	offset += sprintf(&debug_str[offset],
> +		"private size = %d ",
> +		mbuf->pool->private_data_size);
> +	offset += sprintf(&debug_str[offset],
> +		"off =%d, len =%d",
> +		DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
> +	DPAA2_SEC_DP_DEBUG("%s", debug_str);
> +#else
> +	RTE_SET_USED(bpid);
> +#endif
> +

Since this code is repeated, and not in hot path why not make it
a function, then the #ifdef mess would be less as well

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

* [v2] crypto/dpaa2_sec: rework debug code
  2024-10-07  8:43 [PATCH] crypto/dpaa2_sec: rework debug code Gagandeep Singh
  2024-10-07  8:48 ` David Marchand
  2024-10-07 15:25 ` Stephen Hemminger
@ 2024-10-09  5:07 ` Gagandeep Singh
  2024-10-09 21:01   ` [EXTERNAL] " Akhil Goyal
  2024-10-10  6:03   ` [v3] " Gagandeep Singh
  2 siblings, 2 replies; 10+ messages in thread
From: Gagandeep Singh @ 2024-10-09  5:07 UTC (permalink / raw)
  To: dev, Hemant Agrawal; +Cc: Jun Yang

Output debug information according to various modes.

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 72 +++++++++++++--------
 1 file changed, 46 insertions(+), 26 deletions(-)

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 2cdf9308f8..0c96ca0023 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -65,6 +65,47 @@ enum dpaa2_sec_dump_levels {
 uint8_t cryptodev_driver_id;
 uint8_t dpaa2_sec_dp_dump = DPAA2_SEC_DP_ERR_DUMP;
 
+static inline void
+dpaa2_sec_dp_fd_dump(const struct qbman_fd *fd, uint16_t bpid,
+		     struct rte_mbuf *mbuf, bool tx)
+{
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	char debug_str[1024];
+	int offset;
+
+	if (tx) {
+		offset = sprintf(debug_str,
+			"CIPHER SG: fdaddr =%" PRIx64 ", from %s pool ",
+			DPAA2_GET_FD_ADDR(fd),
+			bpid < MAX_BPID ? "SW" : "BMAN");
+		if (bpid < MAX_BPID) {
+			offset += sprintf(&debug_str[offset],
+				"bpid = %d ", bpid);
+		}
+	} else {
+		offset = sprintf(debug_str, "Mbuf %p from %s pool ",
+				 mbuf, DPAA2_GET_FD_IVP(fd) ? "SW" : "BMAN");
+		if (!DPAA2_GET_FD_IVP(fd)) {
+			offset += sprintf(&debug_str[offset], "bpid = %d ",
+					  DPAA2_GET_FD_BPID(fd));
+		}
+	}
+	offset += sprintf(&debug_str[offset],
+		"private size = %d ",
+		mbuf->pool->private_data_size);
+	offset += sprintf(&debug_str[offset],
+		"addr %p, fdaddr =%" PRIx64 ", off =%d, len =%d",
+		mbuf->buf_addr, DPAA2_GET_FD_ADDR(fd),
+		DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
+	DPAA2_SEC_DP_DEBUG("%s", debug_str);
+#else
+	RTE_SET_USED(bpid);
+	RTE_SET_USED(tx);
+	RTE_SET_USED(mbuf);
+	RTE_SET_USED(fd);
+#endif
+}
+
 static inline void
 free_fle(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 {
@@ -1097,7 +1138,7 @@ build_auth_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 
 static int
 build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
-		struct qbman_fd *fd, __rte_unused uint16_t bpid)
+		struct qbman_fd *fd, uint16_t bpid)
 {
 	struct rte_crypto_sym_op *sym_op = op->sym;
 	struct qbman_fle *ip_fle, *op_fle, *sge, *fle;
@@ -1212,14 +1253,8 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	DPAA2_SET_FD_COMPOUND_FMT(fd);
 	DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc));
 
-	DPAA2_SEC_DP_DEBUG(
-		"CIPHER SG: fdaddr =%" PRIx64 " bpid =%d meta =%d"
-		" off =%d, len =%d",
-		DPAA2_GET_FD_ADDR(fd),
-		DPAA2_GET_FD_BPID(fd),
-		rte_dpaa2_bpid_info[bpid].meta_data_size,
-		DPAA2_GET_FD_OFFSET(fd),
-		DPAA2_GET_FD_LEN(fd));
+	dpaa2_sec_dp_fd_dump(fd, bpid, mbuf, true);
+
 	return 0;
 }
 
@@ -1326,14 +1361,7 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	DPAA2_SET_FLE_FIN(sge);
 	DPAA2_SET_FLE_FIN(fle);
 
-	DPAA2_SEC_DP_DEBUG(
-		"CIPHER: fdaddr =%" PRIx64 " bpid =%d meta =%d"
-		" off =%d, len =%d",
-		DPAA2_GET_FD_ADDR(fd),
-		DPAA2_GET_FD_BPID(fd),
-		rte_dpaa2_bpid_info[bpid].meta_data_size,
-		DPAA2_GET_FD_OFFSET(fd),
-		DPAA2_GET_FD_LEN(fd));
+	dpaa2_sec_dp_fd_dump(fd, bpid, dst, true);
 
 	return 0;
 }
@@ -1604,15 +1632,7 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 		dst->data_len = len;
 	}
 
-	DPAA2_SEC_DP_DEBUG("mbuf %p BMAN buf addr %p,"
-		" fdaddr =%" PRIx64 " bpid =%d meta =%d off =%d, len =%d",
-		(void *)dst,
-		dst->buf_addr,
-		DPAA2_GET_FD_ADDR(fd),
-		DPAA2_GET_FD_BPID(fd),
-		rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size,
-		DPAA2_GET_FD_OFFSET(fd),
-		DPAA2_GET_FD_LEN(fd));
+	dpaa2_sec_dp_fd_dump(fd, 0, dst, false);
 
 	/* free the fle memory */
 	if (likely(rte_pktmbuf_is_contiguous(src))) {
-- 
2.25.1


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

* RE: [EXTERNAL] [v2] crypto/dpaa2_sec: rework debug code
  2024-10-09  5:07 ` [v2] " Gagandeep Singh
@ 2024-10-09 21:01   ` Akhil Goyal
  2024-10-10  5:52     ` Gagandeep Singh
  2024-10-10  6:03   ` [v3] " Gagandeep Singh
  1 sibling, 1 reply; 10+ messages in thread
From: Akhil Goyal @ 2024-10-09 21:01 UTC (permalink / raw)
  To: Gagandeep Singh, dev, Hemant Agrawal; +Cc: Jun Yang

Hi Gagan,

> Output debug information according to various modes.
> 
> Signed-off-by: Jun Yang <jun.yang@nxp.com>
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>

It seems the base patch was merged in main branch.
Can you rebase this patch on current top of tree?

> ---
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 72 +++++++++++++--------
>  1 file changed, 46 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> index 2cdf9308f8..0c96ca0023 100644
> --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> @@ -65,6 +65,47 @@ enum dpaa2_sec_dump_levels {
>  uint8_t cryptodev_driver_id;
>  uint8_t dpaa2_sec_dp_dump = DPAA2_SEC_DP_ERR_DUMP;
> 
> +static inline void
> +dpaa2_sec_dp_fd_dump(const struct qbman_fd *fd, uint16_t bpid,
> +		     struct rte_mbuf *mbuf, bool tx)
> +{
> +#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
> +	char debug_str[1024];
> +	int offset;
> +
> +	if (tx) {
> +		offset = sprintf(debug_str,
> +			"CIPHER SG: fdaddr =%" PRIx64 ", from %s pool ",
> +			DPAA2_GET_FD_ADDR(fd),
> +			bpid < MAX_BPID ? "SW" : "BMAN");
> +		if (bpid < MAX_BPID) {
> +			offset += sprintf(&debug_str[offset],
> +				"bpid = %d ", bpid);
> +		}
> +	} else {
> +		offset = sprintf(debug_str, "Mbuf %p from %s pool ",
> +				 mbuf, DPAA2_GET_FD_IVP(fd) ? "SW" :
> "BMAN");
> +		if (!DPAA2_GET_FD_IVP(fd)) {
> +			offset += sprintf(&debug_str[offset], "bpid = %d ",
> +					  DPAA2_GET_FD_BPID(fd));
> +		}
> +	}
> +	offset += sprintf(&debug_str[offset],
> +		"private size = %d ",
> +		mbuf->pool->private_data_size);
> +	offset += sprintf(&debug_str[offset],
> +		"addr %p, fdaddr =%" PRIx64 ", off =%d, len =%d",
> +		mbuf->buf_addr, DPAA2_GET_FD_ADDR(fd),
> +		DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
> +	DPAA2_SEC_DP_DEBUG("%s", debug_str);
> +#else
> +	RTE_SET_USED(bpid);
> +	RTE_SET_USED(tx);
> +	RTE_SET_USED(mbuf);
> +	RTE_SET_USED(fd);
> +#endif
> +}
> +
>  static inline void
>  free_fle(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
>  {
> @@ -1097,7 +1138,7 @@ build_auth_fd(dpaa2_sec_session *sess, struct
> rte_crypto_op *op,
> 
>  static int
>  build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
> -		struct qbman_fd *fd, __rte_unused uint16_t bpid)
> +		struct qbman_fd *fd, uint16_t bpid)
>  {
>  	struct rte_crypto_sym_op *sym_op = op->sym;
>  	struct qbman_fle *ip_fle, *op_fle, *sge, *fle;
> @@ -1212,14 +1253,8 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct
> rte_crypto_op *op,
>  	DPAA2_SET_FD_COMPOUND_FMT(fd);
>  	DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc));
> 
> -	DPAA2_SEC_DP_DEBUG(
> -		"CIPHER SG: fdaddr =%" PRIx64 " bpid =%d meta =%d"
> -		" off =%d, len =%d",
> -		DPAA2_GET_FD_ADDR(fd),
> -		DPAA2_GET_FD_BPID(fd),
> -		rte_dpaa2_bpid_info[bpid].meta_data_size,
> -		DPAA2_GET_FD_OFFSET(fd),
> -		DPAA2_GET_FD_LEN(fd));
> +	dpaa2_sec_dp_fd_dump(fd, bpid, mbuf, true);
> +
>  	return 0;
>  }
> 
> @@ -1326,14 +1361,7 @@ build_cipher_fd(dpaa2_sec_session *sess, struct
> rte_crypto_op *op,
>  	DPAA2_SET_FLE_FIN(sge);
>  	DPAA2_SET_FLE_FIN(fle);
> 
> -	DPAA2_SEC_DP_DEBUG(
> -		"CIPHER: fdaddr =%" PRIx64 " bpid =%d meta =%d"
> -		" off =%d, len =%d",
> -		DPAA2_GET_FD_ADDR(fd),
> -		DPAA2_GET_FD_BPID(fd),
> -		rte_dpaa2_bpid_info[bpid].meta_data_size,
> -		DPAA2_GET_FD_OFFSET(fd),
> -		DPAA2_GET_FD_LEN(fd));
> +	dpaa2_sec_dp_fd_dump(fd, bpid, dst, true);
> 
>  	return 0;
>  }
> @@ -1604,15 +1632,7 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct
> dpaa2_sec_qp *qp)
>  		dst->data_len = len;
>  	}
> 
> -	DPAA2_SEC_DP_DEBUG("mbuf %p BMAN buf addr %p,"
> -		" fdaddr =%" PRIx64 " bpid =%d meta =%d off =%d, len =%d",
> -		(void *)dst,
> -		dst->buf_addr,
> -		DPAA2_GET_FD_ADDR(fd),
> -		DPAA2_GET_FD_BPID(fd),
> -
> 	rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size,
> -		DPAA2_GET_FD_OFFSET(fd),
> -		DPAA2_GET_FD_LEN(fd));
> +	dpaa2_sec_dp_fd_dump(fd, 0, dst, false);
> 
>  	/* free the fle memory */
>  	if (likely(rte_pktmbuf_is_contiguous(src))) {
> --
> 2.25.1


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

* RE: [EXTERNAL] [v2] crypto/dpaa2_sec: rework debug code
  2024-10-09 21:01   ` [EXTERNAL] " Akhil Goyal
@ 2024-10-10  5:52     ` Gagandeep Singh
  0 siblings, 0 replies; 10+ messages in thread
From: Gagandeep Singh @ 2024-10-10  5:52 UTC (permalink / raw)
  To: Akhil Goyal, dev, Hemant Agrawal; +Cc: Jun Yang

Hi,

Sure, I will submit the rebased patch soon.

> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Thursday, October 10, 2024 2:32 AM
> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org; Hemant Agrawal
> <hemant.agrawal@nxp.com>
> Cc: Jun Yang <jun.yang@nxp.com>
> Subject: RE: [EXTERNAL] [v2] crypto/dpaa2_sec: rework debug code
> 
> Hi Gagan,
> 
> > Output debug information according to various modes.
> >
> > Signed-off-by: Jun Yang <jun.yang@nxp.com>
> > Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> 
> It seems the base patch was merged in main branch.
> Can you rebase this patch on current top of tree?
> 
> > ---
> >  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 72
> > +++++++++++++--------
> >  1 file changed, 46 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> > b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> > index 2cdf9308f8..0c96ca0023 100644
> > --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> > +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> > @@ -65,6 +65,47 @@ enum dpaa2_sec_dump_levels {  uint8_t
> > cryptodev_driver_id;  uint8_t dpaa2_sec_dp_dump =
> > DPAA2_SEC_DP_ERR_DUMP;
> >
> > +static inline void
> > +dpaa2_sec_dp_fd_dump(const struct qbman_fd *fd, uint16_t bpid,
> > +		     struct rte_mbuf *mbuf, bool tx) { #if (RTE_LOG_DEBUG <=
> > +RTE_LOG_DP_LEVEL)
> > +	char debug_str[1024];
> > +	int offset;
> > +
> > +	if (tx) {
> > +		offset = sprintf(debug_str,
> > +			"CIPHER SG: fdaddr =%" PRIx64 ", from %s pool ",
> > +			DPAA2_GET_FD_ADDR(fd),
> > +			bpid < MAX_BPID ? "SW" : "BMAN");
> > +		if (bpid < MAX_BPID) {
> > +			offset += sprintf(&debug_str[offset],
> > +				"bpid = %d ", bpid);
> > +		}
> > +	} else {
> > +		offset = sprintf(debug_str, "Mbuf %p from %s pool ",
> > +				 mbuf, DPAA2_GET_FD_IVP(fd) ? "SW" :
> > "BMAN");
> > +		if (!DPAA2_GET_FD_IVP(fd)) {
> > +			offset += sprintf(&debug_str[offset], "bpid = %d ",
> > +					  DPAA2_GET_FD_BPID(fd));
> > +		}
> > +	}
> > +	offset += sprintf(&debug_str[offset],
> > +		"private size = %d ",
> > +		mbuf->pool->private_data_size);
> > +	offset += sprintf(&debug_str[offset],
> > +		"addr %p, fdaddr =%" PRIx64 ", off =%d, len =%d",
> > +		mbuf->buf_addr, DPAA2_GET_FD_ADDR(fd),
> > +		DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
> > +	DPAA2_SEC_DP_DEBUG("%s", debug_str); #else
> > +	RTE_SET_USED(bpid);
> > +	RTE_SET_USED(tx);
> > +	RTE_SET_USED(mbuf);
> > +	RTE_SET_USED(fd);
> > +#endif
> > +}
> > +
> >  static inline void
> >  free_fle(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)  { @@
> > -1097,7 +1138,7 @@ build_auth_fd(dpaa2_sec_session *sess, struct
> > rte_crypto_op *op,
> >
> >  static int
> >  build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
> > -		struct qbman_fd *fd, __rte_unused uint16_t bpid)
> > +		struct qbman_fd *fd, uint16_t bpid)
> >  {
> >  	struct rte_crypto_sym_op *sym_op = op->sym;
> >  	struct qbman_fle *ip_fle, *op_fle, *sge, *fle; @@ -1212,14 +1253,8
> > @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op
> > *op,
> >  	DPAA2_SET_FD_COMPOUND_FMT(fd);
> >  	DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc));
> >
> > -	DPAA2_SEC_DP_DEBUG(
> > -		"CIPHER SG: fdaddr =%" PRIx64 " bpid =%d meta =%d"
> > -		" off =%d, len =%d",
> > -		DPAA2_GET_FD_ADDR(fd),
> > -		DPAA2_GET_FD_BPID(fd),
> > -		rte_dpaa2_bpid_info[bpid].meta_data_size,
> > -		DPAA2_GET_FD_OFFSET(fd),
> > -		DPAA2_GET_FD_LEN(fd));
> > +	dpaa2_sec_dp_fd_dump(fd, bpid, mbuf, true);
> > +
> >  	return 0;
> >  }
> >
> > @@ -1326,14 +1361,7 @@ build_cipher_fd(dpaa2_sec_session *sess, struct
> > rte_crypto_op *op,
> >  	DPAA2_SET_FLE_FIN(sge);
> >  	DPAA2_SET_FLE_FIN(fle);
> >
> > -	DPAA2_SEC_DP_DEBUG(
> > -		"CIPHER: fdaddr =%" PRIx64 " bpid =%d meta =%d"
> > -		" off =%d, len =%d",
> > -		DPAA2_GET_FD_ADDR(fd),
> > -		DPAA2_GET_FD_BPID(fd),
> > -		rte_dpaa2_bpid_info[bpid].meta_data_size,
> > -		DPAA2_GET_FD_OFFSET(fd),
> > -		DPAA2_GET_FD_LEN(fd));
> > +	dpaa2_sec_dp_fd_dump(fd, bpid, dst, true);
> >
> >  	return 0;
> >  }
> > @@ -1604,15 +1632,7 @@ sec_fd_to_mbuf(const struct qbman_fd *fd,
> > struct dpaa2_sec_qp *qp)
> >  		dst->data_len = len;
> >  	}
> >
> > -	DPAA2_SEC_DP_DEBUG("mbuf %p BMAN buf addr %p,"
> > -		" fdaddr =%" PRIx64 " bpid =%d meta =%d off =%d, len =%d",
> > -		(void *)dst,
> > -		dst->buf_addr,
> > -		DPAA2_GET_FD_ADDR(fd),
> > -		DPAA2_GET_FD_BPID(fd),
> > -
> > 	rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size,
> > -		DPAA2_GET_FD_OFFSET(fd),
> > -		DPAA2_GET_FD_LEN(fd));
> > +	dpaa2_sec_dp_fd_dump(fd, 0, dst, false);
> >
> >  	/* free the fle memory */
> >  	if (likely(rte_pktmbuf_is_contiguous(src))) {
> > --
> > 2.25.1


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

* [v3] crypto/dpaa2_sec: rework debug code
  2024-10-09  5:07 ` [v2] " Gagandeep Singh
  2024-10-09 21:01   ` [EXTERNAL] " Akhil Goyal
@ 2024-10-10  6:03   ` Gagandeep Singh
  2024-10-10  7:06     ` David Marchand
  2024-11-06 11:34     ` [EXTERNAL] " Akhil Goyal
  1 sibling, 2 replies; 10+ messages in thread
From: Gagandeep Singh @ 2024-10-10  6:03 UTC (permalink / raw)
  To: dev, Hemant Agrawal; +Cc: Jun Yang

Move the duplicate code in a common function and
remove un-necessary newline characters from the logs.

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 110 ++++++++------------
 1 file changed, 44 insertions(+), 66 deletions(-)

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index b34183d594..a1e8dffe4a 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -65,6 +65,47 @@ enum dpaa2_sec_dump_levels {
 uint8_t cryptodev_driver_id;
 uint8_t dpaa2_sec_dp_dump = DPAA2_SEC_DP_ERR_DUMP;
 
+static inline void
+dpaa2_sec_dp_fd_dump(const struct qbman_fd *fd, uint16_t bpid,
+		     struct rte_mbuf *mbuf, bool tx)
+{
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	char debug_str[1024];
+	int offset;
+
+	if (tx) {
+		offset = sprintf(debug_str,
+			"CIPHER SG: fdaddr =%" PRIx64 ", from %s pool ",
+			DPAA2_GET_FD_ADDR(fd),
+			bpid < MAX_BPID ? "SW" : "BMAN");
+		if (bpid < MAX_BPID) {
+			offset += sprintf(&debug_str[offset],
+				"bpid = %d ", bpid);
+		}
+	} else {
+		offset = sprintf(debug_str, "Mbuf %p from %s pool ",
+				 mbuf, DPAA2_GET_FD_IVP(fd) ? "SW" : "BMAN");
+		if (!DPAA2_GET_FD_IVP(fd)) {
+			offset += sprintf(&debug_str[offset], "bpid = %d ",
+					  DPAA2_GET_FD_BPID(fd));
+		}
+	}
+	offset += sprintf(&debug_str[offset],
+		"private size = %d ",
+		mbuf->pool->private_data_size);
+	offset += sprintf(&debug_str[offset],
+		"addr %p, fdaddr =%" PRIx64 ", off =%d, len =%d",
+		mbuf->buf_addr, DPAA2_GET_FD_ADDR(fd),
+		DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
+	DPAA2_SEC_DP_DEBUG("%s", debug_str);
+#else
+	RTE_SET_USED(bpid);
+	RTE_SET_USED(tx);
+	RTE_SET_USED(mbuf);
+	RTE_SET_USED(fd);
+#endif
+}
+
 static inline void
 free_fle(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 {
@@ -1107,10 +1148,6 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	struct rte_mbuf *mbuf;
 	uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			sess->iv.offset);
-#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
-	char debug_str[1024];
-	int offset;
-#endif
 
 	data_len = sym_op->cipher.data.length;
 	data_offset = sym_op->cipher.data.offset;
@@ -1215,26 +1252,7 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	DPAA2_SET_FD_LEN(fd, ip_fle->length);
 	DPAA2_SET_FD_COMPOUND_FMT(fd);
 	DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc));
-
-#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
-	offset = sprintf(debug_str,
-		"CIPHER SG: fdaddr =%" PRIx64 ", from %s pool ",
-		DPAA2_GET_FD_ADDR(fd),
-		bpid < MAX_BPID ? "SW" : "BMAN");
-	if (bpid < MAX_BPID) {
-		offset += sprintf(&debug_str[offset],
-			"bpid = %d ", bpid);
-	}
-	offset += sprintf(&debug_str[offset],
-		"private size = %d ",
-		mbuf->pool->private_data_size);
-	offset += sprintf(&debug_str[offset],
-		"off =%d, len =%d",
-		DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
-	DPAA2_SEC_DP_DEBUG("%s", debug_str);
-#else
-	RTE_SET_USED(bpid);
-#endif
+	dpaa2_sec_dp_fd_dump(fd, bpid, mbuf, true);
 
 	return 0;
 }
@@ -1251,10 +1269,6 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			sess->iv.offset);
 	struct rte_mbuf *dst;
-#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
-	char debug_str[1024];
-	int offset;
-#endif
 
 	data_len = sym_op->cipher.data.length;
 	data_offset = sym_op->cipher.data.offset;
@@ -1345,24 +1359,7 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	sge->length = data_len;
 	DPAA2_SET_FLE_FIN(sge);
 	DPAA2_SET_FLE_FIN(fle);
-
-#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
-	offset = sprintf(debug_str,
-		"CIPHER: fdaddr =%" PRIx64 ", from %s pool ",
-		DPAA2_GET_FD_ADDR(fd),
-		bpid < MAX_BPID ? "SW" : "BMAN");
-	if (bpid < MAX_BPID) {
-		offset += sprintf(&debug_str[offset],
-			"bpid = %d ", bpid);
-	}
-	offset += sprintf(&debug_str[offset],
-			"private size = %d ",
-			dst->pool->private_data_size);
-	offset += sprintf(&debug_str[offset],
-			"off =%d, len =%d",
-			DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
-	DPAA2_SEC_DP_DEBUG("%s", debug_str);
-#endif
+	dpaa2_sec_dp_fd_dump(fd, bpid, dst, true);
 
 	return 0;
 }
@@ -1595,10 +1592,6 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 	struct qbman_fle *fle;
 	struct rte_crypto_op *op;
 	struct rte_mbuf *dst, *src;
-#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
-	char debug_str[1024];
-	int offset;
-#endif
 
 	if (DPAA2_FD_GET_FORMAT(fd) == qbman_fd_single)
 		return sec_simple_fd_to_mbuf(fd);
@@ -1636,22 +1629,7 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 		}
 		dst->data_len = len;
 	}
-
-#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
-	offset = sprintf(debug_str, "Mbuf %p from %s pool ",
-			dst, DPAA2_GET_FD_IVP(fd) ? "SW" : "BMAN");
-	if (!DPAA2_GET_FD_IVP(fd)) {
-		offset += sprintf(&debug_str[offset], "bpid = %d ",
-				DPAA2_GET_FD_BPID(fd));
-	}
-	offset += sprintf(&debug_str[offset],
-			"private size = %d ", dst->pool->private_data_size);
-	offset += sprintf(&debug_str[offset],
-			"addr %p, fdaddr =%" PRIx64 ", off =%d, len =%d",
-			dst->buf_addr, DPAA2_GET_FD_ADDR(fd),
-			DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
-	DPAA2_SEC_DP_DEBUG("%s", debug_str);
-#endif
+	dpaa2_sec_dp_fd_dump(fd, 0, dst, false);
 
 	/* free the fle memory */
 	if (likely(rte_pktmbuf_is_contiguous(src))) {
-- 
2.25.1


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

* Re: [v3] crypto/dpaa2_sec: rework debug code
  2024-10-10  6:03   ` [v3] " Gagandeep Singh
@ 2024-10-10  7:06     ` David Marchand
  2024-11-06 11:34     ` [EXTERNAL] " Akhil Goyal
  1 sibling, 0 replies; 10+ messages in thread
From: David Marchand @ 2024-10-10  7:06 UTC (permalink / raw)
  To: Gagandeep Singh; +Cc: dev, Hemant Agrawal, Jun Yang

On Thu, Oct 10, 2024 at 8:03 AM Gagandeep Singh <g.singh@nxp.com> wrote:
>
> Move the duplicate code in a common function and
> remove un-necessary newline characters from the logs.
>
> Signed-off-by: Jun Yang <jun.yang@nxp.com>
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>

There was a network issue when testing this series in GHA.
Recheck-request: github-robot


-- 
David Marchand


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

* RE: [EXTERNAL] [v3] crypto/dpaa2_sec: rework debug code
  2024-10-10  6:03   ` [v3] " Gagandeep Singh
  2024-10-10  7:06     ` David Marchand
@ 2024-11-06 11:34     ` Akhil Goyal
  1 sibling, 0 replies; 10+ messages in thread
From: Akhil Goyal @ 2024-11-06 11:34 UTC (permalink / raw)
  To: Gagandeep Singh, dev, Hemant Agrawal; +Cc: Jun Yang

> Move the duplicate code in a common function and
> remove un-necessary newline characters from the logs.
> 
> Signed-off-by: Jun Yang <jun.yang@nxp.com>
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
Applied to dpdk-next-crypto
Thanks.

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

* [PATCH] crypto/dpaa2_sec: rework debug code
@ 2024-10-07  8:40 Gagandeep Singh
  0 siblings, 0 replies; 10+ messages in thread
From: Gagandeep Singh @ 2024-10-07  8:40 UTC (permalink / raw)
  To: dev, gakhil, david.marchand; +Cc: Gagandeep Singh, Jun Yang, Gagandeep Singh

Output debug information according to various modes.

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Gagandeep Singh <G.singh@nxp.com>
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 87 +++++++++++++++------
 1 file changed, 63 insertions(+), 24 deletions(-)

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 2cdf9308f8..1a897514e1 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1097,7 +1097,7 @@ build_auth_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 
 static int
 build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
-		struct qbman_fd *fd, __rte_unused uint16_t bpid)
+		struct qbman_fd *fd, uint16_t bpid)
 {
 	struct rte_crypto_sym_op *sym_op = op->sym;
 	struct qbman_fle *ip_fle, *op_fle, *sge, *fle;
@@ -1107,6 +1107,10 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	struct rte_mbuf *mbuf;
 	uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			sess->iv.offset);
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	char debug_str[1024];
+	int offset;
+#endif
 
 	data_len = sym_op->cipher.data.length;
 	data_offset = sym_op->cipher.data.offset;
@@ -1212,14 +1216,26 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	DPAA2_SET_FD_COMPOUND_FMT(fd);
 	DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc));
 
-	DPAA2_SEC_DP_DEBUG(
-		"CIPHER SG: fdaddr =%" PRIx64 " bpid =%d meta =%d"
-		" off =%d, len =%d",
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	offset = sprintf(debug_str,
+		"CIPHER SG: fdaddr =%" PRIx64 ", from %s pool ",
 		DPAA2_GET_FD_ADDR(fd),
-		DPAA2_GET_FD_BPID(fd),
-		rte_dpaa2_bpid_info[bpid].meta_data_size,
-		DPAA2_GET_FD_OFFSET(fd),
-		DPAA2_GET_FD_LEN(fd));
+		bpid < MAX_BPID ? "SW" : "BMAN");
+	if (bpid < MAX_BPID) {
+		offset += sprintf(&debug_str[offset],
+			"bpid = %d ", bpid);
+	}
+	offset += sprintf(&debug_str[offset],
+		"private size = %d ",
+		mbuf->pool->private_data_size);
+	offset += sprintf(&debug_str[offset],
+		"off =%d, len =%d",
+		DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
+	DPAA2_SEC_DP_DEBUG("%s", debug_str);
+#else
+	RTE_SET_USED(bpid);
+#endif
+
 	return 0;
 }
 
@@ -1235,6 +1251,10 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
 			sess->iv.offset);
 	struct rte_mbuf *dst;
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	char debug_str[1024];
+	int offset;
+#endif
 
 	data_len = sym_op->cipher.data.length;
 	data_offset = sym_op->cipher.data.offset;
@@ -1326,14 +1346,23 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
 	DPAA2_SET_FLE_FIN(sge);
 	DPAA2_SET_FLE_FIN(fle);
 
-	DPAA2_SEC_DP_DEBUG(
-		"CIPHER: fdaddr =%" PRIx64 " bpid =%d meta =%d"
-		" off =%d, len =%d",
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	offset = sprintf(debug_str,
+		"CIPHER: fdaddr =%" PRIx64 ", from %s pool ",
 		DPAA2_GET_FD_ADDR(fd),
-		DPAA2_GET_FD_BPID(fd),
-		rte_dpaa2_bpid_info[bpid].meta_data_size,
-		DPAA2_GET_FD_OFFSET(fd),
-		DPAA2_GET_FD_LEN(fd));
+		bpid < MAX_BPID ? "SW" : "BMAN");
+	if (bpid < MAX_BPID) {
+		offset += sprintf(&debug_str[offset],
+			"bpid = %d ", bpid);
+	}
+	offset += sprintf(&debug_str[offset],
+			"private size = %d ",
+			dst->pool->private_data_size);
+	offset += sprintf(&debug_str[offset],
+			"off =%d, len =%d",
+			DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
+	DPAA2_SEC_DP_DEBUG("%s", debug_str);
+#endif
 
 	return 0;
 }
@@ -1566,6 +1595,10 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 	struct qbman_fle *fle;
 	struct rte_crypto_op *op;
 	struct rte_mbuf *dst, *src;
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	char debug_str[1024];
+	int offset;
+#endif
 
 	if (DPAA2_FD_GET_FORMAT(fd) == qbman_fd_single)
 		return sec_simple_fd_to_mbuf(fd);
@@ -1604,15 +1637,21 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 		dst->data_len = len;
 	}
 
-	DPAA2_SEC_DP_DEBUG("mbuf %p BMAN buf addr %p,"
-		" fdaddr =%" PRIx64 " bpid =%d meta =%d off =%d, len =%d",
-		(void *)dst,
-		dst->buf_addr,
-		DPAA2_GET_FD_ADDR(fd),
-		DPAA2_GET_FD_BPID(fd),
-		rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size,
-		DPAA2_GET_FD_OFFSET(fd),
-		DPAA2_GET_FD_LEN(fd));
+#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL)
+	offset = sprintf(debug_str, "Mbuf %p from %s pool ",
+			dst, DPAA2_GET_FD_IVP(fd) ? "SW" : "BMAN");
+	if (!DPAA2_GET_FD_IVP(fd)) {
+		offset += sprintf(&debug_str[offset], "bpid = %d ",
+				DPAA2_GET_FD_BPID(fd));
+	}
+	offset += sprintf(&debug_str[offset],
+			"private size = %d ", dst->pool->private_data_size);
+	offset += sprintf(&debug_str[offset],
+			"addr %p, fdaddr =%" PRIx64 ", off =%d, len =%d",
+			dst->buf_addr, DPAA2_GET_FD_ADDR(fd),
+			DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd));
+	DPAA2_SEC_DP_DEBUG("%s", debug_str);
+#endif
 
 	/* free the fle memory */
 	if (likely(rte_pktmbuf_is_contiguous(src))) {
-- 
2.25.1


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

end of thread, other threads:[~2024-11-06 11:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-07  8:43 [PATCH] crypto/dpaa2_sec: rework debug code Gagandeep Singh
2024-10-07  8:48 ` David Marchand
2024-10-07 15:25 ` Stephen Hemminger
2024-10-09  5:07 ` [v2] " Gagandeep Singh
2024-10-09 21:01   ` [EXTERNAL] " Akhil Goyal
2024-10-10  5:52     ` Gagandeep Singh
2024-10-10  6:03   ` [v3] " Gagandeep Singh
2024-10-10  7:06     ` David Marchand
2024-11-06 11:34     ` [EXTERNAL] " Akhil Goyal
  -- strict thread matches above, loose matches on Subject: below --
2024-10-07  8:40 [PATCH] " Gagandeep Singh

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