Commit ec6e2bf3 authored by Iuliana Prodan's avatar Iuliana Prodan Committed by Herbert Xu

crypto: algapi - create function to add request in front of queue

Add crypto_enqueue_request_head function that enqueues a
request in front of queue.
This will be used in crypto-engine, on error path. In case a request
was not executed by hardware, enqueue it back in front of queue (to
keep the order of requests).
Signed-off-by: default avatarIuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 3e37f04f
...@@ -914,6 +914,14 @@ int crypto_enqueue_request(struct crypto_queue *queue, ...@@ -914,6 +914,14 @@ int crypto_enqueue_request(struct crypto_queue *queue,
} }
EXPORT_SYMBOL_GPL(crypto_enqueue_request); EXPORT_SYMBOL_GPL(crypto_enqueue_request);
void crypto_enqueue_request_head(struct crypto_queue *queue,
struct crypto_async_request *request)
{
queue->qlen++;
list_add(&request->list, &queue->list);
}
EXPORT_SYMBOL_GPL(crypto_enqueue_request_head);
struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue) struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue)
{ {
struct list_head *request; struct list_head *request;
......
...@@ -125,6 +125,8 @@ int crypto_inst_setname(struct crypto_instance *inst, const char *name, ...@@ -125,6 +125,8 @@ int crypto_inst_setname(struct crypto_instance *inst, const char *name,
void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen); void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen);
int crypto_enqueue_request(struct crypto_queue *queue, int crypto_enqueue_request(struct crypto_queue *queue,
struct crypto_async_request *request); struct crypto_async_request *request);
void crypto_enqueue_request_head(struct crypto_queue *queue,
struct crypto_async_request *request);
struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue); struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue);
static inline unsigned int crypto_queue_len(struct crypto_queue *queue) static inline unsigned int crypto_queue_len(struct crypto_queue *queue)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment