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