crypto: qat - refactor submission logic
authorGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Mon, 9 May 2022 13:34:09 +0000 (14:34 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 20 May 2022 05:49:17 +0000 (13:49 +0800)
commitaf88d3c109aa5edfaa11c9a26d9c0ff21ddf501c
tree0bc74b5d79eca33930f0b3a973fdd1a6116eb9d9
parente0831e7af4e03f2715de102e18e9179ec0a81562
crypto: qat - refactor submission logic

All the algorithms in qat_algs.c and qat_asym_algs.c use the same
pattern to submit messages to the HW queues. Move the submission loop
to a new function, qat_alg_send_message(), and share it between the
symmetric and the asymmetric algorithms.

As part of this rework, since the number of retries before returning an
error is inconsistent between the symmetric and asymmetric
implementations, set it to a value that works for both (i.e. 20, was 10
in qat_algs.c and 100 in qat_asym_algs.c)

In addition fix the return code reported when the HW queues are full.
In that case return -ENOSPC instead of -EBUSY.

Including stable in CC since (1) the error code returned if the HW queues
are full is incorrect and (2) to facilitate the backport of the next fix
"crypto: qat - add backlog mechanism".

Cc: stable@vger.kernel.org
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qat/qat_common/Makefile
drivers/crypto/qat/qat_common/qat_algs.c
drivers/crypto/qat/qat_common/qat_algs_send.c [new file with mode: 0644]
drivers/crypto/qat/qat_common/qat_algs_send.h [new file with mode: 0644]
drivers/crypto/qat/qat_common/qat_asym_algs.c
drivers/crypto/qat/qat_common/qat_crypto.h