From patchwork Tue Jun 20 05:27:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejasree Kondoj X-Patchwork-Id: 128815 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8F47442D02; Tue, 20 Jun 2023 07:27:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9512042C4D; Tue, 20 Jun 2023 07:27:47 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 265A142C4D for ; Tue, 20 Jun 2023 07:27:46 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35K23NF5003812 for ; Mon, 19 Jun 2023 22:27:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=VqH42p6BgQsUFHix2v6rh1BZV4LfWPBhmzbFqKCpAjo=; b=IIUmsrh0rMX5KhOGO1LFNE6CwtH+OgVGddOQfDx2XtcCMNA3/PD6WeHoVA+BWn/1twLc 8u4cyFdTIdhe9CfTCQ8a9BGUyPBi/sNJ4/vL6LOCXScZ+wFCkDqm6pfb6xHlME4XlKjb 0kpkRTE4tcb4RcnHLPrWQOfnFA+HFaJ7FLuyuJFNAvej0F4En3ubpmK67lE4aJ1ADWGO MD1mR+zMjeM/zS6tJAR6UEyLhmIQnmak8WHkTp7CuEm25W0zJtTq4d2M9wuJqbhSRil6 +7LUyjfAqR1aKVM5TZ6Jfwf6v1WaTMRVBVA7M8y1UeRvsDPrphbUNa2XgQIlrvmjpStU YA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3r9cbkes0p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 19 Jun 2023 22:27:45 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 19 Jun 2023 22:27:43 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Mon, 19 Jun 2023 22:27:43 -0700 Received: from hyd1554.marvell.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id 31CF53F7070; Mon, 19 Jun 2023 22:27:40 -0700 (PDT) From: Tejasree Kondoj To: Akhil Goyal CC: Anoob Joseph , Aakash Sasidharan , Gowrishankar Muthukrishnan , Vidya Sagar Velumuri , Subject: [PATCH v2 2/8] crypto/cnxk: remove packet length checks in crypto offload Date: Tue, 20 Jun 2023 10:57:29 +0530 Message-ID: <20230620052735.3969606-3-ktejasree@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230620052735.3969606-1-ktejasree@marvell.com> References: <20230620052735.3969606-1-ktejasree@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 97qWgO4EJcX54W_z_4tF2thJ_oul6w1Y X-Proofpoint-ORIG-GUID: 97qWgO4EJcX54W_z_4tF2thJ_oul6w1Y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-20_02,2023-06-16_01,2023-05-22_02 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 From: Anoob Joseph When performing crypto offload, the packet length of the input/output buffer does not matter. The length that matters is the cipher/authentication range specified in crypto_op. Since application can request for ciphering of a small portion of the buffer, the extra comparison of buffer lengths may result in false failures during enqueue of OOP operations. Signed-off-by: Anoob Joseph --- drivers/crypto/cnxk/cnxk_se.h | 54 +++-------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index a85e4c5170..87414eb131 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -2539,23 +2539,6 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, } if (unlikely(m_dst != NULL)) { - uint32_t pkt_len; - - /* Try to make room as much as src has */ - pkt_len = rte_pktmbuf_pkt_len(m_dst); - - if (unlikely(pkt_len < rte_pktmbuf_pkt_len(m_src))) { - pkt_len = rte_pktmbuf_pkt_len(m_src) - pkt_len; - if (!rte_pktmbuf_append(m_dst, pkt_len)) { - plt_dp_err("Not enough space in " - "m_dst %p, need %u" - " more", - m_dst, pkt_len); - ret = -EINVAL; - goto err_exit; - } - } - if (prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0)) { plt_dp_err("Prepare dst iov failed for " "m_dst %p", @@ -2650,32 +2633,18 @@ fill_pdcp_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, fc_params.dst_iov = fc_params.src_iov = (void *)src; prepare_iov_from_pkt_inplace(m_src, &fc_params, &flags); } else { - uint32_t pkt_len; - /* Out of place processing */ + fc_params.src_iov = (void *)src; 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 (unlikely(prepare_iov_from_pkt(m_src, fc_params.src_iov, 0))) { plt_dp_err("Prepare src iov failed"); ret = -EINVAL; goto err_exit; } - /* Try to make room as much as src has */ - pkt_len = rte_pktmbuf_pkt_len(m_dst); - - if (unlikely(pkt_len < rte_pktmbuf_pkt_len(m_src))) { - pkt_len = rte_pktmbuf_pkt_len(m_src) - pkt_len; - if (unlikely(rte_pktmbuf_append(m_dst, pkt_len) == NULL)) { - plt_dp_err("Not enough space in m_dst %p, need %u more", m_dst, - pkt_len); - ret = -EINVAL; - goto err_exit; - } - } - if (unlikely(prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0))) { plt_dp_err("Prepare dst iov failed for m_dst %p", m_dst); ret = -EINVAL; @@ -2689,7 +2658,8 @@ fill_pdcp_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, mdata = alloc_op_meta(&fc_params.meta_buf, m_info->mlen, m_info->pool, infl_req); if (mdata == NULL) { plt_dp_err("Could not allocate meta buffer"); - return -ENOMEM; + ret = -ENOMEM; + goto err_exit; } } @@ -2798,22 +2768,6 @@ fill_pdcp_chain_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, } if (unlikely(m_dst != NULL)) { - uint32_t pkt_len; - - /* Try to make room as much as src has */ - pkt_len = rte_pktmbuf_pkt_len(m_dst); - - if (unlikely(pkt_len < rte_pktmbuf_pkt_len(m_src))) { - pkt_len = rte_pktmbuf_pkt_len(m_src) - pkt_len; - if (!rte_pktmbuf_append(m_dst, pkt_len)) { - plt_dp_err("Not enough space in m_dst " - "%p, need %u more", - m_dst, pkt_len); - ret = -EINVAL; - goto err_exit; - } - } - if (unlikely(prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0))) { plt_dp_err("Could not prepare m_dst iov %p", m_dst); ret = -EINVAL;