patch 'crypto/qat: fix placement of OOP offset' has been queued to stable release 23.11.2

Xueming Li xuemingl at nvidia.com
Mon Aug 12 14:49:50 CEST 2024


Hi,

FYI, your patch has been queued to stable release 23.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/14/24. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=a408bd0bcb3a3f3cdb83e1d1d08d16f184f59150

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From a408bd0bcb3a3f3cdb83e1d1d08d16f184f59150 Mon Sep 17 00:00:00 2001
From: Arkadiusz Kusztal <arkadiuszx.kusztal at intel.com>
Date: Thu, 4 Jul 2024 11:26:49 +0100
Subject: [PATCH] crypto/qat: fix placement of OOP offset
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 9f0a50dd2bc4acec586616bf5553de4711451991 ]

This patch fixes incorrect placement of OOP offset.
Data preceding crypto operation is not copied to the output
buffer, which is conformant to the API.

Fixes: a815a04cea05 ("crypto/qat: support symmetric build op request")

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal at intel.com>
Acked-by: Brian Dooley <brian.dooley at intel.com>
---
 drivers/crypto/qat/dev/qat_crypto_pmd_gens.h | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h b/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
index b87253ae02..64e892d022 100644
--- a/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
+++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
@@ -394,7 +394,7 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op,
 		struct qat_sym_op_cookie *cookie)
 {
 	union rte_crypto_sym_ofs ofs;
-	uint32_t max_len = 0;
+	uint32_t max_len = 0, oop_offset = 0;
 	uint32_t cipher_len = 0, cipher_ofs = 0;
 	uint32_t auth_len = 0, auth_ofs = 0;
 	int is_oop = (op->sym->m_dst != NULL) &&
@@ -468,6 +468,16 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op,
 
 	max_len = RTE_MAX(cipher_ofs + cipher_len, auth_ofs + auth_len);
 
+	/* If OOP, we need to keep in mind that offset needs to start where
+	 * cipher/auth starts, namely no offset on the smaller one
+	 */
+	if (is_oop) {
+		oop_offset = RTE_MIN(auth_ofs, cipher_ofs);
+		auth_ofs -= oop_offset;
+		cipher_ofs -= oop_offset;
+		max_len -= oop_offset;
+	}
+
 	/* digest in buffer check. Needed only for wireless algos
 	 * or combined cipher-crc operations
 	 */
@@ -508,9 +518,7 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op,
 			max_len = RTE_MAX(max_len, auth_ofs + auth_len +
 					ctx->digest_length);
 	}
-
-	/* Passing 0 as cipher & auth offsets are assigned into ofs later */
-	n_src = rte_crypto_mbuf_to_vec(op->sym->m_src, 0, max_len,
+	n_src = rte_crypto_mbuf_to_vec(op->sym->m_src, oop_offset, max_len,
 			in_sgl->vec, QAT_SYM_SGL_MAX_NUMBER);
 	if (unlikely(n_src < 0 || n_src > op->sym->m_src->nb_segs)) {
 		op->status = RTE_CRYPTO_OP_STATUS_ERROR;
@@ -520,7 +528,7 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op,
 
 	if (unlikely((op->sym->m_dst != NULL) &&
 			(op->sym->m_dst != op->sym->m_src))) {
-		int n_dst = rte_crypto_mbuf_to_vec(op->sym->m_dst, 0,
+		int n_dst = rte_crypto_mbuf_to_vec(op->sym->m_dst, oop_offset,
 				max_len, out_sgl->vec, QAT_SYM_SGL_MAX_NUMBER);
 
 		if (n_dst < 0 || n_dst > op->sym->m_dst->nb_segs) {
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-08-12 20:44:06.110492913 +0800
+++ 0113-crypto-qat-fix-placement-of-OOP-offset.patch	2024-08-12 20:44:02.445069363 +0800
@@ -1 +1 @@
-From 9f0a50dd2bc4acec586616bf5553de4711451991 Mon Sep 17 00:00:00 2001
+From a408bd0bcb3a3f3cdb83e1d1d08d16f184f59150 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 9f0a50dd2bc4acec586616bf5553de4711451991 ]
@@ -11 +13,0 @@
-Cc: stable at dpdk.org
@@ -20 +22 @@
-index 2c5816e696..35c1888082 100644
+index b87253ae02..64e892d022 100644
@@ -23 +25 @@
-@@ -399,7 +399,7 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op,
+@@ -394,7 +394,7 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op,
@@ -32 +34 @@
-@@ -473,6 +473,16 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op,
+@@ -468,6 +468,16 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op,
@@ -49 +51 @@
-@@ -513,9 +523,7 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op,
+@@ -508,9 +518,7 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op,
@@ -60 +62 @@
-@@ -525,7 +533,7 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op,
+@@ -520,7 +528,7 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op,


More information about the stable mailing list