examples/fips_validation: remove illegal usage of API
authorAkhil Goyal <gakhil@marvell.com>
Tue, 10 Aug 2021 19:50:19 +0000 (01:20 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Wed, 8 Sep 2021 07:34:25 +0000 (09:34 +0200)
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 <gakhil@marvell.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
examples/fips_validation/fips_dev_self_test.c
examples/fips_validation/main.c

index 17e8597..b4eab05 100644 (file)
@@ -3,7 +3,7 @@
  */
 
 #include <rte_cryptodev.h>
-#include <rte_cryptodev_pmd.h>
+#include <rte_malloc.h>
 
 #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
index e892078..a8daad1 100644 (file)
@@ -7,7 +7,7 @@
 #include <dirent.h>
 
 #include <rte_cryptodev.h>
-#include <rte_cryptodev_pmd.h>
+#include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_mbuf.h>
 #include <rte_string_fns.h>
@@ -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;
                }