Messages in this thread Patch in this message | | | From | Iuliana Prodan <> | Subject | [PATCH v5 1/3] crypto: algapi - create function to add request in front of queue | Date | Wed, 15 Apr 2020 23:26:13 +0300 |
| |
Add crypto_enqueue_request_head function that enqueues a MAY_BACKLOG 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> --- crypto/algapi.c | 11 +++++++++++ include/crypto/algapi.h | 2 ++ 2 files changed, 13 insertions(+)
diff --git a/crypto/algapi.c b/crypto/algapi.c index 69605e21af92..a8732e8e7843 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -904,6 +904,17 @@ int crypto_enqueue_request(struct crypto_queue *queue, } EXPORT_SYMBOL_GPL(crypto_enqueue_request); +void crypto_enqueue_request_head(struct crypto_queue *queue, + struct crypto_async_request *request) +{ + /* only backlog requests can be enqueued */ + BUG_ON(!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG)); + + 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) { -- 2.17.1
| |