linux/drivers/crypto/amcc
Christian Lamparter 8ef8d19543 crypto: crypto4xx - add backlog queue support
Previously, If the crypto4xx driver used all available
security contexts, it would simply refuse new requests
with -EAGAIN. CRYPTO_TFM_REQ_MAY_BACKLOG was ignored.

in case of dm-crypt.c's crypt_convert() function this was
causing the following errors to manifest, if the system was
pushed hard enough:

| EXT4-fs warning (dm-1): ext4_end_bio:314: I/O error -5 writing to ino ..
| EXT4-fs warning (dm-1): ext4_end_bio:314: I/O error -5 writing to ino ..
| EXT4-fs warning (dm-1): ext4_end_bio:314: I/O error -5 writing to ino ..
| JBD2: Detected IO errors while flushing file data on dm-1-8
| Aborting journal on device dm-1-8.
| EXT4-fs error : ext4_journal_check_start:56: Detected aborted journal
| EXT4-fs (dm-1): Remounting filesystem read-only
| EXT4-fs : ext4_writepages: jbd2_start: 2048 pages, inode 498...; err -30

(This did cause corruptions due to failed writes)

To fix this mess, the crypto4xx driver needs to notifiy the
user to slow down. This can be achieved by returning -EBUSY
on requests, once the crypto hardware was falling behind.

Note: -EBUSY has two different meanings. Setting the flag
CRYPTO_TFM_REQ_MAY_BACKLOG implies that the request was
successfully queued, by the crypto driver. To achieve this
requirement, the implementation introduces a threshold check and
adds logic to the completion routines in much the same way as
AMD's Cryptographic Coprocessor (CCP) driver do.

Note2: Tests showed that dm-crypt starved ipsec traffic.
Under load, ipsec links dropped to 0 Kbits/s. This is because
dm-crypt's callback would instantly queue the next request.
In order to not starve ipsec, the driver reserves a small
portion of the available crypto contexts for this purpose.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2017-10-12 22:55:12 +08:00
..
crypto4xx_alg.c crypto: crypto4xx - wire up hmac_mc to hmac_muting 2017-10-12 22:55:07 +08:00
crypto4xx_core.c crypto: crypto4xx - add backlog queue support 2017-10-12 22:55:12 +08:00
crypto4xx_core.h crypto: crypto4xx - add backlog queue support 2017-10-12 22:55:12 +08:00
crypto4xx_reg_def.h crypto: crypto4xx - rename ce_ring_contol to ce_ring_control 2017-04-24 18:11:06 +08:00
crypto4xx_sa.h crypto: crypto4xx - fix type mismatch compiler error 2017-10-12 22:55:10 +08:00
crypto4xx_trng.c crypto4xx: integrate ppc4xx-rng into crypto4xx 2016-04-20 17:50:02 +08:00
crypto4xx_trng.h crypto4xx: integrate ppc4xx-rng into crypto4xx 2016-04-20 17:50:02 +08:00
Makefile crypto: crypto4xx - move and refactor dynamic_contents helpers 2017-09-22 17:43:18 +08:00