DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] test/crypto: improve asymmetric crypto testsuite setup
@ 2019-07-24 10:27 Ayuj Verma
  2019-07-24 10:27 ` Ayuj Verma
  0 siblings, 1 reply; 3+ messages in thread
From: Ayuj Verma @ 2019-07-24 10:27 UTC (permalink / raw)
  To: akhil.goyal
  Cc: arkadiuszx.kusztal, shallyv, ssahu, kkotamarthy, anoobj, dev, Ayuj Verma

Improve logic:
  * to get list of valid devices based on driver id so that to
    eliminate unnecessary if check for driver id match in device loop
  * loop till 1st device supporting asymmetric feature is found unlike
    previous logic which breaks on 1st device

Ayuj Verma (1):
  test/crypto: improve asymmetric crypto testsuite setup

 app/test/test_cryptodev_asym.c | 43 +++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 21 deletions(-)

-- 
1.8.3.1


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

* [dpdk-dev] [PATCH v1] test/crypto: improve asymmetric crypto testsuite setup
  2019-07-24 10:27 [dpdk-dev] [PATCH v1] test/crypto: improve asymmetric crypto testsuite setup Ayuj Verma
@ 2019-07-24 10:27 ` Ayuj Verma
  2019-07-26 13:56   ` Akhil Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Ayuj Verma @ 2019-07-24 10:27 UTC (permalink / raw)
  To: akhil.goyal
  Cc: arkadiuszx.kusztal, shallyv, ssahu, kkotamarthy, anoobj, dev, Ayuj Verma

Improve logic:
  * to get list of valid devices based on driver id so that to
    eliminate unnecessary if check for driver id match in device loop
  * loop till 1st device supporting asymmetric feature is found unlike
    previous logic which breaks on 1st device

Signed-off-by: Kanaka Durga Kotamarthy <kkotamarthy@marvell.com>
Signed-off-by: Ayuj Verma <ayverma@marvell.com>
---
 app/test/test_cryptodev_asym.c | 43 +++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index 95e7d34..e8177e7 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -710,9 +710,10 @@ struct test_cases_array {
 testsuite_setup(void)
 {
 	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
 	struct rte_cryptodev_info info;
-	uint32_t i = 0, nb_devs, dev_id;
-	int ret;
+	int ret, dev_id = -1;
+	uint32_t i, nb_devs;
 	uint16_t qp_id;
 
 	memset(ts_params, 0, sizeof(*ts_params));
@@ -748,36 +749,36 @@ struct test_cases_array {
 		}
 	}
 
-	nb_devs = rte_cryptodev_count();
+	/* Get list of valid crypto devs */
+	nb_devs = rte_cryptodev_devices_get(
+				rte_cryptodev_driver_name_get(gbl_driver_id),
+				valid_devs, RTE_CRYPTO_MAX_DEVS);
 	if (nb_devs < 1) {
 		RTE_LOG(ERR, USER1, "No crypto devices found?\n");
 		return TEST_FAILED;
 	}
 
-	/* Create list of valid crypto devs */
-	for (i = 0; i < nb_devs; i++) {
-		rte_cryptodev_info_get(i, &info);
-		if (info.driver_id == gbl_driver_id)
-			ts_params->valid_devs[ts_params->valid_dev_count++] = i;
+	/*
+	 * Get first valid asymmetric device found in test suite param and
+	 * break
+	 */
+	for (i = 0; i < nb_devs ; i++) {
+		rte_cryptodev_info_get(valid_devs[i], &info);
+		if (info.feature_flags & RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO) {
+			dev_id = ts_params->valid_devs[0] = valid_devs[i];
+			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];
-
-	rte_cryptodev_info_get(dev_id, &info);
-
-	/* check if device support asymmetric, skip if not */
-	if (!(info.feature_flags &
-				RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO)) {
+	if (dev_id == -1) {
 		RTE_LOG(ERR, USER1, "Device doesn't support asymmetric. "
-				"Test Skipped.\n");
+			"Test skipped.\n");
 		return TEST_FAILED;
 	}
 
+	/* Set valid device count */
+	ts_params->valid_dev_count = nb_devs;
+
 	/* configure device with num qp */
 	ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
 	ts_params->conf.socket_id = SOCKET_ID_ANY;
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH v1] test/crypto: improve asymmetric crypto testsuite setup
  2019-07-24 10:27 ` Ayuj Verma
@ 2019-07-26 13:56   ` Akhil Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2019-07-26 13:56 UTC (permalink / raw)
  To: Ayuj Verma; +Cc: arkadiuszx.kusztal, shallyv, ssahu, kkotamarthy, anoobj, dev


> 
> Improve logic:
>   * to get list of valid devices based on driver id so that to
>     eliminate unnecessary if check for driver id match in device loop
>   * loop till 1st device supporting asymmetric feature is found unlike
>     previous logic which breaks on 1st device
> 
> Signed-off-by: Kanaka Durga Kotamarthy <kkotamarthy@marvell.com>
> Signed-off-by: Ayuj Verma <ayverma@marvell.com>
> ---
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>

Applied to dpdk-next-crypto

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

end of thread, other threads:[~2019-07-26 13:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24 10:27 [dpdk-dev] [PATCH v1] test/crypto: improve asymmetric crypto testsuite setup Ayuj Verma
2019-07-24 10:27 ` Ayuj Verma
2019-07-26 13:56   ` 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).