From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id A4B60A04BA;
	Wed,  7 Oct 2020 07:27:49 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 1DBE61B67B;
	Wed,  7 Oct 2020 07:27:09 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com
 [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id E124F1B3DF
 for <dev@dpdk.org>; Wed,  7 Oct 2020 07:27:05 +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
 0975LkDC003006; Tue, 6 Oct 2020 22:27:04 -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=1UoYImSPr0Ltln27qmxyCL5Za2T4FI6NClIUw+/jUuw=;
 b=Cay+kJrm42uORhEj8Lqw+Ax7tR8f9SXrZ9qTan5kK6WpvGrZp1/Ac44E0Fh9KAYWfia3
 8jhdPpwadtCzAl4xzYajN3w0Tgln5TN1oAohK/dXGBDTTJoBqjD9OcwnSQU8D/MX/U/F
 /WMg1Grw7T54BEYHXXlubvVGTkkHtJry3qyeh7mgDiVUhPJ4kl0y1LNDyXeGj/IVG/CH
 ebvbVVttr8o1L2eg0IbLr6QAj/nDChRflpvhUgtTArIbQSTnVb1TxsrsSKmCfvgaxwCf
 8XeBC57X/i3TWfe58iY082vI+hec3qnBl7Y4aKINcW7FmNdPqZWY9tDXcbg94QrdCMia Lw== 
Received: from sc-exch03.marvell.com ([199.233.58.183])
 by mx0b-0016f401.pphosted.com with ESMTP id 33xrtnk0g2-2
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Tue, 06 Oct 2020 22:27:04 -0700
Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com
 (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Oct
 2020 22:27:02 -0700
Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH04.marvell.com
 (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2;
 Tue, 6 Oct 2020 22:27:02 -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.2 via Frontend
 Transport; Tue, 6 Oct 2020 22:27:02 -0700
Received: from hyd1349.t110.caveonetworks.com (unknown [10.29.45.13])
 by maili.marvell.com (Postfix) with ESMTP id 95F913F703F;
 Tue,  6 Oct 2020 22:27:00 -0700 (PDT)
From: Ankur Dwivedi <adwivedi@marvell.com>
To: <dev@dpdk.org>
CC: <abhinandan.gujjar@intel.com>, <jerinj@marvell.com>, <anoobj@marvell.com>, 
 Ankur Dwivedi <adwivedi@marvell.com>
Date: Wed, 7 Oct 2020 10:56:29 +0530
Message-ID: <20201007052629.28566-4-adwivedi@marvell.com>
X-Mailer: git-send-email 2.28.0
In-Reply-To: <20201007052629.28566-1-adwivedi@marvell.com>
References: <20200925072841.17578-1-adwivedi@marvell.com>
 <20201007052629.28566-1-adwivedi@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687
 definitions=2020-10-07_03:2020-10-06,
 2020-10-07 signatures=0
Subject: [dpdk-dev] [PATCH v3 3/3] test/event_crypto_adapter: free resources
	during exit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

The resources held by crypto adapter should be freed when the
test suite exits.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 app/test/test_event_crypto_adapter.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index 87a67139d..d6fbbfdde 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -899,6 +899,27 @@ testsuite_setup(void)
 	return TEST_SUCCESS;
 }
 
+static void
+crypto_adapter_teardown(void)
+{
+	int ret;
+
+	ret = rte_event_crypto_adapter_stop(TEST_ADAPTER_ID);
+	if (ret < 0)
+		RTE_LOG(ERR, USER1, "Failed to stop adapter!");
+
+	ret = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
+					TEST_CDEV_ID, TEST_CDEV_QP_ID);
+	if (ret < 0)
+		RTE_LOG(ERR, USER1, "Failed to delete queue pair!");
+
+	ret = rte_event_crypto_adapter_free(TEST_ADAPTER_ID);
+	if (ret < 0)
+		RTE_LOG(ERR, USER1, "Failed to free adapter!");
+
+	crypto_adapter_setup_done = 0;
+}
+
 static void
 crypto_teardown(void)
 {
@@ -941,6 +962,7 @@ eventdev_teardown(void)
 static void
 testsuite_teardown(void)
 {
+	crypto_adapter_teardown();
 	crypto_teardown();
 	eventdev_teardown();
 }
-- 
2.28.0