DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gagandeep Singh <g.singh@nxp.com>
To: dev@dpdk.org
Cc: hemant.agrawal@nxp.com, stable@dpdk.org,
	Gagandeep Singh <g.singh@nxp.com>
Subject: [PATCH] app/test-crypto-perf: reset mbuf state for IPsec outbound iterations
Date: Thu, 16 Jul 2026 12:46:20 +0530	[thread overview]
Message-ID: <20260716071620.1550810-1-g.singh@nxp.com> (raw)

In cperf_set_ops_security_ipsec(), the same mbuf is reused across
multiple throughput iterations.  For outbound (encap) IPsec the PMD
may modify mbuf metadata such as data_off, data_len and pkt_len as
part of in-place protocol processing.  When the mbuf is recycled for
the next burst those modifications must be undone so the PMD always
sees a clean, freshly-allocated-like buffer.

Use rte_pktmbuf_reset() to restore the mbuf to its post-alloc state
in a PMD-agnostic manner, rather than patching individual fields with
driver-specific knowledge of the expected offset values.

Without this reset, drivers that back-adjust data_off after encap
(e.g. DPAA2 SEC, which advances data_off by SEC_FLC_DHR_OUTBOUND on
each dequeue) will receive a buffer with insufficient headroom on the
second and subsequent enqueues, causing hardware errors such as:

  DPAA2_SEC: SEC encap returned Error - 50000045
    (QI error 0x45: DHR correction underflow, reuse mode)
  DPAA2_SEC: SEC returned Error - 50000020
    (QI error 0x20: FD format error)

Fixes: 3b7d9f2bc6 ("app/test-crypto-perf: add ipsec lookaside support")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 app/test-crypto-perf/cperf_ops.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index 873fa3b59f..1c8d1e263a 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -409,6 +409,8 @@ cperf_set_ops_security_ipsec(struct rte_crypto_op **ops,
 		ops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
 		rte_security_attach_session(ops[i], sess);
 		sym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] + src_buf_offset);
+		if (options->is_outbound)
+			rte_pktmbuf_reset(sym_op->m_src);
 		sym_op->m_src->pkt_len = test_buffer_size;
 
 		while ((m->next != NULL) && (offset >= m->data_len)) {
-- 
2.25.1


             reply	other threads:[~2026-07-16  7:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16  7:16 Gagandeep Singh [this message]
2026-07-20  7:44 ` [EXTERNAL] [PATCH] app/test-crypto-perf: reset mbuf state for IPsec outbound iterations Nithinsen Kaithakadan

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=20260716071620.1550810-1-g.singh@nxp.com \
    --to=g.singh@nxp.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=stable@dpdk.org \
    /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