DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Iremonger, Bernard" <bernard.iremonger@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] test/ipsec: fix test suite setup function
Date: Thu, 17 Jan 2019 10:34:50 +0000	[thread overview]
Message-ID: <2601191342CEEE43887BDE71AB977258010D904F2F@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <1547720125-32101-1-git-send-email-bernard.iremonger@intel.com>



> -----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
> 
> 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 = &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++] = 0;
> +	driver_id = 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 = 0; i < nb_devs; i++) {
> +		rte_cryptodev_info_get(i, &info);
> +		if (info.driver_id == driver_id) {
> +			ts_params->valid_dev = 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;
> 
>  	/* Set up all the qps on the first of the valid devices found */
> -	dev_id = ts_params->valid_devs[0];
> +	dev_id = ts_params->valid_dev;
> 
>  	rte_cryptodev_info_get(dev_id, &info);
> 
> @@ -353,9 +368,9 @@ ut_setup(void)
>  	ts_params->conf.socket_id = SOCKET_ID_ANY;
> 
>  	/* 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);
> 
>  	return TEST_SUCCESS;
>  }
> @@ -399,7 +414,7 @@ ut_teardown(void)
>  			rte_mempool_avail_count(ts_params->mbuf_pool));
> 
>  	/* Stop the device */
> -	rte_cryptodev_stop(ts_params->valid_devs[0]);
> +	rte_cryptodev_stop(ts_params->valid_dev);
>  }
> 

  reply	other threads:[~2019-01-17 10:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 11:19 [dpdk-dev] [PATCH] " Bernard Iremonger
2019-01-15 11:55 ` Ananyev, Konstantin
2019-01-15 12:34   ` Iremonger, Bernard
2019-01-15 12:49     ` Ananyev, Konstantin
2019-01-17 10:04       ` Iremonger, Bernard
2019-01-17 10:30         ` Ananyev, Konstantin
2019-01-17 11:12           ` Iremonger, Bernard
2019-01-17 10:15 ` [dpdk-dev] [PATCH v2] " Bernard Iremonger
2019-01-17 10:34   ` Ananyev, Konstantin [this message]
2019-01-17 11:20     ` Iremonger, Bernard
2019-01-17 15:35       ` Iremonger, Bernard
2019-01-17 16:03   ` [dpdk-dev] [PATCH v3] " Bernard Iremonger
2019-01-17 17:05     ` Ananyev, Konstantin
2019-01-17 23:30       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2601191342CEEE43887BDE71AB977258010D904F2F@irsmsx105.ger.corp.intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).