src/dpdk/drivers/crypto/mvsam/rte_mrvl_pmd.c
static uint16_t
mrvl_crypto_pmd_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops,
		uint16_t nb_ops)
{
	uint16_t iter_ops = 0;
	uint16_t to_enq = 0;
	uint16_t consumed = 0;
	int ret;
	struct sam_cio_op_params requests[nb_ops];
	/*
	 * SAM does not store bd pointers, so on-stack scope will be enough.
	 */
	struct mrvl_crypto_src_table src_bd[nb_ops];
	struct sam_buf_info          dst_bd[nb_ops];
	struct mrvl_crypto_qp *qp = (struct mrvl_crypto_qp *)queue_pair;

	if (nb_ops == 0)
		return 0;

	/* Prepare the burst. */
	memset(&requests, 0, sizeof(requests));
	memset(&src_bd, 0, sizeof(src_bd));

	/* Iterate through */
	for (; iter_ops < nb_ops; ++iter_ops) {
		/* store the op id for debug */
		src_bd[iter_ops].iter_ops = iter_ops;
		if (mrvl_request_prepare(&requests[iter_ops],
					src_bd[iter_ops].src_bd,
					&dst_bd[iter_ops],
					ops[iter_ops]) < 0) {
			MRVL_LOG(ERR, "Error while preparing parameters!");
			qp->stats.enqueue_err_count++;
			ops[iter_ops]->status = RTE_CRYPTO_OP_STATUS_ERROR;

			/*
			 * Number of handled ops is increased
			 * (even if the result of handling is error).
			 */
			++consumed;
			break;
		}

		ops[iter_ops]->status =
			RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;

		/* Increase the number of ops to enqueue. */
		++to_enq;
	} /* for (; iter_ops < nb_ops;... */

	if (to_enq > 0) {
		/* Send the burst */
		ret = sam_cio_enq(qp->cio, requests, &to_enq);
		consumed += to_enq;
		if (ret < 0) {
			/*
			 * Trust SAM that in this case returned value will be at
			 * some point correct (now it is returned unmodified).
			 */
			qp->stats.enqueue_err_count += to_enq;
			for (iter_ops = 0; iter_ops < to_enq; ++iter_ops)
				ops[iter_ops]->status =
					RTE_CRYPTO_OP_STATUS_ERROR;
		}
	}

	qp->stats.enqueued_count += to_enq;
	return consumed;
}
/**
 * Enqueue burst.
 *
 * @param queue_pair Pointer to queue pair.
 * @param ops Pointer to ops requests array.
 * @param nb_ops Number of elements in ops requests array.
 * @returns Number of elements consumed from ops.
 */
Enqueue burst.
@param queue_pair Pointer to queue pair.
@param ops Pointer to ops requests array.
@param nb_ops Number of elements in ops requests array.
@returns Number of elements consumed from ops.
Enqueue burst . @param queue_pair Pointer to queue pair . @param ops Pointer to ops requests array . @param nb_ops Number of elements in ops requests array . @returns Number of elements consumed from ops .
static uint16_t
mrvl_crypto_pmd_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops,
		uint16_t nb_ops)
{
	uint16_t iter_ops = 0;
	uint16_t to_enq = 0;
	uint16_t consumed = 0;
	int ret;
	struct sam_cio_op_params requests[nb_ops];
	struct mrvl_crypto_src_table src_bd[nb_ops];
	struct sam_buf_info          dst_bd[nb_ops];
	struct mrvl_crypto_qp *qp = (struct mrvl_crypto_qp *)queue_pair;
	if (nb_ops == 0)
		return 0;
	memset(&requests, 0, sizeof(requests));
	memset(&src_bd, 0, sizeof(src_bd));
	for (; iter_ops < nb_ops; ++iter_ops) {
		src_bd[iter_ops].iter_ops = iter_ops;
		if (mrvl_request_prepare(&requests[iter_ops],
					src_bd[iter_ops].src_bd,
					&dst_bd[iter_ops],
					ops[iter_ops]) < 0) {
			MRVL_LOG(ERR, "Error while preparing parameters!");
			qp->stats.enqueue_err_count++;
			ops[iter_ops]->status = RTE_CRYPTO_OP_STATUS_ERROR;
			++consumed;
			break;
		}
		ops[iter_ops]->status =
			RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
		++to_enq;
	} 
	if (to_enq > 0) {
		ret = sam_cio_enq(qp->cio, requests, &to_enq);
		consumed += to_enq;
		if (ret < 0) {
			qp->stats.enqueue_err_count += to_enq;
			for (iter_ops = 0; iter_ops < to_enq; ++iter_ops)
				ops[iter_ops]->status =
					RTE_CRYPTO_OP_STATUS_ERROR;
		}
	}
	qp->stats.enqueued_count += to_enq;
	return consumed;
}
static uint16_t mrvl_crypto_pmd_enqueue_burst ( void * queue_pair , struct rte_crypto_op * * ops , uint16_t nb_ops ) { uint16_t iter_ops = 0 ; uint16_t to_enq = 0 ; uint16_t consumed = 0 ; int ret ; struct sam_cio_op_params requests [ nb_ops ] ; struct mrvl_crypto_src_table src_bd [ nb_ops ] ; struct sam_buf_info dst_bd [ nb_ops ] ; struct mrvl_crypto_qp * qp = ( struct mrvl_crypto_qp * ) queue_pair ; if ( nb_ops == 0 ) return 0 ; memset ( & requests , 0 , sizeof ( requests ) ) ; memset ( & src_bd , 0 , sizeof ( src_bd ) ) ; for ( ; iter_ops < nb_ops ; ++ iter_ops ) { src_bd [ iter_ops ] . iter_ops = iter_ops ; if ( mrvl_request_prepare ( & requests [ iter_ops ] , src_bd [ iter_ops ] . src_bd , & dst_bd [ iter_ops ] , ops [ iter_ops ] ) < 0 ) { MRVL_LOG ( ERR , " " ) ; qp -> stats . enqueue_err_count ++ ; ops [ iter_ops ] -> status = RTE_CRYPTO_OP_STATUS_ERROR ; ++ consumed ; break ; } ops [ iter_ops ] -> status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED ; ++ to_enq ; } if ( to_enq > 0 ) { ret = sam_cio_enq ( qp -> cio , requests , & to_enq ) ; consumed += to_enq ; if ( ret < 0 ) { qp -> stats . enqueue_err_count += to_enq ; for ( iter_ops = 0 ; iter_ops < to_enq ; ++ iter_ops ) ops [ iter_ops ] -> status = RTE_CRYPTO_OP_STATUS_ERROR ; } } qp -> stats . enqueued_count += to_enq ; return consumed ; }
Enqueue burst.
Enqueue burst .
/*
	 * SAM does not store bd pointers, so on-stack scope will be enough.
	 */ /* Prepare the burst. */ /* Iterate through */ /* store the op id for debug */ /*
			 * Number of handled ops is increased
			 * (even if the result of handling is error).
			 */ /* Increase the number of ops to enqueue. */ /* for (; iter_ops < nb_ops;... */ /* Send the burst */ /*
			 * Trust SAM that in this case returned value will be at
			 * some point correct (now it is returned unmodified).
			 */