DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ji, Kai" <kai.ji@intel.com>
To: "Nicolau, Radu" <radu.nicolau@intel.com>,
	"Kusztal, ArkadiuszX" <arkadiuszx.kusztal@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [PATCH] crypto/qat: fix out-of-place chain/cipher/auth headers
Date: Tue, 17 Jun 2025 09:55:26 +0000	[thread overview]
Message-ID: <DS0PR11MB74583A17750C4A6AAF023CA88173A@DS0PR11MB7458.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20250612101414.240641-1-radu.nicolau@intel.com>

[-- Attachment #1: Type: text/plain, Size: 4810 bytes --]

Acked-by: Kai Ji <kai.ji@intel.com>

________________________________
From: Radu Nicolau <radu.nicolau@intel.com>
Sent: 12 June 2025 11:14
To: Ji, Kai <kai.ji@intel.com>; Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
Cc: dev@dpdk.org <dev@dpdk.org>; Nicolau, Radu <radu.nicolau@intel.com>; stable@dpdk.org <stable@dpdk.org>
Subject: [PATCH] crypto/qat: fix out-of-place chain/cipher/auth headers

Extend the original fix to gen3 and gen4 code.

Fixes: 317d05f3721c ("crypto/qat: fix out-of-place chain/cipher/auth headers")
Cc: arkadiuszx.kusztal@intel.com
Cc: stable@dpdk.org

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c | 13 ++++++++-----
 drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c | 13 ++++++++-----
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c
index 478e766b97..428430882d 100644
--- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c
+++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c
@@ -643,16 +643,19 @@ qat_sym_dp_enqueue_aead_jobs_gen3(void *qp_data, uint8_t *drv_ctx,
         for (i = 0; i < n; i++) {
                 struct qat_sym_op_cookie *cookie =
                         qp->op_cookies[tail >> tx_queue->trailz];
+               int error = 0;

                 req  = (struct icp_qat_fw_la_bulk_req *)(
                         (uint8_t *)tx_queue->base_addr + tail);
                 rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req));

                 if (vec->dest_sgl) {
-                       data_len = qat_sym_build_req_set_data(req,
-                               user_data[i], cookie,
-                               vec->src_sgl[i].vec, vec->src_sgl[i].num,
-                               vec->dest_sgl[i].vec, vec->dest_sgl[i].num);
+                       data_len = qat_reqs_mid_set(&error, req, cookie, user_data[i],
+                                       &vec->src_sgl[i], &vec->dest_sgl[i], ofs);
+                       /* In oop there is no offset, src/dst addresses are moved
+                        * to avoid overwriting the dst header
+                        */
+                       ofs.ofs.cipher.head = 0;
                 } else {
                         data_len = qat_sym_build_req_set_data(req,
                                 user_data[i], cookie,
@@ -660,7 +663,7 @@ qat_sym_dp_enqueue_aead_jobs_gen3(void *qp_data, uint8_t *drv_ctx,
                                 vec->src_sgl[i].num, NULL, 0);
                 }

-               if (unlikely(data_len < 0))
+               if (unlikely(data_len < 0) || error)
                         break;

                 enqueue_one_aead_job_gen3(ctx, req, &vec->iv[i],
diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c b/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c
index 6a5d6e78b9..638da1a173 100644
--- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c
+++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c
@@ -418,16 +418,19 @@ qat_sym_dp_enqueue_aead_jobs_gen4(void *qp_data, uint8_t *drv_ctx,
         for (i = 0; i < n; i++) {
                 struct qat_sym_op_cookie *cookie =
                         qp->op_cookies[tail >> tx_queue->trailz];
+               int error = 0;

                 req  = (struct icp_qat_fw_la_bulk_req *)(
                         (uint8_t *)tx_queue->base_addr + tail);
                 rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req));

                 if (vec->dest_sgl) {
-                       data_len = qat_sym_build_req_set_data(req,
-                               user_data[i], cookie,
-                               vec->src_sgl[i].vec, vec->src_sgl[i].num,
-                               vec->dest_sgl[i].vec, vec->dest_sgl[i].num);
+                       data_len = qat_reqs_mid_set(&error, req, cookie, user_data[i],
+                                       &vec->src_sgl[i], &vec->dest_sgl[i], ofs);
+                       /* In oop there is no offset, src/dst addresses are moved
+                        * to avoid overwriting the dst header
+                        */
+                       ofs.ofs.cipher.head = 0;
                 } else {
                         data_len = qat_sym_build_req_set_data(req,
                                 user_data[i], cookie,
@@ -435,7 +438,7 @@ qat_sym_dp_enqueue_aead_jobs_gen4(void *qp_data, uint8_t *drv_ctx,
                                 vec->src_sgl[i].num, NULL, 0);
                 }

-               if (unlikely(data_len < 0))
+               if (unlikely(data_len < 0) || error)
                         break;

                 enqueue_one_aead_job_gen4(ctx, req, &vec->iv[i],
--
2.43.0


[-- Attachment #2: Type: text/html, Size: 12130 bytes --]

      reply	other threads:[~2025-06-17  9:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12 10:14 Radu Nicolau
2025-06-17  9:55 ` Ji, Kai [this message]

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=DS0PR11MB74583A17750C4A6AAF023CA88173A@DS0PR11MB7458.namprd11.prod.outlook.com \
    --to=kai.ji@intel.com \
    --cc=arkadiuszx.kusztal@intel.com \
    --cc=dev@dpdk.org \
    --cc=radu.nicolau@intel.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;
as well as URLs for NNTP newsgroup(s).