From patchwork Mon Jun 25 08:48:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "De Lara Guarch, Pablo" X-Patchwork-Id: 41496 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D070B5920; Mon, 25 Jun 2018 18:55:10 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 7F9DD548B for ; Mon, 25 Jun 2018 18:54:59 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jun 2018 09:54:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,270,1526367600"; d="scan'208";a="66193934" Received: from silpixa00399466.ir.intel.com (HELO silpixa00399466.ger.corp.intel.com) ([10.237.223.220]) by fmsmga004.fm.intel.com with ESMTP; 25 Jun 2018 09:54:56 -0700 From: Pablo de Lara To: declan.doherty@intel.com, akhil.goyal@nxp.com, shally.verma@caviumnetworks.com, ravi1.kumar@amd.com, jerin.jacob@caviumnetworks.com, roy.fan.zhang@intel.com, fiona.trahe@intel.com, tdu@semihalf.com, jianjay.zhou@huawei.com Cc: dev@dpdk.org, Pablo de Lara Date: Mon, 25 Jun 2018 09:48:49 +0100 Message-Id: <20180625084856.25205-9-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180625084856.25205-1-pablo.de.lara.guarch@intel.com> References: <20180608220234.10170-1-pablo.de.lara.guarch@intel.com> <20180625084856.25205-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v2 08/15] cryptodev: define value for unlimited sessions 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- app/test-crypto-perf/main.c | 2 +- doc/guides/rel_notes/release_18_08.rst | 2 ++ examples/ipsec-secgw/ipsec-secgw.c | 2 +- lib/librte_cryptodev/rte_cryptodev.h | 5 ++++- test/test/test_cryptodev.c | 6 ++++-- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index b02d3f597..87aaba0ce 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -169,7 +169,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 6bf53dc31..2b994ee78 100644 --- a/doc/guides/rel_notes/release_18_08.rst +++ b/doc/guides/rel_notes/release_18_08.rst @@ -62,6 +62,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. ABI Changes diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 2582dcb6e..dacf323c9 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1441,7 +1441,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 0a4dd39b1..64ffbafca 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -384,7 +384,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 5c906cfae..73aadaced 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",