return -1;
}
-int __rte_experimental
+int
rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,
const char *xform_string)
{
return -1;
}
-const struct rte_cryptodev_asymmetric_xform_capability * __rte_experimental
+const struct rte_cryptodev_asymmetric_xform_capability *
rte_cryptodev_asym_capability_get(uint8_t dev_id,
const struct rte_cryptodev_asym_capability_idx *idx)
{
return 0;
}
-int __rte_experimental
+int
rte_cryptodev_asym_xform_capability_check_optype(
const struct rte_cryptodev_asymmetric_xform_capability *capability,
enum rte_crypto_asym_op_type op_type)
return 0;
}
-int __rte_experimental
+int
rte_cryptodev_asym_xform_capability_check_modlen(
const struct rte_cryptodev_asymmetric_xform_capability *capability,
uint16_t modlen)
return "CPU_ARM_CE";
case RTE_CRYPTODEV_FF_SECURITY:
return "SECURITY_PROTOCOL";
+ case RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_EXP:
+ return "RSA_PRIV_OP_KEY_EXP";
+ case RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT:
+ return "RSA_PRIV_OP_KEY_QT";
+ case RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED:
+ return "DIGEST_ENCRYPTED";
default:
return NULL;
}
rte_cryptodev_data_alloc(uint8_t dev_id, struct rte_cryptodev_data **data,
int socket_id)
{
- char mz_name[RTE_CRYPTODEV_NAME_MAX_LEN];
+ char mz_name[RTE_MEMZONE_NAMESIZE];
const struct rte_memzone *mz;
int n;
return 0;
}
+static inline int
+rte_cryptodev_data_free(uint8_t dev_id, struct rte_cryptodev_data **data)
+{
+ char mz_name[RTE_MEMZONE_NAMESIZE];
+ const struct rte_memzone *mz;
+ int n;
+
+ /* generate memzone name */
+ n = snprintf(mz_name, sizeof(mz_name), "rte_cryptodev_data_%u", dev_id);
+ if (n >= (int)sizeof(mz_name))
+ return -EINVAL;
+
+ mz = rte_memzone_lookup(mz_name);
+ if (mz == NULL)
+ return -ENOMEM;
+
+ RTE_ASSERT(*data == mz->addr);
+ *data = NULL;
+
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+ return rte_memzone_free(mz);
+
+ return 0;
+}
+
static uint8_t
rte_cryptodev_find_free_device_index(void)
{
cryptodev = rte_cryptodev_pmd_get_dev(dev_id);
if (cryptodev->data == NULL) {
- struct rte_cryptodev_data *cryptodev_data =
- cryptodev_globals.data[dev_id];
+ struct rte_cryptodev_data **cryptodev_data =
+ &cryptodev_globals.data[dev_id];
- int retval = rte_cryptodev_data_alloc(dev_id, &cryptodev_data,
+ int retval = rte_cryptodev_data_alloc(dev_id, cryptodev_data,
socket_id);
- if (retval < 0 || cryptodev_data == NULL)
+ if (retval < 0 || *cryptodev_data == NULL)
return NULL;
- cryptodev->data = cryptodev_data;
+ cryptodev->data = *cryptodev_data;
- snprintf(cryptodev->data->name, RTE_CRYPTODEV_NAME_MAX_LEN,
- "%s", name);
+ strlcpy(cryptodev->data->name, name,
+ RTE_CRYPTODEV_NAME_MAX_LEN);
cryptodev->data->dev_id = dev_id;
cryptodev->data->socket_id = socket_id;
rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev)
{
int ret;
+ uint8_t dev_id;
if (cryptodev == NULL)
return -EINVAL;
+ dev_id = cryptodev->data->dev_id;
+
/* Close device only if device operations have been set */
if (cryptodev->dev_ops) {
- ret = rte_cryptodev_close(cryptodev->data->dev_id);
+ ret = rte_cryptodev_close(dev_id);
if (ret < 0)
return ret;
}
+ ret = rte_cryptodev_data_free(dev_id, &cryptodev_globals.data[dev_id]);
+ if (ret < 0)
+ return ret;
+
cryptodev->attached = RTE_CRYPTODEV_DETACHED;
cryptodev_globals.nb_devs--;
return 0;
return 0;
}
-int __rte_experimental
+int
rte_cryptodev_asym_session_init(uint8_t dev_id,
struct rte_cryptodev_asym_session *sess,
struct rte_crypto_asym_xform *xforms,
return 0;
}
-struct rte_mempool * __rte_experimental
+struct rte_mempool *
rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
int socket_id)
return sess;
}
-struct rte_cryptodev_asym_session * __rte_experimental
+struct rte_cryptodev_asym_session *
rte_cryptodev_asym_session_create(struct rte_mempool *mp)
{
struct rte_cryptodev_asym_session *sess;
return -EINVAL;
driver_id = dev->driver_id;
+ if (sess->sess_data[driver_id].refcnt == 0)
+ return 0;
if (--sess->sess_data[driver_id].refcnt != 0)
return -EBUSY;
return 0;
}
-int __rte_experimental
+int
rte_cryptodev_asym_session_clear(uint8_t dev_id,
struct rte_cryptodev_asym_session *sess)
{
return 0;
}
-int __rte_experimental
+int
rte_cryptodev_asym_session_free(struct rte_cryptodev_asym_session *sess)
{
uint8_t i;
rte_cryptodev_sym_session_data_size(&s));
}
-unsigned int __rte_experimental
+unsigned int
rte_cryptodev_sym_get_existing_header_session_size(
struct rte_cryptodev_sym_session *sess)
{
rte_cryptodev_sym_session_data_size(sess));
}
-unsigned int __rte_experimental
+unsigned int
rte_cryptodev_asym_get_header_session_size(void)
{
/*
return priv_sess_size;
}
-unsigned int __rte_experimental
+unsigned int
rte_cryptodev_asym_get_private_session_size(uint8_t dev_id)
{
struct rte_cryptodev *dev;
}
-int __rte_experimental
+int
rte_cryptodev_sym_session_set_user_data(
struct rte_cryptodev_sym_session *sess,
void *data,
return 0;
}
-void * __rte_experimental
+void *
rte_cryptodev_sym_session_get_user_data(
struct rte_cryptodev_sym_session *sess)
{