cryptodev: add dequeue count parameter in raw API

This patch changes the experimental raw data path dequeue burst API.
Originally the API enforces the user to provide callback function
to get maximum dequeue count. This change gives the user one more
option to pass directly the expected dequeue count.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
This commit is contained in:
Fan Zhang 2021-03-31 18:20:38 +01:00 committed by Akhil Goyal
parent 398b70cbbb
commit c21574edc5
5 changed files with 34 additions and 12 deletions

View File

@ -162,12 +162,6 @@ ceil_byte_length(uint32_t num_bits)
return (num_bits >> 3); return (num_bits >> 3);
} }
static uint32_t
get_raw_dp_dequeue_count(void *user_data __rte_unused)
{
return 1;
}
static void static void
post_process_raw_dp_op(void *user_data, uint32_t index __rte_unused, post_process_raw_dp_op(void *user_data, uint32_t index __rte_unused,
uint8_t is_op_success) uint8_t is_op_success)
@ -345,7 +339,7 @@ process_sym_raw_dp_op(uint8_t dev_id, uint16_t qp_id,
n = n_success = 0; n = n_success = 0;
while (count++ < MAX_RAW_DEQUEUE_COUNT && n == 0) { while (count++ < MAX_RAW_DEQUEUE_COUNT && n == 0) {
n = rte_cryptodev_raw_dequeue_burst(ctx, n = rte_cryptodev_raw_dequeue_burst(ctx,
get_raw_dp_dequeue_count, post_process_raw_dp_op, NULL, 1, post_process_raw_dp_op,
(void **)&ret_op, 0, &n_success, (void **)&ret_op, 0, &n_success,
&dequeue_status); &dequeue_status);
if (dequeue_status < 0) { if (dequeue_status < 0) {

View File

@ -236,6 +236,10 @@ API Changes
* pci: The value ``PCI_ANY_ID`` is marked as deprecated * pci: The value ``PCI_ANY_ID`` is marked as deprecated
and can be replaced with ``RTE_PCI_ANY_ID``. and can be replaced with ``RTE_PCI_ANY_ID``.
* cryptodev: The experimental raw data path API for dequeue
``rte_cryptodev_raw_dequeue_burst`` got a new parameter
``max_nb_to_dequeue`` to provide flexible control on dequeue.
ABI Changes ABI Changes
----------- -----------

View File

@ -707,6 +707,7 @@ qat_sym_dp_enqueue_chain_jobs(void *qp_data, uint8_t *drv_ctx,
static __rte_always_inline uint32_t static __rte_always_inline uint32_t
qat_sym_dp_dequeue_burst(void *qp_data, uint8_t *drv_ctx, qat_sym_dp_dequeue_burst(void *qp_data, uint8_t *drv_ctx,
rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count, rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count,
uint32_t max_nb_to_dequeue,
rte_cryptodev_raw_post_dequeue_t post_dequeue, rte_cryptodev_raw_post_dequeue_t post_dequeue,
void **out_user_data, uint8_t is_user_data_array, void **out_user_data, uint8_t is_user_data_array,
uint32_t *n_success_jobs, int *return_status) uint32_t *n_success_jobs, int *return_status)
@ -736,9 +737,23 @@ qat_sym_dp_dequeue_burst(void *qp_data, uint8_t *drv_ctx,
resp_opaque = (void *)(uintptr_t)resp->opaque_data; resp_opaque = (void *)(uintptr_t)resp->opaque_data;
/* get the dequeue count */ /* get the dequeue count */
n = get_dequeue_count(resp_opaque); if (get_dequeue_count) {
if (unlikely(n == 0)) n = get_dequeue_count(resp_opaque);
return 0; if (unlikely(n == 0))
return 0;
else if (n > 1) {
head = (head + rx_queue->msg_size * (n - 1)) &
rx_queue->modulo_mask;
resp = (struct icp_qat_fw_comn_resp *)(
(uint8_t *)rx_queue->base_addr + head);
if (*(uint32_t *)resp == ADF_RING_EMPTY_SIG)
return 0;
}
} else {
if (unlikely(max_nb_to_dequeue == 0))
return 0;
n = max_nb_to_dequeue;
}
out_user_data[0] = resp_opaque; out_user_data[0] = resp_opaque;
status = QAT_SYM_DP_IS_RESP_SUCCESS(resp); status = QAT_SYM_DP_IS_RESP_SUCCESS(resp);

View File

@ -2234,13 +2234,14 @@ rte_cryptodev_raw_enqueue_done(struct rte_crypto_raw_dp_ctx *ctx,
uint32_t uint32_t
rte_cryptodev_raw_dequeue_burst(struct rte_crypto_raw_dp_ctx *ctx, rte_cryptodev_raw_dequeue_burst(struct rte_crypto_raw_dp_ctx *ctx,
rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count, rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count,
uint32_t max_nb_to_dequeue,
rte_cryptodev_raw_post_dequeue_t post_dequeue, rte_cryptodev_raw_post_dequeue_t post_dequeue,
void **out_user_data, uint8_t is_user_data_array, void **out_user_data, uint8_t is_user_data_array,
uint32_t *n_success_jobs, int *status) uint32_t *n_success_jobs, int *status)
{ {
return (*ctx->dequeue_burst)(ctx->qp_data, ctx->drv_ctx_data, return (*ctx->dequeue_burst)(ctx->qp_data, ctx->drv_ctx_data,
get_dequeue_count, post_dequeue, out_user_data, get_dequeue_count, max_nb_to_dequeue, post_dequeue,
is_user_data_array, n_success_jobs, status); out_user_data, is_user_data_array, n_success_jobs, status);
} }
int int

View File

@ -1562,6 +1562,9 @@ typedef void (*rte_cryptodev_raw_post_dequeue_t)(void *user_data,
* @param drv_ctx Driver specific context data. * @param drv_ctx Driver specific context data.
* @param get_dequeue_count User provided callback function to * @param get_dequeue_count User provided callback function to
* obtain dequeue operation count. * obtain dequeue operation count.
* @param max_nb_to_dequeue When get_dequeue_count is NULL this
* value is used to pass the maximum
* number of operations to be dequeued.
* @param post_dequeue User provided callback function to * @param post_dequeue User provided callback function to
* post-process a dequeued operation. * post-process a dequeued operation.
* @param out_user_data User data pointer array to be retrieve * @param out_user_data User data pointer array to be retrieve
@ -1596,6 +1599,7 @@ typedef void (*rte_cryptodev_raw_post_dequeue_t)(void *user_data,
typedef uint32_t (*cryptodev_sym_raw_dequeue_burst_t)(void *qp, typedef uint32_t (*cryptodev_sym_raw_dequeue_burst_t)(void *qp,
uint8_t *drv_ctx, uint8_t *drv_ctx,
rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count, rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count,
uint32_t max_nb_to_dequeue,
rte_cryptodev_raw_post_dequeue_t post_dequeue, rte_cryptodev_raw_post_dequeue_t post_dequeue,
void **out_user_data, uint8_t is_user_data_array, void **out_user_data, uint8_t is_user_data_array,
uint32_t *n_success, int *dequeue_status); uint32_t *n_success, int *dequeue_status);
@ -1763,6 +1767,9 @@ rte_cryptodev_raw_enqueue_done(struct rte_crypto_raw_dp_ctx *ctx,
* data. * data.
* @param get_dequeue_count User provided callback function to * @param get_dequeue_count User provided callback function to
* obtain dequeue operation count. * obtain dequeue operation count.
* @param max_nb_to_dequeue When get_dequeue_count is NULL this
* value is used to pass the maximum
* number of operations to be dequeued.
* @param post_dequeue User provided callback function to * @param post_dequeue User provided callback function to
* post-process a dequeued operation. * post-process a dequeued operation.
* @param out_user_data User data pointer array to be retrieve * @param out_user_data User data pointer array to be retrieve
@ -1798,6 +1805,7 @@ __rte_experimental
uint32_t uint32_t
rte_cryptodev_raw_dequeue_burst(struct rte_crypto_raw_dp_ctx *ctx, rte_cryptodev_raw_dequeue_burst(struct rte_crypto_raw_dp_ctx *ctx,
rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count, rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count,
uint32_t max_nb_to_dequeue,
rte_cryptodev_raw_post_dequeue_t post_dequeue, rte_cryptodev_raw_post_dequeue_t post_dequeue,
void **out_user_data, uint8_t is_user_data_array, void **out_user_data, uint8_t is_user_data_array,
uint32_t *n_success, int *dequeue_status); uint32_t *n_success, int *dequeue_status);