cryptodev: rename function to check device validity
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>
This commit is contained in:
parent
59c6646e6d
commit
e74abd4843
@ -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
|
||||
-----------
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user