From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 7027A98 for ; Fri, 20 Jul 2018 10:53:45 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jul 2018 01:53:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,378,1526367600"; d="scan'208";a="58037753" Received: from irsmsx109.ger.corp.intel.com ([163.33.3.23]) by orsmga007.jf.intel.com with ESMTP; 20 Jul 2018 01:53:43 -0700 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.185]) by IRSMSX109.ger.corp.intel.com ([169.254.13.124]) with mapi id 14.03.0319.002; Fri, 20 Jul 2018 09:53:41 +0100 From: "Trahe, Fiona" To: "De Lara Guarch, Pablo" , "Doherty, Declan" CC: "dev@dpdk.org" Thread-Topic: [PATCH v2 4/5] examples/l2fwd-crypto: fix session mempool size Thread-Index: AQHUH4AdujXHnm9t6kWiomj80J2Jk6SXzgIA Date: Fri, 20 Jul 2018 08:53:42 +0000 Message-ID: <348A99DA5F5B7549AA880327E580B435895DDDF3@IRSMSX101.ger.corp.intel.com> References: <20180717103815.26841-1-pablo.de.lara.guarch@intel.com> <20180719083959.41480-1-pablo.de.lara.guarch@intel.com> <20180719083959.41480-5-pablo.de.lara.guarch@intel.com> In-Reply-To: <20180719083959.41480-5-pablo.de.lara.guarch@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDMyODhlMGMtMjRjYy00Y2QyLThhZjMtMTc4OTcyOTI2YjJhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibkVvVW90QmhPZ2p2bzdpY1hzOFJGTW9PMnZNcEhXd3FKKzdzNFN4dnNFNTdhdTdZaE04K0pkQTJQWlpYckg2bCJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 4/5] examples/l2fwd-crypto: fix session mempool size 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: , X-List-Received-Date: Fri, 20 Jul 2018 08:53:46 -0000 Hi Pablo, > -----Original Message----- > From: De Lara Guarch, Pablo > Sent: Thursday, July 19, 2018 9:40 AM > To: Doherty, Declan ; Trahe, Fiona > Cc: dev@dpdk.org; De Lara Guarch, Pablo > Subject: [PATCH v2 4/5] examples/l2fwd-crypto: fix session mempool size >=20 > 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. >=20 > However, previously this calculation was done before all devices > were checked, resulting in an incorrect number of sessions > required. >=20 > 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. >=20 > Fixes: e3bcb99a5e13 ("examples/l2fwd-crypto: limit number of sessions") >=20 > Signed-off-by: Pablo de Lara > --- > examples/l2fwd-crypto/main.c | 272 +++++++++++++++++++++++++++++++++++++= ++++-- > 1 file changed, 260 insertions(+), 12 deletions(-) >=20 > 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; > } >=20 > - for (cdev_id =3D 0; cdev_id < cdev_count; cdev_id++) { > + for (cdev_id =3D 0; cdev_id < cdev_count && enabled_cdev_count < nb_por= ts; > + cdev_id++) { > sess_sz =3D rte_cryptodev_sym_get_private_session_size(cdev_id); > if (sess_sz > max_sess_sz) > max_sess_sz =3D sess_sz; > + > + if (check_cryptodev_mask(options, cdev_id) < 0) > + continue; > + > + if (check_capabilities(options, cdev_id) < 0) > + continue; > + > + l2fwd_enabled_crypto_mask |=3D (((uint64_t)1) << cdev_id); > + > + enabled_cdevs[cdev_id] =3D 1; > + enabled_cdev_count++; > } [Fiona] It would be better to move the sess_sz assignment down to after the= capabilities check. Apart from this=20 Acked-by: Fiona Trahe =20