• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define QAT_MAX_BUFF_DESC	4
24 
25 struct qat_alg_buf {
26 	u32 len;
27 	u32 resrvd;
28 	u64 addr;
29 } __packed;
30 
31 struct qat_alg_buf_list {
32 	u64 resrvd;
33 	u32 num_bufs;
34 	u32 num_mapped_bufs;
35 	struct qat_alg_buf bufers[];
36 } __packed;
37 
38 struct qat_alg_fixed_buf_list {
39 	struct qat_alg_buf_list sgl_hdr;
40 	struct qat_alg_buf descriptors[QAT_MAX_BUFF_DESC];
41 } __packed __aligned(64);
42 
43 struct qat_crypto_request_buffs {
44 	struct qat_alg_buf_list *bl;
45 	dma_addr_t blp;
46 	struct qat_alg_buf_list *blout;
47 	dma_addr_t bloutp;
48 	size_t sz;
49 	size_t sz_out;
50 	bool sgl_src_valid;
51 	bool sgl_dst_valid;
52 	struct qat_alg_fixed_buf_list sgl_src;
53 	struct qat_alg_fixed_buf_list sgl_dst;
54 };
55 
56 struct qat_crypto_request;
57 
58 struct qat_crypto_request {
59 	struct icp_qat_fw_la_bulk_req req;
60 	union {
61 		struct qat_alg_aead_ctx *aead_ctx;
62 		struct qat_alg_skcipher_ctx *skcipher_ctx;
63 	};
64 	union {
65 		struct aead_request *aead_req;
66 		struct skcipher_request *skcipher_req;
67 	};
68 	struct qat_crypto_request_buffs buf;
69 	void (*cb)(struct icp_qat_fw_la_resp *resp,
70 		   struct qat_crypto_request *req);
71 	void *iv;
72 	dma_addr_t iv_paddr;
73 };
74 
75 #endif
76