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