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 E37D2A0C48; Tue, 20 Jul 2021 15:12:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9E10407FF; Tue, 20 Jul 2021 15:12:18 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id BC28A40DFB for ; Tue, 20 Jul 2021 15:12:17 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10050"; a="233012163" X-IronPort-AV: E=Sophos;i="5.84,254,1620716400"; d="scan'208";a="233012163" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2021 06:12:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,254,1620716400"; d="scan'208";a="500746578" Received: from silpixa00399302.ir.intel.com ([10.237.214.136]) by FMSMGA003.fm.intel.com with ESMTP; 20 Jul 2021 06:12:10 -0700 From: Adam Dybkowski To: dev@dpdk.org, roy.fan.zhang@intel.com, gakhil@marvell.com Cc: Adam Dybkowski Date: Tue, 20 Jul 2021 14:11:33 +0100 Message-Id: <20210720131133.62869-1-adamx.dybkowski@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20210719123718.15960-1-adamx.dybkowski@intel.com> References: <20210719123718.15960-1-adamx.dybkowski@intel.com> Subject: [dpdk-dev] [PATCH v4] test/crypto: check if RAW API is supported 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" This patch adds checking if RAW API is supported at the start of the test command "cryptodev_qat_raw_api_autotest". Signed-off-by: Adam Dybkowski --- app/test/test_cryptodev.c | 43 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 31201d93e1..25778f464b 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -14517,6 +14517,41 @@ run_cryptodev_testsuite(const char *pmd_name) return ret; } +static int +require_feature_flag(const char *pmd_name, uint64_t flag, const char *flag_name) +{ + struct rte_cryptodev_info dev_info; + uint8_t i, nb_devs; + int driver_id; + + driver_id = rte_cryptodev_driver_id_get(pmd_name); + if (driver_id == -1) { + RTE_LOG(WARNING, USER1, "%s PMD must be loaded.\n", pmd_name); + return TEST_SKIPPED; + } + + nb_devs = rte_cryptodev_count(); + if (nb_devs < 1) { + RTE_LOG(WARNING, USER1, "No crypto devices found?\n"); + return TEST_SKIPPED; + } + + for (i = 0; i < nb_devs; i++) { + rte_cryptodev_info_get(i, &dev_info); + if (dev_info.driver_id == driver_id) { + if (!(dev_info.feature_flags & flag)) { + RTE_LOG(INFO, USER1, "%s not supported\n", + flag_name); + return TEST_SKIPPED; + } + return 0; /* found */ + } + } + + RTE_LOG(INFO, USER1, "%s not supported\n", flag_name); + return TEST_SKIPPED; +} + static int test_cryptodev_qat(void) { @@ -14766,10 +14801,16 @@ test_cryptodev_bcmfs(void) static int test_cryptodev_qat_raw_api(void) { + static const char *pmd_name = RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD); int ret; + ret = require_feature_flag(pmd_name, RTE_CRYPTODEV_FF_SYM_RAW_DP, + "RAW API"); + if (ret) + return ret; + global_api_test_type = CRYPTODEV_RAW_API_TEST; - ret = run_cryptodev_testsuite(RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); + ret = run_cryptodev_testsuite(pmd_name); global_api_test_type = CRYPTODEV_API_TEST; return ret; -- 2.25.1