linux/drivers/crypto/intel/qat/qat_common/qat_compression.h
Suman Kumar Chakraborty cd0e7160f8 crypto: qat - refactor compression template logic
The logic that generates the compression templates, which are used by to
submit compression requests to the QAT device, is very similar between
QAT devices and diverges mainly on the HW generation-specific
configuration word.

This makes the logic that generates the compression and decompression
templates common between GEN2 and GEN4 devices and abstracts the
generation-specific logic to the generation-specific implementations.

The adf_gen2_dc.c and adf_gen4_dc.c have been replaced by adf_dc.c, and
the generation-specific logic has been reduced and moved to
adf_gen2_hw_data.c and adf_gen4_hw_data.c.

This does not introduce any functional change.

Co-developed-by: Vijay Sundar Selvamani <vijay.sundar.selvamani@intel.com>
Signed-off-by: Vijay Sundar Selvamani <vijay.sundar.selvamani@intel.com>
Signed-off-by: Suman Kumar Chakraborty <suman.kumar.chakraborty@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2025-05-05 18:20:44 +08:00

36 lines
846 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright(c) 2022 Intel Corporation */
#ifndef _QAT_COMPRESSION_H_
#define _QAT_COMPRESSION_H_
#include <linux/list.h>
#include <linux/types.h>
#include "adf_accel_devices.h"
#include "qat_algs_send.h"
#define QAT_COMP_MAX_SKID 4096
struct qat_compression_instance {
struct adf_etr_ring_data *dc_tx;
struct adf_etr_ring_data *dc_rx;
struct adf_accel_dev *accel_dev;
struct list_head list;
unsigned long state;
int id;
atomic_t refctr;
struct qat_instance_backlog backlog;
struct adf_dc_data *dc_data;
};
static inline bool adf_hw_dev_has_compression(struct adf_accel_dev *accel_dev)
{
struct adf_hw_device_data *hw_device = accel_dev->hw_device;
u32 mask = ~hw_device->accel_capabilities_mask;
if (mask & ADF_ACCEL_CAPABILITIES_COMPRESSION)
return false;
return true;
}
#endif