From patchwork Mon Jun 19 12:45:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejasree Kondoj X-Patchwork-Id: 128791 X-Patchwork-Delegate: thomas@monjalon.net 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 A54A842CFA; Mon, 19 Jun 2023 14:45:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6002142D12; Mon, 19 Jun 2023 14:45:41 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 9A23442BDA for ; Mon, 19 Jun 2023 14:45:39 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35JBUFxR012520 for ; Mon, 19 Jun 2023 05:45:38 -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=OL2sKH8pG8vjiFqx3c4un7nbH3LP2mc/6/yvWo/S7GIk0jc2PAuLa8RLWpbx5nDNOc1h r7+tCRcFn+C6pTQQist+DJSltXxwKAjCxO9tdq9GxIEj+NMymKM8ORoRzFo/Xlt36HPc kFEoxTPfvA7yGf9eKXS6YDdORPdHKAqmIKioNQUM/s3M/BD48cXTuYUBEt2ldArwYIaG X4kzOJ8GufQSi0wYkPKUT6efmE5U8Cz9YUOJWkGPRNLdbK1sXZGEwFbUssEtwqqy1oI8 yzz8irGMqehovdIRuF6WKhgFYm3/loo21sG+FNDPB1C8fF1xq5b9FA/kko7JD0uE52p6 Bw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3r9a6n5hkt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 19 Jun 2023 05:45:38 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 19 Jun 2023 05:45:37 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Mon, 19 Jun 2023 05:45:37 -0700 Received: from hyd1554.marvell.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id 1352D5C68EB; Mon, 19 Jun 2023 05:45:34 -0700 (PDT) From: Tejasree Kondoj To: Akhil Goyal CC: Anoob Joseph , Aakash Sasidharan , Gowrishankar Muthukrishnan , Vidya Sagar Velumuri , Subject: [PATCH 2/8] crypto/cnxk: remove packet length checks in crypto offload Date: Mon, 19 Jun 2023 18:15:22 +0530 Message-ID: <20230619124528.3967275-3-ktejasree@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230619124528.3967275-1-ktejasree@marvell.com> References: <20230619124528.3967275-1-ktejasree@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: gK5hSWv1qIeGQgrAiTiYdehiZYKmuFM1 X-Proofpoint-GUID: gK5hSWv1qIeGQgrAiTiYdehiZYKmuFM1 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-19_09,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;