1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright(c) 2022 Intel Corporation */
3 #ifndef _QAT_COMPRESSION_H_
4 #define _QAT_COMPRESSION_H_
5 
6 #include <linux/list.h>
7 #include <linux/types.h>
8 #include "adf_accel_devices.h"
9 #include "qat_algs_send.h"
10 
11 #define QAT_COMP_MAX_SKID 4096
12 
13 struct qat_compression_instance {
14 	struct adf_etr_ring_data *dc_tx;
15 	struct adf_etr_ring_data *dc_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 	struct qat_instance_backlog backlog;
22 	struct adf_dc_data *dc_data;
23 	void (*build_deflate_ctx)(void *ctx);
24 };
25 
26 static inline bool adf_hw_dev_has_compression(struct adf_accel_dev *accel_dev)
27 {
28 	struct adf_hw_device_data *hw_device = accel_dev->hw_device;
29 	u32 mask = ~hw_device->accel_capabilities_mask;
30 
31 	if (mask & ADF_ACCEL_CAPABILITIES_COMPRESSION)
32 		return false;
33 
34 	return true;
35 }
36 
37 #endif
38