[dpdk-dev] [PATCH v2 4/5] examples/l2fwd-crypto: fix session mempool size
Trahe, Fiona
fiona.trahe at intel.com
Fri Jul 20 10:53:42 CEST 2018
Hi Pablo,
> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Thursday, July 19, 2018 9:40 AM
> To: Doherty, Declan <declan.doherty at intel.com>; Trahe, Fiona <fiona.trahe at intel.com>
> Cc: dev at dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>
> Subject: [PATCH v2 4/5] examples/l2fwd-crypto: fix session mempool size
>
> The session mempool size for this application depends
> on the number of crypto devices that are capable
> of performing the operation given by the parameters on the app.
>
> However, previously this calculation was done before all devices
> were checked, resulting in an incorrect number of sessions
> required.
>
> Now the calculation of the devices to be used is done first
> (checking the capabilities of the enabled devices),
> followed by the creation of the session pool, resulting
> in a correct number of objects needed for the sessions
> to be created.
>
> Fixes: e3bcb99a5e13 ("examples/l2fwd-crypto: limit number of sessions")
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
> ---
> examples/l2fwd-crypto/main.c | 272 +++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 260 insertions(+), 12 deletions(-)
>
> diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
//snip//
> @@ -1976,16 +2217,31 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned
> nb_ports,
> return -1;
> }
>
> - for (cdev_id = 0; cdev_id < cdev_count; cdev_id++) {
> + for (cdev_id = 0; cdev_id < cdev_count && enabled_cdev_count < nb_ports;
> + cdev_id++) {
> sess_sz = rte_cryptodev_sym_get_private_session_size(cdev_id);
> if (sess_sz > max_sess_sz)
> max_sess_sz = sess_sz;
> +
> + if (check_cryptodev_mask(options, cdev_id) < 0)
> + continue;
> +
> + if (check_capabilities(options, cdev_id) < 0)
> + continue;
> +
> + l2fwd_enabled_crypto_mask |= (((uint64_t)1) << cdev_id);
> +
> + enabled_cdevs[cdev_id] = 1;
> + enabled_cdev_count++;
> }
[Fiona] It would be better to move the sess_sz assignment down to after the capabilities check.
Apart from this
Acked-by: Fiona Trahe <fiona.trahe at intel.com>
More information about the dev
mailing list