From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bernard.iremonger@intel.com>
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id 68FC2A3
 for <dev@dpdk.org>; Thu, 17 Jan 2019 16:35:08 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga006.jf.intel.com ([10.7.209.51])
 by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 17 Jan 2019 07:35:07 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.56,489,1539673200"; d="scan'208";a="109017754"
Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31])
 by orsmga006.jf.intel.com with ESMTP; 17 Jan 2019 07:35:06 -0800
Received: from irsmsx155.ger.corp.intel.com (163.33.192.3) by
 IRSMSX106.ger.corp.intel.com (163.33.3.31) with Microsoft SMTP Server (TLS)
 id 14.3.408.0; Thu, 17 Jan 2019 15:35:05 +0000
Received: from irsmsx108.ger.corp.intel.com ([169.254.11.205]) by
 irsmsx155.ger.corp.intel.com ([169.254.14.157]) with mapi id 14.03.0415.000;
 Thu, 17 Jan 2019 15:35:05 +0000
From: "Iremonger, Bernard" <bernard.iremonger@intel.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>, "dev@dpdk.org"
 <dev@dpdk.org>
Thread-Topic: [PATCH v2] test/ipsec: fix test suite setup function
Thread-Index: AQHUrk2bOPJD6eIfsEqQCrgqxaknxKWzQ/EAgAALA+CAAEeuUA==
Date: Thu, 17 Jan 2019 15:35:04 +0000
Message-ID: <8CEF83825BEC744B83065625E567D7C260D50AF4@IRSMSX108.ger.corp.intel.com>
References: <1547551191-28863-1-git-send-email-bernard.iremonger@intel.com>
 <1547720125-32101-1-git-send-email-bernard.iremonger@intel.com>
 <2601191342CEEE43887BDE71AB977258010D904F2F@irsmsx105.ger.corp.intel.com>
 <8CEF83825BEC744B83065625E567D7C260D508D2@IRSMSX108.ger.corp.intel.com>
In-Reply-To: <8CEF83825BEC744B83065625E567D7C260D508D2@IRSMSX108.ger.corp.intel.com>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiN2Y5M2I3N2MtMDdiZC00N2MxLWIwMDctZWQwYTFhNmU1ZjAzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiSmluTzFpMWZ3aGUzbDdcL25IU0o0SGdRVEIycHlZY0ZjbHNremVZRTZUN1R2RUpYNlVLS3ZEYkFjeG5QV3pMa3AifQ==
x-ctpclassification: CTP_NT
dlp-product: dlpe-windows
dlp-version: 11.0.400.15
dlp-reaction: no-action
x-originating-ip: [163.33.239.180]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH v2] test/ipsec: fix test suite setup function
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 17 Jan 2019 15:35:09 -0000

Hi Konstantin,

<snip>

> > > Subject: [PATCH v2] test/ipsec: fix test suite setup function
> > >
> > > Check for valid crypto_null device before continuing.
> > > Use valid_dev instead of valid_devs[].
> > > Call create_crypto_session for one driver only.
> > >
> > > Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test")
> > > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > > ---
> > >  test/test/test_ipsec.c | 91
> > > +++++++++++++++++++++++++-------------------------
> > >  1 file changed, 45 insertions(+), 46 deletions(-)
> > >
> > > diff --git a/test/test/test_ipsec.c b/test/test/test_ipsec.c index
> > > ff1a1c4..a5c1c4b 100644
> > > --- a/test/test/test_ipsec.c
> > > +++ b/test/test/test_ipsec.c
> > > @@ -62,7 +62,7 @@ struct ipsec_testsuite_params {
> > >  	struct rte_cryptodev_config conf;
> > >  	struct rte_cryptodev_qp_conf qp_conf;
> > >
> > > -	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
> > > +	uint8_t valid_dev;
> > >  	uint8_t valid_dev_count;
> > >  };
> > >
> > > @@ -218,8 +218,9 @@ testsuite_setup(void)  {
> > >  	struct ipsec_testsuite_params *ts_params =3D &testsuite_params;
> > >  	struct rte_cryptodev_info info;
> > > -	uint32_t nb_devs, dev_id;
> > > +	uint32_t i, nb_devs, dev_id;
> > >  	size_t sess_sz;
> > > +	int driver_id;
> > >
> > >  	memset(ts_params, 0, sizeof(*ts_params));
> > >
> > > @@ -251,10 +252,24 @@ testsuite_setup(void)
> > >  		return TEST_FAILED;
> > >  	}
> > >
> > > -	ts_params->valid_devs[ts_params->valid_dev_count++] =3D 0;
> > > +	driver_id =3D rte_cryptodev_driver_id_get(
> > > +			RTE_STR(CRYPTODEV_NAME_NULL_PMD));
> >
> >
> > I still think that guessing device capabilities by driver name is not
> > a right approach.
> > Please use check_device_capabilites() here.
>=20
> Ok, this will require some refactoring of the tests.

I will refactor test_ipsec.c
=20
> > > +
> > > +	/* Find first valid crypto device */
> > > +	for (i =3D 0; i < nb_devs; i++) {
> > > +		rte_cryptodev_info_get(i, &info);
> > > +		if (info.driver_id =3D=3D driver_id) {
> > > +			ts_params->valid_dev =3D i;
> > > +			ts_params->valid_dev_count++;
> >
> > As you use only one device now, I don't think you need valid_dev_count
> > any more.
>=20
> I will check if it is still needed.

Still need to know that a  valid device has been found.
I will rename valid_dev_count to valid_dev_found.

>=20
> > > +			break;
> > > +		}
> > > +	}
> > > +
> > > +	if (ts_params->valid_dev_count < 1)
> > > +		return TEST_FAILED;
> > >
>=20
> <snip>

I will send a v3 patch.

 Regards,
=20
 Bernard.