cryptodev: rename function to check device validity
authorAkhil Goyal <gakhil@marvell.com>
Tue, 10 Aug 2021 19:50:18 +0000 (01:20 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Wed, 8 Sep 2021 07:21:10 +0000 (09:21 +0200)
The API rte_cryptodev_pmd_is_valid_dev, can be used
by the application as well as PMD to check whether
the device is valid or not. Hence, _pmd is removed
from the API.
The applications and drivers which use this API are
also updated.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
doc/guides/rel_notes/release_21_11.rst
drivers/net/softnic/rte_eth_softnic_cryptodev.c
examples/fips_validation/main.c
examples/ip_pipeline/cryptodev.c
lib/cryptodev/rte_cryptodev.c
lib/cryptodev/rte_cryptodev.h
lib/cryptodev/rte_cryptodev_pmd.h
lib/cryptodev/version.map
lib/eventdev/rte_event_crypto_adapter.c
lib/eventdev/rte_eventdev.c
lib/pipeline/rte_table_action.c

index 411fa95..e7ad50b 100644 (file)
@@ -102,6 +102,10 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* cryptodev: The API rte_cryptodev_pmd_is_valid_dev is modified to
+  rte_cryptodev_is_valid_dev as it can be used by the application as
+  well as PMD to check whether the device is valid or not.
+
 
 ABI Changes
 -----------
index a1a4ca5..8e27880 100644 (file)
@@ -82,7 +82,7 @@ softnic_cryptodev_create(struct pmd_internals *p,
 
                dev_id = (uint32_t)status;
        } else {
-               if (rte_cryptodev_pmd_is_valid_dev(params->dev_id) == 0)
+               if (rte_cryptodev_is_valid_dev(params->dev_id) == 0)
                        return NULL;
 
                dev_id = params->dev_id;
index c175fe6..e892078 100644 (file)
@@ -196,7 +196,7 @@ parse_cryptodev_id_arg(char *arg)
        }
 
 
-       if (!rte_cryptodev_pmd_is_valid_dev(cryptodev_id)) {
+       if (!rte_cryptodev_is_valid_dev(cryptodev_id)) {
                RTE_LOG(ERR, USER1, "Error %i: invalid cryptodev id %s\n",
                                cryptodev_id, arg);
                return -1;
index b0d9f3d..9997d97 100644 (file)
@@ -6,7 +6,6 @@
 #include <stdio.h>
 
 #include <rte_cryptodev.h>
-#include <rte_cryptodev_pmd.h>
 #include <rte_string_fns.h>
 
 #include "cryptodev.h"
@@ -74,7 +73,7 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
 
                dev_id = (uint32_t)status;
        } else {
-               if (rte_cryptodev_pmd_is_valid_dev(params->dev_id) == 0)
+               if (rte_cryptodev_is_valid_dev(params->dev_id) == 0)
                        return NULL;
 
                dev_id = params->dev_id;
index 447aa9d..37502b9 100644 (file)
@@ -663,7 +663,7 @@ rte_cryptodev_is_valid_device_data(uint8_t dev_id)
 }
 
 unsigned int
-rte_cryptodev_pmd_is_valid_dev(uint8_t dev_id)
+rte_cryptodev_is_valid_dev(uint8_t dev_id)
 {
        struct rte_cryptodev *dev = NULL;
 
@@ -761,7 +761,7 @@ rte_cryptodev_socket_id(uint8_t dev_id)
 {
        struct rte_cryptodev *dev;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id))
+       if (!rte_cryptodev_is_valid_dev(dev_id))
                return -1;
 
        dev = rte_cryptodev_pmd_get_dev(dev_id);
@@ -1032,7 +1032,7 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
        struct rte_cryptodev *dev;
        int diag;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return -EINVAL;
        }
@@ -1080,7 +1080,7 @@ rte_cryptodev_start(uint8_t dev_id)
 
        CDEV_LOG_DEBUG("Start dev_id=%" PRIu8, dev_id);
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return -EINVAL;
        }
@@ -1110,7 +1110,7 @@ rte_cryptodev_stop(uint8_t dev_id)
 {
        struct rte_cryptodev *dev;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return;
        }
