From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 20C725424 for ; Tue, 15 Jan 2019 12:19:56 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2019 03:19:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,481,1539673200"; d="scan'208";a="108388028" Received: from sivswdev08.ir.intel.com (HELO localhost.localdomain) ([10.237.217.47]) by orsmga006.jf.intel.com with ESMTP; 15 Jan 2019 03:19:54 -0800 From: Bernard Iremonger To: dev@dpdk.org, konstantin.ananyev@intel.com Cc: Bernard Iremonger Date: Tue, 15 Jan 2019 11:19:51 +0000 Message-Id: <1547551191-28863-1-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] test/ipsec: fix test suite setup function 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: , X-List-Received-Date: Tue, 15 Jan 2019 11:19:57 -0000 Check for valid crypto_null devices before continuing. Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test") Signed-off-by: Bernard Iremonger --- test/test/test_ipsec.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/test/test_ipsec.c b/test/test/test_ipsec.c index ff1a1c4..4dfc55b 100644 --- a/test/test/test_ipsec.c +++ b/test/test/test_ipsec.c @@ -46,6 +46,8 @@ #define BURST_SIZE 32 #define REORDER_PKTS 1 +static int gbl_driver_id; + struct user_params { enum rte_crypto_sym_xform_type auth; enum rte_crypto_sym_xform_type cipher; @@ -218,7 +220,7 @@ testsuite_setup(void) { struct ipsec_testsuite_params *ts_params = &testsuite_params; struct rte_cryptodev_info info; - uint32_t nb_devs, dev_id; + uint32_t i, nb_devs, dev_id; size_t sess_sz; memset(ts_params, 0, sizeof(*ts_params)); @@ -251,7 +253,18 @@ testsuite_setup(void) return TEST_FAILED; } - ts_params->valid_devs[ts_params->valid_dev_count++] = 0; + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_NULL_PMD)); + + /* 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; + } + + 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]; -- 2.7.4