DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Zhang, Fan" <fanzhang.oss@gmail.com>
To: Aakash Sasidharan <asasidharan@marvell.com>,
	Akhil Goyal <gakhil@marvell.com>
Cc: jerinj@marvell.com, anoobj@marvell.com, dev@dpdk.org
Subject: Re: [PATCH] test/crypto: add cryptodev reconfig test
Date: Thu, 6 Apr 2023 15:21:14 +0100	[thread overview]
Message-ID: <a8ca6699-4efc-0abc-4a6b-39795991fc1f@gmail.com> (raw)
In-Reply-To: <20230405074117.2212923-1-asasidharan@marvell.com>

Hi Aakash,

I really like the idea to create a test for device reconfiguration.

I am wondering if we need to test all PMDs against this patch first.

Regards,

Fan

On 4/5/2023 8:41 AM, Aakash Sasidharan wrote:
> Add cryptodev tests to verify that the device supports
> reconfiguration any number of times via
> rte_cryptodev_configure API.
>
> Signed-off-by: Aakash Sasidharan <asasidharan@marvell.com>
> ---
>   app/test/test_cryptodev.c | 81 +++++++++++++++++++++++++++++++++++++++
>   1 file changed, 81 insertions(+)
>
> diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
> index 9c670e9a35..3376ed91a3 100644
> --- a/app/test/test_cryptodev.c
> +++ b/app/test/test_cryptodev.c
> @@ -12368,6 +12368,85 @@ test_stats(void)
>   	return TEST_SUCCESS;
>   }
>   
> +static int
> +test_device_reconfigure(void)
> +{
> +	struct crypto_testsuite_params *ts_params = &testsuite_params;
> +	uint16_t orig_nb_qps = ts_params->conf.nb_queue_pairs;
> +	struct rte_cryptodev_qp_conf qp_conf = {
> +		.nb_descriptors = MAX_NUM_OPS_INFLIGHT,
> +		.mp_session = ts_params->session_mpool
> +	};
> +	uint16_t qp_id, dev_id, num_devs = 0;
> +
> +	TEST_ASSERT((num_devs = rte_cryptodev_count()) >= 1,
> +			"Need at least %d devices for test", 1);
> +
> +	dev_id = ts_params->valid_devs[0];
> +
> +	/* Stop the device in case it's started so it can be configured */
> +	rte_cryptodev_stop(dev_id);
> +
> +	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, &ts_params->conf),
> +			"Failed test for rte_cryptodev_configure: "
> +			"dev_num %u", dev_id);
> +
> +	/* Reconfigure with same configure params */
> +	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, &ts_params->conf),
> +			"Failed test for rte_cryptodev_configure: "
> +			"dev_num %u", dev_id);
> +
> +	/* Reconfigure with just one queue pair */
> +	ts_params->conf.nb_queue_pairs = 1;
> +
> +	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
> +			&ts_params->conf),
> +			"Failed to configure cryptodev: dev_id %u, qp_id %u",
> +			ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs);
> +
> +	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
> +		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
> +				ts_params->valid_devs[0], qp_id, &qp_conf,
> +				rte_cryptodev_socket_id(
> +						ts_params->valid_devs[0])),
> +				"Failed test for "
> +				"rte_cryptodev_queue_pair_setup: num_inflights "
> +				"%u on qp %u on cryptodev %u",
> +				qp_conf.nb_descriptors, qp_id,
> +				ts_params->valid_devs[0]);
> +	}
> +
> +	/* Reconfigure with max number of queue pairs */
> +	ts_params->conf.nb_queue_pairs = orig_nb_qps;
> +
> +	TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
> +			&ts_params->conf),
> +			"Failed to configure cryptodev: dev_id %u, qp_id %u",
> +			ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs);
> +
> +	qp_conf.mp_session = ts_params->session_mpool;
> +
> +	for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
> +		TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
> +				ts_params->valid_devs[0], qp_id, &qp_conf,
> +				rte_cryptodev_socket_id(
> +						ts_params->valid_devs[0])),
> +				"Failed test for "
> +				"rte_cryptodev_queue_pair_setup: num_inflights "
> +				"%u on qp %u on cryptodev %u",
> +				qp_conf.nb_descriptors, qp_id,
> +				ts_params->valid_devs[0]);
> +	}
> +
> +	/* Start the device */
> +	TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts_params->valid_devs[0]),
> +			"Failed to start cryptodev %u",
> +			ts_params->valid_devs[0]);
> +
> +	/* Test expected values */
> +	return test_AES_CBC_HMAC_SHA1_encrypt_digest();
> +}
> +
>   static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params,
>   				   struct crypto_unittest_params *ut_params,
>   				   enum rte_crypto_auth_operation op,
> @@ -16022,6 +16101,8 @@ static struct unit_test_suite cryptodev_gen_testsuite  = {
>   	.suite_name = "Crypto General Unit Test Suite",
>   	.setup = crypto_gen_testsuite_setup,
>   	.unit_test_cases = {
> +		TEST_CASE_ST(ut_setup, ut_teardown,
> +				test_device_reconfigure),
>   		TEST_CASE_ST(ut_setup, ut_teardown,
>   				test_device_configure_invalid_dev_id),
>   		TEST_CASE_ST(ut_setup, ut_teardown,

  reply	other threads:[~2023-04-06 14:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05  7:41 Aakash Sasidharan
2023-04-06 14:21 ` Zhang, Fan [this message]
2023-04-10  7:19   ` [EXT] " Anoob Joseph
2023-04-18 13:29 ` Zhang, Fan
2023-04-19 13:37 ` O'Donovan, Saoirse
2023-05-03  7:13   ` Akhil Goyal

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=a8ca6699-4efc-0abc-4a6b-39795991fc1f@gmail.com \
    --to=fanzhang.oss@gmail.com \
    --cc=anoobj@marvell.com \
    --cc=asasidharan@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=jerinj@marvell.com \
    /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).