Browse Source

qcedev: reduce wait timeout for crypto operations

Current wait times for crypto is too high which might cause
concurerency issues for other EEs. Reduce this to what is
required.

Also, reset the offload error for every new IOCTL call.

Change-Id: I43dd2e59e3f30706c87cdc4f633d8132dc8410c9
Signed-off-by: Gaurav Kashyap <[email protected]>
Gaurav Kashyap 2 years ago
parent
commit
63658ee1fd
1 changed files with 7 additions and 3 deletions
  1. 7 3
      crypto-qti/qcedev.c

+ 7 - 3
crypto-qti/qcedev.c

@@ -37,8 +37,12 @@
 #define CACHE_LINE_SIZE 64
 #define CE_SHA_BLOCK_SIZE SHA256_BLOCK_SIZE
 #define MAX_CEHW_REQ_TRANSFER_SIZE (128*32*1024)
-/* Max wait time once a crypt o request is done */
-#define MAX_CRYPTO_WAIT_TIME 1500
+/*
+ * Max wait time once a crypto request is done.
+ * Assuming 5ms per crypto operation, this is calculated for
+ * the scenario of having 3 offload reqs + 1 tz req + buffer.
+ */
+#define MAX_CRYPTO_WAIT_TIME 25
 
 static uint8_t  _std_init_vector_sha1_uint8[] =   {
 	0x67, 0x45, 0x23, 0x01, 0xEF, 0xCD, 0xAB, 0x89,
@@ -2156,7 +2160,7 @@ long qcedev_ioctl(struct file *file,
 			err = -EINVAL;
 			goto exit_free_qcedev_areq;
 		}
-
+		qcedev_areq->offload_cipher_op_req.err = QCEDEV_OFFLOAD_NO_ERROR;
 		err = qcedev_smmu_ablk_offload_cipher(qcedev_areq, handle);
 		if (err)
 			goto exit_free_qcedev_areq;