From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <konstantin.ananyev@intel.com>
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id 367123572
 for <dev@dpdk.org>; Thu, 17 Jan 2019 11:34:54 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga003.jf.intel.com ([10.7.209.27])
 by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 17 Jan 2019 02:34:53 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.56,488,1539673200"; d="scan'208";a="119215484"
Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99])
 by orsmga003.jf.intel.com with ESMTP; 17 Jan 2019 02:34:52 -0800
Received: from irsmsx111.ger.corp.intel.com (10.108.20.4) by
 IRSMSX107.ger.corp.intel.com (163.33.3.99) with Microsoft SMTP Server (TLS)
 id 14.3.408.0; Thu, 17 Jan 2019 10:34:51 +0000
Received: from irsmsx105.ger.corp.intel.com ([169.254.7.116]) by
 irsmsx111.ger.corp.intel.com ([169.254.2.160]) with mapi id 14.03.0415.000;
 Thu, 17 Jan 2019 10:34:51 +0000
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Iremonger, Bernard" <bernard.iremonger@intel.com>, "dev@dpdk.org"
 <dev@dpdk.org>
Thread-Topic: [PATCH v2] test/ipsec: fix test suite setup function
Thread-Index: AQHUrk2bk2nmoL24pUiHr9sfTVpuaqWzQq5A
Date: Thu, 17 Jan 2019 10:34:50 +0000
Message-ID: <2601191342CEEE43887BDE71AB977258010D904F2F@irsmsx105.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>
In-Reply-To: <1547720125-32101-1-git-send-email-bernard.iremonger@intel.com>
Accept-Language: en-IE, 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.181]
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 10:34:54 -0000



> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Thursday, January 17, 2019 10:15 AM
> To: dev@dpdk.org; Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: [PATCH v2] test/ipsec: fix test suite setup function
>=20
> Check for valid crypto_null device before continuing.
> Use valid_dev instead of valid_devs[].
> Call create_crypto_session for one driver only.
>=20
> 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(-)
>=20
> 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;
>=20
> -	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
> +	uint8_t valid_dev;
>  	uint8_t valid_dev_count;
>  };
>=20
> @@ -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;
>=20
>  	memset(ts_params, 0, sizeof(*ts_params));
>=20
> @@ -251,10 +252,24 @@ testsuite_setup(void)
>  		return TEST_FAILED;
>  	}
>=20
> -	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.

> +
> +	/* 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.

> +			break;
> +		}
> +	}
> +
> +	if (ts_params->valid_dev_count < 1)
> +		return TEST_FAILED;
>=20
>  	/* Set up all the qps on the first of the valid devices found */
> -	dev_id =3D ts_params->valid_devs[0];
> +	dev_id =3D ts_params->valid_dev;
>=20
>  	rte_cryptodev_info_get(dev_id, &info);
>=20
> @@ -353,9 +368,9 @@ ut_setup(void)
>  	ts_params->conf.socket_id =3D SOCKET_ID_ANY;
>=20
>  	/* Start the device */
> -	TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts_params->valid_devs[0]),
> +	TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts_params->valid_dev),
>  			"Failed to start cryptodev %u",
> -			ts_params->valid_devs[0]);
> +			ts_params->valid_dev);
>=20
>  	return TEST_SUCCESS;
>  }
> @@ -399,7 +414,7 @@ ut_teardown(void)
>  			rte_mempool_avail_count(ts_params->mbuf_pool));
>=20
>  	/* Stop the device */
> -	rte_cryptodev_stop(ts_params->valid_devs[0]);
> +	rte_cryptodev_stop(ts_params->valid_dev);
>  }
>=20