New upstream version 18.11-rc1
[deb_dpdk.git] / drivers / compress / qat / qat_comp.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2015-2018 Intel Corporation
3  */
4
5 #ifndef _QAT_COMP_H_
6 #define _QAT_COMP_H_
7
8 #ifdef RTE_LIBRTE_COMPRESSDEV
9
10 #include <rte_compressdev.h>
11 #include <rte_compressdev_pmd.h>
12
13 #include "qat_common.h"
14 #include "icp_qat_hw.h"
15 #include "icp_qat_fw_comp.h"
16 #include "icp_qat_fw_la.h"
17
18 #define QAT_64_BYTE_ALIGN_MASK (~0x3f)
19 #define QAT_64_BYTE_ALIGN (64)
20 #define QAT_NUM_BUFS_IN_IM_SGL 1
21
22 #define ERR_CODE_QAT_COMP_WRONG_FW -99
23
24 enum qat_comp_request_type {
25         QAT_COMP_REQUEST_FIXED_COMP_STATELESS,
26         QAT_COMP_REQUEST_DYNAMIC_COMP_STATELESS,
27         QAT_COMP_REQUEST_DECOMPRESS,
28         REQ_COMP_END
29 };
30
31 struct array_of_ptrs {
32         phys_addr_t pointer[0];
33 };
34
35 struct qat_inter_sgl {
36         qat_sgl_hdr;
37         struct qat_flat_buf buffers[QAT_NUM_BUFS_IN_IM_SGL];
38 } __rte_packed __rte_cache_aligned;
39
40 struct qat_comp_sgl {
41         qat_sgl_hdr;
42         struct qat_flat_buf buffers[RTE_PMD_QAT_COMP_SGL_MAX_SEGMENTS];
43 } __rte_packed __rte_cache_aligned;
44
45 struct qat_comp_op_cookie {
46         struct qat_comp_sgl qat_sgl_src;
47         struct qat_comp_sgl qat_sgl_dst;
48         phys_addr_t qat_sgl_src_phys_addr;
49         phys_addr_t qat_sgl_dst_phys_addr;
50 };
51
52 struct qat_comp_xform {
53         struct icp_qat_fw_comp_req qat_comp_req_tmpl;
54         enum qat_comp_request_type qat_comp_request_type;
55         enum rte_comp_checksum_type checksum_type;
56 };
57
58 int
59 qat_comp_build_request(void *in_op, uint8_t *out_msg, void *op_cookie,
60                        enum qat_device_gen qat_dev_gen __rte_unused);
61
62 int
63 qat_comp_process_response(void **op, uint8_t *resp);
64
65
66 int
67 qat_comp_private_xform_create(struct rte_compressdev *dev,
68                               const struct rte_comp_xform *xform,
69                               void **private_xform);
70
71 int
72 qat_comp_private_xform_free(struct rte_compressdev *dev, void *private_xform);
73
74 unsigned int
75 qat_comp_xform_size(void);
76
77 #endif
78 #endif