From: Anoob Joseph <anoobj@marvell.com>
To: Akhil Goyal <akhil.goyal@nxp.com>,
Pablo de Lara <pablo.de.lara.guarch@intel.com>
Cc: Ankur Dwivedi <adwivedi@marvell.com>,
Fiona Trahe <fiona.trahe@intel.com>,
Jerin Jacob <jerinj@marvell.com>,
Narayana Prasad <pathreya@marvell.com>,
Shally Verma <shallyv@marvell.com>,
Kanaka Durga Kotamarthy <kkotamarthy@marvell.com>,
Sunila Sahu <ssahu@marvell.com>,
Tejasree Kondoj <ktejasree@marvell.com>, <dev@dpdk.org>,
Anoob Joseph <anoobj@marvell.com>
Subject: [dpdk-dev] [PATCH v3 06/11] crypto/octeontx2: add session related functions
Date: Wed, 16 Oct 2019 20:55:39 +0530 [thread overview]
Message-ID: <1571239544-13387-7-git-send-email-anoobj@marvell.com> (raw)
In-Reply-To: <1571239544-13387-1-git-send-email-anoobj@marvell.com>
From: Ankur Dwivedi <adwivedi@marvell.com>
This patch adds the symmetric session related callbacks.
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
drivers/common/cpt/cpt_mcode_defines.h | 2 +
drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 117 +++++++++++++++++++++++++-
drivers/crypto/octeontx2/otx2_cryptodev_ops.h | 5 ++
3 files changed, 121 insertions(+), 3 deletions(-)
diff --git a/drivers/common/cpt/cpt_mcode_defines.h b/drivers/common/cpt/cpt_mcode_defines.h
index 91d30a5..f356e62 100644
--- a/drivers/common/cpt/cpt_mcode_defines.h
+++ b/drivers/common/cpt/cpt_mcode_defines.h
@@ -226,6 +226,8 @@ struct cpt_sess_misc {
uint16_t is_null:1;
/** Flag for GMAC */
uint16_t is_gmac:1;
+ /** Engine group */
+ uint16_t egrp:3;
/** AAD length */
uint16_t aad_length;
/** MAC len in bytes */
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
index f2146ba..b06d8f3 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
@@ -17,6 +17,7 @@
#include "cpt_hw_types.h"
#include "cpt_pmd_logs.h"
#include "cpt_pmd_ops_helper.h"
+#include "cpt_ucode.h"
#define METABUF_POOL_CACHE_SIZE 512
@@ -244,6 +245,90 @@ otx2_cpt_qp_destroy(const struct rte_cryptodev *dev, struct otx2_cpt_qp *qp)
return 0;
}
+static int
+sym_session_configure(int driver_id, struct rte_crypto_sym_xform *xform,
+ struct rte_cryptodev_sym_session *sess,
+ struct rte_mempool *pool)
+{
+ struct cpt_sess_misc *misc;
+ void *priv;
+ int ret;
+
+ if (unlikely(cpt_is_algo_supported(xform))) {
+ CPT_LOG_ERR("Crypto xform not supported");
+ return -ENOTSUP;
+ }
+
+ if (unlikely(rte_mempool_get(pool, &priv))) {
+ CPT_LOG_ERR("Could not allocate session private data");
+ return -ENOMEM;
+ }
+
+ misc = priv;
+
+ for ( ; xform != NULL; xform = xform->next) {
+ switch (xform->type) {
+ case RTE_CRYPTO_SYM_XFORM_AEAD:
+ ret = fill_sess_aead(xform, misc);
+ break;
+ case RTE_CRYPTO_SYM_XFORM_CIPHER:
+ ret = fill_sess_cipher(xform, misc);
+ break;
+ case RTE_CRYPTO_SYM_XFORM_AUTH:
+ if (xform->auth.algo == RTE_CRYPTO_AUTH_AES_GMAC)
+ ret = fill_sess_gmac(xform, misc);
+ else
+ ret = fill_sess_auth(xform, misc);
+ break;
+ default:
+ ret = -1;
+ }
+
+ if (ret)
+ goto priv_put;
+ }
+
+ set_sym_session_private_data(sess, driver_id, misc);
+
+ misc->ctx_dma_addr = rte_mempool_virt2iova(misc) +
+ sizeof(struct cpt_sess_misc);
+
+ /*
+ * IE engines support IPsec operations
+ * SE engines support IPsec operations and Air-Crypto operations
+ */
+ if (misc->zsk_flag)
+ misc->egrp = OTX2_CPT_EGRP_SE;
+ else
+ misc->egrp = OTX2_CPT_EGRP_SE_IE;
+
+ return 0;
+
+priv_put:
+ rte_mempool_put(pool, priv);
+
+ CPT_LOG_ERR("Crypto xform not supported");
+ return -ENOTSUP;
+}
+
+static void
+sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
+{
+ void *priv = get_sym_session_private_data(sess, driver_id);
+ struct rte_mempool *pool;
+
+ if (priv == NULL)
+ return;
+
+ memset(priv, 0, cpt_get_session_size());
+
+ pool = rte_mempool_from_obj(priv);
+
+ set_sym_session_private_data(sess, driver_id, NULL);
+
+ rte_mempool_put(pool, priv);
+}
+
/* PMD ops */
static int
@@ -426,6 +511,32 @@ otx2_cpt_queue_pair_release(struct rte_cryptodev *dev, uint16_t qp_id)
return 0;
}
+static unsigned int
+otx2_cpt_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
+{
+ return cpt_get_session_size();
+}
+
+static int
+otx2_cpt_sym_session_configure(struct rte_cryptodev *dev,
+ struct rte_crypto_sym_xform *xform,
+ struct rte_cryptodev_sym_session *sess,
+ struct rte_mempool *pool)
+{
+ CPT_PMD_INIT_FUNC_TRACE();
+
+ return sym_session_configure(dev->driver_id, xform, sess, pool);
+}
+
+static void
+otx2_cpt_sym_session_clear(struct rte_cryptodev *dev,
+ struct rte_cryptodev_sym_session *sess)
+{
+ CPT_PMD_INIT_FUNC_TRACE();
+
+ return sym_session_clear(dev->driver_id, sess);
+}
+
struct rte_cryptodev_ops otx2_cpt_ops = {
/* Device control ops */
.dev_configure = otx2_cpt_dev_config,
@@ -441,7 +552,7 @@ struct rte_cryptodev_ops otx2_cpt_ops = {
.queue_pair_count = NULL,
/* Symmetric crypto ops */
- .sym_session_get_size = NULL,
- .sym_session_configure = NULL,
- .sym_session_clear = NULL,
+ .sym_session_get_size = otx2_cpt_sym_session_get_size,
+ .sym_session_configure = otx2_cpt_sym_session_configure,
+ .sym_session_clear = otx2_cpt_sym_session_clear,
};
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.h b/drivers/crypto/octeontx2/otx2_cryptodev_ops.h
index 9bd24e7..ba93a66 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.h
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.h
@@ -10,6 +10,11 @@
#define OTX2_CPT_MIN_HEADROOM_REQ 24
#define OTX2_CPT_MIN_TAILROOM_REQ 8
+enum otx2_cpt_egrp {
+ OTX2_CPT_EGRP_SE = 0,
+ OTX2_CPT_EGRP_SE_IE = 1,
+};
+
struct rte_cryptodev_ops otx2_cpt_ops;
#endif /* _OTX2_CRYPTODEV_OPS_H_ */
--
2.7.4
next prev parent reply other threads:[~2019-10-16 15:28 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-30 6:28 [dpdk-dev] [PATCH 00/11] add OCTEON TX2 crypto PMD Anoob Joseph
2019-08-30 6:28 ` [dpdk-dev] [PATCH 01/11] crypto/octeontx2: add PMD skeleton Anoob Joseph
2019-10-04 11:21 ` Akhil Goyal
2019-10-05 7:06 ` Anoob Joseph
2019-08-30 6:28 ` [dpdk-dev] [PATCH 02/11] crypto/octeontx2: add device init sequence in probe Anoob Joseph
2019-08-30 6:28 ` [dpdk-dev] [PATCH 03/11] crypto/octeontx2: add device control ops Anoob Joseph
2019-08-30 6:28 ` [dpdk-dev] [PATCH 04/11] crypto/octeontx2: add symmetric capabilities Anoob Joseph
2019-08-30 6:28 ` [dpdk-dev] [PATCH 05/11] crypto/octeontx2: add hardware definitions Anoob Joseph
2019-08-30 6:28 ` [dpdk-dev] [PATCH 06/11] crypto/octeontx2: add queue pair functions Anoob Joseph
2019-08-30 6:28 ` [dpdk-dev] [PATCH 07/11] crypto/octeontx2: add session related functions Anoob Joseph
2019-08-30 6:28 ` [dpdk-dev] [PATCH 08/11] crypto/octeontx2: add enqueue burst Anoob Joseph
2019-08-30 6:28 ` [dpdk-dev] [PATCH 09/11] crypto/octeontx2: add dequeue burst Anoob Joseph
2019-08-30 6:28 ` [dpdk-dev] [PATCH 10/11] test: add OCTEON TX2 tests Anoob Joseph
2019-08-30 6:28 ` [dpdk-dev] [PATCH 11/11] doc: add documentation for OCTEON TX2 crypto PMD Anoob Joseph
2019-09-03 5:22 ` Jerin Jacob Kollanukkaran
2019-09-03 11:18 ` Anoob Joseph
2019-09-03 17:42 ` Thomas Monjalon
2019-09-04 11:07 ` Anoob Joseph
2019-09-04 11:03 ` Jerin Jacob Kollanukkaran
2019-09-26 11:03 ` [dpdk-dev] [PATCH 00/11] add " Anoob Joseph
2019-09-27 7:51 ` Akhil Goyal
2019-10-13 12:39 ` [dpdk-dev] [PATCH v2 00/12] " Anoob Joseph
2019-10-13 12:39 ` [dpdk-dev] [PATCH v2 01/12] crypto/octeontx2: add PMD skeleton Anoob Joseph
2019-10-15 7:56 ` Akhil Goyal
2019-10-15 8:44 ` Anoob Joseph
2019-10-13 12:39 ` [dpdk-dev] [PATCH v2 02/12] crypto/octeontx2: add device init sequence in probe Anoob Joseph
2019-10-13 12:39 ` [dpdk-dev] [PATCH v2 03/12] crypto/octeontx2: add device control ops Anoob Joseph
2019-10-13 12:39 ` [dpdk-dev] [PATCH v2 04/12] crypto/octeontx2: add queue pair functions Anoob Joseph
2019-10-13 12:39 ` [dpdk-dev] [PATCH v2 05/12] crypto/octeontx2: add symmetric capabilities Anoob Joseph
2019-10-13 12:39 ` [dpdk-dev] [PATCH v2 06/12] crypto/octeontx2: add session related functions Anoob Joseph
2019-10-13 12:39 ` [dpdk-dev] [PATCH v2 07/12] crypto/octeontx2: add enqueue/dequeue ops Anoob Joseph
2019-10-15 11:19 ` Gavin Hu (Arm Technology China)
2019-10-16 9:57 ` Anoob Joseph
2019-10-13 12:39 ` [dpdk-dev] [PATCH v2 08/12] test: add OCTEON TX2 tests Anoob Joseph
2019-10-13 12:39 ` [dpdk-dev] [PATCH v2 09/12] crypto/octeontx2: allocate memory for asymmetric operation Anoob Joseph
2019-10-13 12:40 ` [dpdk-dev] [PATCH v2 10/12] crypto/octeontx2: add asymmetric session operations Anoob Joseph
2019-10-13 12:40 ` [dpdk-dev] [PATCH v2 11/12] crypto/octeontx2: add asymmetric in enqueue/dequeue ops Anoob Joseph
2019-10-13 12:40 ` [dpdk-dev] [PATCH v2 12/12] app/test: register octeontx2 PMD to asym testsuite Anoob Joseph
2019-10-16 13:32 ` [dpdk-dev] [PATCH v2 00/12] add OCTEON TX2 crypto PMD Akhil Goyal
2019-10-16 13:39 ` Anoob Joseph
2019-10-16 15:25 ` [dpdk-dev] [PATCH v3 00/11] " Anoob Joseph
2019-10-16 15:25 ` [dpdk-dev] [PATCH v3 01/11] crypto/octeontx2: add PMD skeleton Anoob Joseph
2019-10-16 15:25 ` [dpdk-dev] [PATCH v3 02/11] crypto/octeontx2: add device init sequence in probe Anoob Joseph
2019-10-16 15:25 ` [dpdk-dev] [PATCH v3 03/11] crypto/octeontx2: add device control ops Anoob Joseph
2019-10-16 15:25 ` [dpdk-dev] [PATCH v3 04/11] crypto/octeontx2: add queue pair functions Anoob Joseph
2019-10-16 15:25 ` [dpdk-dev] [PATCH v3 05/11] crypto/octeontx2: add symmetric capabilities Anoob Joseph
2019-10-16 15:25 ` Anoob Joseph [this message]
2019-10-16 15:25 ` [dpdk-dev] [PATCH v3 07/11] crypto/octeontx2: add enqueue/dequeue ops Anoob Joseph
2019-10-16 15:25 ` [dpdk-dev] [PATCH v3 08/11] test: add OCTEON TX2 tests Anoob Joseph
2019-10-16 15:25 ` [dpdk-dev] [PATCH v3 09/11] crypto/octeontx2: add asymmetric session operations Anoob Joseph
2019-10-16 15:25 ` [dpdk-dev] [PATCH v3 10/11] crypto/octeontx2: add asymmetric in enqueue/dequeue ops Anoob Joseph
2019-10-16 15:25 ` [dpdk-dev] [PATCH v3 11/11] app/test: register octeontx2 PMD to asym testsuite Anoob Joseph
2019-10-17 9:48 ` [dpdk-dev] [PATCH v3 00/11] add OCTEON TX2 crypto PMD 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=1571239544-13387-7-git-send-email-anoobj@marvell.com \
--to=anoobj@marvell.com \
--cc=adwivedi@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=ktejasree@marvell.com \
--cc=pablo.de.lara.guarch@intel.com \
--cc=pathreya@marvell.com \
--cc=shallyv@marvell.com \
--cc=ssahu@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).