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 004E1454A7; Mon, 24 Jun 2024 08:32:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6529B40E22; Mon, 24 Jun 2024 08:31:45 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 786654027B for ; Mon, 24 Jun 2024 08:24:40 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45NMJR0W027065 for ; Sun, 23 Jun 2024 23:24:40 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=x V5HlxcGoYTPw7ZFJrLNCaQTeS5tSY6mLGTaBcITRIU=; b=K1C0B/inPWwQAS1ps s5BKula8mEOggZcr/hmue3ov6Tp7XDbLtMrtpUIn06H0z5biw2QR5VCOJueOzY0R IpCfTDXM+SXgTvbKWAO63KNfc0IM9mawoUFJh+woxTmtXaaXYNj+bIYw9vhluHiW JKr5SZLQ9QLEOMlNDXym2HrBfz1FIjJ56ByYzizoCYNn/EGCwv7Z00dSY+emRK1O TIMnE1RFzExZRlR6IU0ijSA8D3SOXqSKluMCbMXfbCZmes3ySrTtIJ1PrTcO3FB5 aIJ3LDI31R0n3yGHCFzycwr9vyNNaFWqH2y6+YPWTBgOgIREwYF1jgK0JZLrzjry Ys/dg== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3ywx4gbp7s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 23 Jun 2024 23:24:39 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 23 Jun 2024 23:24:38 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Sun, 23 Jun 2024 23:24:38 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id EAA703F7040; Sun, 23 Jun 2024 23:24:35 -0700 (PDT) From: Aakash Sasidharan To: Ankur Dwivedi , Anoob Joseph , Tejasree Kondoj , Akhil Goyal CC: , , , Subject: [PATCH v2 10/12] crypto/cnxk: fix aes-gcm zero len input cases Date: Mon, 24 Jun 2024 11:53:59 +0530 Message-ID: <20240624062401.4143606-11-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240624062401.4143606-1-asasidharan@marvell.com> References: <20240620145848.3461844-1-asasidharan@marvell.com> <20240624062401.4143606-1-asasidharan@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: nd9XIRcJPegBN9cxxrCA0Z0l5PH_D_zU X-Proofpoint-ORIG-GUID: nd9XIRcJPegBN9cxxrCA0Z0l5PH_D_zU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-24_05,2024-06-21_01,2024-05-17_01 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 For aes-gcm (AEAD) zero length input, sg code path is taken unlike the digest only cases as AAD is treated as a separate input component. Fix the zero len case in SG path by avoiding the gather component only when it is a non AEAD algorithm. Also add sg version check as the fix only applies to specific model. Fixes: 4d8166d64988 ("crypto/cnxk: enable digest for zero length input") Signed-off-by: Aakash Sasidharan --- drivers/crypto/cnxk/cnxk_se.h | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index 6374718a82..63dbef4411 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -2468,13 +2468,14 @@ fill_sess_gmac(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) } static __rte_always_inline uint32_t -prepare_iov_from_pkt(struct rte_mbuf *pkt, struct roc_se_iov_ptr *iovec, uint32_t start_offset) +prepare_iov_from_pkt(struct rte_mbuf *pkt, struct roc_se_iov_ptr *iovec, uint32_t start_offset, + const bool is_aead, const bool is_sg_ver2) { uint16_t index = 0; void *seg_data = NULL; int32_t seg_size = 0; - if (!pkt || pkt->data_len == 0) { + if (!pkt || (is_sg_ver2 && (pkt->data_len == 0) && !is_aead)) { iovec->buf_cnt = 0; return 0; } @@ -2619,13 +2620,13 @@ fill_sm_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, fc_params.dst_iov = (void *)dst; /* Store SG I/O in the api for reuse */ - if (prepare_iov_from_pkt(m_src, fc_params.src_iov, 0)) { + if (prepare_iov_from_pkt(m_src, fc_params.src_iov, 0, false, is_sg_ver2)) { plt_dp_err("Prepare src iov failed"); ret = -EINVAL; goto err_exit; } - if (prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0)) { + if (prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0, false, is_sg_ver2)) { plt_dp_err("Prepare dst iov failed for m_dst %p", m_dst); ret = -EINVAL; goto err_exit; @@ -2816,14 +2817,15 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, fc_params.dst_iov = (void *)dst; /* Store SG I/O in the api for reuse */ - if (prepare_iov_from_pkt(m_src, fc_params.src_iov, 0)) { + if (prepare_iov_from_pkt(m_src, fc_params.src_iov, 0, is_aead, is_sg_ver2)) { plt_dp_err("Prepare src iov failed"); ret = -EINVAL; goto err_exit; } if (unlikely(m_dst != NULL)) { - if (prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0)) { + if (prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0, is_aead, + is_sg_ver2)) { plt_dp_err("Prepare dst iov failed for " "m_dst %p", m_dst); @@ -2957,13 +2959,15 @@ fill_pdcp_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, fc_params.dst_iov = (void *)dst; /* Store SG I/O in the api for reuse */ - if (unlikely(prepare_iov_from_pkt(m_src, fc_params.src_iov, 0))) { + if (unlikely( + prepare_iov_from_pkt(m_src, fc_params.src_iov, 0, false, is_sg_ver2))) { plt_dp_err("Prepare src iov failed"); ret = -EINVAL; goto err_exit; } - if (unlikely(prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0))) { + if (unlikely( + prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0, false, is_sg_ver2))) { plt_dp_err("Prepare dst iov failed for m_dst %p", m_dst); ret = -EINVAL; goto err_exit; @@ -3080,14 +3084,16 @@ fill_pdcp_chain_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, fc_params.dst_iov = (void *)dst; /* Store SG I/O in the api for reuse */ - if (unlikely(prepare_iov_from_pkt(m_src, fc_params.src_iov, 0))) { + if (unlikely( + prepare_iov_from_pkt(m_src, fc_params.src_iov, 0, false, is_sg_ver2))) { plt_dp_err("Could not prepare src iov"); ret = -EINVAL; goto err_exit; } if (unlikely(m_dst != NULL)) { - if (unlikely(prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0))) { + if (unlikely(prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0, false, + is_sg_ver2))) { plt_dp_err("Could not prepare m_dst iov %p", m_dst); ret = -EINVAL; goto err_exit; @@ -3306,7 +3312,7 @@ fill_digest_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, params.src_iov = (void *)src; /*Store SG I/O in the api for reuse */ - if (prepare_iov_from_pkt(m_src, params.src_iov, auth_range_off)) { + if (prepare_iov_from_pkt(m_src, params.src_iov, auth_range_off, false, is_sg_ver2)) { plt_dp_err("Prepare src iov failed"); ret = -EINVAL; goto free_mdata_and_exit; -- 2.25.1