1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2015-2018 Intel Corporation
5 #ifndef _QAT_COMP_PMD_H_
6 #define _QAT_COMP_PMD_H_
8 #ifdef RTE_LIB_COMPRESSDEV
10 #include <rte_compressdev.h>
11 #include <rte_compressdev_pmd.h>
13 #include "qat_device.h"
16 /**< Intel(R) QAT Compression PMD name */
17 #define COMPRESSDEV_NAME_QAT_PMD compress_qat
19 /* Private data structure for a QAT compression device capability. */
20 struct qat_comp_capabilities_info {
21 const struct rte_compressdev_capabilities *data;
26 * Function prototypes for GENx specific compress device operations.
28 typedef struct qat_comp_capabilities_info (*get_comp_capabilities_info_t)
29 (struct qat_pci_device *qat_dev);
31 typedef uint16_t (*get_comp_ram_bank_flags_t)(void);
33 typedef int (*set_comp_slice_cfg_word_t)(struct qat_comp_xform *qat_xform,
34 const struct rte_comp_xform *xform,
35 enum rte_comp_op_type op_type, uint32_t *comp_slice_cfg_word);
37 typedef unsigned int (*get_comp_num_im_bufs_required_t)(void);
39 typedef uint64_t (*get_comp_feature_flags_t)(void);
41 struct qat_comp_gen_dev_ops {
42 struct rte_compressdev_ops *compressdev_ops;
43 get_comp_feature_flags_t qat_comp_get_feature_flags;
44 get_comp_capabilities_info_t qat_comp_get_capabilities;
45 get_comp_ram_bank_flags_t qat_comp_get_ram_bank_flags;
46 set_comp_slice_cfg_word_t qat_comp_set_slice_cfg_word;
47 get_comp_num_im_bufs_required_t qat_comp_get_num_im_bufs_required;
50 extern struct qat_comp_gen_dev_ops qat_comp_gen_dev_ops[];
52 /** private data structure for a QAT compression device.
53 * This QAT device is a device offering only a compression service,
54 * there can be one of these on each qat_pci_device (VF).
56 struct qat_comp_dev_private {
57 struct qat_pci_device *qat_dev;
58 /**< The qat pci device hosting the service */
59 struct rte_compressdev *compressdev;
60 /**< The pointer to this compression device structure */
61 const struct rte_compressdev_capabilities *qat_dev_capabilities;
62 /* QAT device compression capabilities */
63 const struct rte_memzone *interm_buff_mz;
64 /**< The device's memory for intermediate buffers */
65 struct rte_mempool *xformpool;
66 /**< The device's pool for qat_comp_xforms */
67 struct rte_mempool *streampool;
68 /**< The device's pool for qat_comp_streams */
69 const struct rte_memzone *capa_mz;
70 /* Shared memzone for storing capabilities */
71 uint16_t min_enq_burst_threshold;
75 qat_comp_dev_config(struct rte_compressdev *dev,
76 struct rte_compressdev_config *config);
79 qat_comp_dev_start(struct rte_compressdev *dev __rte_unused);
82 qat_comp_dev_stop(struct rte_compressdev *dev __rte_unused);
85 qat_comp_dev_close(struct rte_compressdev *dev);
88 qat_comp_dev_info_get(struct rte_compressdev *dev,
89 struct rte_compressdev_info *info);
92 qat_comp_stats_get(struct rte_compressdev *dev,
93 struct rte_compressdev_stats *stats);
96 qat_comp_stats_reset(struct rte_compressdev *dev);
99 qat_comp_qp_release(struct rte_compressdev *dev, uint16_t queue_pair_id);
102 qat_comp_qp_setup(struct rte_compressdev *dev, uint16_t qp_id,
103 uint32_t max_inflight_ops, int socket_id);
105 const struct rte_memzone *
106 qat_comp_setup_inter_buffers(struct qat_comp_dev_private *comp_dev,
110 qat_comp_dev_create(struct qat_pci_device *qat_pci_dev,
111 struct qat_dev_cmd_param *qat_dev_cmd_param);
114 qat_comp_dev_destroy(struct qat_pci_device *qat_pci_dev);
117 static __rte_always_inline unsigned int
118 qat_comp_get_num_im_bufs_required(enum qat_device_gen gen)
120 return (*qat_comp_gen_dev_ops[gen].qat_comp_get_num_im_bufs_required)();
124 #endif /* _QAT_COMP_PMD_H_ */