DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anoob Joseph <anoobj@marvell.com>
To: Akhil Goyal <akhil.goyal@nxp.com>,
	Pablo de Lara <pablo.de.lara.guarch@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>
Cc: Kanaka Durga Kotamarthy <kkotamarthy@marvell.com>,
	Jerin Jacob <jerinj@marvell.com>,
	Narayana Prasad <pathreya@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>,
	Fiona Trahe <fiona.trahe@intel.com>,
	Shally Verma <shallyv@marvell.com>,
	Sunila Sahu <ssahu@marvell.com>, <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 2/6] crypto/octeontx2: allocate memory for asymmetric operation
Date: Mon, 9 Sep 2019 20:56:35 +0530	[thread overview]
Message-ID: <1568042799-25982-3-git-send-email-anoobj@marvell.com> (raw)
In-Reply-To: <1568042799-25982-1-git-send-email-anoobj@marvell.com>

From: Kanaka Durga Kotamarthy <kkotamarthy@marvell.com>

This patch determines metabuf length needed to perform asymmetric crypto
operation.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Kanaka Durga Kotamarthy <kkotamarthy@marvell.com>
Signed-off-by: Sunila Sahu <ssahu@marvell.com>
---
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 37 +++++++++++++++++++--------
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
index b21714c..6050b18 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
@@ -38,24 +38,39 @@ otx2_cpt_metabuf_mempool_create(const struct rte_cryptodev *dev,
 				int nb_elements)
 {
 	char mempool_name[RTE_MEMPOOL_NAMESIZE];
-	int sg_mlen, lb_mlen, max_mlen, ret;
 	struct cpt_qp_meta_info *meta_info;
 	struct rte_mempool *pool;
+	int ret, max_mlen;
+	int asym_mlen = 0;
+	int lb_mlen = 0;
+	int sg_mlen = 0;
 
-	/* Get meta len for scatter gather mode */
-	sg_mlen = cpt_pmd_ops_helper_get_mlen_sg_mode();
+	if (dev->feature_flags & RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO) {
 
-	/* Extra 32B saved for future considerations */
-	sg_mlen += 4 * sizeof(uint64_t);
+		/* Get meta len for scatter gather mode */
+		sg_mlen = cpt_pmd_ops_helper_get_mlen_sg_mode();
 
-	/* Get meta len for linear buffer (direct) mode */
-	lb_mlen = cpt_pmd_ops_helper_get_mlen_direct_mode();
+		/* Extra 32B saved for future considerations */
+		sg_mlen += 4 * sizeof(uint64_t);
 
-	/* Extra 32B saved for future considerations */
-	lb_mlen += 4 * sizeof(uint64_t);
+		/* Get meta len for linear buffer (direct) mode */
+		lb_mlen = cpt_pmd_ops_helper_get_mlen_direct_mode();
 
-	/* Check max requirement for meta buffer */
-	max_mlen = RTE_MAX(lb_mlen, sg_mlen);
+		/* Extra 32B saved for future considerations */
+		lb_mlen += 4 * sizeof(uint64_t);
+	}
+
+	if (dev->feature_flags & RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO) {
+
+		/* Get meta len required for asymmetric operations */
+		asym_mlen = cpt_pmd_ops_helper_asym_get_mlen();
+	}
+
+	/*
+	 * Check max requirement for meta buffer to
+	 * support crypto op of any type (sym/asym).
+	 */
+	max_mlen = RTE_MAX(RTE_MAX(lb_mlen, sg_mlen), asym_mlen);
 
 	/* Allocate mempool */
 
-- 
2.7.4


  parent reply	other threads:[~2019-09-09 15:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-09 15:26 [dpdk-dev] [PATCH 0/6] add asymmetric support in crypto_octeontx2 PMD Anoob Joseph
2019-09-09 15:26 ` [dpdk-dev] [PATCH 1/6] crypto/octeontx2: add RSA and modexp asym capabilities Anoob Joseph
2019-09-09 15:26 ` Anoob Joseph [this message]
2019-09-09 15:26 ` [dpdk-dev] [PATCH 3/6] crypto/octeontx2: add asymmetric session operations Anoob Joseph
2019-09-09 15:26 ` [dpdk-dev] [PATCH 4/6] crypto/octeontx2: add asymmetric in enqueue/dequeue ops Anoob Joseph
2019-10-01 14:11   ` Akhil Goyal
2019-10-02 10:55     ` Anoob Joseph
2019-09-09 15:26 ` [dpdk-dev] [PATCH 5/6] app/test: register octeontx2 PMD to asym testsuite Anoob Joseph
2019-10-01 14:13   ` Akhil Goyal
2019-10-02 10:52     ` Anoob Joseph
2019-09-09 15:26 ` [dpdk-dev] [PATCH 6/6] doc: add documentation for OCTEON TX2 crypto asym support Anoob Joseph
2019-09-10  4:13   ` Jerin Jacob Kollanukkaran
2019-09-10  6:12     ` Anoob Joseph
2019-09-10  6:30     ` Thomas Monjalon
2019-09-10 11:33       ` Anoob Joseph
2019-09-10 11:39         ` Akhil Goyal
2019-09-10 12:23           ` Anoob Joseph
2019-09-10 11:41         ` Thomas Monjalon
2019-09-09 16:25 ` [dpdk-dev] [PATCH 0/6] add asymmetric support in crypto_octeontx2 PMD Shally Verma

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=1568042799-25982-3-git-send-email-anoobj@marvell.com \
    --to=anoobj@marvell.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=jerinj@marvell.com \
    --cc=kkotamarthy@marvell.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=pathreya@marvell.com \
    --cc=shallyv@marvell.com \
    --cc=ssahu@marvell.com \
    --cc=thomas@monjalon.net \
    /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).