New upstream version 18.08
[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 ERR_CODE_QAT_COMP_WRONG_FW -99
19
20 enum qat_comp_request_type {
21         QAT_COMP_REQUEST_FIXED_COMP_STATELESS,
22         QAT_COMP_REQUEST_DYNAMIC_COMP_STATELESS,
23         QAT_COMP_REQUEST_DECOMPRESS,
24         REQ_COMP_END
25 };
26
27 struct qat_comp_sgl {
28         qat_sgl_hdr;
29         struct qat_flat_buf buffers[RTE_PMD_QAT_COMP_SGL_MAX_SEGMENTS];
30 } __rte_packed __rte_cache_aligned;
31
32 struct qat_comp_op_cookie {
33         struct qat_comp_sgl qat_sgl_src;
34         struct qat_comp_sgl qat_sgl_dst;
35         phys_addr_t qat_sgl_src_phys_addr;
36         phys_addr_t qat_sgl_dst_phys_addr;
37 };
38
39 struct qat_comp_xform {
40         struct icp_qat_fw_comp_req qat_comp_req_tmpl;
41         enum qat_comp_request_type qat_comp_request_type;
42         enum rte_comp_checksum_type checksum_type;
43 };
44
45 int
46 qat_comp_build_request(void *in_op, uint8_t *out_msg, void *op_cookie,
47                        enum qat_device_gen qat_dev_gen __rte_unused);
48
49 int
50 qat_comp_process_response(void **op, uint8_t *resp);
51
52
53 int
54 qat_comp_private_xform_create(struct rte_compressdev *dev,
55                               const struct rte_comp_xform *xform,
56                               void **private_xform);
57
58 int
59 qat_comp_private_xform_free(struct rte_compressdev *dev, void *private_xform);
60
61 unsigned int
62 qat_comp_xform_size(void);
63
64 #endif
65 #endif