Skip to content

Commit 442134a

Browse files
committed
crypto: marvell/cesa - Fix engine load inaccuracy
If an error occurs during queueing the engine load will never be decremented. Fix this by moving the engine load adjustment into the cleanup function. Fixes: bf8f91e ("crypto: marvell - Add load balancing between engines") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent a091a58 commit 442134a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

drivers/crypto/marvell/cesa/cipher.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,12 @@ mv_cesa_skcipher_dma_cleanup(struct skcipher_request *req)
7575
static inline void mv_cesa_skcipher_cleanup(struct skcipher_request *req)
7676
{
7777
struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req);
78+
struct mv_cesa_engine *engine = creq->base.engine;
7879

7980
if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ)
8081
mv_cesa_skcipher_dma_cleanup(req);
82+
83+
atomic_sub(req->cryptlen, &engine->load);
8184
}
8285

8386
static void mv_cesa_skcipher_std_step(struct skcipher_request *req)
@@ -212,7 +215,6 @@ mv_cesa_skcipher_complete(struct crypto_async_request *req)
212215
struct mv_cesa_engine *engine = creq->base.engine;
213216
unsigned int ivsize;
214217

215-
atomic_sub(skreq->cryptlen, &engine->load);
216218
ivsize = crypto_skcipher_ivsize(crypto_skcipher_reqtfm(skreq));
217219

218220
if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) {

drivers/crypto/marvell/cesa/hash.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,12 @@ static inline void mv_cesa_ahash_dma_cleanup(struct ahash_request *req)
110110
static inline void mv_cesa_ahash_cleanup(struct ahash_request *req)
111111
{
112112
struct mv_cesa_ahash_req *creq = ahash_request_ctx(req);
113+
struct mv_cesa_engine *engine = creq->base.engine;
113114

114115
if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ)
115116
mv_cesa_ahash_dma_cleanup(req);
117+
118+
atomic_sub(req->nbytes, &engine->load);
116119
}
117120

118121
static void mv_cesa_ahash_last_cleanup(struct ahash_request *req)
@@ -392,8 +395,6 @@ static void mv_cesa_ahash_complete(struct crypto_async_request *req)
392395
}
393396
}
394397
}
395-
396-
atomic_sub(ahashreq->nbytes, &engine->load);
397398
}
398399

399400
static void mv_cesa_ahash_prepare(struct crypto_async_request *req,

0 commit comments

Comments
 (0)