From patchwork Thu Aug 5 20:02:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 96686 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 68F48A0C41; Thu, 5 Aug 2021 22:03:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 948864129A; Thu, 5 Aug 2021 22:03:14 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id F100F4128E for ; Thu, 5 Aug 2021 22:03:12 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 175K17h9012534; Thu, 5 Aug 2021 13:03:06 -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-transfer-encoding : content-type; s=pfpt0220; bh=uvO8sR6cP1T/dZr3vOCN8uZ0aI9hkhZ9Nozi35bFqKI=; b=bA8a72eBNriytHFtRfJ0ZWy4/e2+IUVaBWJTq2oALcZ4yGL3iNIrOxSs5SrOoknbpOTq +pNGYMhUDkY6IIM2bRwUPBeERt8VP3yvevCzyPZZRSK8+vvJW5ZmZfKOKYuxG08d67Yr 4Nm4mEaX4rpx+77C+8FIiHdd67ydDywDkxBHvDsqi0A0JwgZn/lmZVFaj/ne0EAB1M7b ft7J/ljjorSjgIZQxjz+tfrTPs8ldgzoVHtaz6NMglCR5Gh1nn68qdH2AK1ITzhJzwdB A6Tl6ze00GGBPTLZGuOgJnfKDvlzCC8tHZcb7fyXqrGElMPhBupNNoKpRChibiXYU+4T yQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3a8ata2cm8-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 05 Aug 2021 13:03:06 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 5 Aug 2021 13:03:04 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 5 Aug 2021 13:03:04 -0700 Received: from localhost.localdomain (unknown [10.28.36.185]) by maili.marvell.com (Postfix) with ESMTP id D09F93F705F; Thu, 5 Aug 2021 13:02:58 -0700 (PDT) From: Akhil Goyal To: CC: , , , , , , , , , , , , , , , , , Akhil Goyal Date: Fri, 6 Aug 2021 01:32:35 +0530 Message-ID: <20210805200236.1180289-4-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210805200236.1180289-1-gakhil@marvell.com> References: <20210805200236.1180289-1-gakhil@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: U0aC4lDOINSSibDiaqYx_7oUweSkCF2P X-Proofpoint-GUID: U0aC4lDOINSSibDiaqYx_7oUweSkCF2P X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-08-05_10:2021-08-05, 2021-08-05 signatures=0 Subject: [dpdk-dev] [PATCH 3/4] examples/fips_validation: remove illegal usage of APIs 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" Some of the cryptodev APIs are not allowed to be used by application directly. Hence removing the usage of 1. queue_pair_release: it is not required, as configure of queue pair release the previous queue pairs and the dev is not directly exposed to application, hence cannot use its ops from app. 2. rte_cryptodev_stop: it can be used directly without checking if the device is started or not. 3. rte_cryptodev_pmd_destroy: application should use rte_cryptodev_close instead. Signed-off-by: Akhil Goyal --- examples/fips_validation/fips_dev_self_test.c | 19 ++----------------- examples/fips_validation/main.c | 7 ++----- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c index 17e85973c0..b4eab05a98 100644 --- a/examples/fips_validation/fips_dev_self_test.c +++ b/examples/fips_validation/fips_dev_self_test.c @@ -3,7 +3,7 @@ */ #include -#include +#include #include "fips_dev_self_test.h" @@ -1523,12 +1523,6 @@ static void fips_dev_auto_test_uninit(uint8_t dev_id, struct fips_dev_auto_test_env *env) { - struct rte_cryptodev *dev = rte_cryptodev_pmd_get_dev(dev_id); - uint32_t i; - - if (!dev) - return; - if (env->mbuf) rte_pktmbuf_free(env->mbuf); if (env->op) @@ -1542,16 +1536,7 @@ fips_dev_auto_test_uninit(uint8_t dev_id, if (env->sess_priv_pool) rte_mempool_free(env->sess_priv_pool); - if (dev->data->dev_started) - rte_cryptodev_stop(dev_id); - - if (dev->data->nb_queue_pairs) { - for (i = 0; i < dev->data->nb_queue_pairs; i++) - (*dev->dev_ops->queue_pair_release)(dev, i); - dev->data->nb_queue_pairs = 0; - rte_free(dev->data->queue_pairs); - dev->data->queue_pairs = NULL; - } + rte_cryptodev_stop(dev_id); } static int diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index e892078f0e..a8daad1f48 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include @@ -73,10 +73,7 @@ cryptodev_fips_validate_app_int(void) if (env.self_test) { ret = fips_dev_self_test(env.dev_id, env.broken_test_config); if (ret < 0) { - struct rte_cryptodev *cryptodev = - rte_cryptodev_pmd_get_dev(env.dev_id); - - rte_cryptodev_pmd_destroy(cryptodev); + rte_cryptodev_close(env.dev_id); return ret; }