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 5456F41D5F; Fri, 24 Feb 2023 10:41:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2153442D2D; Fri, 24 Feb 2023 10:40:42 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id AB1ED41141 for ; Fri, 24 Feb 2023 10:40:39 +0100 (CET) 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 31O72sB9031843 for ; Fri, 24 Feb 2023 01:40:39 -0800 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=rhTCKIECrsvr/bJeQoiTe+W3YXOZ84Xa31ISLT0UB4c=; b=Tiq+BUW5mLIc1JncludtNuwjvlvIoHwvDjugum04wAw7JMyA8t0ojrXNXZV0kqfXDCjd jvC5+TJDpHdhb3PX5OdxL0ove41gLH6ZnIQIglBsDOfm4VUcYRydyDbwmQeatDrCwP/6 6czfxUHXAg48jg54OFXTYaOx/AHN7WU9+cJTx/9Y1CAzfdaCTFDxVGPag3kVpv+eZiQN VVwpomQ6JFIoDEwg32zRoSxOnuplvktri4rg5yCQAgbwy4fl/FXiLONa4ZK2Ac2eX4Re ljlpObDxsYQSrT/eRVEry2ddMaXM14hK0nQ6+P08SmkkWJwLGNV0mDg/aXGaUyb8di3y dg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3nxfkwb2jj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 24 Feb 2023 01:40:38 -0800 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.42; Fri, 24 Feb 2023 01:40:37 -0800 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.42 via Frontend Transport; Fri, 24 Feb 2023 01:40:36 -0800 Received: from hyd1554.marvell.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id 6DE585B692E; Fri, 24 Feb 2023 01:40:35 -0800 (PST) From: Tejasree Kondoj To: Akhil Goyal CC: Gowrishankar Muthukrishnan , Anoob Joseph , Subject: [PATCH v2 10/11] crypto/cnxk: fix order of ECFPM params Date: Fri, 24 Feb 2023 15:10:13 +0530 Message-ID: <20230224094014.3246764-11-ktejasree@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230224094014.3246764-1-ktejasree@marvell.com> References: <20230224094014.3246764-1-ktejasree@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: kme_FtEBV7noaF4W_VvC1A9fspoWl3IT X-Proofpoint-ORIG-GUID: kme_FtEBV7noaF4W_VvC1A9fspoWl3IT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-24_05,2023-02-23_01,2023-02-09_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 From: Gowrishankar Muthukrishnan Fix the order of ECFPM parameters according to target board. Fixes: 8e39b133235 ("crypto/cnxk: support fixed point multiplication") Signed-off-by: Gowrishankar Muthukrishnan --- drivers/crypto/cnxk/cnxk_ae.h | 48 ++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_ae.h b/drivers/crypto/cnxk/cnxk_ae.h index b7c13a9e01..47f000dd5e 100644 --- a/drivers/crypto/cnxk/cnxk_ae.h +++ b/drivers/crypto/cnxk/cnxk_ae.h @@ -700,7 +700,7 @@ static __rte_always_inline int cnxk_ae_ecfpm_prep(struct rte_crypto_ecpm_op_param *ecpm, struct roc_ae_buf_ptr *meta_buf, uint64_t *fpm_iova, struct roc_ae_ec_group *ec_grp, uint8_t curveid, - struct cpt_inst_s *inst) + struct cpt_inst_s *inst, int cpt_ver) { uint16_t scalar_align, p_align; uint16_t dlen, prime_len; @@ -719,26 +719,33 @@ cnxk_ae_ecfpm_prep(struct rte_crypto_ecpm_op_param *ecpm, scalar_align = RTE_ALIGN_CEIL(ecpm->scalar.length, 8); /* - * Set dlen = sum(ROUNDUP8(input point(x and y coordinates), prime, - * scalar length), + * Set dlen = sum(prime, scalar length, table address and + * optionally ROUNDUP8(input point(x and y coordinates)). * Please note point length is equivalent to prime of the curve */ - dlen = sizeof(fpm_table_iova) + 3 * p_align + scalar_align; - - memset(dptr, 0, dlen); - - *(uint64_t *)dptr = fpm_table_iova; - dptr += sizeof(fpm_table_iova); - - /* Copy scalar, prime */ - memcpy(dptr, ecpm->scalar.data, ecpm->scalar.length); - dptr += scalar_align; - memcpy(dptr, ec_grp->prime.data, ec_grp->prime.length); - dptr += p_align; - memcpy(dptr, ec_grp->consta.data, ec_grp->consta.length); - dptr += p_align; - memcpy(dptr, ec_grp->constb.data, ec_grp->constb.length); - dptr += p_align; + if (cpt_ver == ROC_CPT_REVISION_ID_96XX_C0) { + dlen = sizeof(fpm_table_iova) + 3 * p_align + scalar_align; + memset(dptr, 0, dlen); + *(uint64_t *)dptr = fpm_table_iova; + dptr += sizeof(fpm_table_iova); + memcpy(dptr, ecpm->scalar.data, ecpm->scalar.length); + dptr += scalar_align; + memcpy(dptr, ec_grp->prime.data, ec_grp->prime.length); + dptr += p_align; + memcpy(dptr, ec_grp->consta.data, ec_grp->consta.length); + dptr += p_align; + memcpy(dptr, ec_grp->constb.data, ec_grp->constb.length); + dptr += p_align; + } else { + dlen = sizeof(fpm_table_iova) + p_align + scalar_align; + memset(dptr, 0, dlen); + memcpy(dptr, ecpm->scalar.data, ecpm->scalar.length); + dptr += scalar_align; + memcpy(dptr, ec_grp->prime.data, ec_grp->prime.length); + dptr += p_align; + *(uint64_t *)dptr = fpm_table_iova; + dptr += sizeof(fpm_table_iova); + } /* Setup opcodes */ w4.s.opcode_major = ROC_AE_MAJOR_OP_ECC; @@ -969,7 +976,8 @@ cnxk_ae_enqueue(struct cnxk_cpt_qp *qp, struct rte_crypto_op *op, ret = cnxk_ae_ecfpm_prep(&asym_op->ecpm, &meta_buf, sess->cnxk_fpm_iova, sess->ec_grp[sess->ec_ctx.curveid], - sess->ec_ctx.curveid, inst); + sess->ec_ctx.curveid, inst, + sess->lf->roc_cpt->cpt_revision); if (unlikely(ret)) goto req_fail; break; -- 2.25.1