[v2,06/15] examples/ipsec-secgw: check for max supported sessions
diff mbox series

Message ID 20180625084856.25205-7-pablo.de.lara.guarch@intel.com
State Superseded, archived
Delegated to: Pablo de Lara Guarch
Headers show
Series
  • Cryptodev API changes for 18.08
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Pablo de Lara June 25, 2018, 8:48 a.m. UTC
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 examples/ipsec-secgw/ipsec-secgw.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch
diff mbox series

diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index a5da8b280..2582dcb6e 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1440,6 +1440,12 @@  cryptodevs_init(void)
 		dev_conf.socket_id = rte_cryptodev_socket_id(cdev_id);
 		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))
+			rte_exit(EXIT_FAILURE,
+				"Device does not support at least %u "
+				"sessions", CDEV_MP_NB_OBJS / 2);
+
 		if (!socket_ctx[dev_conf.socket_id].session_pool) {
 			char mp_name[RTE_MEMPOOL_NAMESIZE];
 			struct rte_mempool *sess_mp;