From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 38BB3A0507; Wed, 6 Apr 2022 15:45:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0BAC740689; Wed, 6 Apr 2022 15:45:33 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 4D5A14014F for ; Wed, 6 Apr 2022 15:45:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649252732; x=1680788732; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=7Gm0W3/zxXUgHjhCU/bmVXp69/a/T/8O0s7o+ijQWlg=; b=LSgnqVgu8Gkp0zthMxD2VtiQTDCurE3Te6YGgsHyYnirtDZ157+G26t3 gJhUdPoXWg99IyU0QdKfHc7HvlTRNkSUN07RA8qlKY4tqE1gVtSpKy+fV Yo42ht28TvNPftMHMHXUxBdzY1kYC/Uf64ND6rfXat4htbA4Srdda8ytN L8c3TY2SMmkRQCVlwfrLqeCCpCmCMlrdaHgT8XRTf3nGj9VE4xR1K2f+V G+zz0uNjMmVAq9jLXWdyLFSiV+0TDwcYU4nIQIvy06wgiZTlqjyvBVkwL 3V3PvKLl+DX3MjDuMtBAsBDGYfliO8DDzefO5FxFS7bgxcIhTeo57/L3r Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="259879776" X-IronPort-AV: E=Sophos;i="5.90,239,1643702400"; d="scan'208";a="259879776" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 06:45:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,239,1643702400"; d="scan'208";a="523929137" Received: from silpixa00400465.ir.intel.com ([10.55.128.22]) by orsmga002.jf.intel.com with ESMTP; 06 Apr 2022 06:45:29 -0700 From: Kai Ji To: dev@dpdk.org Cc: gakhil@marvell.com, Kai Ji Subject: [dpdk-dev v2] crypto/qat: fix of offset and length assignment Date: Wed, 6 Apr 2022 21:45:27 +0800 Message-Id: <20220406134527.39383-1-kai.ji@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220325112207.44344-1-kai.ji@intel.com> References: <20220325112207.44344-1-kai.ji@intel.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch fix the cipher & auth offset and length values when convert mbuf to vector chain for QAT build op. Fixes: a815a04cea05 ("crypto/qat: support symmetric build op request") Signed-off-by: Kai Ji --- drivers/crypto/qat/dev/qat_crypto_pmd_gens.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h b/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h index 50a9c5ad5b..9e01755fd9 100644 --- a/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h +++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h @@ -330,7 +330,7 @@ qat_sym_convert_op_to_vec_auth(struct rte_crypto_op *op, } n_src = rte_crypto_mbuf_to_vec(op->sym->m_src, auth_ofs, - auth_ofs + auth_len, in_sgl->vec, + auth_len, in_sgl->vec, QAT_SYM_SGL_MAX_NUMBER); if (n_src < 0 || n_src > op->sym->m_src->nb_segs) { op->status = RTE_CRYPTO_OP_STATUS_ERROR; @@ -343,7 +343,7 @@ qat_sym_convert_op_to_vec_auth(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, auth_ofs, - auth_ofs + auth_len, out_sgl->vec, + auth_len, out_sgl->vec, QAT_SYM_SGL_MAX_NUMBER); if ((n_dst < 0) || (n_dst > op->sym->m_dst->nb_segs)) { @@ -369,7 +369,7 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op, struct rte_crypto_va_iova_ptr *digest) { union rte_crypto_sym_ofs ofs; - uint32_t min_ofs = 0, max_len = 0; + uint32_t max_len = 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) && @@ -395,12 +395,12 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op, ret = qat_cipher_is_len_in_bits(ctx, op); switch (ret) { case 1: - cipher_len = op->sym->aead.data.length >> 3; - cipher_ofs = op->sym->aead.data.offset >> 3; + cipher_len = op->sym->cipher.data.length >> 3; + cipher_ofs = op->sym->cipher.data.offset >> 3; break; case 0: - cipher_len = op->sym->aead.data.length; - cipher_ofs = op->sym->aead.data.offset; + cipher_len = op->sym->cipher.data.length; + cipher_ofs = op->sym->cipher.data.offset; break; default: QAT_DP_LOG(ERR, @@ -426,7 +426,6 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op, return -EINVAL; } - min_ofs = cipher_ofs < auth_ofs ? cipher_ofs : auth_ofs; max_len = RTE_MAX(cipher_ofs + cipher_len, auth_ofs + auth_len); /* digest in buffer check. Needed only for wireless algos */ @@ -463,7 +462,8 @@ qat_sym_convert_op_to_vec_chain(struct rte_crypto_op *op, ctx->digest_length); } - n_src = rte_crypto_mbuf_to_vec(op->sym->m_src, min_ofs, max_len, + /* 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, 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; @@ -473,7 +473,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, min_ofs, + int n_dst = rte_crypto_mbuf_to_vec(op->sym->m_dst, 0, max_len, out_sgl->vec, QAT_SYM_SGL_MAX_NUMBER); if (n_dst < 0 || n_dst > op->sym->m_dst->nb_segs) { -- 2.17.1