1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only) */
2 /* Copyright(c) 2014 - 2020 Intel Corporation */
3 #ifndef _QAT_CRYPTO_INSTANCE_H_
4 #define _QAT_CRYPTO_INSTANCE_H_
5 
6 #include <linux/list.h>
7 #include <linux/slab.h>
8 #include "adf_accel_devices.h"
9 #include "icp_qat_fw_la.h"
10 
11 struct qat_crypto_instance {
12 	struct adf_etr_ring_data *sym_tx;
13 	struct adf_etr_ring_data *sym_rx;
14 	struct adf_etr_ring_data *pke_tx;
15 	struct adf_etr_ring_data *pke_rx;
16 	struct adf_accel_dev *accel_dev;
17 	struct list_head list;
18 	unsigned long state;
19 	int id;
20 	atomic_t refctr;
21 };
22 
23 struct qat_crypto_request_buffs {
24 	struct qat_alg_buf_list *bl;
25 	dma_addr_t blp;
26 	struct qat_alg_buf_list *blout;
27 	dma_addr_t bloutp;
28 	size_t sz;
29 	size_t sz_out;
30 };
31 
32 struct qat_crypto_request;
33 
34 struct qat_crypto_request {
35 	struct icp_qat_fw_la_bulk_req req;
36 	union {
37 		struct qat_alg_aead_ctx *aead_ctx;
38 		struct qat_alg_skcipher_ctx *skcipher_ctx;
39 	};
40 	union {
41 		struct aead_request *aead_req;
42 		struct skcipher_request *skcipher_req;
43 	};
44 	struct qat_crypto_request_buffs buf;
45 	void (*cb)(struct icp_qat_fw_la_resp *resp,
46 		   struct qat_crypto_request *req);
47 	void *iv;
48 	dma_addr_t iv_paddr;
49 };
50 
51 #endif
52