hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/include/crypto/engine.h
....@@ -1,13 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Crypto engine API
34 *
45 * Copyright (c) 2016 Baolin Wang <baolin.wang@linaro.org>
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of the GNU General Public License as published by the Free
8
- * Software Foundation; either version 2 of the License, or (at your option)
9
- * any later version.
10
- *
116 */
127 #ifndef _CRYPTO_ENGINE_H
138 #define _CRYPTO_ENGINE_H
....@@ -29,7 +24,9 @@
2924 * @idling: the engine is entering idle state
3025 * @busy: request pump is busy
3126 * @running: the engine is on working
32
- * @cur_req_prepared: current request is prepared
27
+ * @retry_support: indication that the hardware allows re-execution
28
+ * of a failed backlog request
29
+ * crypto-engine, in head position to keep order
3330 * @list: link with the global crypto engine list
3431 * @queue_lock: spinlock to syncronise access to request queue
3532 * @queue: the crypto queue of the engine
....@@ -40,6 +37,8 @@
4037 * @unprepare_crypt_hardware: there are currently no more requests on the
4138 * queue so the subsystem notifies the driver that it may relax the
4239 * hardware by issuing this call
40
+ * @do_batch_requests: execute a batch of requests. Depends on multiple
41
+ * requests support.
4342 * @kworker: kthread worker struct for request pump
4443 * @pump_requests: work struct for scheduling work to the request pump
4544 * @priv_data: the engine private data
....@@ -50,7 +49,8 @@
5049 bool idling;
5150 bool busy;
5251 bool running;
53
- bool cur_req_prepared;
52
+
53
+ bool retry_support;
5454
5555 struct list_head list;
5656 spinlock_t queue_lock;
....@@ -61,6 +61,8 @@
6161
6262 int (*prepare_crypt_hardware)(struct crypto_engine *engine);
6363 int (*unprepare_crypt_hardware)(struct crypto_engine *engine);
64
+ int (*do_batch_requests)(struct crypto_engine *engine);
65
+
6466
6567 struct kthread_worker *kworker;
6668 struct kthread_work pump_requests;
....@@ -88,8 +90,6 @@
8890 struct crypto_engine_op op;
8991 };
9092
91
-int crypto_transfer_ablkcipher_request_to_engine(struct crypto_engine *engine,
92
- struct ablkcipher_request *req);
9393 int crypto_transfer_aead_request_to_engine(struct crypto_engine *engine,
9494 struct aead_request *req);
9595 int crypto_transfer_akcipher_request_to_engine(struct crypto_engine *engine,
....@@ -98,8 +98,6 @@
9898 struct ahash_request *req);
9999 int crypto_transfer_skcipher_request_to_engine(struct crypto_engine *engine,
100100 struct skcipher_request *req);
101
-void crypto_finalize_ablkcipher_request(struct crypto_engine *engine,
102
- struct ablkcipher_request *req, int err);
103101 void crypto_finalize_aead_request(struct crypto_engine *engine,
104102 struct aead_request *req, int err);
105103 void crypto_finalize_akcipher_request(struct crypto_engine *engine,
....@@ -111,6 +109,10 @@
111109 int crypto_engine_start(struct crypto_engine *engine);
112110 int crypto_engine_stop(struct crypto_engine *engine);
113111 struct crypto_engine *crypto_engine_alloc_init(struct device *dev, bool rt);
112
+struct crypto_engine *crypto_engine_alloc_init_and_set(struct device *dev,
113
+ bool retry_support,
114
+ int (*cbk_do_batch)(struct crypto_engine *engine),
115
+ bool rt, int qlen);
114116 int crypto_engine_exit(struct crypto_engine *engine);
115117
116118 #endif /* _CRYPTO_ENGINE_H */