DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] crypto/mlx5: add max segment assert
@ 2024-03-01 12:42 Suanming Mou
  2024-03-01 16:09 ` Patrick Robb
  2024-03-04 10:01 ` [EXTERNAL] " Akhil Goyal
  0 siblings, 2 replies; 3+ messages in thread
From: Suanming Mou @ 2024-03-01 12:42 UTC (permalink / raw)
  To: Matan Azrad; +Cc: dev

Currently, for multi-segment mbuf, before crypto WQE an extra
UMR WQE will be introduced to build the contiguous memory space.
Crypto WQE uses that contiguous memory space key as input.

This commit adds assert for maximum supported segments in debug
mode in case the segments exceed UMR's limitation.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/crypto/mlx5/mlx5_crypto_gcm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/crypto/mlx5/mlx5_crypto_gcm.c b/drivers/crypto/mlx5/mlx5_crypto_gcm.c
index 8b9953b46d..fc6ade6711 100644
--- a/drivers/crypto/mlx5/mlx5_crypto_gcm.c
+++ b/drivers/crypto/mlx5/mlx5_crypto_gcm.c
@@ -441,6 +441,9 @@ mlx5_crypto_gcm_get_op_info(struct mlx5_crypto_qp *qp,
 	op_info->digest = NULL;
 	op_info->src_addr = aad_addr;
 	if (op->sym->m_dst && op->sym->m_dst != m_src) {
+		/* Add 2 for AAD and digest. */
+		MLX5_ASSERT((uint32_t)(m_dst->nb_segs + m_src->nb_segs + 2) <
+			    qp->priv->max_klm_num);
 		op_info->is_oop = true;
 		m_dst = op->sym->m_dst;
 		dst_addr = rte_pktmbuf_mtod_offset(m_dst, void *, op->sym->aead.data.offset);
@@ -457,6 +460,9 @@ mlx5_crypto_gcm_get_op_info(struct mlx5_crypto_qp *qp,
 			op_info->need_umr = true;
 			return;
 		}
+	} else {
+		/* Add 2 for AAD and digest. */
+		MLX5_ASSERT((uint32_t)(m_src->nb_segs) + 2 < qp->priv->max_klm_num);
 	}
 	if (m_src->nb_segs > 1) {
 		op_info->need_umr = true;
-- 
2.34.1


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

* Re: [PATCH] crypto/mlx5: add max segment assert
  2024-03-01 12:42 [PATCH] crypto/mlx5: add max segment assert Suanming Mou
@ 2024-03-01 16:09 ` Patrick Robb
  2024-03-04 10:01 ` [EXTERNAL] " Akhil Goyal
  1 sibling, 0 replies; 3+ messages in thread
From: Patrick Robb @ 2024-03-01 16:09 UTC (permalink / raw)
  To: Suanming Mou; +Cc: Matan Azrad, dev

[-- Attachment #1: Type: text/plain, Size: 2112 bytes --]

The Community Lab had an infra failure this morning and some patches
including yours were affected with false failures. The issue is now
resolved and we are rerunning the tests in question for all patches
submitted today.

On Fri, Mar 1, 2024 at 7:43 AM Suanming Mou <suanmingm@nvidia.com> wrote:

> Currently, for multi-segment mbuf, before crypto WQE an extra
> UMR WQE will be introduced to build the contiguous memory space.
> Crypto WQE uses that contiguous memory space key as input.
>
> This commit adds assert for maximum supported segments in debug
> mode in case the segments exceed UMR's limitation.
>
> Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
>  drivers/crypto/mlx5/mlx5_crypto_gcm.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/crypto/mlx5/mlx5_crypto_gcm.c
> b/drivers/crypto/mlx5/mlx5_crypto_gcm.c
> index 8b9953b46d..fc6ade6711 100644
> --- a/drivers/crypto/mlx5/mlx5_crypto_gcm.c
> +++ b/drivers/crypto/mlx5/mlx5_crypto_gcm.c
> @@ -441,6 +441,9 @@ mlx5_crypto_gcm_get_op_info(struct mlx5_crypto_qp *qp,
>         op_info->digest = NULL;
>         op_info->src_addr = aad_addr;
>         if (op->sym->m_dst && op->sym->m_dst != m_src) {
> +               /* Add 2 for AAD and digest. */
> +               MLX5_ASSERT((uint32_t)(m_dst->nb_segs + m_src->nb_segs +
> 2) <
> +                           qp->priv->max_klm_num);
>                 op_info->is_oop = true;
>                 m_dst = op->sym->m_dst;
>                 dst_addr = rte_pktmbuf_mtod_offset(m_dst, void *,
> op->sym->aead.data.offset);
> @@ -457,6 +460,9 @@ mlx5_crypto_gcm_get_op_info(struct mlx5_crypto_qp *qp,
>                         op_info->need_umr = true;
>                         return;
>                 }
> +       } else {
> +               /* Add 2 for AAD and digest. */
> +               MLX5_ASSERT((uint32_t)(m_src->nb_segs) + 2 <
> qp->priv->max_klm_num);
>         }
>         if (m_src->nb_segs > 1) {
>                 op_info->need_umr = true;
> --
> 2.34.1
>
>

[-- Attachment #2: Type: text/html, Size: 2826 bytes --]

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

* RE: [EXTERNAL] [PATCH] crypto/mlx5: add max segment assert
  2024-03-01 12:42 [PATCH] crypto/mlx5: add max segment assert Suanming Mou
  2024-03-01 16:09 ` Patrick Robb
@ 2024-03-04 10:01 ` Akhil Goyal
  1 sibling, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2024-03-04 10:01 UTC (permalink / raw)
  To: Suanming Mou, Matan Azrad; +Cc: dev

> Currently, for multi-segment mbuf, before crypto WQE an extra
> UMR WQE will be introduced to build the contiguous memory space.
> Crypto WQE uses that contiguous memory space key as input.
> 
> This commit adds assert for maximum supported segments in debug
> mode in case the segments exceed UMR's limitation.
> 
> Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
Applied to dpdk-next-crypto
Thanks.

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

end of thread, other threads:[~2024-03-04 10:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-01 12:42 [PATCH] crypto/mlx5: add max segment assert Suanming Mou
2024-03-01 16:09 ` Patrick Robb
2024-03-04 10:01 ` [EXTERNAL] " Akhil Goyal

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