From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 1D6691B76F for ; Thu, 10 Jan 2019 15:50:27 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2019 06:50:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,461,1539673200"; d="scan'208";a="126595012" Received: from silpixa00398673.ir.intel.com (HELO silpixa00398673.ger.corp.intel.com) ([10.237.223.54]) by orsmga001.jf.intel.com with ESMTP; 10 Jan 2019 06:50:25 -0800 From: Fan Zhang To: dev@dpdk.org Cc: akhil.goyal@nxp.com, pablo.de.lara.guarch@intel.com, fiona.trahe@intel.com Date: Thu, 10 Jan 2019 14:50:11 +0000 Message-Id: <20190110145022.42883-2-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190110145022.42883-1-roy.fan.zhang@intel.com> References: <20190109225609.20590-1-roy.fan.zhang@intel.com> <20190110145022.42883-1-roy.fan.zhang@intel.com> Subject: [dpdk-dev] [PATCH v5 01/12] cryptodev: change queue pair configure structure 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: Thu, 10 Jan 2019 14:50:29 -0000 This patch changes the cryptodev queue pair configure structure to enable two mempool passed into cryptodev PMD simutaneously. Signed-off-by: Fan Zhang Acked-by: Fiona Trahe --- app/test-crypto-perf/main.c | 6 ++-- doc/guides/prog_guide/cryptodev_lib.rst | 19 ++++++++--- doc/guides/rel_notes/deprecation.rst | 3 -- doc/guides/rel_notes/release_19_02.rst | 9 +++++- drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 ++-- drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c | 5 +-- drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h | 2 ++ drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 7 ++-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 5 +-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 2 ++ drivers/crypto/armv8/rte_armv8_pmd.c | 7 ++-- drivers/crypto/armv8/rte_armv8_pmd_ops.c | 5 +-- drivers/crypto/armv8/rte_armv8_pmd_private.h | 2 ++ drivers/crypto/caam_jr/caam_jr.c | 3 +- drivers/crypto/ccp/ccp_pmd_ops.c | 5 +-- drivers/crypto/ccp/ccp_pmd_private.h | 2 ++ drivers/crypto/ccp/rte_ccp_pmd.c | 9 +++++- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 3 +- drivers/crypto/dpaa_sec/dpaa_sec.c | 3 +- drivers/crypto/kasumi/rte_kasumi_pmd.c | 7 ++-- drivers/crypto/kasumi/rte_kasumi_pmd_ops.c | 5 +-- drivers/crypto/kasumi/rte_kasumi_pmd_private.h | 2 ++ drivers/crypto/mvsam/rte_mrvl_pmd_ops.c | 5 +-- drivers/crypto/mvsam/rte_mrvl_pmd_private.h | 3 ++ drivers/crypto/null/null_crypto_pmd.c | 5 +-- drivers/crypto/null/null_crypto_pmd_ops.c | 5 +-- drivers/crypto/null/null_crypto_pmd_private.h | 2 ++ drivers/crypto/octeontx/otx_cryptodev_ops.c | 3 +- drivers/crypto/openssl/rte_openssl_pmd.c | 7 ++-- drivers/crypto/openssl/rte_openssl_pmd_ops.c | 5 +-- drivers/crypto/openssl/rte_openssl_pmd_private.h | 2 ++ drivers/crypto/qat/qat_sym_pmd.c | 2 +- drivers/crypto/scheduler/scheduler_pmd_ops.c | 5 ++- drivers/crypto/snow3g/rte_snow3g_pmd.c | 7 ++-- drivers/crypto/snow3g/rte_snow3g_pmd_ops.c | 5 +-- drivers/crypto/snow3g/rte_snow3g_pmd_private.h | 2 ++ drivers/crypto/virtio/virtio_cryptodev.c | 6 ++-- drivers/crypto/zuc/rte_zuc_pmd.c | 7 ++-- drivers/crypto/zuc/rte_zuc_pmd_ops.c | 5 +-- drivers/crypto/zuc/rte_zuc_pmd_private.h | 2 ++ drivers/net/softnic/rte_eth_softnic_cryptodev.c | 2 +- examples/fips_validation/main.c | 4 +-- examples/ip_pipeline/cryptodev.c | 2 +- examples/ipsec-secgw/ipsec-secgw.c | 7 ++-- examples/l2fwd-crypto/main.c | 4 ++- examples/vhost_crypto/main.c | 9 ++++-- lib/librte_cryptodev/Makefile | 4 +-- lib/librte_cryptodev/meson.build | 4 +-- lib/librte_cryptodev/rte_cryptodev.c | 16 ++++++++-- lib/librte_cryptodev/rte_cryptodev.h | 7 ++-- lib/librte_cryptodev/rte_cryptodev_pmd.h | 3 +- test/test/test_cryptodev.c | 37 +++++++++------------- test/test/test_cryptodev_asym.c | 8 ++--- test/test/test_event_crypto_adapter.c | 5 +-- 54 files changed, 189 insertions(+), 119 deletions(-) diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index 953e058c9..38a2e429f 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -218,6 +218,9 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs, session_pool_socket[socket_id] = sess_mp; } + qp_conf.mp_session = session_pool_socket[socket_id]; + qp_conf.mp_session_private = session_pool_socket[socket_id]; + ret = rte_cryptodev_configure(cdev_id, &conf); if (ret < 0) { printf("Failed to configure cryptodev %u", cdev_id); @@ -226,8 +229,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs, for (j = 0; j < opts->nb_qps; j++) { ret = rte_cryptodev_queue_pair_setup(cdev_id, j, - &qp_conf, socket_id, - session_pool_socket[socket_id]); + &qp_conf, socket_id); if (ret < 0) { printf("Failed to setup queue pair %u on " "cryptodev %u", j, cdev_id); diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guide/cryptodev_lib.rst index 8ee33c875..0bb6a8841 100644 --- a/doc/guides/prog_guide/cryptodev_lib.rst +++ b/doc/guides/prog_guide/cryptodev_lib.rst @@ -121,11 +121,21 @@ Each queue pairs resources may be allocated on a specified socket. const struct rte_cryptodev_qp_conf *qp_conf, int socket_id) - struct rte_cryptodev_qp_conf { + struct rte_cryptodev_qp_conf { uint32_t nb_descriptors; /**< Number of descriptors per queue pair */ + struct rte_mempool *mp_session; + /**< The mempool for creating session in sessionless mode */ + struct rte_mempool *mp_session_private; + /**< The mempool for creating sess private data in sessionless mode */ }; +The fields ``mp_session`` and ``mp_session_private`` are used for creating +temporary session to process the crypto operations in the session-less mode. +They can be the same other different mempools. Please note not all Cryptodev +PMDs supports session-less mode. + + Logical Cores, Memory and Queues Pair Relationships ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -682,14 +692,15 @@ using one of the crypto PMDs available in DPDK. .socket_id = socket_id }; struct rte_cryptodev_qp_conf qp_conf = { - .nb_descriptors = 2048 + .nb_descriptors = 2048, + .mp_session = session_pool, + .mp_session_private = session_pool }; if (rte_cryptodev_configure(cdev_id, &conf) < 0) rte_exit(EXIT_FAILURE, "Failed to configure cryptodev %u", cdev_id); - if (rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf, - socket_id, session_pool) < 0) + if (rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf, socket_id) < 0) rte_exit(EXIT_FAILURE, "Failed to setup queue pair\n"); if (rte_cryptodev_start(cdev_id) < 0) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index d4aea4b46..df12835eb 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -80,6 +80,3 @@ Deprecation Notices - The size and layout of ``rte_cryptodev_sym_session`` will change to fix existing issues. - - The size and layout of ``rte_cryptodev_qp_conf`` and syntax of - ``rte_cryptodev_queue_pair_setup`` will change to to allow to use - two different mempools for crypto and device private sessions. diff --git a/doc/guides/rel_notes/release_19_02.rst b/doc/guides/rel_notes/release_19_02.rst index e3b2055d0..527705926 100644 --- a/doc/guides/rel_notes/release_19_02.rst +++ b/doc/guides/rel_notes/release_19_02.rst @@ -164,6 +164,9 @@ API Changes ``rte_pdump_init()`` and enum ``rte_pdump_socktype`` were deprecated since 18.05 and are removed in this release. +* cryptodev: The parameter ``session_pool`` in the function + ``rte_cryptodev_queue_pair_setup()`` is removed. + ABI Changes ----------- @@ -183,6 +186,10 @@ ABI Changes * mbuf: The format of the sched field of ``rte_mbuf`` has been changed to include the following fields: ``queue ID``, ``traffic class``, ``color``. +* cryptodev: as shown in the the 18.11 deprecation notice, the structure + ``rte_cryptodev_qp_conf`` has been added two parameters of symmetric session + mempool and symmetric session private data mempool. + Shared Library Versions ----------------------- @@ -214,7 +221,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_cfgfile.so.2 librte_cmdline.so.2 librte_compressdev.so.1 - librte_cryptodev.so.5 + + librte_cryptodev.so.6 librte_distributor.so.1 librte_eal.so.9 librte_efd.so.1 diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index ebdf7c35a..abc7a6d5f 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c @@ -151,7 +151,8 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op) if (rte_mempool_get(qp->sess_mp, (void **)&_sess)) return NULL; - if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data)) + if (rte_mempool_get(qp->sess_mp_priv, + (void **)&_sess_private_data)) return NULL; sess = (struct aesni_gcm_session *)_sess_private_data; @@ -159,7 +160,7 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op) if (unlikely(aesni_gcm_set_session_parameters(qp->ops, sess, sym_op->xform) != 0)) { rte_mempool_put(qp->sess_mp, _sess); - rte_mempool_put(qp->sess_mp, _sess_private_data); + rte_mempool_put(qp->sess_mp_priv, _sess_private_data); sess = NULL; } sym_op->session = (struct rte_cryptodev_sym_session *)_sess; @@ -419,7 +420,7 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp, memset(sess, 0, sizeof(struct aesni_gcm_session)); memset(op->sym->session, 0, rte_cryptodev_sym_get_header_session_size()); - rte_mempool_put(qp->sess_mp, sess); + 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_gcm/aesni_gcm_pmd_ops.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c index cd15245bd..bf69dde54 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c @@ -206,7 +206,7 @@ aesni_gcm_pmd_qp_create_processed_pkts_ring(struct aesni_gcm_qp *qp, static int aesni_gcm_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, struct rte_mempool *session_pool) + int socket_id) { struct aesni_gcm_qp *qp = NULL; struct aesni_gcm_private *internals = dev->data->dev_private; @@ -234,7 +234,8 @@ aesni_gcm_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, if (qp->processed_pkts == NULL) goto qp_setup_cleanup; - qp->sess_mp = session_pool; + qp->sess_mp = qp_conf->mp_session; + qp->sess_mp_priv = qp_conf->mp_session_private; memset(&qp->qp_stats, 0, sizeof(qp->qp_stats)); diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h index 92b041354..903e7503d 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_private.h @@ -48,6 +48,8 @@ struct aesni_gcm_qp { /**< Queue pair statistics */ struct rte_mempool *sess_mp; /**< Session Mempool */ + struct rte_mempool *sess_mp_priv; + /**< Session Private Data Mempool */ uint16_t id; /**< Queue Pair Identifier */ char name[RTE_CRYPTODEV_NAME_MAX_LEN]; diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index 83250e32c..b0f5c4d67 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -668,7 +668,8 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op) if (rte_mempool_get(qp->sess_mp, (void **)&_sess)) return NULL; - if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data)) + if (rte_mempool_get(qp->sess_mp_priv, + (void **)&_sess_private_data)) return NULL; sess = (struct aesni_mb_session *)_sess_private_data; @@ -676,7 +677,7 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op) if (unlikely(aesni_mb_set_session_parameters(qp->op_fns, sess, op->sym->xform) != 0)) { rte_mempool_put(qp->sess_mp, _sess); - rte_mempool_put(qp->sess_mp, _sess_private_data); + rte_mempool_put(qp->sess_mp_priv, _sess_private_data); sess = NULL; } op->sym->session = (struct rte_cryptodev_sym_session *)_sess; @@ -951,7 +952,7 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job) memset(sess, 0, sizeof(struct aesni_mb_session)); memset(op->sym->session, 0, rte_cryptodev_sym_get_header_session_size()); - rte_mempool_put(qp->sess_mp, sess); + 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_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c index f3eff2685..af3021616 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c @@ -566,7 +566,7 @@ aesni_mb_pmd_qp_create_processed_ops_ring(struct aesni_mb_qp *qp, static int aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, struct rte_mempool *session_pool) + int socket_id) { struct aesni_mb_qp *qp = NULL; struct aesni_mb_private *internals = dev->data->dev_private; @@ -604,7 +604,8 @@ aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, goto qp_setup_cleanup; } - qp->sess_mp = session_pool; + qp->sess_mp = qp_conf->mp_session; + qp->sess_mp_priv = qp_conf->mp_session_private; memset(&qp->stats, 0, sizeof(qp->stats)); diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h index d8021cdaa..923403336 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h @@ -131,6 +131,8 @@ struct aesni_mb_qp { /**< Ring for placing operations ready for processing */ struct rte_mempool *sess_mp; /**< Session Mempool */ + struct rte_mempool *sess_mp_priv; + /**< Session Private Data Mempool */ struct rte_cryptodev_stats stats; /**< Queue pair statistics */ uint8_t digest_idx; diff --git a/drivers/crypto/armv8/rte_armv8_pmd.c b/drivers/crypto/armv8/rte_armv8_pmd.c index 9d15fee53..3b2d7fb2f 100644 --- a/drivers/crypto/armv8/rte_armv8_pmd.c +++ b/drivers/crypto/armv8/rte_armv8_pmd.c @@ -514,7 +514,8 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op) if (rte_mempool_get(qp->sess_mp, (void **)&_sess)) return NULL; - if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data)) + if (rte_mempool_get(qp->sess_mp_priv, + (void **)&_sess_private_data)) return NULL; sess = (struct armv8_crypto_session *)_sess_private_data; @@ -522,7 +523,7 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op) if (unlikely(armv8_crypto_set_session_parameters(sess, op->sym->xform) != 0)) { rte_mempool_put(qp->sess_mp, _sess); - rte_mempool_put(qp->sess_mp, _sess_private_data); + rte_mempool_put(qp->sess_mp_priv, _sess_private_data); sess = NULL; } op->sym->session = (struct rte_cryptodev_sym_session *)_sess; @@ -656,7 +657,7 @@ process_op(struct armv8_crypto_qp *qp, struct rte_crypto_op *op, memset(op->sym->session, 0, rte_cryptodev_sym_get_header_session_size()); rte_mempool_put(qp->sess_mp, sess); - rte_mempool_put(qp->sess_mp, op->sym->session); + rte_mempool_put(qp->sess_mp_priv, op->sym->session); op->sym->session = NULL; } diff --git a/drivers/crypto/armv8/rte_armv8_pmd_ops.c b/drivers/crypto/armv8/rte_armv8_pmd_ops.c index ae03117ea..a4fee83a8 100644 --- a/drivers/crypto/armv8/rte_armv8_pmd_ops.c +++ b/drivers/crypto/armv8/rte_armv8_pmd_ops.c @@ -220,7 +220,7 @@ armv8_crypto_pmd_qp_create_processed_ops_ring(struct armv8_crypto_qp *qp, static int armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, struct rte_mempool *session_pool) + int socket_id) { struct armv8_crypto_qp *qp = NULL; @@ -245,7 +245,8 @@ armv8_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, if (qp->processed_ops == NULL) goto qp_setup_cleanup; - qp->sess_mp = session_pool; + qp->sess_mp = qp_conf->mp_session; + qp->sess_mp_priv = qp_conf->mp_session_private; memset(&qp->stats, 0, sizeof(qp->stats)); diff --git a/drivers/crypto/armv8/rte_armv8_pmd_private.h b/drivers/crypto/armv8/rte_armv8_pmd_private.h index 7feb021db..0afd9c7c5 100644 --- a/drivers/crypto/armv8/rte_armv8_pmd_private.h +++ b/drivers/crypto/armv8/rte_armv8_pmd_private.h @@ -116,6 +116,8 @@ struct armv8_crypto_qp { /**< Ring for placing process packets */ struct rte_mempool *sess_mp; /**< Session Mempool */ + struct rte_mempool *sess_mp_priv; + /**< Session Private Data Mempool */ struct rte_cryptodev_stats stats; /**< Queue pair statistics */ char name[RTE_CRYPTODEV_NAME_MAX_LEN]; diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c index f505adf6b..45b281331 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -1540,8 +1540,7 @@ static int caam_jr_queue_pair_setup( struct rte_cryptodev *dev, uint16_t qp_id, __rte_unused const struct rte_cryptodev_qp_conf *qp_conf, - __rte_unused int socket_id, - __rte_unused struct rte_mempool *session_pool) + __rte_unused int socket_id) { struct sec_job_ring_t *internals; struct caam_jr_qp *qp = NULL; diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c index 6984913f1..d5041f0ec 100644 --- a/drivers/crypto/ccp/ccp_pmd_ops.c +++ b/drivers/crypto/ccp/ccp_pmd_ops.c @@ -685,7 +685,7 @@ ccp_pmd_qp_create_batch_info_ring(struct ccp_qp *qp, static int ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, struct rte_mempool *session_pool) + int socket_id) { struct ccp_private *internals = dev->data->dev_private; struct ccp_qp *qp; @@ -726,7 +726,8 @@ ccp_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, goto qp_setup_cleanup; } - qp->sess_mp = session_pool; + qp->sess_mp = qp_conf->mp_session; + qp->sess_mp_priv = qp_conf->mp_session_private; /* mempool for batch info */ qp->batch_mp = rte_mempool_create( diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h index 79752f687..7f2979e89 100644 --- a/drivers/crypto/ccp/ccp_pmd_private.h +++ b/drivers/crypto/ccp/ccp_pmd_private.h @@ -76,6 +76,8 @@ struct ccp_qp { /**< Ring for placing process packets */ struct rte_mempool *sess_mp; /**< Session Mempool */ + struct rte_mempool *sess_mp_priv; + /**< Session Private Data Mempool */ struct rte_mempool *batch_mp; /**< Session Mempool for batch info */ struct rte_cryptodev_stats qp_stats; diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c index 92d8a9559..b4bb5528f 100644 --- a/drivers/crypto/ccp/rte_ccp_pmd.c +++ b/drivers/crypto/ccp/rte_ccp_pmd.c @@ -179,7 +179,7 @@ get_ccp_session(struct ccp_qp *qp, struct rte_crypto_op *op) if (unlikely(ccp_set_session_parameters(sess, op->sym->xform, internals) != 0)) { rte_mempool_put(qp->sess_mp, _sess); - rte_mempool_put(qp->sess_mp, _sess_private_data); + rte_mempool_put(qp->sess_mp_priv, _sess_private_data); sess = NULL; } op->sym->session = (struct rte_cryptodev_sym_session *)_sess; @@ -241,6 +241,13 @@ ccp_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, for (i = 0; i < nb_dequeued; i++) if (unlikely(ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) { + struct ccp_session *sess = (struct ccp_session *) + get_sym_session_private_data( + ops[i]->sym->session, + ccp_cryptodev_driver_id); + + rte_mempool_put(qp->sess_mp_priv, + sess); rte_mempool_put(qp->sess_mp, ops[i]->sym->session); ops[i]->sym->session = NULL; diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 6095c6021..82220ac4f 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -1518,8 +1518,7 @@ dpaa2_sec_queue_pair_release(struct rte_cryptodev *dev, uint16_t queue_pair_id) static int dpaa2_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id, __rte_unused const struct rte_cryptodev_qp_conf *qp_conf, - __rte_unused int socket_id, - __rte_unused struct rte_mempool *session_pool) + __rte_unused int socket_id) { struct dpaa2_sec_dev_private *priv = dev->data->dev_private; struct dpaa2_sec_qp *qp; diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index d83e74541..c95e43b7f 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -1661,8 +1661,7 @@ dpaa_sec_queue_pair_release(struct rte_cryptodev *dev, static int dpaa_sec_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id, __rte_unused const struct rte_cryptodev_qp_conf *qp_conf, - __rte_unused int socket_id, - __rte_unused struct rte_mempool *session_pool) + __rte_unused int socket_id) { struct dpaa_sec_dev_private *internals; struct dpaa_sec_qp *qp = NULL; diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c index 239a1cf44..6df645a23 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c @@ -145,7 +145,8 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op) if (rte_mempool_get(qp->sess_mp, (void **)&_sess)) return NULL; - if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data)) + if (rte_mempool_get(qp->sess_mp_priv, + (void **)&_sess_private_data)) return NULL; sess = (struct kasumi_session *)_sess_private_data; @@ -153,7 +154,7 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op) if (unlikely(kasumi_set_session_parameters(sess, op->sym->xform) != 0)) { rte_mempool_put(qp->sess_mp, _sess); - rte_mempool_put(qp->sess_mp, _sess_private_data); + rte_mempool_put(qp->sess_mp_priv, _sess_private_data); sess = NULL; } op->sym->session = (struct rte_cryptodev_sym_session *)_sess; @@ -325,7 +326,7 @@ process_ops(struct rte_crypto_op **ops, struct kasumi_session *session, memset(session, 0, sizeof(struct kasumi_session)); memset(ops[i]->sym->session, 0, rte_cryptodev_sym_get_header_session_size()); - rte_mempool_put(qp->sess_mp, 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/kasumi/rte_kasumi_pmd_ops.c b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c index 9e4bf1b52..a4982f091 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd_ops.c @@ -192,7 +192,7 @@ kasumi_pmd_qp_create_processed_ops_ring(struct kasumi_qp *qp, static int kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, struct rte_mempool *session_pool) + int socket_id) { struct kasumi_qp *qp = NULL; @@ -217,7 +217,8 @@ kasumi_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, if (qp->processed_ops == NULL) goto qp_setup_cleanup; - qp->sess_mp = session_pool; + qp->sess_mp = qp_conf->mp_session; + qp->sess_mp_priv = qp_conf->mp_session_private; memset(&qp->qp_stats, 0, sizeof(qp->qp_stats)); diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h index 488777ca8..76f746c03 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd_private.h +++ b/drivers/crypto/kasumi/rte_kasumi_pmd_private.h @@ -36,6 +36,8 @@ struct kasumi_qp { /**< Ring for placing processed ops */ struct rte_mempool *sess_mp; /**< Session Mempool */ + struct rte_mempool *sess_mp_priv; + /**< Session Private Data Mempool */ struct rte_cryptodev_stats qp_stats; /**< Queue pair statistics */ uint8_t temp_digest[KASUMI_DIGEST_LENGTH]; diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c index 9956f051f..ef520356f 100644 --- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c +++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c @@ -633,7 +633,7 @@ mrvl_crypto_pmd_close(struct rte_cryptodev *dev) static int mrvl_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, struct rte_mempool *session_pool) + int socket_id) { struct mrvl_crypto_qp *qp = NULL; char match[RTE_CRYPTODEV_NAME_MAX_LEN]; @@ -690,7 +690,8 @@ mrvl_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, if (sam_cio_init(&qp->cio_params, &qp->cio) < 0) break; - qp->sess_mp = session_pool; + qp->sess_mp = qp_conf->mp_session; + qp->sess_mp_priv = qp_conf->mp_session_private; memset(&qp->stats, 0, sizeof(qp->stats)); dev->data->queue_pairs[qp_id] = qp; diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd_private.h b/drivers/crypto/mvsam/rte_mrvl_pmd_private.h index 6f8cf5624..deb80c55d 100644 --- a/drivers/crypto/mvsam/rte_mrvl_pmd_private.h +++ b/drivers/crypto/mvsam/rte_mrvl_pmd_private.h @@ -51,6 +51,9 @@ struct mrvl_crypto_qp { /** Session Mempool. */ struct rte_mempool *sess_mp; + /** Session Private Data Mempool. */ + struct rte_mempool *sess_mp_priv; + /** Queue pair statistics. */ struct rte_cryptodev_stats stats; diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c index 6e29a21a6..d5e3064f2 100644 --- a/drivers/crypto/null/null_crypto_pmd.c +++ b/drivers/crypto/null/null_crypto_pmd.c @@ -87,7 +87,8 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op) if (rte_mempool_get(qp->sess_mp, (void **)&_sess)) return NULL; - if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data)) + if (rte_mempool_get(qp->sess_mp_priv, + (void **)&_sess_private_data)) return NULL; sess = (struct null_crypto_session *)_sess_private_data; @@ -95,7 +96,7 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op) if (unlikely(null_crypto_set_session_parameters(sess, sym_op->xform) != 0)) { rte_mempool_put(qp->sess_mp, _sess); - rte_mempool_put(qp->sess_mp, _sess_private_data); + rte_mempool_put(qp->sess_mp_priv, _sess_private_data); sess = NULL; } sym_op->session = (struct rte_cryptodev_sym_session *)_sess; diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c index 2bdcd019e..941d62bed 100644 --- a/drivers/crypto/null/null_crypto_pmd_ops.c +++ b/drivers/crypto/null/null_crypto_pmd_ops.c @@ -184,7 +184,7 @@ null_crypto_pmd_qp_create_processed_pkts_ring(struct null_crypto_qp *qp, static int null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, struct rte_mempool *session_pool) + int socket_id) { struct null_crypto_private *internals = dev->data->dev_private; struct null_crypto_qp *qp; @@ -228,7 +228,8 @@ null_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, goto qp_setup_cleanup; } - qp->sess_mp = session_pool; + qp->sess_mp = qp_conf->mp_session; + qp->sess_mp_priv = qp_conf->mp_session_private; memset(&qp->qp_stats, 0, sizeof(qp->qp_stats)); diff --git a/drivers/crypto/null/null_crypto_pmd_private.h b/drivers/crypto/null/null_crypto_pmd_private.h index d5905afd8..d7bfd9cc8 100644 --- a/drivers/crypto/null/null_crypto_pmd_private.h +++ b/drivers/crypto/null/null_crypto_pmd_private.h @@ -31,6 +31,8 @@ struct null_crypto_qp { /**< Ring for placing process packets */ struct rte_mempool *sess_mp; /**< Session Mempool */ + struct rte_mempool *sess_mp_priv; + /**< Session Mempool */ struct rte_cryptodev_stats qp_stats; /**< Queue pair statistics */ } __rte_cache_aligned; diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c index 90d0c14b8..6a0cf83f4 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_ops.c +++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c @@ -186,8 +186,7 @@ static int otx_cpt_que_pair_setup(struct rte_cryptodev *dev, uint16_t que_pair_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id __rte_unused, - struct rte_mempool *session_pool __rte_unused) + int socket_id __rte_unused) { void *cptvf = dev->data->dev_private; struct cpt_instance *instance = NULL; diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index a0ccacb1e..a193af642 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -768,7 +768,8 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op) if (rte_mempool_get(qp->sess_mp, (void **)&_sess)) return NULL; - if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data)) + if (rte_mempool_get(qp->sess_mp_priv, + (void **)&_sess_private_data)) return NULL; sess = (struct openssl_session *)_sess_private_data; @@ -776,7 +777,7 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op) if (unlikely(openssl_set_session_parameters(sess, op->sym->xform) != 0)) { rte_mempool_put(qp->sess_mp, _sess); - rte_mempool_put(qp->sess_mp, _sess_private_data); + rte_mempool_put(qp->sess_mp_priv, _sess_private_data); sess = NULL; } op->sym->session = (struct rte_cryptodev_sym_session *)_sess; @@ -2020,7 +2021,7 @@ process_op(struct openssl_qp *qp, struct rte_crypto_op *op, memset(sess, 0, sizeof(struct openssl_session)); memset(op->sym->session, 0, rte_cryptodev_sym_get_header_session_size()); - rte_mempool_put(qp->sess_mp, sess); + 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/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c index d382476a6..40217cf0d 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c +++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c @@ -715,7 +715,7 @@ openssl_pmd_qp_create_processed_ops_ring(struct openssl_qp *qp, static int openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, struct rte_mempool *session_pool) + int socket_id) { struct openssl_qp *qp = NULL; @@ -740,7 +740,8 @@ openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, if (qp->processed_ops == NULL) goto qp_setup_cleanup; - qp->sess_mp = session_pool; + qp->sess_mp = qp_conf->mp_session; + qp->sess_mp_priv = qp_conf->mp_session_private; memset(&qp->stats, 0, sizeof(qp->stats)); diff --git a/drivers/crypto/openssl/rte_openssl_pmd_private.h b/drivers/crypto/openssl/rte_openssl_pmd_private.h index a8f2c8482..43ac3813d 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd_private.h +++ b/drivers/crypto/openssl/rte_openssl_pmd_private.h @@ -64,6 +64,8 @@ struct openssl_qp { /**< Ring for placing process packets */ struct rte_mempool *sess_mp; /**< Session Mempool */ + struct rte_mempool *sess_mp_priv; + /**< Session Private Data Mempool */ struct rte_cryptodev_stats stats; /**< Queue pair statistics */ uint8_t temp_digest[DIGEST_LENGTH_MAX]; diff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c index c3f700406..31ccab32e 100644 --- a/drivers/crypto/qat/qat_sym_pmd.c +++ b/drivers/crypto/qat/qat_sym_pmd.c @@ -127,7 +127,7 @@ static int qat_sym_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id) static int qat_sym_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, struct rte_mempool *session_pool __rte_unused) + int socket_id) { struct qat_qp *qp; int ret = 0; diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c index 939105aa8..cf70218b7 100644 --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c @@ -390,8 +390,7 @@ scheduler_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id) /** Setup a queue pair */ static int scheduler_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, - const struct rte_cryptodev_qp_conf *qp_conf, int socket_id, - struct rte_mempool *session_pool) + const struct rte_cryptodev_qp_conf *qp_conf, int socket_id) { struct scheduler_ctx *sched_ctx = dev->data->dev_private; struct scheduler_qp_ctx *qp_ctx; @@ -419,7 +418,7 @@ scheduler_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, * must be big enough for all the drivers used. */ ret = rte_cryptodev_queue_pair_setup(slave_id, qp_id, - qp_conf, socket_id, session_pool); + qp_conf, socket_id); if (ret < 0) return ret; } diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c index a17536b77..7d131f780 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c @@ -147,7 +147,8 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op) if (rte_mempool_get(qp->sess_mp, (void **)&_sess)) return NULL; - if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data)) + if (rte_mempool_get(qp->sess_mp_priv, + (void **)&_sess_private_data)) return NULL; sess = (struct snow3g_session *)_sess_private_data; @@ -155,7 +156,7 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op) if (unlikely(snow3g_set_session_parameters(sess, op->sym->xform) != 0)) { rte_mempool_put(qp->sess_mp, _sess); - rte_mempool_put(qp->sess_mp, _sess_private_data); + rte_mempool_put(qp->sess_mp_priv, _sess_private_data); sess = NULL; } op->sym->session = (struct rte_cryptodev_sym_session *)_sess; @@ -340,7 +341,7 @@ process_ops(struct rte_crypto_op **ops, struct snow3g_session *session, memset(session, 0, sizeof(struct snow3g_session)); memset(ops[i]->sym->session, 0, rte_cryptodev_sym_get_header_session_size()); - rte_mempool_put(qp->sess_mp, 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/snow3g/rte_snow3g_pmd_ops.c b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c index a367ee9a0..d2125233f 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd_ops.c @@ -198,7 +198,7 @@ snow3g_pmd_qp_create_processed_ops_ring(struct snow3g_qp *qp, static int snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, struct rte_mempool *session_pool) + int socket_id) { struct snow3g_qp *qp = NULL; @@ -223,7 +223,8 @@ snow3g_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, if (qp->processed_ops == NULL) goto qp_setup_cleanup; - qp->sess_mp = session_pool; + qp->sess_mp = qp_conf->mp_session; + qp->sess_mp_priv = qp_conf->mp_session_private; memset(&qp->qp_stats, 0, sizeof(qp->qp_stats)); diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd_private.h b/drivers/crypto/snow3g/rte_snow3g_pmd_private.h index b7807b621..df5c6092b 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd_private.h +++ b/drivers/crypto/snow3g/rte_snow3g_pmd_private.h @@ -36,6 +36,8 @@ struct snow3g_qp { /**< Ring for placing processed ops */ struct rte_mempool *sess_mp; /**< Session Mempool */ + struct rte_mempool *sess_mp_priv; + /**< Session Private Data Mempool */ struct rte_cryptodev_stats qp_stats; /**< Queue pair statistics */ uint8_t temp_digest[SNOW3G_DIGEST_LENGTH]; diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c index 568b5a406..4bae3b865 100644 --- a/drivers/crypto/virtio/virtio_cryptodev.c +++ b/drivers/crypto/virtio/virtio_cryptodev.c @@ -36,8 +36,7 @@ static void virtio_crypto_dev_stats_reset(struct rte_cryptodev *dev); static int virtio_crypto_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, - struct rte_mempool *session_pool); + int socket_id); static int virtio_crypto_qp_release(struct rte_cryptodev *dev, uint16_t queue_pair_id); static void virtio_crypto_dev_free_mbufs(struct rte_cryptodev *dev); @@ -585,8 +584,7 @@ virtio_crypto_dev_stats_reset(struct rte_cryptodev *dev) static int virtio_crypto_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, - struct rte_mempool *session_pool __rte_unused) + int socket_id) { int ret; struct virtqueue *vq; diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c index 313f4590b..997c2092f 100644 --- a/drivers/crypto/zuc/rte_zuc_pmd.c +++ b/drivers/crypto/zuc/rte_zuc_pmd.c @@ -144,7 +144,8 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op) if (rte_mempool_get(qp->sess_mp, (void **)&_sess)) return NULL; - if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data)) + if (rte_mempool_get(qp->sess_mp_priv, + (void **)&_sess_private_data)) return NULL; sess = (struct zuc_session *)_sess_private_data; @@ -152,7 +153,7 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op) if (unlikely(zuc_set_session_parameters(sess, op->sym->xform) != 0)) { rte_mempool_put(qp->sess_mp, _sess); - rte_mempool_put(qp->sess_mp, _sess_private_data); + rte_mempool_put(qp->sess_mp_priv, _sess_private_data); sess = NULL; } op->sym->session = (struct rte_cryptodev_sym_session *)_sess; @@ -327,7 +328,7 @@ process_ops(struct rte_crypto_op **ops, enum zuc_operation op_type, memset(sessions[i], 0, sizeof(struct zuc_session)); memset(ops[i]->sym->session, 0, rte_cryptodev_sym_get_header_session_size()); - rte_mempool_put(qp->sess_mp, sessions[i]); + 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/drivers/crypto/zuc/rte_zuc_pmd_ops.c b/drivers/crypto/zuc/rte_zuc_pmd_ops.c index 04d45e449..1b88947eb 100644 --- a/drivers/crypto/zuc/rte_zuc_pmd_ops.c +++ b/drivers/crypto/zuc/rte_zuc_pmd_ops.c @@ -198,7 +198,7 @@ zuc_pmd_qp_create_processed_ops_ring(struct zuc_qp *qp, static int zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, struct rte_mempool *session_pool) + int socket_id) { struct zuc_qp *qp = NULL; @@ -223,7 +223,8 @@ zuc_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, if (qp->processed_ops == NULL) goto qp_setup_cleanup; - qp->sess_mp = session_pool; + qp->sess_mp = qp_conf->mp_session; + qp->sess_mp_priv = qp_conf->mp_session_private; memset(&qp->qp_stats, 0, sizeof(qp->qp_stats)); diff --git a/drivers/crypto/zuc/rte_zuc_pmd_private.h b/drivers/crypto/zuc/rte_zuc_pmd_private.h index 5e5906ddb..aa73c0016 100644 --- a/drivers/crypto/zuc/rte_zuc_pmd_private.h +++ b/drivers/crypto/zuc/rte_zuc_pmd_private.h @@ -36,6 +36,8 @@ struct zuc_qp { /**< Ring for placing processed ops */ struct rte_mempool *sess_mp; /**< Session Mempool */ + struct rte_mempool *sess_mp_priv; + /**< Session Private Data Mempool */ struct rte_cryptodev_stats qp_stats; /**< Queue pair statistics */ uint8_t temp_digest[ZUC_DIGEST_LENGTH]; diff --git a/drivers/net/softnic/rte_eth_softnic_cryptodev.c b/drivers/net/softnic/rte_eth_softnic_cryptodev.c index 1480f6dd5..f031d8803 100644 --- a/drivers/net/softnic/rte_eth_softnic_cryptodev.c +++ b/drivers/net/softnic/rte_eth_softnic_cryptodev.c @@ -101,7 +101,7 @@ softnic_cryptodev_create(struct pmd_internals *p, queue_conf.nb_descriptors = params->queue_size; for (i = 0; i < params->n_queues; i++) { status = rte_cryptodev_queue_pair_setup(dev_id, i, - &queue_conf, socket_id, NULL); + &queue_conf, socket_id); if (status < 0) return NULL; } diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index e7559c633..384b7a240 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -39,7 +39,7 @@ static int cryptodev_fips_validate_app_int(void) { struct rte_cryptodev_config conf = {rte_socket_id(), 1}; - struct rte_cryptodev_qp_conf qp_conf = {128}; + struct rte_cryptodev_qp_conf qp_conf = {128, NULL, NULL}; int ret; ret = rte_cryptodev_configure(env.dev_id, &conf); @@ -52,7 +52,7 @@ cryptodev_fips_validate_app_int(void) return ret; ret = rte_cryptodev_queue_pair_setup(env.dev_id, 0, &qp_conf, - rte_socket_id(), env.mpool); + rte_socket_id()); if (ret < 0) return ret; diff --git a/examples/ip_pipeline/cryptodev.c b/examples/ip_pipeline/cryptodev.c index c4ba72bec..b365810de 100644 --- a/examples/ip_pipeline/cryptodev.c +++ b/examples/ip_pipeline/cryptodev.c @@ -93,7 +93,7 @@ cryptodev_create(const char *name, struct cryptodev_params *params) queue_conf.nb_descriptors = params->queue_size; for (i = 0; i < params->n_queues; i++) { status = rte_cryptodev_queue_pair_setup(dev_id, i, - &queue_conf, socket_id, NULL); + &queue_conf, socket_id); if (status < 0) return NULL; } diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 1bc0b5b50..a0ff8f7f7 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1493,10 +1493,13 @@ cryptodevs_init(void) cdev_id); qp_conf.nb_descriptors = CDEV_QUEUE_DESC; + qp_conf.mp_session = + socket_ctx[dev_conf.socket_id].session_pool; + qp_conf.mp_session_private = + socket_ctx[dev_conf.socket_id].session_pool; for (qp = 0; qp < dev_conf.nb_queue_pairs; qp++) if (rte_cryptodev_queue_pair_setup(cdev_id, qp, - &qp_conf, dev_conf.socket_id, - socket_ctx[dev_conf.socket_id].session_pool)) + &qp_conf, dev_conf.socket_id)) rte_panic("Failed to setup queue %u for " "cdev_id %u\n", 0, cdev_id); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index f12fd266e..1df7ba743 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -2443,9 +2443,11 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, } qp_conf.nb_descriptors = 2048; + qp_conf.mp_session = session_pool_socket[socket_id]; + qp_conf.mp_session_private = session_pool_socket[socket_id]; retval = rte_cryptodev_queue_pair_setup(cdev_id, 0, &qp_conf, - socket_id, session_pool_socket[socket_id]); + socket_id); if (retval < 0) { printf("Failed to setup queue pair %u on cryptodev %u", 0, cdev_id); diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c index 3deb5263f..cb30f84c0 100644 --- a/examples/vhost_crypto/main.c +++ b/examples/vhost_crypto/main.c @@ -463,7 +463,7 @@ free_resource(void) int main(int argc, char *argv[]) { - struct rte_cryptodev_qp_conf qp_conf = {NB_CRYPTO_DESCRIPTORS}; + struct rte_cryptodev_qp_conf qp_conf; struct rte_cryptodev_config config; struct rte_cryptodev_info dev_info; char name[128]; @@ -551,11 +551,14 @@ main(int argc, char *argv[]) options.infos[i] = info; + qp_conf.nb_descriptors = NB_CRYPTO_DESCRIPTORS; + qp_conf.mp_session = info->sess_pool; + qp_conf.mp_session_private = info->sess_pool; + for (j = 0; j < dev_info.max_nb_queue_pairs; j++) { ret = rte_cryptodev_queue_pair_setup(info->cid, j, &qp_conf, rte_lcore_to_socket_id( - lo->lcore_id), - info->sess_pool); + lo->lcore_id)); if (ret < 0) { RTE_LOG(ERR, USER1, "Failed to configure qp\n"); goto error_exit; diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile index a8f94c097..e38018183 100644 --- a/lib/librte_cryptodev/Makefile +++ b/lib/librte_cryptodev/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2015 Intel Corporation +# Copyright(c) 2015-2019 Intel Corporation include $(RTE_SDK)/mk/rte.vars.mk @@ -7,7 +7,7 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_cryptodev.a # library version -LIBABIVER := 5 +LIBABIVER := 6 # build flags CFLAGS += -O3 diff --git a/lib/librte_cryptodev/meson.build b/lib/librte_cryptodev/meson.build index 990dd3d44..44bd83212 100644 --- a/lib/librte_cryptodev/meson.build +++ b/lib/librte_cryptodev/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation +# Copyright(c) 2017-2019 Intel Corporation -version = 5 +version = 6 sources = files('rte_cryptodev.c', 'rte_cryptodev_pmd.c') headers = files('rte_cryptodev.h', 'rte_cryptodev_pmd.h', diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index a52eaaa45..4929d0451 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -941,8 +941,7 @@ rte_cryptodev_close(uint8_t dev_id) int rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id, - const struct rte_cryptodev_qp_conf *qp_conf, int socket_id, - struct rte_mempool *session_pool) + const struct rte_cryptodev_qp_conf *qp_conf, int socket_id) { struct rte_cryptodev *dev; @@ -958,6 +957,17 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id, return -EINVAL; } + if (!qp_conf) { + CDEV_LOG_ERR("qp_conf cannot be NULL\n"); + return -EINVAL; + } + + if ((qp_conf->mp_session && !qp_conf->mp_session_private) || + (!qp_conf->mp_session && qp_conf->mp_session_private)) { + CDEV_LOG_ERR("Invalid mempools\n"); + return -EINVAL; + } + if (dev->data->dev_started) { CDEV_LOG_ERR( "device %d must be stopped to allow configuration", dev_id); @@ -967,7 +977,7 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id, RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_pair_setup, -ENOTSUP); return (*dev->dev_ops->queue_pair_setup)(dev, queue_pair_id, qp_conf, - socket_id, session_pool); + socket_id); } diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 4099823f1..f9e7507da 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -495,6 +495,10 @@ enum rte_cryptodev_event_type { /** Crypto device queue pair configuration structure. */ struct rte_cryptodev_qp_conf { uint32_t nb_descriptors; /**< Number of descriptors per queue pair */ + struct rte_mempool *mp_session; + /**< The mempool for creating session in sessionless mode */ + struct rte_mempool *mp_session_private; + /**< The mempool for creating sess private data in sessionless mode */ }; /** @@ -689,8 +693,7 @@ rte_cryptodev_close(uint8_t dev_id); */ extern int rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id, - const struct rte_cryptodev_qp_conf *qp_conf, int socket_id, - struct rte_mempool *session_pool); + const struct rte_cryptodev_qp_conf *qp_conf, int socket_id); /** * Get the number of queue pairs on a specific crypto device diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h index 1b6cafd17..f15c9af30 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h @@ -188,13 +188,12 @@ typedef void (*cryptodev_info_get_t)(struct rte_cryptodev *dev, * @param qp_id Queue Pair Index * @param qp_conf Queue configuration structure * @param socket_id Socket Index - * @param session_pool Pointer to device session mempool * * @return Returns 0 on success. */ typedef int (*cryptodev_queue_pair_setup_t)(struct rte_cryptodev *dev, uint16_t qp_id, const struct rte_cryptodev_qp_conf *qp_conf, - int socket_id, struct rte_mempool *session_pool); + int socket_id); /** * Release memory resources allocated by given queue pair. diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c index 84065eb49..aac0b1f0b 100644 --- a/test/test/test_cryptodev.c +++ b/test/test/test_cryptodev.c @@ -461,12 +461,13 @@ testsuite_setup(void) dev_id, ts_params->conf.nb_queue_pairs); ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT; + ts_params->qp_conf.mp_session = ts_params->session_mpool; + ts_params->qp_conf.mp_session_private = ts_params->session_mpool; for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) { TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( dev_id, qp_id, &ts_params->qp_conf, - rte_cryptodev_socket_id(dev_id), - ts_params->session_mpool), + rte_cryptodev_socket_id(dev_id)), "Failed to setup queue pair %u on cryptodev %u", qp_id, dev_id); } @@ -519,8 +520,7 @@ ut_setup(void) TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, &ts_params->qp_conf, - rte_cryptodev_socket_id(ts_params->valid_devs[0]), - ts_params->session_mpool), + rte_cryptodev_socket_id(ts_params->valid_devs[0])), "Failed to setup queue pair %u on cryptodev %u", qp_id, ts_params->valid_devs[0]); } @@ -709,13 +709,14 @@ test_queue_pair_descriptor_setup(void) * freed so are re-used if ring is released and re-created. */ qp_conf.nb_descriptors = MIN_NUM_OPS_INFLIGHT; /* min size*/ + qp_conf.mp_session = ts_params->session_mpool; + qp_conf.mp_session_private = ts_params->session_mpool; for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) { TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, &qp_conf, rte_cryptodev_socket_id( - ts_params->valid_devs[0]), - ts_params->session_mpool), + ts_params->valid_devs[0])), "Failed test for " "rte_cryptodev_queue_pair_setup: num_inflights " "%u on qp %u on cryptodev %u", @@ -729,8 +730,7 @@ test_queue_pair_descriptor_setup(void) TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, &qp_conf, rte_cryptodev_socket_id( - ts_params->valid_devs[0]), - ts_params->session_mpool), + ts_params->valid_devs[0])), "Failed test for" " rte_cryptodev_queue_pair_setup: num_inflights" " %u on qp %u on cryptodev %u", @@ -744,8 +744,7 @@ test_queue_pair_descriptor_setup(void) TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, &qp_conf, rte_cryptodev_socket_id( - ts_params->valid_devs[0]), - ts_params->session_mpool), + ts_params->valid_devs[0])), "Failed test for " "rte_cryptodev_queue_pair_setup: num_inflights" " %u on qp %u on cryptodev %u", @@ -760,8 +759,7 @@ test_queue_pair_descriptor_setup(void) TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, &qp_conf, rte_cryptodev_socket_id( - ts_params->valid_devs[0]), - ts_params->session_mpool), + ts_params->valid_devs[0])), "Unexpectedly passed test for " "rte_cryptodev_queue_pair_setup:" "num_inflights %u on qp %u on cryptodev %u", @@ -776,8 +774,7 @@ test_queue_pair_descriptor_setup(void) TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, &qp_conf, rte_cryptodev_socket_id( - ts_params->valid_devs[0]), - ts_params->session_mpool), + ts_params->valid_devs[0])), "Unexpectedly passed test for " "rte_cryptodev_queue_pair_setup:" "num_inflights %u on qp %u on cryptodev %u", @@ -791,8 +788,7 @@ test_queue_pair_descriptor_setup(void) TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, &qp_conf, rte_cryptodev_socket_id( - ts_params->valid_devs[0]), - ts_params->session_mpool), + ts_params->valid_devs[0])), "Failed test for" " rte_cryptodev_queue_pair_setup:" "num_inflights %u on qp %u on cryptodev %u", @@ -807,8 +803,7 @@ test_queue_pair_descriptor_setup(void) TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, &qp_conf, rte_cryptodev_socket_id( - ts_params->valid_devs[0]), - ts_params->session_mpool), + ts_params->valid_devs[0])), "Unexpectedly passed test for " "rte_cryptodev_queue_pair_setup:" "num_inflights %u on qp %u on cryptodev %u", @@ -824,8 +819,7 @@ test_queue_pair_descriptor_setup(void) TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, &qp_conf, - rte_cryptodev_socket_id(ts_params->valid_devs[0]), - ts_params->session_mpool), + rte_cryptodev_socket_id(ts_params->valid_devs[0])), "Failed test for rte_cryptodev_queue_pair_setup:" "invalid qp %u on cryptodev %u", qp_id, ts_params->valid_devs[0]); @@ -835,8 +829,7 @@ test_queue_pair_descriptor_setup(void) TEST_ASSERT_FAIL(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, &qp_conf, - rte_cryptodev_socket_id(ts_params->valid_devs[0]), - ts_params->session_mpool), + rte_cryptodev_socket_id(ts_params->valid_devs[0])), "Failed test for rte_cryptodev_queue_pair_setup:" "invalid qp %u on cryptodev %u", qp_id, ts_params->valid_devs[0]); diff --git a/test/test/test_cryptodev_asym.c b/test/test/test_cryptodev_asym.c index a899f9973..0f6fc5767 100644 --- a/test/test/test_cryptodev_asym.c +++ b/test/test/test_cryptodev_asym.c @@ -383,11 +383,12 @@ testsuite_setup(void) /* configure qp */ ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT; + ts_params->qp_conf.mp_session = ts_params->session_mpool; + ts_params->qp_conf.mp_session_private = ts_params->session_mpool; for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) { TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( dev_id, qp_id, &ts_params->qp_conf, - rte_cryptodev_socket_id(dev_id), - ts_params->session_mpool), + rte_cryptodev_socket_id(dev_id)), "Failed to setup queue pair %u on cryptodev %u ASYM", qp_id, dev_id); } @@ -449,8 +450,7 @@ ut_setup(void) TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, &ts_params->qp_conf, - rte_cryptodev_socket_id(ts_params->valid_devs[0]), - ts_params->session_mpool), + rte_cryptodev_socket_id(ts_params->valid_devs[0])), "Failed to setup queue pair %u on cryptodev %u", qp_id, ts_params->valid_devs[0]); } diff --git a/test/test/test_event_crypto_adapter.c b/test/test/test_event_crypto_adapter.c index de258c346..54717870e 100644 --- a/test/test/test_event_crypto_adapter.c +++ b/test/test/test_event_crypto_adapter.c @@ -546,11 +546,12 @@ configure_cryptodev(void) TEST_CDEV_ID, conf.nb_queue_pairs); qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT; + qp_conf.mp_session = params.session_mpool; + qp_conf.mp_session_private = params.session_mpool; TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( TEST_CDEV_ID, TEST_CDEV_QP_ID, &qp_conf, - rte_cryptodev_socket_id(TEST_CDEV_ID), - params.session_mpool), + rte_cryptodev_socket_id(TEST_CDEV_ID)), "Failed to setup queue pair %u on cryptodev %u\n", TEST_CDEV_QP_ID, TEST_CDEV_ID); -- 2.13.6