DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gregory Etelson <getelson@nvidia.com>
To: <dev@dpdk.org>
Cc: getelson@nvidia.com,   <mkashani@nvidia.com>,
	rasland@nvidia.com, "Shani Peretz" <shperetz@nvidia.com>
Subject: [PATCH] crypto/mlx5: log when num of segs exceed max segs
Date: Sun, 9 Feb 2025 14:08:51 +0200	[thread overview]
Message-ID: <20250209120851.254695-1-getelson@nvidia.com> (raw)

From: Shani Peretz <shperetz@nvidia.com>

This patch logs and aborts when mbuf segment count exceeding max_segs_num.
The log message suggests the user to either increase the segment size
or set a higher value for the max_segs_num devarg.

Fixes: b01095830734 ("crypto/mlx5: add GCM enqueue/dequeue operations")

Signed-off-by: Shani Peretz <shperetz@nvidia.com>
---
 drivers/crypto/mlx5/mlx5_crypto_gcm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/mlx5/mlx5_crypto_gcm.c b/drivers/crypto/mlx5/mlx5_crypto_gcm.c
index 89f32c7722..d7156a6abc 100644
--- a/drivers/crypto/mlx5/mlx5_crypto_gcm.c
+++ b/drivers/crypto/mlx5/mlx5_crypto_gcm.c
@@ -554,7 +554,15 @@ mlx5_crypto_gcm_build_mbuf_chain_klms(struct mlx5_crypto_qp *qp,
 	uint32_t klm_n = 0;
 
 	/* mbuf seg num should be less than max_segs_num. */
-	MLX5_ASSERT(nb_segs <= qp->priv->max_segs_num);
+	if (nb_segs > qp->priv->max_segs_num) {
+		DRV_LOG(WARNING, "Segment count exceeds limit. "
+				"Current segments: %d, Maximum allowed: %d. "
+				"To resolve, either increase the segment size "
+				"or set a higher value for the devargs max_segs_num parameter.",
+			nb_segs, qp->priv->max_segs_num);
+		RTE_VERIFY(nb_segs <= qp->priv->max_segs_num);
+		return 0;
+	}
 	/* First mbuf needs to take the data offset. */
 	if (unlikely(_mlx5_crypto_gcm_umr_build_mbuf_klm(qp, mbuf, klm,
 		     op->sym->aead.data.offset, &remain_len) == UINT32_MAX)) {
-- 
2.45.2


             reply	other threads:[~2025-02-09 12:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-09 12:08 Gregory Etelson [this message]
2025-02-10 17:04 ` Stephen Hemminger

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=20250209120851.254695-1-getelson@nvidia.com \
    --to=getelson@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=mkashani@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=shperetz@nvidia.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).