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: [email protected]
Signed-off-by: Gagandeep Singh <[email protected]>
---
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