From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>
Cc: <anoobj@marvell.com>, Akhil Goyal <gakhil@marvell.com>,
Fan Zhang <fanzhang.oss@gmail.com>,
Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Subject: [PATCH v1 3/4] crypto/cnxk: change order of ECFPM params
Date: Thu, 26 Oct 2023 13:45:11 +0530 [thread overview]
Message-ID: <af11add1f4995745b5a48cb47ee43f40b63d9631.1698307299.git.gmuthukrishn@marvell.com> (raw)
In-Reply-To: <cover.1698307299.git.gmuthukrishn@marvell.com>
Change order of ECFPM params to match changes in v2.0 microcode.
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
drivers/crypto/cnxk/cnxk_ae.h | 49 ++++++++++++++---------------------
1 file changed, 20 insertions(+), 29 deletions(-)
diff --git a/drivers/crypto/cnxk/cnxk_ae.h b/drivers/crypto/cnxk/cnxk_ae.h
index 6e61ccb0c5..f05ae4f4a1 100644
--- a/drivers/crypto/cnxk/cnxk_ae.h
+++ b/drivers/crypto/cnxk/cnxk_ae.h
@@ -923,7 +923,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, int cpt_ver)
+ struct cpt_inst_s *inst)
{
uint16_t scalar_align, p_align;
uint16_t dlen, prime_len;
@@ -942,34 +942,26 @@ cnxk_ae_ecfpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
scalar_align = RTE_ALIGN_CEIL(ecpm->scalar.length, 8);
/*
- * Set dlen = sum(prime, scalar length, table address and
- * optionally ROUNDUP8(input point(x and y coordinates)).
+ * Set dlen = sum(ROUNDUP8(input point(x and y coordinates), prime,
+ * scalar length),
* Please note point length is equivalent to prime of the curve
*/
- if (cpt_ver == ROC_CPT_REVISION_ID_96XX_B0 || cpt_ver == ROC_CPT_REVISION_ID_96XX_C0 ||
- cpt_ver == ROC_CPT_REVISION_ID_98XX) {
- 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);
- }
+ 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;
/* Setup opcodes */
w4.s.opcode_major = ROC_AE_MAJOR_OP_ECC;
@@ -1224,8 +1216,7 @@ 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->lf->roc_cpt->cpt_revision);
+ sess->ec_ctx.curveid, inst);
if (unlikely(ret))
goto req_fail;
break;
--
2.25.1
next prev parent reply other threads:[~2023-10-26 8:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-26 8:15 [PATCH v1 0/4] test/cryptodev: add ECDH tests Gowrishankar Muthukrishnan
2023-10-26 8:15 ` [PATCH v1 1/4] " Gowrishankar Muthukrishnan
2023-10-30 18:48 ` Akhil Goyal
2023-11-08 13:17 ` [PATCH v2] " Gowrishankar Muthukrishnan
2023-11-09 20:24 ` Akhil Goyal
2023-10-26 8:15 ` [PATCH v1 2/4] crypto/cnxk: use generic EC opcodes Gowrishankar Muthukrishnan
2023-10-26 8:15 ` Gowrishankar Muthukrishnan [this message]
2023-10-26 8:15 ` [PATCH v1 4/4] crypto/cnxk: add ECDH support Gowrishankar Muthukrishnan
2023-10-30 18:49 ` Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=af11add1f4995745b5a48cb47ee43f40b63d9631.1698307299.git.gmuthukrishn@marvell.com \
--to=gmuthukrishn@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=gakhil@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).