Skip to contentSkip to conversation

app/test-crypto-perf: reset mbuf state for IPsec outbound iterations

PATCH In review Gagandeep Singh 3 participants 3 messages Jul 16 – Sep 18

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/test-crypto-perf: reset mbuf state for IPsec outbound iterations

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")
---
 app/test-crypto-perf/cperf_ops.c | 2 ++
 1 file changed, 2 insertions(+)
app/test-crypto-perf/cperf_ops.c +2 -0
index 873fa3b59f..1c8d1e263a 100644
@@ -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)) {
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines

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)
Quoted 5 lines
Fixes 3b7d9f2bc6 ("app/test-crypto-perf: add ipsec lookaside support")

---

#2 lore raw
Quoted 18 lines
Quoted 18 lines

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:

Quoted 6 lines
Quoted 6 lines

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

Fixes tag is not correct. Fixed it while merging.
Applied to dpdk-next-crypto

Quoted 7 lines
Quoted 4 lines

---