From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9BE32A046B for ; Wed, 24 Jul 2019 12:27:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 856BF1C1AF; Wed, 24 Jul 2019 12:27:15 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 774031C193 for ; Wed, 24 Jul 2019 12:27:13 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6OAOiQj020184; Wed, 24 Jul 2019 03:27:12 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=mVsjn19fRSgwfw92G6h5i+057jLc3i8KK8f45veZCcg=; b=jRF4atxRKWiTrZikfRk16RqYjUwOhB3i6OkifB/2N4+6E6pIkDEB0GidS+X7cBHJjT96 pKzlb3lshIpYS2rfiDvyGoYW6f0725IhOL3S+QFXZTEIOpnIhxzi6/0r3/MUVFgGhLkg eONsvyQAl6n3LkAdiffsVweDvAmmnQOm+Ww0u5JVYiFx+AQZ1pbR7P5rhK1ZuUZ8M5V0 caPfSq5Y6u+xT0b/qBhsJWzytZ8b3TWSzQSQdGjjKb0hCGYlLrgEOomK/75tde741F3S sa08Is4gIImuKFq9RUwvu5Il0Q2FPnNPEu8M4mV1TSokyVsrDbA7Crczw61vI4Gq5yb7 BQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2tx624ue5g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 24 Jul 2019 03:27:12 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 24 Jul 2019 03:27:11 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 24 Jul 2019 03:27:11 -0700 Received: from localhost.marvell.com (unknown [10.28.10.76]) by maili.marvell.com (Postfix) with ESMTP id A4BF23F7041; Wed, 24 Jul 2019 03:27:08 -0700 (PDT) From: Ayuj Verma To: CC: , , , , , , Ayuj Verma Date: Wed, 24 Jul 2019 15:57:01 +0530 Message-ID: <1563964021-28288-2-git-send-email-ayverma@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1563964021-28288-1-git-send-email-ayverma@marvell.com> References: <1563964021-28288-1-git-send-email-ayverma@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-24_04:2019-07-24,2019-07-24 signatures=0 Subject: [dpdk-dev] [PATCH v1] test/crypto: improve asymmetric crypto testsuite setup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "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 Signed-off-by: Ayuj Verma --- 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