1 /* SPDX-License-Identifier: BSD-3-Clause */ 2 /* Copyright(c) 2007-2025 Intel Corporation */ 3 /** 4 *************************************************************************** 5 * @file sal_types_compression.h 6 * 7 * @ingroup SalCtrl 8 * 9 * Generic compression instance type definition 10 * 11 ***************************************************************************/ 12 #ifndef SAL_TYPES_COMPRESSION_H_ 13 #define SAL_TYPES_COMPRESSION_H_ 14 15 #include "cpa_dc.h" 16 #include "cpa_dc_dp.h" 17 #include "lac_sal_types.h" 18 #include "icp_qat_hw.h" 19 #include "icp_buffer_desc.h" 20 21 #include "lac_mem_pools.h" 22 #include "icp_adf_transport.h" 23 24 #define DC_NUM_RX_RINGS (1) 25 #define DC_NUM_COMPRESSION_LEVELS (CPA_DC_L12) 26 27 #define MAX_SGL_NUM 0x10000 28 29 /** 30 ***************************************************************************** 31 * @ingroup SalCtrl 32 * Compression device specific data 33 * 34 * @description 35 * Contains device specific information for a compression service. 36 * 37 *****************************************************************************/ 38 typedef struct sal_compression_device_data { 39 /* Device specific minimum output buffer size for static compression */ 40 Cpa32U minOutputBuffSize; 41 42 /* Device specific minimum output buffer size for dynamic compression */ 43 Cpa32U minOutputBuffSizeDynamic; 44 45 /* Enable/disable secureRam/acceleratorRam for intermediate buffers*/ 46 Cpa8U useDevRam; 47 48 /* When set, implies device can decompress interim odd byte length 49 * stateful decompression requests. 50 */ 51 CpaBoolean oddByteDecompInterim; 52 53 /* When set, implies device can decompress odd byte length 54 * stateful decompression requests when bFinal is absent 55 */ 56 CpaBoolean oddByteDecompNobFinal; 57 58 /* Flag to indicate if translator slice overflow is supported */ 59 CpaBoolean translatorOverflow; 60 61 /* Flag to enable/disable delayed match mode */ 62 icp_qat_hw_compression_delayed_match_t enableDmm; 63 64 Cpa32U inflateContextSize; 65 Cpa8U highestHwCompressionDepth; 66 67 /* Mask that reports supported window sizes for comp/decomp */ 68 Cpa8U windowSizeMask; 69 70 /* List representing compression levels that are the first to have 71 a unique search depth. */ 72 CpaBoolean uniqueCompressionLevels[DC_NUM_COMPRESSION_LEVELS + 1]; 73 Cpa8U numCompressionLevels; 74 75 /* Flag to indicate CompressAndVerifyAndRecover feature support */ 76 CpaBoolean cnvnrSupported; 77 78 /* When set, implies device supports ASB_ENABLE */ 79 CpaBoolean asbEnableSupport; 80 } sal_compression_device_data_t; 81 82 /** 83 ***************************************************************************** 84 * @ingroup SalCtrl 85 * Compression specific Service Container 86 * 87 * @description 88 * Contains information required per compression service instance. 89 * 90 *****************************************************************************/ 91 typedef struct sal_compression_service_s { 92 /* An instance of the Generic Service Container */ 93 sal_service_t generic_service_info; 94 95 /* Memory pool ID used for compression */ 96 lac_memory_pool_id_t compression_mem_pool; 97 98 /* Pointer to an array of atomic stats for compression */ 99 QatUtilsAtomic *pCompStatsArr; 100 101 /* Size of the DRAM intermediate buffer in bytes */ 102 Cpa64U minInterBuffSizeInBytes; 103 104 /* Number of DRAM intermediate buffers */ 105 Cpa16U numInterBuffs; 106 107 /* Address of the array of DRAM intermediate buffers*/ 108 icp_qat_addr_width_t *pInterBuffPtrsArray; 109 CpaPhysicalAddr pInterBuffPtrsArrayPhyAddr; 110 111 icp_comms_trans_handle trans_handle_compression_tx; 112 icp_comms_trans_handle trans_handle_compression_rx; 113 114 /* Maximum number of in flight requests */ 115 Cpa32U maxNumCompConcurrentReq; 116 117 /* Callback function defined for the DcDp API compression session */ 118 CpaDcDpCallbackFn pDcDpCb; 119 120 /* Config info */ 121 Cpa16U acceleratorNum; 122 Cpa16U bankNum; 123 Cpa16U pkgID; 124 Cpa16U isPolled; 125 Cpa32U coreAffinity; 126 Cpa32U nodeAffinity; 127 128 sal_compression_device_data_t comp_device_data; 129 130 /* Statistics handler */ 131 debug_file_info_t *debug_file; 132 } sal_compression_service_t; 133 134 /************************************************************************* 135 * @ingroup SalCtrl 136 * @description 137 * This function returns a valid compression instance handle for the system 138 * if it exists. 139 * 140 * @performance 141 * To avoid calling this function the user of the QA api should not use 142 * instanceHandle = CPA_INSTANCE_HANDLE_SINGLE. 143 * 144 * @context 145 * This function is called whenever instanceHandle = 146 * CPA_INSTANCE_HANDLE_SINGLE at the QA Dc api. 147 * 148 * @assumptions 149 * None 150 * @sideEffects 151 * None 152 * @reentrant 153 * No 154 * @threadSafe 155 * Yes 156 * 157 * @retval Pointer to first compression instance handle or NULL if no 158 * compression instances in the system. 159 * 160 *************************************************************************/ 161 CpaInstanceHandle dcGetFirstHandle(void); 162 163 #endif /*SAL_TYPES_COMPRESSION_H_*/ 164