.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Crypto engine API |
---|
3 | 4 | * |
---|
4 | 5 | * 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 | | - * |
---|
11 | 6 | */ |
---|
12 | 7 | #ifndef _CRYPTO_ENGINE_H |
---|
13 | 8 | #define _CRYPTO_ENGINE_H |
---|
.. | .. |
---|
29 | 24 | * @idling: the engine is entering idle state |
---|
30 | 25 | * @busy: request pump is busy |
---|
31 | 26 | * @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 |
---|
33 | 30 | * @list: link with the global crypto engine list |
---|
34 | 31 | * @queue_lock: spinlock to syncronise access to request queue |
---|
35 | 32 | * @queue: the crypto queue of the engine |
---|
.. | .. |
---|
40 | 37 | * @unprepare_crypt_hardware: there are currently no more requests on the |
---|
41 | 38 | * queue so the subsystem notifies the driver that it may relax the |
---|
42 | 39 | * hardware by issuing this call |
---|
| 40 | + * @do_batch_requests: execute a batch of requests. Depends on multiple |
---|
| 41 | + * requests support. |
---|
43 | 42 | * @kworker: kthread worker struct for request pump |
---|
44 | 43 | * @pump_requests: work struct for scheduling work to the request pump |
---|
45 | 44 | * @priv_data: the engine private data |
---|
.. | .. |
---|
50 | 49 | bool idling; |
---|
51 | 50 | bool busy; |
---|
52 | 51 | bool running; |
---|
53 | | - bool cur_req_prepared; |
---|
| 52 | + |
---|
| 53 | + bool retry_support; |
---|
54 | 54 | |
---|
55 | 55 | struct list_head list; |
---|
56 | 56 | spinlock_t queue_lock; |
---|
.. | .. |
---|
61 | 61 | |
---|
62 | 62 | int (*prepare_crypt_hardware)(struct crypto_engine *engine); |
---|
63 | 63 | int (*unprepare_crypt_hardware)(struct crypto_engine *engine); |
---|
| 64 | + int (*do_batch_requests)(struct crypto_engine *engine); |
---|
| 65 | + |
---|
64 | 66 | |
---|
65 | 67 | struct kthread_worker *kworker; |
---|
66 | 68 | struct kthread_work pump_requests; |
---|
.. | .. |
---|
88 | 90 | struct crypto_engine_op op; |
---|
89 | 91 | }; |
---|
90 | 92 | |
---|
91 | | -int crypto_transfer_ablkcipher_request_to_engine(struct crypto_engine *engine, |
---|
92 | | - struct ablkcipher_request *req); |
---|
93 | 93 | int crypto_transfer_aead_request_to_engine(struct crypto_engine *engine, |
---|
94 | 94 | struct aead_request *req); |
---|
95 | 95 | int crypto_transfer_akcipher_request_to_engine(struct crypto_engine *engine, |
---|
.. | .. |
---|
98 | 98 | struct ahash_request *req); |
---|
99 | 99 | int crypto_transfer_skcipher_request_to_engine(struct crypto_engine *engine, |
---|
100 | 100 | struct skcipher_request *req); |
---|
101 | | -void crypto_finalize_ablkcipher_request(struct crypto_engine *engine, |
---|
102 | | - struct ablkcipher_request *req, int err); |
---|
103 | 101 | void crypto_finalize_aead_request(struct crypto_engine *engine, |
---|
104 | 102 | struct aead_request *req, int err); |
---|
105 | 103 | void crypto_finalize_akcipher_request(struct crypto_engine *engine, |
---|
.. | .. |
---|
111 | 109 | int crypto_engine_start(struct crypto_engine *engine); |
---|
112 | 110 | int crypto_engine_stop(struct crypto_engine *engine); |
---|
113 | 111 | 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); |
---|
114 | 116 | int crypto_engine_exit(struct crypto_engine *engine); |
---|
115 | 117 | |
---|
116 | 118 | #endif /* _CRYPTO_ENGINE_H */ |
---|