In current implementation, we have a kernel worker job handling crypto ops after calling CIOCASYNCCRYPT and submit some crypto jobs, but the worker will do it synchronously one by one. By this way, we can not make full use of those hardware accelerators who have the ability to process multiple encryption ops in parallel, unless we create multiple handles, which means we have to open /dev/crypto multiple times in one userspace program to do this, which is not a good way as I can see.
I think one better way to do this is: CIOCASYNCCRYPT only handle the mission of submit request to driver, then -EINPROGRESS be returned from that submit, after request completed by driver, the all finish job, including free of request struct, should be done in the callback function.
In current implementation, we have a kernel worker job handling crypto ops after calling CIOCASYNCCRYPT and submit some crypto jobs, but the worker will do it synchronously one by one. By this way, we can not make full use of those hardware accelerators who have the ability to process multiple encryption ops in parallel, unless we create multiple handles, which means we have to open /dev/crypto multiple times in one userspace program to do this, which is not a good way as I can see.
I think one better way to do this is: CIOCASYNCCRYPT only handle the mission of submit request to driver, then -EINPROGRESS be returned from that submit, after request completed by driver, the all finish job, including free of request struct, should be done in the callback function.