From: Pablo de Lara Date: Thu, 5 Jul 2018 02:07:57 +0000 (+0100) Subject: cryptodev: define value for unlimited sessions X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2925e0c190f57dccf31b5b716f50a83fd469d123;p=dpdk.git cryptodev: define value for unlimited sessions Currently, the info structure contains the maximum number of sessions that a device can manage. This field was useful when the session mempool was created inside each device, but now it is created at the application level. Most PMDs do not have a limitation on the sessions managed, but a few do, therefore this field must remain in the structure. However, a new value, 0, can be used to indicate that a device does not have an actual maximum of sessions. Signed-off-by: Pablo de Lara Acked-by: Akhil Goyal --- diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index 74e2165a43..2181d0193d 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -172,7 +172,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs, * A single session is required per queue pair * in each device */ - if (dev_max_nb_sess < opts->nb_qps) { + if (dev_max_nb_sess != 0 && dev_max_nb_sess < opts->nb_qps) { RTE_LOG(ERR, USER1, "Device does not support at least " "%u sessions\n", opts->nb_qps); diff --git a/doc/guides/rel_notes/release_18_08.rst b/doc/guides/rel_notes/release_18_08.rst index 0304b80b8e..b051e60253 100644 --- a/doc/guides/rel_notes/release_18_08.rst +++ b/doc/guides/rel_notes/release_18_08.rst @@ -84,6 +84,8 @@ API Changes * cryptodev: In struct ``struct rte_cryptodev_info``, field ``rte_pci_device *pci_dev`` has been replaced with field ``struct rte_device *device``. + Value 0 is accepted in ``sym.max_nb_sessions``, meaning that a device + supports an unlimited number of sessions. * compressdev: Feature flag ``RTE_COMP_FF_MBUF_SCATTER_GATHER`` is replaced with the following more explicit flags: diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 22249f3ff9..ff576eb94d 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1440,7 +1440,7 @@ cryptodevs_init(void) dev_conf.nb_queue_pairs = qp; uint32_t dev_max_sess = cdev_info.sym.max_nb_sessions; - if (dev_max_sess < (CDEV_MP_NB_OBJS / 2)) + if (dev_max_sess != 0 && dev_max_sess < (CDEV_MP_NB_OBJS / 2)) rte_exit(EXIT_FAILURE, "Device does not support at least %u " "sessions", CDEV_MP_NB_OBJS / 2); diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 114c9fd6e5..7989eb876d 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -349,7 +349,10 @@ struct rte_cryptodev_info { struct { unsigned max_nb_sessions; - /**< Maximum number of sessions supported by device. */ + /**< Maximum number of sessions supported by device. + * If 0, the device does not have any limitation in + * number of sessions that can be used. + */ } sym; }; diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c index 0887c05af7..877dc16584 100644 --- a/test/test/test_cryptodev.c +++ b/test/test/test_cryptodev.c @@ -436,7 +436,8 @@ testsuite_setup(void) * Create mempool with maximum number of sessions * 2, * to include the session headers */ - if (info.sym.max_nb_sessions < MAX_NB_SESSIONS) { + if (info.sym.max_nb_sessions != 0 && + info.sym.max_nb_sessions < MAX_NB_SESSIONS) { RTE_LOG(ERR, USER1, "Device does not support " "at least %u sessions\n", MAX_NB_SESSIONS); @@ -8546,7 +8547,8 @@ test_scheduler_attach_slave_op(void) unsigned int session_size = rte_cryptodev_sym_get_private_session_size(i); - if (info.sym.max_nb_sessions < MAX_NB_SESSIONS) { + if (info.sym.max_nb_sessions != 0 && + info.sym.max_nb_sessions < MAX_NB_SESSIONS) { RTE_LOG(ERR, USER1, "Device does not support " "at least %u sessions\n",