summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIuliana Prodan <iuliana.prodan@nxp.com>2020-04-28 18:49:03 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2020-05-08 08:30:40 +0300
commitec6e2bf33b54cc3351bd702452e5d016b8f9d2f4 (patch)
tree66e745497119d160bcbcbaadf806f8515e72f223
parent3e37f04f2bf3dd86432785e15182793a8a8ef00e (diff)
downloadlinux-ec6e2bf33b54cc3351bd702452e5d016b8f9d2f4.tar.xz
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: Iuliana Prodan <iuliana.prodan@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/algapi.c8
-rw-r--r--include/crypto/algapi.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index f1e6ccaff853..92abdf675992 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -914,6 +914,14 @@ out:
}
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 list_head *request;
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index e115f9215ed5..00a9cf98debe 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -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);
int crypto_enqueue_request(struct crypto_queue *queue,
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);
static inline unsigned int crypto_queue_len(struct crypto_queue *queue)
{