From: Fan Zhang <roy.fan.zhang@intel.com>
To: dev@dpdk.org
Cc: akhil.goyal@nxp.com, pablo.de.lara.guarch@intel.com,
fiona.trahe@intel.com
Subject: [dpdk-dev] [PATCH v4 08/12] cryptodev: add sym session header size API
Date: Wed, 9 Jan 2019 22:56:05 +0000 [thread overview]
Message-ID: <20190109225609.20590-9-roy.fan.zhang@intel.com> (raw)
In-Reply-To: <20190109225609.20590-1-roy.fan.zhang@intel.com>
This patch adds a new API in Cryptodev Framework. The API is used
to get the header size for the created symmetric Cryptodev session.
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
doc/guides/prog_guide/cryptodev_lib.rst | 3 ++-
doc/guides/rel_notes/release_19_02.rst | 7 +++++++
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 3 ++-
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 3 ++-
drivers/crypto/armv8/rte_armv8_pmd.c | 3 ++-
drivers/crypto/kasumi/rte_kasumi_pmd.c | 3 ++-
drivers/crypto/openssl/rte_openssl_pmd.c | 3 ++-
drivers/crypto/snow3g/rte_snow3g_pmd.c | 3 ++-
drivers/crypto/zuc/rte_zuc_pmd.c | 3 ++-
lib/librte_cryptodev/rte_cryptodev.c | 10 ++++++++++
lib/librte_cryptodev/rte_cryptodev.h | 15 +++++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 1 +
12 files changed, 49 insertions(+), 8 deletions(-)
diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst
index 366508618..9dc2d2aa4 100644
--- a/doc/guides/prog_guide/cryptodev_lib.rst
+++ b/doc/guides/prog_guide/cryptodev_lib.rst
@@ -471,7 +471,8 @@ an application to calculate the max device session size of all crypto devices
to create a single session mempool.
If instead an application creates multiple session mempools, the Crypto device
framework also provides ``rte_cryptodev_sym_get_header_session_size`` to get
-the size of an uninitialized session.
+the size of an uninitialized session. For the initialized session, the function
+``rte_cryptodev_sym_get_existing_header_session_size`` should be used instead.
Once the session mempools have been created, ``rte_cryptodev_sym_session_create()``
is used to allocate an uninitialized session from the given mempool.
diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst
index 0b3c30c80..445d6a809 100644
--- a/doc/guides/rel_notes/release_19_02.rst
+++ b/doc/guides/rel_notes/release_19_02.rst
@@ -172,6 +172,13 @@ API Changes
and all crypto applications are required to use this function to create
symmetric session mempool from now on.
+* cryptodev: introduced a new function
+ ``rte_cryptodev_sym_get_existing_header_session_size()``. The function is
+ used to get the session header size from existing symmetric session. Since
+ different sessions may be created from the mempools with different elt size,
+ using this function help pinpoint the exact header data for the session
+ header.
+
ABI Changes
-----------
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index abc7a6d5f..948ff0763 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -419,7 +419,8 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_gcm_session));
memset(op->sym->session, 0,
- rte_cryptodev_sym_get_header_session_size());
+ rte_cryptodev_sym_get_existing_header_session_size(
+ op->sym->session));
rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index b0f5c4d67..f3b270d09 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -951,7 +951,8 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job)
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct aesni_mb_session));
memset(op->sym->session, 0,
- rte_cryptodev_sym_get_header_session_size());
+ rte_cryptodev_sym_get_existing_header_session_size(
+ op->sym->session));
rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c
index 3b2d7fb2f..0d4649adc 100644
--- a/drivers/crypto/armv8/rte_armv8_pmd.c
+++ b/drivers/crypto/armv8/rte_armv8_pmd.c
@@ -655,7 +655,8 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op,
if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sess, 0, sizeof(struct armv8_crypto_session));
memset(op->sym->session, 0,
- rte_cryptodev_sym_get_header_session_size());
+ rte_cryptodev_sym_get_existing_header_session_size(
+ op->sym->session));
rte_mempool_put(qp->sess_mp, sess);
rte_mempool_put(qp->sess_mp_priv, op->sym->session);
op->sym->session = NULL;
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index 6df645a23..3abdb01a9 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -325,7 +325,8 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct kasumi_session));
memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_header_session_size());
+ rte_cryptodev_sym_get_existing_header_session_size(
+ ops[i]->sym->session));
rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c
index a193af642..ea5aac69e 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -2020,7 +2020,8 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
openssl_reset_session(sess);
memset(sess, 0, sizeof(struct openssl_session));
memset(op->sym->session, 0,
- rte_cryptodev_sym_get_header_session_size());
+ rte_cryptodev_sym_get_existing_header_session_size(
+ op->sym->session));
rte_mempool_put(qp->sess_mp_priv, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;
diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c
index 7d131f780..5fd94b686 100644
--- a/drivers/crypto/snow3g/rte_snow3g_pmd.c
+++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c
@@ -340,7 +340,8 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session,
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(session, 0, sizeof(struct snow3g_session));
memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_header_session_size());
+ rte_cryptodev_sym_get_existing_header_session_size(
+ ops[i]->sym->session));
rte_mempool_put(qp->sess_mp_priv, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c
index 997c2092f..637994dfd 100644
--- a/drivers/crypto/zuc/rte_zuc_pmd.c
+++ b/drivers/crypto/zuc/rte_zuc_pmd.c
@@ -327,7 +327,8 @@ process_ops(struct rte_crypto_op **ops, enum zuc_operation op_type,
if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
memset(sessions[i], 0, sizeof(struct zuc_session));
memset(ops[i]->sym->session, 0,
- rte_cryptodev_sym_get_header_session_size());
+ rte_cryptodev_sym_get_existing_header_session_size(
+ ops[i]->sym->session));
rte_mempool_put(qp->sess_mp_priv, sessions[i]);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 5b1449d14..f4f1cf598 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1407,6 +1407,16 @@ rte_cryptodev_sym_get_header_session_size(void)
return ((sizeof(void *) * nb_drivers) + sizeof(uint8_t));
}
+unsigned int
+rte_cryptodev_sym_get_existing_header_session_size(
+ struct rte_cryptodev_sym_session *sess)
+{
+ if (!sess)
+ return 0;
+ else
+ return rte_cryptodev_sym_get_header_session_size();
+}
+
unsigned int __rte_experimental
rte_cryptodev_asym_get_header_session_size(void)
{
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 265f02cbe..c4db3aa0b 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -1137,6 +1137,21 @@ unsigned int
rte_cryptodev_sym_get_header_session_size(void);
/**
+ * Get the size of the header session from created session.
+ *
+ * @param sess
+ * The sym cryptodev session pointer
+ *
+ * @return
+ * - If sess is not NULL, return the size of the header session including
+ * the private data size defined within sess.
+ * - If sess is NULL, return 0.
+ */
+unsigned int
+rte_cryptodev_sym_get_existing_header_session_size(
+ struct rte_cryptodev_sym_session *sess);
+
+/**
* Get the size of the asymmetric session header, for all registered drivers.
*
* @return
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 5b6b679f5..0c8d67223 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -91,6 +91,7 @@ DPDK_18.05 {
DPDK_19.02 {
global:
+ rte_cryptodev_sym_get_existing_header_session_size;
rte_cryptodev_sym_session_pool_create;
} DPDK_18.05;
--
2.13.6
next prev parent reply other threads:[~2019-01-09 22:56 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-15 17:24 [dpdk-dev] [PATCH 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
2018-11-15 17:24 ` [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure Fan Zhang
2018-11-16 12:05 ` Ananyev, Konstantin
2018-11-19 10:12 ` Zhang, Roy Fan
2018-12-04 16:05 ` Trahe, Fiona
2018-11-15 17:24 ` [dpdk-dev] [PATCH 2/2] cryptodev: change symmetric session structure Fan Zhang
2018-11-16 0:47 ` Ananyev, Konstantin
2018-11-16 14:32 ` Ananyev, Konstantin
2018-11-19 10:11 ` Zhang, Roy Fan
2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 1/2] cryptodev: change queue pair configure structure Fan Zhang
2018-12-17 19:31 ` Trahe, Fiona
2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session structure Fan Zhang
2018-12-17 20:29 ` Trahe, Fiona
2018-12-18 16:25 ` Zhang, Roy Fan
2018-12-18 16:32 ` Trahe, Fiona
2018-12-11 12:26 ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Ananyev, Konstantin
2018-12-21 13:55 ` [dpdk-dev] [PATCH v3 0/2] cryptodev: " Fan Zhang
2018-12-21 13:55 ` [dpdk-dev] [PATCH v3 1/2] cryptodev: change queue pair configure structure Fan Zhang
2019-01-08 23:20 ` De Lara Guarch, Pablo
2019-01-09 11:30 ` Zhang, Roy Fan
2019-01-09 10:41 ` De Lara Guarch, Pablo
2018-12-21 13:55 ` [dpdk-dev] [PATCH v3 2/2] cryptodev: change symmetric session structure Fan Zhang
2019-01-08 16:12 ` Trahe, Fiona
2019-01-09 11:01 ` De Lara Guarch, Pablo
2019-01-09 11:10 ` Zhang, Roy Fan
2019-01-09 22:55 ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
2019-01-09 22:55 ` [dpdk-dev] [PATCH v4 01/12] cryptodev: change queue pair configure structure Fan Zhang
2019-01-10 9:47 ` De Lara Guarch, Pablo
2019-01-10 11:24 ` De Lara Guarch, Pablo
2019-01-09 22:55 ` [dpdk-dev] [PATCH v4 02/12] cryptodev: add sym session mempool create Fan Zhang
2019-01-10 11:22 ` De Lara Guarch, Pablo
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 03/12] app/test-crypto-perf: use separate session mempools Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 04/12] net/softnic: " Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 05/12] examples: " Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 06/12] vhost/crypto: " Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 07/12] test/crypto: " Fan Zhang
2019-01-09 22:56 ` Fan Zhang [this message]
2019-01-10 13:28 ` [dpdk-dev] [PATCH v4 08/12] cryptodev: add sym session header size API De Lara Guarch, Pablo
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 09/12] cryptodev: update symmetric session structure Fan Zhang
2019-01-10 13:06 ` De Lara Guarch, Pablo
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 10/12] cryptodev: add user data size to symmetric session Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 11/12] cryptodev: add reference count to session private data Fan Zhang
2019-01-10 12:35 ` De Lara Guarch, Pablo
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 12/12] cryptodev: add opaque data field to symmetric session Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 00/12] cryptodev: change qp conf and sym session Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 01/12] cryptodev: change queue pair configure structure Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 02/12] cryptodev: add sym session mempool create Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 03/12] app/test-crypto-perf: use separate session mempools Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 04/12] net/softnic: " Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 05/12] examples: " Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 06/12] vhost/crypto: " Fan Zhang
2019-01-11 9:13 ` Maxime Coquelin
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 07/12] test/crypto: " Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 08/12] cryptodev: add sym session header size API Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 09/12] cryptodev: update symmetric session structure Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 10/12] cryptodev: add user data size to symmetric session Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 11/12] cryptodev: add reference count to session private data Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 12/12] cryptodev: add opaque data field to symmetric session Fan Zhang
2019-01-10 15:06 ` [dpdk-dev] [PATCH v5 00/12] cryptodev: change qp conf and sym session Akhil Goyal
2019-01-10 17:18 ` De Lara Guarch, Pablo
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=20190109225609.20590-9-roy.fan.zhang@intel.com \
--to=roy.fan.zhang@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
--cc=pablo.de.lara.guarch@intel.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).