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

Message ID 20180628005304.26544-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

De Lara Guarch, Pablo June 28, 2018, 12:52 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(+)

Comments

Akhil Goyal July 4, 2018, 12:30 p.m. UTC | #1
On 6/28/2018 6:22 AM, Pablo de Lara wrote:
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>   examples/ipsec-secgw/ipsec-secgw.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> 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;
>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>

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;