Skip to contentSkip to conversation

crypto: qat - disable registration of algorithms

PATCH In review Giovanni Cabiddu 2 participants 2 messages Mar 4, 2022 – Mar 9, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: qat - disable registration of algorithms

The implementations of aead and skcipher in the QAT driver do not support properly requests with the CRYPTO_TFM_REQ_MAY_BACKLOG flag set. If the HW queue is full, the driver returns -EBUSY but does not enqueue the request.
This can result in applications like dm-crypt waiting indefinitely for a completion of a request that was never submitted to the hardware.

To avoid this problem, disable the registration of all crypto algorithms in the QAT driver by setting the number of crypto instances to 0 at configuration time.

---
 drivers/crypto/qat/qat_4xxx/adf_drv.c      | 7 +++++++
 drivers/crypto/qat/qat_common/qat_crypto.c | 7 +++++++
 2 files changed, 14 insertions(+)
drivers/crypto/qat/qat_4xxx/adf_drv.c +7 -0
index a6c78b9c730b..fa4c350c1bf9 100644
@@ -75,6 +75,13 @@ static int adf_crypto_dev_config(struct adf_accel_dev *accel_dev)
 	if (ret)
 		goto err;
 
+	/* Temporarily set the number of crypto instances to zero to avoid
+	 * registering the crypto algorithms.
+	 * This will be removed when the algorithms will support the
+	 * CRYPTO_TFM_REQ_MAY_BACKLOG flag
+	 */
+	instances = 0;
+
 	for (i = 0; i < instances; i++) {
 		val = i;
 		bank = i * 2;
drivers/crypto/qat/qat_common/qat_crypto.c +7 -0
index 7234c4940fae..67c9588e89df 100644
@@ -161,6 +161,13 @@ int qat_crypto_dev_config(struct adf_accel_dev *accel_dev)
 	if (ret)
 		goto err;
 
+	/* Temporarily set the number of crypto instances to zero to avoid
+	 * registering the crypto algorithms.
+	 * This will be removed when the algorithms will support the
+	 * CRYPTO_TFM_REQ_MAY_BACKLOG flag
+	 */
+	instances = 0;
+
 	for (i = 0; i < instances; i++) {
 		val = i;
 		snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_ASYM_BANK_NUM, i);
Signature · 1 line
2.35.1
maintainer
#1 lore raw
Quoted 11 lines · Giovanni Cabiddu

The implementations of aead and skcipher in the QAT driver do not support properly requests with the CRYPTO_TFM_REQ_MAY_BACKLOG flag set. If the HW queue is full, the driver returns -EBUSY but does not enqueue the request.
This can result in applications like dm-crypt waiting indefinitely for a completion of a request that was never submitted to the hardware.

To avoid this problem, disable the registration of all crypto algorithms in the QAT driver by setting the number of crypto instances to 0 at configuration time.

Quoted 6 lines
---
 drivers/crypto/qat/qat_4xxx/adf_drv.c      | 7 +++++++
 drivers/crypto/qat/qat_common/qat_crypto.c | 7 +++++++
 2 files changed, 14 insertions(+)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt