Skip to content

Commit

Permalink
crypto: engine - do not requeue in case of fatal error
Browse files Browse the repository at this point in the history
Now, in crypto-engine, if hardware queue is full (-ENOSPC),
requeue request regardless of MAY_BACKLOG flag.
If hardware throws any other error code (like -EIO, -EINVAL,
-ENOMEM, etc.) only MAY_BACKLOG requests are enqueued back into
crypto-engine's queue, since the others can be dropped.
The latter case can be fatal error, so those cannot be recovered from.
For example, in CAAM driver, -EIO is returned in case the job descriptor
is broken, so there is no possibility to fix the job descriptor.
Therefore, these errors might be fatal error, so we shouldn’t
requeue the request. This will just be pass back and forth between
crypto-engine and hardware.

Fixes: 6a89f49 ("crypto: engine - support for parallel requests based on retry mechanism")
Signed-off-by: Iuliana Prodan <[email protected]>
Reported-by: Horia Geantă <[email protected]>
Reviewed-by: Horia Geantă <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
iuliana-prodan authored and herbertx committed May 28, 2020
1 parent ae4052c commit d1c72f6
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions crypto/crypto_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,10 @@ static void crypto_pump_requests(struct crypto_engine *engine,
/*
* If hardware queue is full (-ENOSPC), requeue request
* regardless of backlog flag.
* If hardware throws any other error code,
* requeue only backlog requests.
* Otherwise, unprepare and complete the request.
*/
if (!engine->retry_support ||
((ret != -ENOSPC) &&
!(async_req->flags & CRYPTO_TFM_REQ_MAY_BACKLOG))) {
(ret != -ENOSPC)) {
dev_err(engine->dev,
"Failed to do one request from queue: %d\n",
ret);
Expand Down

0 comments on commit d1c72f6

Please sign in to comment.