@@ -1136,7 +1136,7 @@ rte_cryptodev_close(uint8_t dev_id)
        struct rte_cryptodev *dev;
        int retval;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return -1;
        }
@@ -1176,7 +1176,7 @@ rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
 {
        struct rte_cryptodev *dev;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return -EINVAL;
        }
@@ -1207,7 +1207,7 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
 {
        struct rte_cryptodev *dev;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return -EINVAL;
        }
@@ -1283,7 +1283,7 @@ rte_cryptodev_add_enq_callback(uint8_t dev_id,
                return NULL;
        }
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
                rte_errno = ENODEV;
                return NULL;
@@ -1349,7 +1349,7 @@ rte_cryptodev_remove_enq_callback(uint8_t dev_id,
                return -EINVAL;
        }
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
                return -ENODEV;
        }
@@ -1418,7 +1418,7 @@ rte_cryptodev_add_deq_callback(uint8_t dev_id,
                return NULL;
        }
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
                rte_errno = ENODEV;
                return NULL;
@@ -1484,7 +1484,7 @@ rte_cryptodev_remove_deq_callback(uint8_t dev_id,
                return -EINVAL;
        }
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
                return -ENODEV;
        }
@@ -1542,7 +1542,7 @@ rte_cryptodev_stats_get(uint8_t dev_id, struct rte_cryptodev_stats *stats)
 {
        struct rte_cryptodev *dev;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
                return -ENODEV;
        }
@@ -1565,7 +1565,7 @@ rte_cryptodev_stats_reset(uint8_t dev_id)
 {
        struct rte_cryptodev *dev;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return;
        }
@@ -1581,7 +1581,7 @@ rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info)
 {
        struct rte_cryptodev *dev;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
                return;
        }
@@ -1608,7 +1608,7 @@ rte_cryptodev_callback_register(uint8_t dev_id,
        if (!cb_fn)
                return -EINVAL;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return -EINVAL;
        }
@@ -1652,7 +1652,7 @@ rte_cryptodev_callback_unregister(uint8_t dev_id,
        if (!cb_fn)
                return -EINVAL;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return -EINVAL;
        }
@@ -1720,7 +1720,7 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
        uint8_t index;
        int ret;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return -EINVAL;
        }
@@ -1765,7 +1765,7 @@ rte_cryptodev_asym_session_init(uint8_t dev_id,
        uint8_t index;
        int ret;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return -EINVAL;
        }
@@ -1939,7 +1939,7 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
        struct rte_cryptodev *dev;
        uint8_t driver_id;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return -EINVAL;
        }
@@ -1969,7 +1969,7 @@ rte_cryptodev_asym_session_clear(uint8_t dev_id,
 {
        struct rte_cryptodev *dev;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
                return -EINVAL;
        }
@@ -2079,7 +2079,7 @@ rte_cryptodev_sym_get_private_session_size(uint8_t dev_id)
        struct rte_cryptodev *dev;
        unsigned int priv_sess_size;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id))
+       if (!rte_cryptodev_is_valid_dev(dev_id))
                return 0;
 
        dev = rte_cryptodev_pmd_get_dev(dev_id);
@@ -2099,7 +2099,7 @@ rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)
        unsigned int header_size = sizeof(void *) * nb_drivers;
        unsigned int priv_sess_size;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id))
+       if (!rte_cryptodev_is_valid_dev(dev_id))
                return 0;
 
        dev = rte_cryptodev_pmd_get_dev(dev_id);
