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