Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Crypto engine API
4 *
5 * Copyright (c) 2016 Baolin Wang <baolin.wang@linaro.org>
6 * Copyright (c) 2023 Herbert Xu <herbert@gondor.apana.org.au>
7 */
8#ifndef _CRYPTO_INTERNAL_ENGINE_H
9#define _CRYPTO_INTERNAL_ENGINE_H
10
11#include <crypto/algapi.h>
12#include <crypto/engine.h>
13#include <linux/kthread.h>
14#include <linux/spinlock_types.h>
15#include <linux/types.h>
16
17#define ENGINE_NAME_LEN 30
18
19struct device;
20
21/*
22 * struct crypto_engine - crypto hardware engine
23 * @name: the engine name
24 * @busy: request pump is busy
25 * @running: the engine is on working
26 * @retry_support: indication that the hardware allows re-execution
27 * of a failed backlog request
28 * crypto-engine, in head position to keep order
29 * @rt: whether this queue is set to run as a realtime task
30 * @list: link with the global crypto engine list
31 * @queue_lock: spinlock to synchronise access to request queue
32 * @queue: the crypto queue of the engine
33 * @kworker: kthread worker struct for request pump
34 * @pump_requests: work struct for scheduling work to the request pump
35 * @priv_data: the engine private data
36 * @cur_req: the current request which is on processing
37 */
38struct crypto_engine {
39 char name[ENGINE_NAME_LEN];
40 bool busy;
41 bool running;
42
43 bool retry_support;
44 bool rt;
45
46 struct list_head list;
47 spinlock_t queue_lock;
48 struct crypto_queue queue;
49 struct device *dev;
50
51 struct kthread_worker *kworker;
52 struct kthread_work pump_requests;
53
54 void *priv_data;
55 struct crypto_async_request *cur_req;
56};
57
58#endif