src/dpdk/drivers/crypto/mvsam/rte_mrvl_pmd.c
static int
cryptodev_mrvl_crypto_create(const char *name,
		struct rte_vdev_device *vdev,
		struct mrvl_pmd_init_params *init_params)
{
	struct rte_cryptodev *dev;
	struct mrvl_crypto_private *internals;
	struct sam_init_params	sam_params;
	int ret = -EINVAL;

	dev = rte_cryptodev_pmd_create(name, &vdev->device,
			&init_params->common);
	if (dev == NULL) {
		MRVL_LOG(ERR, "Failed to create cryptodev vdev!");
		goto init_error;
	}

	dev->driver_id = cryptodev_driver_id;
	dev->dev_ops = rte_mrvl_crypto_pmd_ops;

	/* Register rx/tx burst functions for data path. */
	dev->enqueue_burst = mrvl_crypto_pmd_enqueue_burst;
	dev->dequeue_burst = mrvl_crypto_pmd_dequeue_burst;

	dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
			RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
			RTE_CRYPTODEV_FF_HW_ACCELERATED |
			RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
			RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT;

	internals = dev->data->dev_private;

	internals->max_nb_qpairs = init_params->common.max_nb_queue_pairs;
	internals->max_nb_sessions = init_params->max_nb_sessions;

	ret = rte_mvep_init(MVEP_MOD_T_SAM, NULL);
	if (ret)
		goto init_error;

	sam_params.max_num_sessions = internals->max_nb_sessions;

	/* sam_set_debug_flags(3); */

	ret = sam_init(&sam_params);
	if (ret)
		goto init_error;

	return 0;

init_error:
	MRVL_LOG(ERR,
		"Driver %s: %s failed!", init_params->common.name, __func__);

	cryptodev_mrvl_crypto_uninit(vdev);
	return ret;
}
/**
 * Create a new crypto device.
 *
 * @param name Driver name.
 * @param vdev Pointer to device structure.
 * @param init_params Pointer to initialization parameters.
 * @returns 0 in case of success, negative value otherwise.
 */
Create a new crypto device.
@param name Driver name.
@param vdev Pointer to device structure.
@param init_params Pointer to initialization parameters.
@returns 0 in case of success, negative value otherwise.
Create a new crypto device . @param name Driver name . @param vdev Pointer to device structure . @param init_params Pointer to initialization parameters . @returns 0 in case of success negative value otherwise .
static int
cryptodev_mrvl_crypto_create(const char *name,
		struct rte_vdev_device *vdev,
		struct mrvl_pmd_init_params *init_params)
{
	struct rte_cryptodev *dev;
	struct mrvl_crypto_private *internals;
	struct sam_init_params	sam_params;
	int ret = -EINVAL;
	dev = rte_cryptodev_pmd_create(name, &vdev->device,
			&init_params->common);
	if (dev == NULL) {
		MRVL_LOG(ERR, "Failed to create cryptodev vdev!");
		goto init_error;
	}
	dev->driver_id = cryptodev_driver_id;
	dev->dev_ops = rte_mrvl_crypto_pmd_ops;
	dev->enqueue_burst = mrvl_crypto_pmd_enqueue_burst;
	dev->dequeue_burst = mrvl_crypto_pmd_dequeue_burst;
	dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
			RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
			RTE_CRYPTODEV_FF_HW_ACCELERATED |
			RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
			RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT;
	internals = dev->data->dev_private;
	internals->max_nb_qpairs = init_params->common.max_nb_queue_pairs;
	internals->max_nb_sessions = init_params->max_nb_sessions;
	ret = rte_mvep_init(MVEP_MOD_T_SAM, NULL);
	if (ret)
		goto init_error;
	sam_params.max_num_sessions = internals->max_nb_sessions;
	ret = sam_init(&sam_params);
	if (ret)
		goto init_error;
	return 0;
init_error:
	MRVL_LOG(ERR,
		"Driver %s: %s failed!", init_params->common.name, __func__);
	cryptodev_mrvl_crypto_uninit(vdev);
	return ret;
}
static int cryptodev_mrvl_crypto_create ( const char * name , struct rte_vdev_device * vdev , struct mrvl_pmd_init_params * init_params ) { struct rte_cryptodev * dev ; struct mrvl_crypto_private * internals ; struct sam_init_params sam_params ; int ret = - EINVAL ; dev = rte_cryptodev_pmd_create ( name , & vdev -> device , & init_params -> common ) ; if ( dev == NULL ) { MRVL_LOG ( ERR , " " ) ; goto init_error ; } dev -> driver_id = cryptodev_driver_id ; dev -> dev_ops = rte_mrvl_crypto_pmd_ops ; dev -> enqueue_burst = mrvl_crypto_pmd_enqueue_burst ; dev -> dequeue_burst = mrvl_crypto_pmd_dequeue_burst ; dev -> feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | RTE_CRYPTODEV_FF_HW_ACCELERATED | RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT | RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT ; internals = dev -> data -> dev_private ; internals -> max_nb_qpairs = init_params -> common . max_nb_queue_pairs ; internals -> max_nb_sessions = init_params -> max_nb_sessions ; ret = rte_mvep_init ( MVEP_MOD_T_SAM , NULL ) ; if ( ret ) goto init_error ; sam_params . max_num_sessions = internals -> max_nb_sessions ; ret = sam_init ( & sam_params ) ; if ( ret ) goto init_error ; return 0 ; init_error : MRVL_LOG ( ERR , " " , init_params -> common . name , __func__ ) ; cryptodev_mrvl_crypto_uninit ( vdev ) ; return ret ; }
Create a new crypto device.
Create a new crypto device .
/* Register rx/tx burst functions for data path. */ /* sam_set_debug_flags(3); */