cryptodev: rename functions to get session size
authorPablo de Lara <pablo.de.lara.guarch@intel.com>
Mon, 21 May 2018 13:08:41 +0000 (14:08 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Tue, 22 May 2018 14:36:12 +0000 (16:36 +0200)
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>
18 files changed:
app/test-crypto-perf/main.c
doc/guides/prog_guide/cryptodev_lib.rst
doc/guides/rel_notes/deprecation.rst
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
drivers/crypto/armv8/rte_armv8_pmd.c
drivers/crypto/kasumi/rte_kasumi_pmd.c
drivers/crypto/openssl/rte_openssl_pmd.c
drivers/crypto/snow3g/rte_snow3g_pmd.c
drivers/crypto/zuc/rte_zuc_pmd.c
examples/ipsec-secgw/ipsec-secgw.c
examples/l2fwd-crypto/main.c
examples/vhost_crypto/main.c
lib/librte_cryptodev/rte_cryptodev.c
lib/librte_cryptodev/rte_cryptodev.h
lib/librte_cryptodev/rte_cryptodev_version.map
test/test/test_cryptodev.c
test/test/test_event_crypto_adapter.c

index 26e78ff..4ae1439 100644 (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;
        }
index b279a20..30f0bcf 100644 (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,
index 2819b48..1e2443c 100644 (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.
index bc5ee1b..80360dd 100644 (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;
index 2e50078..bb35c66 100644 (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;
index 1fe82cc..fbb08f7 100644 (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;
index 08ee900..205dc1d 100644 (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;
index f584d0d..93c6d7e 100644 (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;
index 5edc0fa..72751e3 100644 (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;
index cd38f30..a805b22 100644 (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;
index c94118e..a5da8b2 100644 (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;
        }
index f4e3e0b..4bca87b 100644 (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;
        }
index 860200e..f334d71 100644 (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) {
index 2f97ce2..7e58212 100644 (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;
index 972f11f..92ce6d4 100644 (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.
index da6905e..be8f4c1 100644 (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:
 
index 940e337..389f796 100644 (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,
index 6f0e794..066b0ad 100644 (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(