On Thu, Jan 16, 2020 at 11:34:19AM +0000, Iuliana Prodan wrote: > On 1/14/2020 4:00 PM, Corentin Labbe wrote: > > We will store the number of request in a batch in engine->ct. > > This patch adds all loop to unprepare all requests of a batch. > > > > Signed-off-by: Corentin Labbe <clabbe.montjoie@xxxxxxxxx> > > --- > > crypto/crypto_engine.c | 30 ++++++++++++++++++------------ > > include/crypto/engine.h | 2 ++ > > 2 files changed, 20 insertions(+), 12 deletions(-) > > > > diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c > > index b72873550587..591dea5ddeec 100644 > > --- a/crypto/crypto_engine.c > > +++ b/crypto/crypto_engine.c > > @@ -28,6 +28,7 @@ static void crypto_finalize_request(struct crypto_engine *engine, > > bool finalize_cur_req = false; > > int ret; > > struct crypto_engine_ctx *enginectx; > > + int i = 0; > > > > spin_lock_irqsave(&engine->queue_lock, flags); > > if (engine->cur_reqs[0].req == req) > You're checking here just the first request, but do the completion for > all? Why? Shouldn't we check for each request if it was done by hw or not? The first request is a sort of key for the whole batch. > > I've also seen that the do_one_request is called only on the first > request, from the batch. Since the request are linked, this is not a problem. But I miss this explanaition in the code. > > In your driver you do the prepare/unprepare for the whole batch at once, > but not all drivers, who uses crypto-engine, are doing this (see virtio, > amlogic, stm32). And I don't know if they can... prepare is optionnal, and unprepare is optional even if prepare is done. Furthermore, doing prepare/unprepare is optional per request. I have tested this serie on sun8i-ss and amlogic which dont use prepare/unprepare.