1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2015-2019 Intel Corporation
8 #ifdef RTE_LIBRTE_COMPRESSDEV
10 #include <rte_compressdev.h>
11 #include <rte_compressdev_pmd.h>
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"
18 #define QAT_64_BYTE_ALIGN_MASK (~0x3f)
19 #define QAT_64_BYTE_ALIGN (64)
20 #define QAT_NUM_BUFS_IN_IM_SGL 1
22 #define ERR_CODE_QAT_COMP_WRONG_FW -99
24 /* fallback to fixed compression threshold */
25 #define QAT_FALLBACK_THLD ((uint32_t)(RTE_PMD_QAT_COMP_IM_BUFFER_SIZE / 1.1))
27 enum qat_comp_request_type
{
28 QAT_COMP_REQUEST_FIXED_COMP_STATELESS
,
29 QAT_COMP_REQUEST_DYNAMIC_COMP_STATELESS
,
30 QAT_COMP_REQUEST_DECOMPRESS
,
34 struct array_of_ptrs
{
35 phys_addr_t pointer
[0];
38 struct qat_inter_sgl
{
40 struct qat_flat_buf buffers
[QAT_NUM_BUFS_IN_IM_SGL
];
41 } __rte_packed __rte_cache_aligned
;
44 struct qat_comp_op_cookie
{
45 phys_addr_t qat_sgl_src_phys_addr
;
46 phys_addr_t qat_sgl_dst_phys_addr
;
47 /* dynamically created SGLs */
49 uint16_t src_nb_elems
;
50 uint16_t dst_nb_elems
;
51 struct qat_sgl
*qat_sgl_src_d
;
52 struct qat_sgl
*qat_sgl_dst_d
;
55 struct qat_comp_xform
{
56 struct icp_qat_fw_comp_req qat_comp_req_tmpl
;
57 enum qat_comp_request_type qat_comp_request_type
;
58 enum rte_comp_checksum_type checksum_type
;
62 qat_comp_build_request(void *in_op
, uint8_t *out_msg
, void *op_cookie
,
63 enum qat_device_gen qat_dev_gen __rte_unused
);
66 qat_comp_process_response(void **op
, uint8_t *resp
,
67 uint64_t *dequeue_err_count
);
70 qat_comp_private_xform_create(struct rte_compressdev
*dev
,
71 const struct rte_comp_xform
*xform
,
72 void **private_xform
);
75 qat_comp_private_xform_free(struct rte_compressdev
*dev
, void *private_xform
);
78 qat_comp_xform_size(void);