Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: bf8f91e71192 ("crypto: marvell - Add load balancing between engines")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+6 -3
+3 -1
drivers/crypto/marvell/cesa/cipher.c
··· 75 75 static inline void mv_cesa_skcipher_cleanup(struct skcipher_request *req) 76 76 { 77 77 struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req); 78 + struct mv_cesa_engine *engine = creq->base.engine; 78 79 79 80 if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) 80 81 mv_cesa_skcipher_dma_cleanup(req); 82 + 83 + atomic_sub(req->cryptlen, &engine->load); 81 84 } 82 85 83 86 static void mv_cesa_skcipher_std_step(struct skcipher_request *req) ··· 215 212 struct mv_cesa_engine *engine = creq->base.engine; 216 213 unsigned int ivsize; 217 214 218 - atomic_sub(skreq->cryptlen, &engine->load); 219 215 ivsize = crypto_skcipher_ivsize(crypto_skcipher_reqtfm(skreq)); 220 216 221 217 if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) {
+3 -2
drivers/crypto/marvell/cesa/hash.c
··· 110 110 static inline void mv_cesa_ahash_cleanup(struct ahash_request *req) 111 111 { 112 112 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req); 113 + struct mv_cesa_engine *engine = creq->base.engine; 113 114 114 115 if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) 115 116 mv_cesa_ahash_dma_cleanup(req); 117 + 118 + atomic_sub(req->nbytes, &engine->load); 116 119 } 117 120 118 121 static void mv_cesa_ahash_last_cleanup(struct ahash_request *req) ··· 395 392 } 396 393 } 397 394 } 398 - 399 - atomic_sub(ahashreq->nbytes, &engine->load); 400 395 } 401 396 402 397 static void mv_cesa_ahash_prepare(struct crypto_async_request *req,