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 521D8454AB; Thu, 20 Jun 2024 17:00:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 53F4442EAF; Thu, 20 Jun 2024 16:59:29 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 159D142E9B for ; Thu, 20 Jun 2024 16:59:26 +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 45KASxhZ028088 for ; Thu, 20 Jun 2024 07:59:26 -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=Xq1/vb/lFg75+lVwu 0jVbzG1gNxTGACsYuH225s2CSPkA+/sgZG3WvgypgnZOVAQWlFcgJW/HxSdh+Utw Fbtearp4AY65kLNcnZF3ZIHSEYi1JGxDKdJEmaFPwobWZo7ZQAOYBwUSt+7w9ne7 uJ8ud/v5FOY6IOFpz8kZRMyg0p5muSH7b5EG6LF4hysdJvU4aEoVH/ofxPlCMlD7 zIwgTSH7ZVG3AjO8IljFcuaneQxo23zxKhGYDG+c7V9tpwFSF8capfI4fRQZOJ2/ 4RkoywF2M5YIUduKF1vREDBqDBu21iOoZOiRmSrJ9HCtAKe4vKVSxVJ5eOgDLo3E Ua18w== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3yvjq0h332-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 20 Jun 2024 07:59:26 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 20 Jun 2024 07:59:25 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 20 Jun 2024 07:59:25 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id EB4073F7043; Thu, 20 Jun 2024 07:59:22 -0700 (PDT) From: Aakash Sasidharan To: Ankur Dwivedi , Anoob Joseph , Tejasree Kondoj , Akhil Goyal CC: , , , Subject: [PATCH 10/12] crypto/cnxk: fix aes-gcm zero len input cases Date: Thu, 20 Jun 2024 20:28:46 +0530 Message-ID: <20240620145848.3461844-11-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240620145848.3461844-1-asasidharan@marvell.com> References: <20240620145848.3461844-1-asasidharan@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 0DXXRLhx9oc7rtR01S1t4BvJiC9JptyP X-Proofpoint-GUID: 0DXXRLhx9oc7rtR01S1t4BvJiC9JptyP 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-20_07,2024-06-20_04,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