cryptodev: rename functions to get session size

rte_cryptodev_get_header_session_size() and
rte_cryptodev_get_private_session_size() functions are
targeting symmetric sessions.

With the future addition of asymmetric operations,
these functions need to be renamed from *cryptodev_*_session_*
to *cryptodev_sym_*_session_* to be symmetric specific.

The two original functions are marked as deprecated
and will be removed in 18.08, so applications can still
use the functions in 18.05.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Shally Verma <shally.verma@caviumnetworks.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
This commit is contained in:
Pablo de Lara 2018-05-21 14:08:41 +01:00
parent d39c461535
commit a106fcce2c
18 changed files with 72 additions and 17 deletions

View File

@ -97,7 +97,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs,
uint32_t max_sess_size = 0, sess_size;
for (cdev_id = 0; cdev_id < rte_cryptodev_count(); cdev_id++) {
sess_size = rte_cryptodev_get_private_session_size(cdev_id);
sess_size = rte_cryptodev_sym_get_private_session_size(cdev_id);
if (sess_size > max_sess_size)
max_sess_size = sess_size;
}

View File

@ -454,12 +454,12 @@ mempool for all crypto devices (where the mempool object size is big
enough to hold the private session of any crypto device), as well as having
multiple session mempools of different sizes for better memory usage.
An application can use ``rte_cryptodev_get_private_session_size()`` to
An application can use ``rte_cryptodev_sym_get_private_session_size()`` to
get the private session size of given crypto device. This function would allow
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_get_header_session_size`` to get
framework also provides ``rte_cryptodev_sym_get_header_session_size`` to get
the size of an uninitialized session.
Once the session mempools have been created, ``rte_cryptodev_sym_session_create()``
@ -662,7 +662,7 @@ using one of the crypto PMDs available in DPDK.
uint8_t cdev_id = rte_cryptodev_get_dev_id(crypto_name);
/* Get private session data size. */
session_size = rte_cryptodev_get_private_session_size(cdev_id);
session_size = rte_cryptodev_sym_get_private_session_size(cdev_id);
/*
* Create session mempool, with two objects per session,

View File

@ -90,3 +90,9 @@ Deprecation Notices
with them.
- Some feature flags such as ``RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER`` are ambiguous,
so some will be replaced by more explicit flags.
- Function ``rte_cryptodev_get_header_session_size()`` will be deprecated
in 18.05, and it gets replaced with ``rte_cryptodev_sym_get_header_session_size()``.
It will be removed in 18.08.
- Function ``rte_cryptodev_get_private_session_size()`` will be deprecated
in 18.05, and it gets replaced with ``rte_cryptodev_sym_get_private_session_size()``.
It will be removed in 18.08.

View File

@ -392,7 +392,7 @@ 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_get_header_session_size());
rte_cryptodev_sym_get_header_session_size());
rte_mempool_put(qp->sess_mp, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;

View File

@ -682,7 +682,7 @@ 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_get_header_session_size());
rte_cryptodev_sym_get_header_session_size());
rte_mempool_put(qp->sess_mp, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;

View File

@ -654,7 +654,7 @@ 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_get_header_session_size());
rte_cryptodev_sym_get_header_session_size());
rte_mempool_put(qp->sess_mp, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;

View File

@ -320,7 +320,7 @@ 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_get_header_session_size());
rte_cryptodev_sym_get_header_session_size());
rte_mempool_put(qp->sess_mp, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;

View File

@ -1569,7 +1569,7 @@ 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_get_header_session_size());
rte_cryptodev_sym_get_header_session_size());
rte_mempool_put(qp->sess_mp, sess);
rte_mempool_put(qp->sess_mp, op->sym->session);
op->sym->session = NULL;

View File

@ -339,7 +339,7 @@ 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_get_header_session_size());
rte_cryptodev_sym_get_header_session_size());
rte_mempool_put(qp->sess_mp, session);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;

View File

@ -327,7 +327,7 @@ 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_get_header_session_size());
rte_cryptodev_sym_get_header_session_size());
rte_mempool_put(qp->sess_mp, sessions[i]);
rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
ops[i]->sym->session = NULL;

View File

@ -1390,7 +1390,7 @@ cryptodevs_init(void)
uint32_t max_sess_sz = 0, sess_sz;
for (cdev_id = 0; cdev_id < rte_cryptodev_count(); cdev_id++) {
sess_sz = rte_cryptodev_get_private_session_size(cdev_id);
sess_sz = rte_cryptodev_sym_get_private_session_size(cdev_id);
if (sess_sz > max_sess_sz)
max_sess_sz = sess_sz;
}

View File

@ -1982,7 +1982,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
}
for (cdev_id = 0; cdev_id < cdev_count; cdev_id++) {
sess_sz = rte_cryptodev_get_private_session_size(cdev_id);
sess_sz = rte_cryptodev_sym_get_private_session_size(cdev_id);
if (sess_sz > max_sess_sz)
max_sess_sz = sess_sz;
}

View File

@ -450,7 +450,7 @@ main(int argc, char *argv[])
snprintf(name, 127, "SESS_POOL_%u", worker_lcore);
info.sess_pool = rte_mempool_create(name, SESSION_MAP_ENTRIES,
rte_cryptodev_get_private_session_size(
rte_cryptodev_sym_get_private_session_size(
cryptodev_id), 64, 0, NULL, NULL, NULL, NULL,
rte_lcore_to_socket_id(worker_lcore), 0);
if (!info.sess_pool) {

View File

@ -1226,6 +1226,12 @@ rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess)
unsigned int
rte_cryptodev_get_header_session_size(void)
{
return rte_cryptodev_sym_get_header_session_size();
}
unsigned int
rte_cryptodev_sym_get_header_session_size(void)
{
/*
* Header contains pointers to the private data
@ -1237,6 +1243,12 @@ rte_cryptodev_get_header_session_size(void)
unsigned int
rte_cryptodev_get_private_session_size(uint8_t dev_id)
{
return rte_cryptodev_sym_get_private_session_size(dev_id);
}
unsigned int
rte_cryptodev_sym_get_private_session_size(uint8_t dev_id)
{
struct rte_cryptodev *dev;
unsigned int header_size = sizeof(void *) * nb_drivers;

View File

@ -972,15 +972,18 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
struct rte_cryptodev_sym_session *sess);
/**
* @deprecated
* Get the size of the header session, for all registered drivers.
*
* @return
* Size of the header session.
*/
__rte_deprecated
unsigned int
rte_cryptodev_get_header_session_size(void);
/**
* @deprecated
* Get the size of the private session data for a device.
*
* @param dev_id The device identifier.
@ -989,9 +992,33 @@ rte_cryptodev_get_header_session_size(void);
* - Size of the private data, if successful
* - 0 if device is invalid or does not have private session
*/
__rte_deprecated
unsigned int
rte_cryptodev_get_private_session_size(uint8_t dev_id);
/**
* Get the size of the header session, for all registered drivers.
*
* @return
* Size of the symmetric eader session.
*/
unsigned int
rte_cryptodev_sym_get_header_session_size(void);
/**
* Get the size of the private symmetric session data
* for a device.
*
* @param dev_id The device identifier.
*
* @return
* - Size of the private data, if successful
* - 0 if device is invalid or does not have private
* symmetric session
*/
unsigned int
rte_cryptodev_sym_get_private_session_size(uint8_t dev_id);
/**
* @deprecated
* Attach queue pair with sym session.

View File

@ -86,6 +86,14 @@ DPDK_17.11 {
} DPDK_17.08;
DPDK_18.05 {
global:
rte_cryptodev_sym_get_header_session_size;
rte_cryptodev_sym_get_private_session_size;
} DPDK_17.11;
EXPERIMENTAL {
global:

View File

@ -428,7 +428,8 @@ testsuite_setup(void)
ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
ts_params->conf.socket_id = SOCKET_ID_ANY;
unsigned int session_size = rte_cryptodev_get_private_session_size(dev_id);
unsigned int session_size =
rte_cryptodev_sym_get_private_session_size(dev_id);
/*
* Create mempool with maximum number of sessions * 2,
@ -8534,7 +8535,8 @@ test_scheduler_attach_slave_op(void)
rte_mempool_free(ts_params->session_mpool);
ts_params->session_mpool = NULL;
}
unsigned int session_size = rte_cryptodev_get_private_session_size(i);
unsigned int session_size =
rte_cryptodev_sym_get_private_session_size(i);
/*
* Create mempool with maximum number of sessions * 2,

View File

@ -523,7 +523,7 @@ configure_cryptodev(void)
* Create mempool with maximum number of sessions * 2,
* to include the session headers & private data
*/
session_size = rte_cryptodev_get_private_session_size(TEST_CDEV_ID);
session_size = rte_cryptodev_sym_get_private_session_size(TEST_CDEV_ID);
session_size += sizeof(union rte_event_crypto_metadata);
params.session_mpool = rte_mempool_create(