DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] test/crypto: add cryptodev reconfig test
@ 2023-04-05  7:41 Aakash Sasidharan
  2023-04-06 14:21 ` Zhang, Fan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Aakash Sasidharan @ 2023-04-05  7:41 UTC (permalink / raw)
  To: Akhil Goyal, Fan Zhang; +Cc: jerinj, anoobj, dev, asasidharan

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,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] test/crypto: add cryptodev reconfig test
  2023-04-05  7:41 [PATCH] test/crypto: add cryptodev reconfig test Aakash Sasidharan
@ 2023-04-06 14:21 ` Zhang, Fan
  2023-04-10  7:19   ` [EXT] " Anoob Joseph
  2023-04-18 13:29 ` Zhang, Fan
  2023-04-19 13:37 ` O'Donovan, Saoirse
  2 siblings, 1 reply; 6+ messages in thread
From: Zhang, Fan @ 2023-04-06 14:21 UTC (permalink / raw)
  To: Aakash Sasidharan, Akhil Goyal; +Cc: jerinj, anoobj, dev

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,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [EXT] Re: [PATCH] test/crypto: add cryptodev reconfig test
  2023-04-06 14:21 ` Zhang, Fan
@ 2023-04-10  7:19   ` Anoob Joseph
  0 siblings, 0 replies; 6+ messages in thread
From: Anoob Joseph @ 2023-04-10  7:19 UTC (permalink / raw)
  To: Zhang, Fan; +Cc: Jerin Jacob Kollanukkaran, dev, Aakash Sasidharan, Akhil Goyal

Hi Fan,

Please see inline.

Thanks,
Anoob

> -----Original Message-----
> From: Zhang, Fan <fanzhang.oss@gmail.com>
> Sent: Thursday, April 6, 2023 7:51 PM
> To: Aakash Sasidharan <asasidharan@marvell.com>; Akhil Goyal
> <gakhil@marvell.com>
> Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Anoob Joseph
> <anoobj@marvell.com>; dev@dpdk.org
> Subject: [EXT] Re: [PATCH] test/crypto: add cryptodev reconfig test
> 
> External Email
> 
> ----------------------------------------------------------------------
> 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.

[Anoob] We have tested the patch with Marvell PMDs, crypto_cn9k & crypto_cn10k as well as with openSSL PMD, cryptodev_openssl. We can wait for few days to see if any PMD owner has any objections. 

Can you review the patch and see if it aligns with DPDK spec?

> 
> 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,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] test/crypto: add cryptodev reconfig test
  2023-04-05  7:41 [PATCH] test/crypto: add cryptodev reconfig test Aakash Sasidharan
  2023-04-06 14:21 ` Zhang, Fan
@ 2023-04-18 13:29 ` Zhang, Fan
  2023-04-19 13:37 ` O'Donovan, Saoirse
  2 siblings, 0 replies; 6+ messages in thread
From: Zhang, Fan @ 2023-04-18 13:29 UTC (permalink / raw)
  To: Aakash Sasidharan, Akhil Goyal; +Cc: jerinj, anoobj, dev, Ji, Kai

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>
> ---

Acked-by: Fan Zhang <fanzhang.oss@gmail.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] test/crypto: add cryptodev reconfig test
  2023-04-05  7:41 [PATCH] test/crypto: add cryptodev reconfig test Aakash Sasidharan
  2023-04-06 14:21 ` Zhang, Fan
  2023-04-18 13:29 ` Zhang, Fan
@ 2023-04-19 13:37 ` O'Donovan, Saoirse
  2023-05-03  7:13   ` Akhil Goyal
  2 siblings, 1 reply; 6+ messages in thread
From: O'Donovan, Saoirse @ 2023-04-19 13:37 UTC (permalink / raw)
  To: Aakash Sasidharan, Akhil Goyal, Fan Zhang; +Cc: jerinj, anoobj, dev

Hi Aakash,

> -----Original Message-----
> From: Aakash Sasidharan <asasidharan@marvell.com>
> Sent: Wednesday 5 April 2023 08:41
> To: Akhil Goyal <gakhil@marvell.com>; Fan Zhang
> <fanzhang.oss@gmail.com>
> Cc: jerinj@marvell.com; anoobj@marvell.com; dev@dpdk.org;
> asasidharan@marvell.com
> Subject: [PATCH] test/crypto: add cryptodev reconfig test
> 
> 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(+)

Tested on the following PMDs: QAT + SW Crypto PMDs 
(snow3g, null, chachapoly, kasumi, aesni_mb, aesni_gcm, zuc)
The test results for the testcase were a mix of skipped and passed, based on the capabilities of each PMD, no failures. 

Tested-by: Saoirse O'Donovan <saoirse.odonovan@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] test/crypto: add cryptodev reconfig test
  2023-04-19 13:37 ` O'Donovan, Saoirse
@ 2023-05-03  7:13   ` Akhil Goyal
  0 siblings, 0 replies; 6+ messages in thread
From: Akhil Goyal @ 2023-05-03  7:13 UTC (permalink / raw)
  To: O'Donovan, Saoirse, Aakash Sasidharan, Fan Zhang
  Cc: Jerin Jacob Kollanukkaran, Anoob Joseph, dev

> Hi Aakash,
> > Subject: [PATCH] test/crypto: add cryptodev reconfig test
> >
> > 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(+)
> 
> Tested on the following PMDs: QAT + SW Crypto PMDs
> (snow3g, null, chachapoly, kasumi, aesni_mb, aesni_gcm, zuc)
> The test results for the testcase were a mix of skipped and passed, based on the
> capabilities of each PMD, no failures.
> 
> Tested-by: Saoirse O'Donovan <saoirse.odonovan@intel.com>

Applied to dpdk-next-crypto
Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-03  7:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-05  7:41 [PATCH] test/crypto: add cryptodev reconfig test Aakash Sasidharan
2023-04-06 14:21 ` Zhang, Fan
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

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).