Files
linux/drivers/crypto/qat/qat_common/qat_compression.h
Giovanni Cabiddu 1198ae56c9 crypto: qat - expose deflate through acomp api for QAT GEN2
Add infrastructure for implementing the acomp APIs in the QAT driver and
expose the deflate algorithm for QAT GEN2 devices.
This adds
  (1) the compression service which includes logic to create, allocate
  and handle compression instances;
  (2) logic to create configuration entries at probe time for the
  compression instances;
  (3) updates to the firmware API for allowing the compression service;
  and;
  (4) a back-end for deflate that implements the acomp api for QAT GEN2
  devices.

The implementation configures the device to produce data compressed
statically, optimized for throughput over compression ratio.

Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Wojciech Ziemba <wojciech.ziemba@intel.com>
Reviewed-by: Adam Guerin <adam.guerin@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2022-12-09 18:44:59 +08:00

38 lines
885 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;
void (*build_deflate_ctx)(void *ctx);
};
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