crypto: qat - add resubmit logic for decompression
authorGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Mon, 28 Nov 2022 12:21:23 +0000 (12:21 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 9 Dec 2022 10:45:00 +0000 (18:45 +0800)
commit3112d0f1b0b32daac97d170dbc9d3cce69f7ff49
tree17438d7e22acdd3d489de5ffd346d9c5c28f4a04
parent5fc8041e56782e4d44682f8c2e4d822817a4dae6
crypto: qat - add resubmit logic for decompression

The acomp API allows to send requests with a NULL destination buffer. In
this case, the algorithm implementation needs to allocate the
destination scatter list, perform the operation and return the buffer to
the user. For decompression, data is likely to expand and be bigger than
the allocated buffer.

This implements a re-submission mechanism for decompression requests
that is triggered if the destination buffer, allocated by the driver,
is not sufficiently big to store the output from decompression.

If an overflow is detected when processing the callback for a
decompression request with a NULL destination buffer, a workqueue is
scheduled. This allocates a new scatter list of size CRYPTO_ACOMP_DST_MAX,
now 128KB, creates a new firmware scatter list and resubmits the job to
the hardware accelerator.

Suggested-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qat/qat_common/qat_bl.c
drivers/crypto/qat/qat_common/qat_bl.h
drivers/crypto/qat/qat_common/qat_comp_algs.c
drivers/crypto/qat/qat_common/qat_comp_req.h