test/event: free resources after crypto adapter test
authorAnkur Dwivedi <adwivedi@marvell.com>
Thu, 8 Oct 2020 12:52:34 +0000 (18:22 +0530)
committerJerin Jacob <jerinj@marvell.com>
Thu, 15 Oct 2020 20:07:39 +0000 (22:07 +0200)
The resources held by crypto adapter should be freed when the
test suite exits.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
app/test/test_event_crypto_adapter.c

index 37bcbec..a0169aa 100644 (file)
@@ -885,6 +885,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)
 {
@@ -927,6 +948,7 @@ eventdev_teardown(void)
 static void
 testsuite_teardown(void)
 {
+       crypto_adapter_teardown();
        crypto_teardown();
        eventdev_teardown();
 }