From patchwork Tue Jun 20 10:21:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejasree Kondoj X-Patchwork-Id: 128838 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 2394342D07; Tue, 20 Jun 2023 12:21:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 87D5742C54; Tue, 20 Jun 2023 12:21:18 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id DEA034113F for ; Tue, 20 Jun 2023 12:21:16 +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 35K9wt5N024228 for ; Tue, 20 Jun 2023 03:21:16 -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=Y4vINa+frPO8vkNhK0Jb/i87q52Aad+TYkL642vwrdobEldaP0gGjE81OkbovM1SFHZK q6T5z1/RaXNUHf3DoTQn77QW/ANy2NrhEzyA9U4nEQUoQ8PeXBl3fbJsxkc+rGyinsun Pg0nn7I+pqLaymskdX1qe7DSQFldrkhk38fBNRtiIXGg6E7HjBSjbXdZq+biltGBU7Vf ETgQKtCw98c2wvWJ8Vns2gY7fanFbzH5Mdp5414WuhUi5lUDA3tGAs1sKEEd2FIDxiI8 VLqcqgQ1YcvBsUXWKYPf0qT+6Evj8s4/1ysnZ4z/s2lLB59rl3ZKg3UMpguy0ha05vD2 Qw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3r9cbkfd3b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 20 Jun 2023 03:21:16 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 20 Jun 2023 03:21:14 -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; Tue, 20 Jun 2023 03:21:14 -0700 Received: from hyd1554.marvell.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id 4E8AA3F707A; Tue, 20 Jun 2023 03:21:12 -0700 (PDT) From: Tejasree Kondoj To: Akhil Goyal CC: Anoob Joseph , Aakash Sasidharan , Gowrishankar Muthukrishnan , Vidya Sagar Velumuri , Subject: [PATCH v3 2/8] crypto/cnxk: remove packet length checks in crypto offload Date: Tue, 20 Jun 2023 15:51:00 +0530 Message-ID: <20230620102106.3970544-3-ktejasree@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230620102106.3970544-1-ktejasree@marvell.com> References: <20230620102106.3970544-1-ktejasree@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: NHhV1obLejg-ote-XlmiPOhtNBP9NEWa X-Proofpoint-ORIG-GUID: NHhV1obLejg-ote-XlmiPOhtNBP9NEWa 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_06,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;