From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0E234A0C47; Thu, 2 Sep 2021 13:54:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D5024003E; Thu, 2 Sep 2021 13:54:30 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 0CD214003C for ; Thu, 2 Sep 2021 13:54:28 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10094"; a="217228206" X-IronPort-AV: E=Sophos;i="5.84,372,1620716400"; d="scan'208";a="217228206" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2021 04:54:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,372,1620716400"; d="scan'208";a="533058447" Received: from silpixa00400904.ir.intel.com ([10.243.23.83]) by FMSMGA003.fm.intel.com with ESMTP; 02 Sep 2021 04:54:27 -0700 From: Rebecca Troy To: dev@dpdk.org Cc: roy.fan.zhang@intel.com, Rebecca Troy , Akhil Goyal , Declan Doherty Date: Thu, 2 Sep 2021 11:54:16 +0000 Message-Id: <20210902115416.1460761-1-rebecca.troy@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] test/crypto: refactor scheduler test worker PMDs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Previously, the scheduler unit test only created and attached 1 or 2 AESNI-MB cryptodev PMDs as workers if less than 2 AESNI-MB PMDs had already been initialized. This commit changes this to always create and attach 2 new AESNI-MB cryptodev PMDs, regardless of previously initialized AESNI-MB PMDs. Signed-off-by: Rebecca Troy --- app/test/test_cryptodev.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9ad0b37473..843d07ba37 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -13475,31 +13475,32 @@ test_scheduler_attach_worker_op(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; uint8_t sched_id = ts_params->valid_devs[0]; - uint32_t nb_devs, i, nb_devs_attached = 0; + uint32_t i, nb_devs_attached = 0; int ret; char vdev_name[32]; + unsigned int count = rte_cryptodev_count(); - /* create 2 AESNI_MB if necessary */ - nb_devs = rte_cryptodev_device_count_by_driver( - rte_cryptodev_driver_id_get( - RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD))); - if (nb_devs < 2) { - for (i = nb_devs; i < 2; i++) { - snprintf(vdev_name, sizeof(vdev_name), "%s_%u", - RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), - i); - ret = rte_vdev_init(vdev_name, NULL); + /* create 2 AESNI_MB vdevs on top of existing devices */ + for (i = count; i < count + 2; i++) { + snprintf(vdev_name, sizeof(vdev_name), "%s_%u", + RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD), + i); + ret = rte_vdev_init(vdev_name, NULL); - TEST_ASSERT(ret == 0, - "Failed to create instance %u of" - " pmd : %s", - i, RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)); + TEST_ASSERT(ret == 0, + "Failed to create instance %u of" + " pmd : %s", + i, RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)); + + if (ret < 0) { + RTE_LOG(ERR, USER1, + "Failed to create 2 AESNI MB PMDs.\n"); + return TEST_SKIPPED; } } /* attach 2 AESNI_MB cdevs */ - for (i = 0; i < rte_cryptodev_count() && nb_devs_attached < 2; - i++) { + for (i = count; i < count + 2; i++) { struct rte_cryptodev_info info; unsigned int session_size; -- 2.25.1