@@ -2156,7 +2156,7 @@ rte_cryptodev_sym_cpu_crypto_process(uint8_t dev_id,
 {
        struct rte_cryptodev *dev;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+       if (!rte_cryptodev_is_valid_dev(dev_id)) {
                sym_crypto_fill_status(vec, EINVAL);
                return 0;
        }
@@ -2179,7 +2179,7 @@ rte_cryptodev_get_raw_dp_ctx_size(uint8_t dev_id)
        int32_t size = sizeof(struct rte_crypto_raw_dp_ctx);
        int32_t priv_size;
 
-       if (!rte_cryptodev_pmd_is_valid_dev(dev_id))
+       if (!rte_cryptodev_is_valid_dev(dev_id))
                return -EINVAL;
 
        dev = rte_cryptodev_pmd_get_dev(dev_id);
index 11f4e6f..bb01f0f 100644 (file)
@@ -1368,6 +1368,17 @@ __rte_experimental
 unsigned int
 rte_cryptodev_asym_get_private_session_size(uint8_t dev_id);
 
+/**
+ * Validate if the crypto device index is valid attached crypto device.
+ *
+ * @param      dev_id  Crypto device index.
+ *
+ * @return
+ *   - If the device index is valid (1) or not (0).
+ */
+unsigned int
+rte_cryptodev_is_valid_dev(uint8_t dev_id);
+
 /**
  * Provide driver identifier.
  *
index 1274436..dd2a494 100644 (file)
@@ -94,17 +94,6 @@ rte_cryptodev_pmd_get_dev(uint8_t dev_id);
 struct rte_cryptodev *
 rte_cryptodev_pmd_get_named_dev(const char *name);
 
-/**
- * Validate if the crypto device index is valid attached crypto device.
- *
- * @param      dev_id  Crypto device index.
- *
- * @return
- *   - If the device index is valid (1) or not (0).
- */
-unsigned int
-rte_cryptodev_pmd_is_valid_dev(uint8_t dev_id);
-
 /**
  * The pool of rte_cryptodev structures.
  */
index 979d823..1a7f759 100644 (file)
@@ -25,6 +25,7 @@ DPDK_22 {
        rte_cryptodev_get_feature_name;
        rte_cryptodev_get_sec_ctx;
        rte_cryptodev_info_get;
+       rte_cryptodev_is_valid_dev;
        rte_cryptodev_name_get;
        rte_cryptodev_pmd_allocate;
        rte_cryptodev_pmd_callback_process;
@@ -33,7 +34,6 @@ DPDK_22 {
        rte_cryptodev_pmd_destroy;
        rte_cryptodev_pmd_get_dev;
        rte_cryptodev_pmd_get_named_dev;
-       rte_cryptodev_pmd_is_valid_dev;
        rte_cryptodev_pmd_parse_input_args;
        rte_cryptodev_pmd_release_device;
        rte_cryptodev_queue_pair_count;
index e1d38d3..2d38389 100644 (file)
@@ -781,7 +781,7 @@ rte_event_crypto_adapter_queue_pair_add(uint8_t id,
 
        EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
 
-       if (!rte_cryptodev_pmd_is_valid_dev(cdev_id)) {
+       if (!rte_cryptodev_is_valid_dev(cdev_id)) {
                RTE_EDEV_LOG_ERR("Invalid dev_id=%" PRIu8, cdev_id);
                return -EINVAL;
        }
@@ -898,7 +898,7 @@ rte_event_crypto_adapter_queue_pair_del(uint8_t id, uint8_t cdev_id,
 
        EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
 
-       if (!rte_cryptodev_pmd_is_valid_dev(cdev_id)) {
+       if (!rte_cryptodev_is_valid_dev(cdev_id)) {
                RTE_EDEV_LOG_ERR("Invalid dev_id=%" PRIu8, cdev_id);
                return -EINVAL;
        }
index 594dd5e..cb0ed7b 100644 (file)
@@ -165,7 +165,7 @@ rte_event_crypto_adapter_caps_get(uint8_t dev_id, uint8_t cdev_id,
        struct rte_cryptodev *cdev;
 
        RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
-       if (!rte_cryptodev_pmd_is_valid_dev(cdev_id))
+       if (!rte_cryptodev_is_valid_dev(cdev_id))
                return -EINVAL;
 
        dev = &rte_eventdevs[dev_id];
index 98f3438..54721ed 100644 (file)
@@ -1732,7 +1732,7 @@ struct sym_crypto_data {
 static int
 sym_crypto_cfg_check(struct rte_table_action_sym_crypto_config *cfg)
 {
-       if (!rte_cryptodev_pmd_is_valid_dev(cfg->cryptodev_id))
+       if (!rte_cryptodev_is_valid_dev(cfg->cryptodev_id))
                return -EINVAL;
        if (cfg->mp_create == NULL || cfg->mp_init == NULL)
                return -EINVAL;