From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id C724BF984 for ; Mon, 21 May 2018 13:06:54 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2018 04:06:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,426,1520924400"; d="scan'208";a="48451077" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by fmsmga002.fm.intel.com with ESMTP; 21 May 2018 04:06:53 -0700 From: Pablo de Lara To: declan.doherty@intel.com, akhil.goyal@nxp.com, shally.verma@cavium.com Cc: dev@dpdk.org, Pablo de Lara Date: Mon, 21 May 2018 12:06:56 +0100 Message-Id: <20180521110656.42437-7-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521110656.42437-1-pablo.de.lara.guarch@intel.com> References: <20180126090355.25903-1-pablo.de.lara.guarch@intel.com> <20180521110656.42437-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v4 6/6] cryptodev: rename get session size API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2018 11:06:55 -0000 rte_cryptodev_get_header_session_size() and rte_cryptodev_get_private_session_size() functions are targetting symmetric sessions. With the future addition of asymmetric operations, these functions need to be renamed from *_session_* to *_sym_session_* to be symmetric specific. Signed-off-by: Pablo de Lara --- app/test-crypto-perf/main.c | 2 +- doc/guides/prog_guide/cryptodev_lib.rst | 6 ++--- doc/guides/rel_notes/deprecation.rst | 6 +++++ drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 2 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 2 +- drivers/crypto/armv8/rte_armv8_pmd.c | 2 +- drivers/crypto/kasumi/rte_kasumi_pmd.c | 2 +- drivers/crypto/openssl/rte_openssl_pmd.c | 2 +- drivers/crypto/snow3g/rte_snow3g_pmd.c | 2 +- drivers/crypto/zuc/rte_zuc_pmd.c | 2 +- examples/ipsec-secgw/ipsec-secgw.c | 2 +- examples/l2fwd-crypto/main.c | 2 +- examples/vhost_crypto/main.c | 2 +- lib/librte_cryptodev/rte_cryptodev.c | 12 +++++++++ lib/librte_cryptodev/rte_cryptodev.h | 27 +++++++++++++++++++ .../rte_cryptodev_version.map | 8 ++++++ test/test/test_cryptodev.c | 6 +++-- test/test/test_event_crypto_adapter.c | 2 +- 18 files changed, 72 insertions(+), 17 deletions(-) diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index 26e78ff43..bb040a3d6 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -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_get_private_sym_session_size(cdev_id); if (sess_size > max_sess_size) max_sess_size = sess_size; } diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst index b279a20e5..3bccea6d7 100644 --- a/doc/guides/prog_guide/cryptodev_lib.rst +++ b/doc/guides/prog_guide/cryptodev_lib.rst @@ -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_get_private_sym_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_get_header_sym_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_get_private_sym_session_size(cdev_id); /* * Create session mempool, with two objects per session, diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 2819b4864..710a3966a 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -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_get_header_sym_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_get_private_sym_session_size()``. + It will be removed in 18.08. diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index bc5ee1b73..33fe2bdf0 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c @@ -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_get_header_sym_session_size()); rte_mempool_put(qp->sess_mp, 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 2e500784d..c86698b85 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -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_get_header_sym_session_size()); rte_mempool_put(qp->sess_mp, 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 1fe82ccad..389f234ce 100644 --- a/drivers/crypto/armv8/rte_armv8_pmd.c +++ b/drivers/crypto/armv8/rte_armv8_pmd.c @@ -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_get_header_sym_session_size()); rte_mempool_put(qp->sess_mp, sess); rte_mempool_put(qp->sess_mp, 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 08ee90051..e01e081dc 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c @@ -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_get_header_sym_session_size()); rte_mempool_put(qp->sess_mp, 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 f584d0d6f..37d2b688c 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -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_get_header_sym_session_size()); rte_mempool_put(qp->sess_mp, 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 5edc0fa0f..d77267956 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c @@ -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_get_header_sym_session_size()); rte_mempool_put(qp->sess_mp, 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 cd38f3030..4bc961161 100644 --- a/drivers/crypto/zuc/rte_zuc_pmd.c +++ b/drivers/crypto/zuc/rte_zuc_pmd.c @@ -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_get_header_sym_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; diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index c94118ef5..f54064cec 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -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_get_private_sym_session_size(cdev_id); if (sess_sz > max_sess_sz) max_sess_sz = sess_sz; } diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index f4e3e0b10..1bbfd4cf2 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -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_get_private_sym_session_size(cdev_id); if (sess_sz > max_sess_sz) max_sess_sz = sess_sz; } diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c index 860200e29..9639c00a8 100644 --- a/examples/vhost_crypto/main.c +++ b/examples/vhost_crypto/main.c @@ -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_get_private_sym_session_size( cryptodev_id), 64, 0, NULL, NULL, NULL, NULL, rte_lcore_to_socket_id(worker_lcore), 0); if (!info.sess_pool) { diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 4959f2ae6..6c20bdd74 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -1224,6 +1224,12 @@ rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess) unsigned int rte_cryptodev_get_header_session_size(void) +{ + return rte_cryptodev_get_header_sym_session_size(); +} + +unsigned int +rte_cryptodev_get_header_sym_session_size(void) { /* * Header contains pointers to the private data @@ -1235,6 +1241,12 @@ rte_cryptodev_get_header_session_size(void) unsigned int rte_cryptodev_get_private_session_size(uint8_t dev_id) +{ + return rte_cryptodev_get_private_sym_session_size(dev_id); +} + +unsigned int +rte_cryptodev_get_private_sym_session_size(uint8_t dev_id) { struct rte_cryptodev *dev; unsigned int header_size = sizeof(void *) * nb_drivers; diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index db367a1f8..e02b474d7 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -969,15 +969,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. @@ -986,9 +989,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_get_header_sym_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_get_private_sym_session_size(uint8_t dev_id); + /** * @deprecated * Attach queue pair with sym session. diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map index da6905ee6..ed8426c32 100644 --- a/lib/librte_cryptodev/rte_cryptodev_version.map +++ b/lib/librte_cryptodev/rte_cryptodev_version.map @@ -86,6 +86,14 @@ DPDK_17.11 { } DPDK_17.08; +DPDK_18.05 { + global: + + rte_cryptodev_get_header_sym_session_size; + rte_cryptodev_get_private_sym_session_size; + +} DPDK_17.11; + EXPERIMENTAL { global: diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c index 940e3378a..42127246a 100644 --- a/test/test/test_cryptodev.c +++ b/test/test/test_cryptodev.c @@ -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_get_private_sym_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_get_private_sym_session_size(i); /* * Create mempool with maximum number of sessions * 2, diff --git a/test/test/test_event_crypto_adapter.c b/test/test/test_event_crypto_adapter.c index 6f0e79460..464d01790 100644 --- a/test/test/test_event_crypto_adapter.c +++ b/test/test/test_event_crypto_adapter.c @@ -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_get_private_sym_session_size(TEST_CDEV_ID); session_size += sizeof(union rte_event_crypto_metadata); params.session_mpool = rte_mempool_create( -- 2.17.0