This patch adds the SGL out of place support to QAT PMD

Signed-off-by: Kai Ji <kai...@intel.com>
---
 drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c | 28 ++++++++--
 drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c | 14 ++++-
 drivers/crypto/qat/dev/qat_sym_pmd_gen1.c    | 55 +++++++++++++++++---
 3 files changed, 83 insertions(+), 14 deletions(-)

diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c 
b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c
index ffa093a7a3..5084a5fcd1 100644
--- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c
+++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c
@@ -468,8 +468,18 @@ qat_sym_dp_enqueue_aead_jobs_gen3(void *qp_data, uint8_t 
*drv_ctx,
                        (uint8_t *)tx_queue->base_addr + tail);
                rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req));
 
-               data_len = qat_sym_build_req_set_data(req, user_data[i], cookie,
-                       vec->src_sgl[i].vec, vec->src_sgl[i].num, NULL, 0);
+               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);
+               } else {
+                       data_len = qat_sym_build_req_set_data(req,
+                               user_data[i], cookie,
+                               vec->src_sgl[i].vec,
+                               vec->src_sgl[i].num, NULL, 0);
+               }
+
                if (unlikely(data_len < 0))
                        break;
 
@@ -565,8 +575,18 @@ qat_sym_dp_enqueue_auth_jobs_gen3(void *qp_data, uint8_t 
*drv_ctx,
                        (uint8_t *)tx_queue->base_addr + tail);
                rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req));
 
-               data_len = qat_sym_build_req_set_data(req, user_data[i], cookie,
-                       vec->src_sgl[i].vec, vec->src_sgl[i].num, NULL, 0);
+               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);
+               } else {
+                       data_len = qat_sym_build_req_set_data(req,
+                               user_data[i], cookie,
+                               vec->src_sgl[i].vec,
+                               vec->src_sgl[i].num, NULL, 0);
+               }
+
                if (unlikely(data_len < 0))
                        break;
                enqueue_one_auth_job_gen3(ctx, cookie, req, &vec->digest[i],
diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c 
b/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c
index f803bc1459..bd7f3785df 100644
--- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c
+++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c
@@ -297,8 +297,18 @@ qat_sym_dp_enqueue_aead_jobs_gen4(void *qp_data, uint8_t 
*drv_ctx,
                        (uint8_t *)tx_queue->base_addr + tail);
                rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req));
 
-               data_len = qat_sym_build_req_set_data(req, user_data[i], cookie,
-                       vec->src_sgl[i].vec, vec->src_sgl[i].num, NULL, 0);
+               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);
+               } else {
+                       data_len = qat_sym_build_req_set_data(req,
+                               user_data[i], cookie,
+                               vec->src_sgl[i].vec,
+                               vec->src_sgl[i].num, NULL, 0);
+               }
+
                if (unlikely(data_len < 0))
                        break;
 
diff --git a/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c 
b/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c
index fee6507512..83d9b66f34 100644
--- a/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c
+++ b/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c
@@ -526,9 +526,18 @@ qat_sym_dp_enqueue_cipher_jobs_gen1(void *qp_data, uint8_t 
*drv_ctx,
                        (uint8_t *)tx_queue->base_addr + tail);
                rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req));
 
-               data_len = qat_sym_build_req_set_data(req, user_data[i],
-                               cookie, vec->src_sgl[i].vec,
+               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);
+               } else {
+                       data_len = qat_sym_build_req_set_data(req,
+                               user_data[i], cookie,
+                               vec->src_sgl[i].vec,
                                vec->src_sgl[i].num, NULL, 0);
+               }
+
                if (unlikely(data_len < 0))
                        break;
                enqueue_one_cipher_job_gen1(ctx, req, &vec->iv[i], ofs,
@@ -625,8 +634,18 @@ qat_sym_dp_enqueue_auth_jobs_gen1(void *qp_data, uint8_t 
*drv_ctx,
                        (uint8_t *)tx_queue->base_addr + tail);
                rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req));
 
-               data_len = qat_sym_build_req_set_data(req, user_data[i], cookie,
-                       vec->src_sgl[i].vec, vec->src_sgl[i].num, NULL, 0);
+               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);
+               } else {
+                       data_len = qat_sym_build_req_set_data(req,
+                               user_data[i], cookie,
+                               vec->src_sgl[i].vec,
+                               vec->src_sgl[i].num, NULL, 0);
+               }
+
                if (unlikely(data_len < 0))
                        break;
                enqueue_one_auth_job_gen1(ctx, req, &vec->digest[i],
@@ -725,8 +744,18 @@ qat_sym_dp_enqueue_chain_jobs_gen1(void *qp_data, uint8_t 
*drv_ctx,
                        (uint8_t *)tx_queue->base_addr + tail);
                rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req));
 
-               data_len = qat_sym_build_req_set_data(req, user_data[i], cookie,
-                       vec->src_sgl[i].vec, vec->src_sgl[i].num, NULL, 0);
+               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);
+               } else {
+                       data_len = qat_sym_build_req_set_data(req,
+                               user_data[i], cookie,
+                               vec->src_sgl[i].vec,
+                               vec->src_sgl[i].num, NULL, 0);
+               }
+
                if (unlikely(data_len < 0))
                        break;
 
@@ -830,8 +859,18 @@ qat_sym_dp_enqueue_aead_jobs_gen1(void *qp_data, uint8_t 
*drv_ctx,
                        (uint8_t *)tx_queue->base_addr + tail);
                rte_mov128((uint8_t *)req, (const uint8_t *)&(ctx->fw_req));
 
-               data_len = qat_sym_build_req_set_data(req, user_data[i], cookie,
-                       vec->src_sgl[i].vec, vec->src_sgl[i].num, NULL, 0);
+               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);
+               } else {
+                       data_len = qat_sym_build_req_set_data(req,
+                               user_data[i], cookie,
+                               vec->src_sgl[i].vec,
+                               vec->src_sgl[i].num, NULL, 0);
+               }
+
                if (unlikely(data_len < 0))
                        break;
 
-- 
2.17.1

Reply via email to