Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/qat/qat_api/common/compression/dc_session.c
Show All 17 Lines | |||||
******************************************************************************* | ******************************************************************************* | ||||
*/ | */ | ||||
#include "cpa.h" | #include "cpa.h" | ||||
#include "cpa_dc.h" | #include "cpa_dc.h" | ||||
#include "icp_qat_fw.h" | #include "icp_qat_fw.h" | ||||
#include "icp_qat_fw_comp.h" | #include "icp_qat_fw_comp.h" | ||||
#include "icp_qat_hw.h" | #include "icp_qat_hw.h" | ||||
#include "icp_qat_hw_20_comp.h" | |||||
/* | /* | ||||
******************************************************************************* | ******************************************************************************* | ||||
* Include private header files | * Include private header files | ||||
******************************************************************************* | ******************************************************************************* | ||||
*/ | */ | ||||
#include "dc_session.h" | #include "dc_session.h" | ||||
#include "dc_datapath.h" | #include "dc_datapath.h" | ||||
#include "lac_mem_pools.h" | #include "lac_mem_pools.h" | ||||
#include "sal_types_compression.h" | #include "sal_types_compression.h" | ||||
#include "lac_buffer_desc.h" | #include "lac_buffer_desc.h" | ||||
#include "sal_service_state.h" | #include "sal_service_state.h" | ||||
#include "sal_qat_cmn_msg.h" | #include "sal_qat_cmn_msg.h" | ||||
#include "sal_hw_gen.h" | |||||
/** | /** | ||||
***************************************************************************** | ***************************************************************************** | ||||
* @ingroup Dc_DataCompression | * @ingroup Dc_DataCompression | ||||
* Check that pSessionData is valid | * Check that pSessionData is valid | ||||
* | * | ||||
* @description | * @description | ||||
* Check that all the parameters defined in the pSessionData are valid | * Check that all the parameters defined in the pSessionData are valid | ||||
* | * | ||||
* @param[in] pSessionData Pointer to a user instantiated structure | * @param[in] pSessionData Pointer to a user instantiated structure | ||||
* containing session data | * containing session data | ||||
* | * | ||||
* @retval CPA_STATUS_SUCCESS Function executed successfully | * @retval CPA_STATUS_SUCCESS Function executed successfully | ||||
* @retval CPA_STATUS_FAIL Function failed to find device | * @retval CPA_STATUS_FAIL Function failed to find device | ||||
* @retval CPA_STATUS_INVALID_PARAM Invalid parameter passed in | * @retval CPA_STATUS_INVALID_PARAM Invalid parameter passed in | ||||
* @retval CPA_STATUS_UNSUPPORTED Unsupported algorithm/feature | * @retval CPA_STATUS_UNSUPPORTED Unsupported algorithm/feature | ||||
* | * | ||||
*****************************************************************************/ | *****************************************************************************/ | ||||
static CpaStatus | CpaStatus | ||||
dcCheckSessionData(const CpaDcSessionSetupData *pSessionData, | dcCheckSessionData(const CpaDcSessionSetupData *pSessionData, | ||||
CpaInstanceHandle dcInstance) | CpaInstanceHandle dcInstance) | ||||
{ | { | ||||
CpaDcInstanceCapabilities instanceCapabilities = { 0 }; | CpaDcInstanceCapabilities instanceCapabilities = { 0 }; | ||||
cpaDcQueryCapabilities(dcInstance, &instanceCapabilities); | cpaDcQueryCapabilities(dcInstance, &instanceCapabilities); | ||||
if ((pSessionData->compLevel < CPA_DC_L1) || | if ((pSessionData->compLevel < CPA_DC_L1) || | ||||
(pSessionData->compLevel > CPA_DC_L9)) { | (pSessionData->compLevel > CPA_DC_L9)) { | ||||
QAT_UTILS_LOG("Invalid compLevel value\n"); | QAT_UTILS_LOG("Invalid compLevel value\n"); | ||||
return CPA_STATUS_INVALID_PARAM; | return CPA_STATUS_INVALID_PARAM; | ||||
} | } | ||||
if ((pSessionData->autoSelectBestHuffmanTree < CPA_DC_ASB_DISABLED) || | if ((pSessionData->autoSelectBestHuffmanTree < CPA_DC_ASB_DISABLED) || | ||||
(pSessionData->autoSelectBestHuffmanTree > | (pSessionData->autoSelectBestHuffmanTree > | ||||
CPA_DC_ASB_UNCOMP_STATIC_DYNAMIC_WITH_NO_HDRS)) { | CPA_DC_ASB_UNCOMP_STATIC_DYNAMIC_WITH_NO_HDRS)) { | ||||
QAT_UTILS_LOG("Invalid autoSelectBestHuffmanTree value\n"); | QAT_UTILS_LOG("Invalid autoSelectBestHuffmanTree value\n"); | ||||
return CPA_STATUS_INVALID_PARAM; | return CPA_STATUS_INVALID_PARAM; | ||||
} | } | ||||
if (pSessionData->compType != CPA_DC_DEFLATE) { | if (pSessionData->compType != CPA_DC_DEFLATE) { | ||||
QAT_UTILS_LOG("Invalid compType value\n"); | QAT_UTILS_LOG("Invalid compType value\n"); | ||||
Show All 39 Lines | |||||
* | * | ||||
* @param[in] pSessionDesc Pointer to the session descriptor | * @param[in] pSessionDesc Pointer to the session descriptor | ||||
* @param[in] pCompConfig Pointer to slice config word | * @param[in] pCompConfig Pointer to slice config word | ||||
* @param[in] compDecomp Direction of the operation | * @param[in] compDecomp Direction of the operation | ||||
* @param[in] enableDmm Delayed Match Mode | * @param[in] enableDmm Delayed Match Mode | ||||
* | * | ||||
*****************************************************************************/ | *****************************************************************************/ | ||||
static void | static void | ||||
dcCompHwBlockPopulate(dc_session_desc_t *pSessionDesc, | dcCompHwBlockPopulate(sal_compression_service_t *pService, | ||||
dc_session_desc_t *pSessionDesc, | |||||
icp_qat_hw_compression_config_t *pCompConfig, | icp_qat_hw_compression_config_t *pCompConfig, | ||||
dc_request_dir_t compDecomp, | dc_request_dir_t compDecomp) | ||||
icp_qat_hw_compression_delayed_match_t enableDmm) | |||||
{ | { | ||||
icp_qat_hw_compression_direction_t dir = | icp_qat_hw_compression_direction_t dir = | ||||
ICP_QAT_HW_COMPRESSION_DIR_COMPRESS; | ICP_QAT_HW_COMPRESSION_DIR_COMPRESS; | ||||
icp_qat_hw_compression_algo_t algo = | icp_qat_hw_compression_algo_t algo = | ||||
ICP_QAT_HW_COMPRESSION_ALGO_DEFLATE; | ICP_QAT_HW_COMPRESSION_ALGO_DEFLATE; | ||||
icp_qat_hw_compression_depth_t depth = ICP_QAT_HW_COMPRESSION_DEPTH_1; | icp_qat_hw_compression_depth_t depth = ICP_QAT_HW_COMPRESSION_DEPTH_1; | ||||
icp_qat_hw_compression_file_type_t filetype = | icp_qat_hw_compression_file_type_t filetype = | ||||
ICP_QAT_HW_COMPRESSION_FILE_TYPE_0; | ICP_QAT_HW_COMPRESSION_FILE_TYPE_0; | ||||
icp_qat_hw_compression_delayed_match_t dmm; | |||||
/* Set the direction */ | /* Set the direction */ | ||||
if (DC_COMPRESSION_REQUEST == compDecomp) { | if (DC_COMPRESSION_REQUEST == compDecomp) { | ||||
dir = ICP_QAT_HW_COMPRESSION_DIR_COMPRESS; | dir = ICP_QAT_HW_COMPRESSION_DIR_COMPRESS; | ||||
} else { | } else { | ||||
dir = ICP_QAT_HW_COMPRESSION_DIR_DECOMPRESS; | dir = ICP_QAT_HW_COMPRESSION_DIR_DECOMPRESS; | ||||
} | } | ||||
if (CPA_DC_DEFLATE == pSessionDesc->compType) { | if (CPA_DC_DEFLATE == pSessionDesc->compType) { | ||||
algo = ICP_QAT_HW_COMPRESSION_ALGO_DEFLATE; | algo = ICP_QAT_HW_COMPRESSION_ALGO_DEFLATE; | ||||
} else { | } else { | ||||
QAT_UTILS_LOG("Algorithm not supported for Compression\n"); | QAT_UTILS_LOG("Algorithm not supported for Compression\n"); | ||||
} | } | ||||
/* Set delay match mode */ | |||||
if (CPA_TRUE == pService->comp_device_data.enableDmm) { | |||||
dmm = ICP_QAT_HW_COMPRESSION_DELAYED_MATCH_ENABLED; | |||||
} else { | |||||
dmm = ICP_QAT_HW_COMPRESSION_DELAYED_MATCH_DISABLED; | |||||
} | |||||
/* Set the depth */ | /* Set the depth */ | ||||
if (DC_DECOMPRESSION_REQUEST == compDecomp) { | if (DC_DECOMPRESSION_REQUEST == compDecomp) { | ||||
depth = ICP_QAT_HW_COMPRESSION_DEPTH_1; | depth = ICP_QAT_HW_COMPRESSION_DEPTH_1; | ||||
} else { | } else { | ||||
switch (pSessionDesc->compLevel) { | switch (pSessionDesc->compLevel) { | ||||
case CPA_DC_L1: | case CPA_DC_L1: | ||||
depth = ICP_QAT_HW_COMPRESSION_DEPTH_1; | depth = ICP_QAT_HW_COMPRESSION_DEPTH_1; | ||||
break; | break; | ||||
case CPA_DC_L2: | case CPA_DC_L2: | ||||
depth = ICP_QAT_HW_COMPRESSION_DEPTH_4; | depth = ICP_QAT_HW_COMPRESSION_DEPTH_4; | ||||
break; | break; | ||||
case CPA_DC_L3: | case CPA_DC_L3: | ||||
depth = ICP_QAT_HW_COMPRESSION_DEPTH_8; | depth = ICP_QAT_HW_COMPRESSION_DEPTH_8; | ||||
break; | break; | ||||
default: | case CPA_DC_L4: | ||||
depth = ICP_QAT_HW_COMPRESSION_DEPTH_16; | depth = ICP_QAT_HW_COMPRESSION_DEPTH_16; | ||||
break; | |||||
default: | |||||
depth = pService->comp_device_data | |||||
.highestHwCompressionDepth; | |||||
break; | |||||
} | } | ||||
} | } | ||||
/* The file type is set to ICP_QAT_HW_COMPRESSION_FILE_TYPE_0. The other | /* The file type is set to ICP_QAT_HW_COMPRESSION_FILE_TYPE_0. The other | ||||
* modes will be used in the future for precompiled huffman trees */ | * modes will be used in the future for precompiled huffman trees */ | ||||
filetype = ICP_QAT_HW_COMPRESSION_FILE_TYPE_0; | filetype = ICP_QAT_HW_COMPRESSION_FILE_TYPE_0; | ||||
pCompConfig->val = ICP_QAT_HW_COMPRESSION_CONFIG_BUILD( | pCompConfig->lower_val = ICP_QAT_HW_COMPRESSION_CONFIG_BUILD( | ||||
dir, enableDmm, algo, depth, filetype); | dir, dmm, algo, depth, filetype); | ||||
pCompConfig->reserved = 0; | /* Upper 32-bits of the configuration word do not need to be | ||||
* configured with legacy devices. | |||||
*/ | |||||
pCompConfig->upper_val = 0; | |||||
} | } | ||||
static void | |||||
dcCompHwBlockPopulateGen4(sal_compression_service_t *pService, | |||||
dc_session_desc_t *pSessionDesc, | |||||
icp_qat_hw_compression_config_t *pCompConfig, | |||||
dc_request_dir_t compDecomp) | |||||
{ | |||||
/* Compression related */ | |||||
if (DC_COMPRESSION_REQUEST == compDecomp) { | |||||
icp_qat_hw_comp_20_config_csr_upper_t hw_comp_upper_csr; | |||||
icp_qat_hw_comp_20_config_csr_lower_t hw_comp_lower_csr; | |||||
memset(&hw_comp_upper_csr, 0, sizeof hw_comp_upper_csr); | |||||
memset(&hw_comp_lower_csr, 0, sizeof hw_comp_lower_csr); | |||||
/* Disable Literal + Length Limit Block Drop by default and | |||||
* enable it only for dynamic deflate compression. | |||||
*/ | |||||
hw_comp_lower_csr.lllbd = | |||||
ICP_QAT_HW_COMP_20_LLLBD_CTRL_LLLBD_DISABLED; | |||||
switch (pSessionDesc->compType) { | |||||
case CPA_DC_DEFLATE: | |||||
/* DEFLATE algorithm settings */ | |||||
hw_comp_lower_csr.skip_ctrl = | |||||
ICP_QAT_HW_COMP_20_BYTE_SKIP_3BYTE_LITERAL; | |||||
if (CPA_DC_HT_FULL_DYNAMIC == pSessionDesc->huffType) { | |||||
hw_comp_lower_csr.algo = | |||||
ICP_QAT_HW_COMP_20_HW_COMP_FORMAT_ILZ77; | |||||
} else /* Static DEFLATE */ | |||||
{ | |||||
hw_comp_lower_csr.algo = | |||||
ICP_QAT_HW_COMP_20_HW_COMP_FORMAT_DEFLATE; | |||||
hw_comp_upper_csr.scb_ctrl = | |||||
ICP_QAT_HW_COMP_20_SCB_CONTROL_DISABLE; | |||||
} | |||||
if (CPA_DC_STATEFUL == pSessionDesc->sessState) { | |||||
hw_comp_upper_csr.som_ctrl = | |||||
ICP_QAT_HW_COMP_20_SOM_CONTROL_REPLAY_MODE; | |||||
} | |||||
break; | |||||
default: | |||||
QAT_UTILS_LOG("Compression algorithm not supported\n"); | |||||
break; | |||||
} | |||||
/* Set the search depth */ | |||||
switch (pSessionDesc->compLevel) { | |||||
case CPA_DC_L1: | |||||
case CPA_DC_L2: | |||||
case CPA_DC_L3: | |||||
case CPA_DC_L4: | |||||
case CPA_DC_L5: | |||||
hw_comp_lower_csr.sd = | |||||
ICP_QAT_HW_COMP_20_SEARCH_DEPTH_LEVEL_1; | |||||
hw_comp_lower_csr.hash_col = | |||||
ICP_QAT_HW_COMP_20_SKIP_HASH_COLLISION_DONT_ALLOW; | |||||
break; | |||||
case CPA_DC_L6: | |||||
case CPA_DC_L7: | |||||
case CPA_DC_L8: | |||||
hw_comp_lower_csr.sd = | |||||
ICP_QAT_HW_COMP_20_SEARCH_DEPTH_LEVEL_6; | |||||
break; | |||||
case CPA_DC_L9: | |||||
hw_comp_lower_csr.sd = | |||||
ICP_QAT_HW_COMP_20_SEARCH_DEPTH_LEVEL_9; | |||||
break; | |||||
default: | |||||
hw_comp_lower_csr.sd = pService->comp_device_data | |||||
.highestHwCompressionDepth; | |||||
if ((CPA_DC_HT_FULL_DYNAMIC == | |||||
pSessionDesc->huffType) && | |||||
(CPA_DC_DEFLATE == pSessionDesc->compType)) { | |||||
/* Enable Literal + Length Limit Block Drop | |||||
* with dynamic deflate compression when | |||||
* highest compression levels are selected. | |||||
*/ | |||||
hw_comp_lower_csr.lllbd = | |||||
ICP_QAT_HW_COMP_20_LLLBD_CTRL_LLLBD_ENABLED; | |||||
} | |||||
break; | |||||
} | |||||
/* Same for all algorithms */ | |||||
hw_comp_lower_csr.abd = ICP_QAT_HW_COMP_20_ABD_ABD_DISABLED; | |||||
hw_comp_lower_csr.hash_update = | |||||
ICP_QAT_HW_COMP_20_SKIP_HASH_UPDATE_DONT_ALLOW; | |||||
hw_comp_lower_csr.edmm = | |||||
(CPA_TRUE == pService->comp_device_data.enableDmm) ? | |||||
ICP_QAT_HW_COMP_20_EXTENDED_DELAY_MATCH_MODE_EDMM_ENABLED : | |||||
ICP_QAT_HW_COMP_20_EXTENDED_DELAY_MATCH_MODE_EDMM_DISABLED; | |||||
/* Hard-coded HW-specific values */ | |||||
hw_comp_upper_csr.nice = | |||||
ICP_QAT_HW_COMP_20_CONFIG_CSR_NICE_PARAM_DEFAULT_VAL; | |||||
hw_comp_upper_csr.lazy = | |||||
ICP_QAT_HW_COMP_20_CONFIG_CSR_LAZY_PARAM_DEFAULT_VAL; | |||||
pCompConfig->upper_val = | |||||
ICP_QAT_FW_COMP_20_BUILD_CONFIG_UPPER(hw_comp_upper_csr); | |||||
pCompConfig->lower_val = | |||||
ICP_QAT_FW_COMP_20_BUILD_CONFIG_LOWER(hw_comp_lower_csr); | |||||
} else /* Decompress */ | |||||
{ | |||||
icp_qat_hw_decomp_20_config_csr_lower_t hw_decomp_lower_csr; | |||||
memset(&hw_decomp_lower_csr, 0, sizeof hw_decomp_lower_csr); | |||||
/* Set the algorithm */ | |||||
if (CPA_DC_DEFLATE == pSessionDesc->compType) { | |||||
hw_decomp_lower_csr.algo = | |||||
ICP_QAT_HW_DECOMP_20_HW_DECOMP_FORMAT_DEFLATE; | |||||
} else { | |||||
QAT_UTILS_LOG("Algorithm not supported for " | |||||
"Decompression\n"); | |||||
} | |||||
pCompConfig->upper_val = 0; | |||||
pCompConfig->lower_val = | |||||
ICP_QAT_FW_DECOMP_20_BUILD_CONFIG_LOWER( | |||||
hw_decomp_lower_csr); | |||||
} | |||||
} | |||||
/** | /** | ||||
***************************************************************************** | ***************************************************************************** | ||||
* @ingroup Dc_DataCompression | * @ingroup Dc_DataCompression | ||||
* Populate the compression content descriptor | * Populate the compression content descriptor | ||||
* | * | ||||
* @description | * @description | ||||
* This function will populate the compression content descriptor | * This function will populate the compression content descriptor | ||||
* | * | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | if (CPA_TRUE == bankEnabled) { | ||||
pCompControlBlock->ram_banks_addr = contextBufferAddrPhys; | pCompControlBlock->ram_banks_addr = contextBufferAddrPhys; | ||||
} else { | } else { | ||||
pCompControlBlock->ram_banks_addr = 0; | pCompControlBlock->ram_banks_addr = 0; | ||||
} | } | ||||
pCompControlBlock->resrvd = 0; | pCompControlBlock->resrvd = 0; | ||||
/* Populate Compression Hardware Setup Block */ | /* Populate Compression Hardware Setup Block */ | ||||
dcCompHwBlockPopulate(pSessionDesc, | if (isDcGen4x(pService)) { | ||||
dcCompHwBlockPopulateGen4(pService, | |||||
pSessionDesc, | |||||
pCompConfig, | pCompConfig, | ||||
compDecomp, | compDecomp); | ||||
pService->comp_device_data.enableDmm); | } else if (isDcGen2x(pService)) { | ||||
dcCompHwBlockPopulate(pService, | |||||
pSessionDesc, | |||||
pCompConfig, | |||||
compDecomp); | |||||
} else { | |||||
QAT_UTILS_LOG("Invalid QAT generation value\n"); | |||||
} | } | ||||
} | |||||
/** | /** | ||||
***************************************************************************** | ***************************************************************************** | ||||
* @ingroup Dc_DataCompression | * @ingroup Dc_DataCompression | ||||
* Populate the translator content descriptor | * Populate the translator content descriptor | ||||
* | * | ||||
* @description | * @description | ||||
* This function will populate the translator content descriptor | * This function will populate the translator content descriptor | ||||
* | * | ||||
* @param[out] pMsg Pointer to the compression message | * @param[out] pMsg Pointer to the compression message | ||||
* @param[in] nextSlice Next slice | * @param[in] nextSlice Next slice | ||||
* | * | ||||
*****************************************************************************/ | *****************************************************************************/ | ||||
static void | void | ||||
dcTransContentDescPopulate(icp_qat_fw_comp_req_t *pMsg, | dcTransContentDescPopulate(icp_qat_fw_comp_req_t *pMsg, | ||||
icp_qat_fw_slice_t nextSlice) | icp_qat_fw_slice_t nextSlice) | ||||
{ | { | ||||
icp_qat_fw_xlt_cd_hdr_t *pTransControlBlock = NULL; | icp_qat_fw_xlt_cd_hdr_t *pTransControlBlock = NULL; | ||||
pTransControlBlock = (icp_qat_fw_xlt_cd_hdr_t *)&(pMsg->u2.xlt_cd_ctrl); | pTransControlBlock = (icp_qat_fw_xlt_cd_hdr_t *)&(pMsg->u2.xlt_cd_ctrl); | ||||
ICP_QAT_FW_COMN_NEXT_ID_SET(pTransControlBlock, nextSlice); | ICP_QAT_FW_COMN_NEXT_ID_SET(pTransControlBlock, nextSlice); | ||||
Show All 30 Lines | dcGetContextSize(CpaInstanceHandle dcInstance, | ||||
Cpa32U *pContextSize) | Cpa32U *pContextSize) | ||||
{ | { | ||||
sal_compression_service_t *pCompService = NULL; | sal_compression_service_t *pCompService = NULL; | ||||
pCompService = (sal_compression_service_t *)dcInstance; | pCompService = (sal_compression_service_t *)dcInstance; | ||||
*pContextSize = 0; | *pContextSize = 0; | ||||
if ((CPA_DC_STATEFUL == pSessionData->sessState) && | if ((CPA_DC_STATEFUL == pSessionData->sessState) && | ||||
(CPA_DC_DEFLATE == pSessionData->compType) && | |||||
(CPA_DC_DIR_COMPRESS != pSessionData->sessDirection)) { | (CPA_DC_DIR_COMPRESS != pSessionData->sessDirection)) { | ||||
switch (pSessionData->compType) { | |||||
case CPA_DC_DEFLATE: | |||||
*pContextSize = | *pContextSize = | ||||
pCompService->comp_device_data.inflateContextSize; | pCompService->comp_device_data.inflateContextSize; | ||||
break; | |||||
default: | |||||
QAT_UTILS_LOG("Invalid compression algorithm."); | |||||
return CPA_STATUS_FAIL; | |||||
} | } | ||||
} | |||||
return CPA_STATUS_SUCCESS; | return CPA_STATUS_SUCCESS; | ||||
} | } | ||||
CpaStatus | CpaStatus | ||||
dcGetCompressCommandId(sal_compression_service_t *pService, | |||||
CpaDcSessionSetupData *pSessionData, | |||||
Cpa8U *pDcCmdId) | |||||
{ | |||||
CpaStatus status = CPA_STATUS_SUCCESS; | |||||
LAC_CHECK_NULL_PARAM(pService); | |||||
LAC_CHECK_NULL_PARAM(pSessionData); | |||||
LAC_CHECK_NULL_PARAM(pDcCmdId); | |||||
switch (pSessionData->compType) { | |||||
case CPA_DC_DEFLATE: | |||||
*pDcCmdId = (CPA_DC_HT_FULL_DYNAMIC == pSessionData->huffType) ? | |||||
ICP_QAT_FW_COMP_CMD_DYNAMIC : | |||||
ICP_QAT_FW_COMP_CMD_STATIC; | |||||
break; | |||||
default: | |||||
QAT_UTILS_LOG("Algorithm not supported for " | |||||
"compression\n"); | |||||
status = CPA_STATUS_UNSUPPORTED; | |||||
break; | |||||
} | |||||
return status; | |||||
} | |||||
CpaStatus | |||||
dcGetDecompressCommandId(sal_compression_service_t *pService, | |||||
CpaDcSessionSetupData *pSessionData, | |||||
Cpa8U *pDcCmdId) | |||||
{ | |||||
CpaStatus status = CPA_STATUS_SUCCESS; | |||||
LAC_CHECK_NULL_PARAM(pService); | |||||
LAC_CHECK_NULL_PARAM(pSessionData); | |||||
LAC_CHECK_NULL_PARAM(pDcCmdId); | |||||
switch (pSessionData->compType) { | |||||
case CPA_DC_DEFLATE: | |||||
*pDcCmdId = ICP_QAT_FW_COMP_CMD_DECOMPRESS; | |||||
break; | |||||
default: | |||||
QAT_UTILS_LOG("Algorithm not supported for " | |||||
"decompression\n"); | |||||
status = CPA_STATUS_UNSUPPORTED; | |||||
break; | |||||
} | |||||
return status; | |||||
} | |||||
CpaStatus | |||||
dcInitSession(CpaInstanceHandle dcInstance, | dcInitSession(CpaInstanceHandle dcInstance, | ||||
CpaDcSessionHandle pSessionHandle, | CpaDcSessionHandle pSessionHandle, | ||||
CpaDcSessionSetupData *pSessionData, | CpaDcSessionSetupData *pSessionData, | ||||
CpaBufferList *pContextBuffer, | CpaBufferList *pContextBuffer, | ||||
CpaDcCallbackFn callbackFn) | CpaDcCallbackFn callbackFn) | ||||
{ | { | ||||
CpaStatus status = CPA_STATUS_SUCCESS; | CpaStatus status = CPA_STATUS_SUCCESS; | ||||
sal_compression_service_t *pService = NULL; | sal_compression_service_t *pService = NULL; | ||||
Show All 36 Lines | dcInitSession(CpaInstanceHandle dcInstance, | ||||
} | } | ||||
if ((CPA_DC_STATEFUL == pSessionData->sessState) && | if ((CPA_DC_STATEFUL == pSessionData->sessState) && | ||||
(CPA_DC_DIR_DECOMPRESS != pSessionData->sessDirection)) { | (CPA_DC_DIR_DECOMPRESS != pSessionData->sessDirection)) { | ||||
QAT_UTILS_LOG("Stateful sessions are not supported.\n"); | QAT_UTILS_LOG("Stateful sessions are not supported.\n"); | ||||
return CPA_STATUS_UNSUPPORTED; | return CPA_STATUS_UNSUPPORTED; | ||||
} | } | ||||
if (CPA_DC_HT_FULL_DYNAMIC == pSessionData->huffType) { | /* Check for Gen4 and stateful, return error if both exist */ | ||||
if ((isDcGen4x(pService)) && | |||||
(CPA_DC_STATEFUL == pSessionData->sessState && | |||||
CPA_DC_DIR_DECOMPRESS != pSessionData->sessDirection)) { | |||||
QAT_UTILS_LOG("Stateful sessions are not supported for " | |||||
"compression direction"); | |||||
return CPA_STATUS_UNSUPPORTED; | |||||
} | |||||
if ((isDcGen2x(pService)) && | |||||
(CPA_DC_HT_FULL_DYNAMIC == pSessionData->huffType)) { | |||||
/* Test if DRAM is available for the intermediate buffers */ | /* Test if DRAM is available for the intermediate buffers */ | ||||
if ((NULL == pService->pInterBuffPtrsArray) && | if ((NULL == pService->pInterBuffPtrsArray) && | ||||
(0 == pService->pInterBuffPtrsArrayPhyAddr)) { | (0 == pService->pInterBuffPtrsArrayPhyAddr)) { | ||||
if (CPA_DC_ASB_STATIC_DYNAMIC == | if (CPA_DC_ASB_STATIC_DYNAMIC == | ||||
pSessionData->autoSelectBestHuffmanTree) { | pSessionData->autoSelectBestHuffmanTree) { | ||||
/* Define the Huffman tree as static */ | /* Define the Huffman tree as static */ | ||||
pSessionData->huffType = CPA_DC_HT_STATIC; | pSessionData->huffType = CPA_DC_HT_STATIC; | ||||
} else { | } else { | ||||
QAT_UTILS_LOG( | QAT_UTILS_LOG( | ||||
"No buffer defined for this instance - see cpaDcStartInstance.\n"); | "No buffer defined for this instance - " | ||||
"see cpaDcStartInstance.\n"); | |||||
return CPA_STATUS_RESOURCE; | return CPA_STATUS_RESOURCE; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if ((CPA_DC_STATEFUL == pSessionData->sessState) && | if ((CPA_DC_STATEFUL == pSessionData->sessState) && | ||||
(CPA_DC_DEFLATE == pSessionData->compType)) { | (CPA_DC_DEFLATE == pSessionData->compType)) { | ||||
/* Get the size of the context buffer */ | /* Get the size of the context buffer */ | ||||
▲ Show 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | pSessionDesc->pCompressionCb = ((void *)NULL != (void *)callbackFn) ? | ||||
LacSync_GenWakeupSyncCaller; | LacSync_GenWakeupSyncCaller; | ||||
/* Reset the pending callback counters */ | /* Reset the pending callback counters */ | ||||
qatUtilsAtomicSet(0, &pSessionDesc->pendingStatelessCbCount); | qatUtilsAtomicSet(0, &pSessionDesc->pendingStatelessCbCount); | ||||
qatUtilsAtomicSet(0, &pSessionDesc->pendingStatefulCbCount); | qatUtilsAtomicSet(0, &pSessionDesc->pendingStatefulCbCount); | ||||
pSessionDesc->pendingDpStatelessCbCount = 0; | pSessionDesc->pendingDpStatelessCbCount = 0; | ||||
if (CPA_DC_DIR_DECOMPRESS != pSessionData->sessDirection) { | if (CPA_DC_DIR_DECOMPRESS != pSessionData->sessDirection) { | ||||
if (CPA_DC_HT_FULL_DYNAMIC == pSessionData->huffType) { | if ((isDcGen2x(pService)) && | ||||
CPA_DC_HT_FULL_DYNAMIC == pSessionData->huffType) { | |||||
/* Populate the compression section of the content | /* Populate the compression section of the content | ||||
* descriptor */ | * descriptor */ | ||||
dcCompContentDescPopulate(pService, | dcCompContentDescPopulate(pService, | ||||
pSessionDesc, | pSessionDesc, | ||||
contextAddrPhys, | contextAddrPhys, | ||||
&(pSessionDesc->reqCacheComp), | &(pSessionDesc->reqCacheComp), | ||||
ICP_QAT_FW_SLICE_XLAT, | ICP_QAT_FW_SLICE_XLAT, | ||||
DC_COMPRESSION_REQUEST); | DC_COMPRESSION_REQUEST); | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | if (0 == pSessionDesc->physDataIntegrityCrcs) { | ||||
QAT_UTILS_LOG( | QAT_UTILS_LOG( | ||||
"Unable to get the physical address of Data Integrity buffer.\n"); | "Unable to get the physical address of Data Integrity buffer.\n"); | ||||
return CPA_STATUS_FAIL; | return CPA_STATUS_FAIL; | ||||
} | } | ||||
/* Initialize default CRC parameters */ | /* Initialize default CRC parameters */ | ||||
pDataIntegrityCrcs = &pSessionDesc->dataIntegrityCrcs; | pDataIntegrityCrcs = &pSessionDesc->dataIntegrityCrcs; | ||||
pDataIntegrityCrcs->crc32 = 0; | pDataIntegrityCrcs->crc32 = 0; | ||||
pDataIntegrityCrcs->adler32 = 1; | pDataIntegrityCrcs->adler32 = 1; | ||||
if (isDcGen2x(pService)) { | |||||
pDataIntegrityCrcs->oCrc32Cpr = DC_INVALID_CRC; | pDataIntegrityCrcs->oCrc32Cpr = DC_INVALID_CRC; | ||||
pDataIntegrityCrcs->iCrc32Cpr = DC_INVALID_CRC; | pDataIntegrityCrcs->iCrc32Cpr = DC_INVALID_CRC; | ||||
pDataIntegrityCrcs->oCrc32Xlt = DC_INVALID_CRC; | pDataIntegrityCrcs->oCrc32Xlt = DC_INVALID_CRC; | ||||
pDataIntegrityCrcs->iCrc32Xlt = DC_INVALID_CRC; | pDataIntegrityCrcs->iCrc32Xlt = DC_INVALID_CRC; | ||||
pDataIntegrityCrcs->xorFlags = DC_XOR_FLAGS_DEFAULT; | pDataIntegrityCrcs->xorFlags = DC_XOR_FLAGS_DEFAULT; | ||||
pDataIntegrityCrcs->crcPoly = DC_CRC_POLY_DEFAULT; | pDataIntegrityCrcs->crcPoly = DC_CRC_POLY_DEFAULT; | ||||
pDataIntegrityCrcs->xorOut = DC_XOR_OUT_DEFAULT; | pDataIntegrityCrcs->xorOut = DC_XOR_OUT_DEFAULT; | ||||
} else { | |||||
pDataIntegrityCrcs->iCrc64Cpr = DC_INVALID_CRC; | |||||
pDataIntegrityCrcs->oCrc64Cpr = DC_INVALID_CRC; | |||||
pDataIntegrityCrcs->iCrc64Xlt = DC_INVALID_CRC; | |||||
pDataIntegrityCrcs->oCrc64Xlt = DC_INVALID_CRC; | |||||
pDataIntegrityCrcs->crc64Poly = DC_CRC64_POLY_DEFAULT; | |||||
pDataIntegrityCrcs->xor64Out = DC_XOR64_OUT_DEFAULT; | |||||
} | |||||
/* Initialise seed checksums */ | /* Initialise seed checksums. | ||||
pSessionDesc->seedSwCrc.swCrcI = 0; | * It initializes swCrc32I, swCrc32O, too(union). | ||||
pSessionDesc->seedSwCrc.swCrcO = 0; | */ | ||||
pSessionDesc->seedSwCrc.swCrc64I = 0; | |||||
pSessionDesc->seedSwCrc.swCrc64O = 0; | |||||
/* Populate the cmdFlags */ | /* Populate the cmdFlags */ | ||||
switch (pSessionDesc->autoSelectBestHuffmanTree) { | switch (pSessionDesc->autoSelectBestHuffmanTree) { | ||||
case CPA_DC_ASB_DISABLED: | case CPA_DC_ASB_DISABLED: | ||||
break; | break; | ||||
case CPA_DC_ASB_STATIC_DYNAMIC: | case CPA_DC_ASB_STATIC_DYNAMIC: | ||||
autoSelectBest = ICP_QAT_FW_COMP_AUTO_SELECT_BEST; | autoSelectBest = ICP_QAT_FW_COMP_AUTO_SELECT_BEST; | ||||
break; | break; | ||||
Show All 12 Lines | dcInitSession(CpaInstanceHandle dcInstance, | ||||
} | } | ||||
rpCmdFlags = ICP_QAT_FW_COMP_REQ_PARAM_FLAGS_BUILD( | rpCmdFlags = ICP_QAT_FW_COMP_REQ_PARAM_FLAGS_BUILD( | ||||
ICP_QAT_FW_COMP_SOP, | ICP_QAT_FW_COMP_SOP, | ||||
ICP_QAT_FW_COMP_EOP, | ICP_QAT_FW_COMP_EOP, | ||||
ICP_QAT_FW_COMP_BFINAL, | ICP_QAT_FW_COMP_BFINAL, | ||||
ICP_QAT_FW_COMP_NO_CNV, | ICP_QAT_FW_COMP_NO_CNV, | ||||
ICP_QAT_FW_COMP_NO_CNV_RECOVERY, | ICP_QAT_FW_COMP_NO_CNV_RECOVERY, | ||||
ICP_QAT_FW_COMP_NO_CNV_DFX, | |||||
ICP_QAT_FW_COMP_CRC_MODE_LEGACY); | ICP_QAT_FW_COMP_CRC_MODE_LEGACY); | ||||
cmdFlags = | cmdFlags = | ||||
ICP_QAT_FW_COMP_FLAGS_BUILD(sessType, | ICP_QAT_FW_COMP_FLAGS_BUILD(sessType, | ||||
autoSelectBest, | autoSelectBest, | ||||
enhancedAutoSelectBest, | enhancedAutoSelectBest, | ||||
disableType0EnhancedAutoSelectBest, | disableType0EnhancedAutoSelectBest, | ||||
secureRam); | secureRam); | ||||
if (CPA_DC_DIR_DECOMPRESS != pSessionData->sessDirection) { | if (CPA_DC_DIR_DECOMPRESS != pSessionData->sessDirection) { | ||||
if (CPA_DC_HT_FULL_DYNAMIC == pSessionDesc->huffType) { | status = dcGetCompressCommandId(pService, | ||||
dcCmdId = (icp_qat_fw_la_cmd_id_t)( | pSessionData, | ||||
ICP_QAT_FW_COMP_CMD_DYNAMIC); | (Cpa8U *)&dcCmdId); | ||||
} | if (CPA_STATUS_SUCCESS != status) { | ||||
QAT_UTILS_LOG( | |||||
"Couldn't get compress command ID for current " | |||||
"session data."); | |||||
return status; | |||||
} | |||||
pReqCache = &(pSessionDesc->reqCacheComp); | pReqCache = &(pSessionDesc->reqCacheComp); | ||||
pReqCache->comp_pars.req_par_flags = rpCmdFlags; | pReqCache->comp_pars.req_par_flags = rpCmdFlags; | ||||
pReqCache->comp_pars.crc.legacy.initial_adler = 1; | pReqCache->comp_pars.crc.legacy.initial_adler = 1; | ||||
pReqCache->comp_pars.crc.legacy.initial_crc32 = 0; | pReqCache->comp_pars.crc.legacy.initial_crc32 = 0; | ||||
/* Populate header of the common request message */ | /* Populate header of the common request message */ | ||||
SalQatMsg_CmnHdrWrite((icp_qat_fw_comn_req_t *)pReqCache, | SalQatMsg_CmnHdrWrite((icp_qat_fw_comn_req_t *)pReqCache, | ||||
ICP_QAT_FW_COMN_REQ_CPM_FW_COMP, | ICP_QAT_FW_COMN_REQ_CPM_FW_COMP, | ||||
(uint8_t)dcCmdId, | (uint8_t)dcCmdId, | ||||
cmnRequestFlags, | cmnRequestFlags, | ||||
cmdFlags); | cmdFlags); | ||||
} | } | ||||
if (CPA_DC_DIR_COMPRESS != pSessionData->sessDirection) { | if (CPA_DC_DIR_COMPRESS != pSessionData->sessDirection) { | ||||
dcCmdId = | status = dcGetDecompressCommandId(pService, | ||||
(icp_qat_fw_la_cmd_id_t)(ICP_QAT_FW_COMP_CMD_DECOMPRESS); | pSessionData, | ||||
(Cpa8U *)&dcCmdId); | |||||
if (CPA_STATUS_SUCCESS != status) { | |||||
QAT_UTILS_LOG( | |||||
"Couldn't get decompress command ID for current " | |||||
"session data."); | |||||
return status; | |||||
} | |||||
pReqCache = &(pSessionDesc->reqCacheDecomp); | pReqCache = &(pSessionDesc->reqCacheDecomp); | ||||
pReqCache->comp_pars.req_par_flags = rpCmdFlags; | pReqCache->comp_pars.req_par_flags = rpCmdFlags; | ||||
pReqCache->comp_pars.crc.legacy.initial_adler = 1; | pReqCache->comp_pars.crc.legacy.initial_adler = 1; | ||||
pReqCache->comp_pars.crc.legacy.initial_crc32 = 0; | pReqCache->comp_pars.crc.legacy.initial_crc32 = 0; | ||||
/* Populate header of the common request message */ | /* Populate header of the common request message */ | ||||
SalQatMsg_CmnHdrWrite((icp_qat_fw_comn_req_t *)pReqCache, | SalQatMsg_CmnHdrWrite((icp_qat_fw_comn_req_t *)pReqCache, | ||||
ICP_QAT_FW_COMN_REQ_CPM_FW_COMP, | ICP_QAT_FW_COMN_REQ_CPM_FW_COMP, | ||||
Show All 37 Lines | |||||
} | } | ||||
CpaStatus | CpaStatus | ||||
cpaDcResetSession(const CpaInstanceHandle dcInstance, | cpaDcResetSession(const CpaInstanceHandle dcInstance, | ||||
CpaDcSessionHandle pSessionHandle) | CpaDcSessionHandle pSessionHandle) | ||||
{ | { | ||||
CpaStatus status = CPA_STATUS_SUCCESS; | CpaStatus status = CPA_STATUS_SUCCESS; | ||||
CpaInstanceHandle insHandle = NULL; | CpaInstanceHandle insHandle = NULL; | ||||
sal_compression_service_t *pService = NULL; | |||||
dc_session_desc_t *pSessionDesc = NULL; | dc_session_desc_t *pSessionDesc = NULL; | ||||
Cpa64U numPendingStateless = 0; | Cpa64U numPendingStateless = 0; | ||||
Cpa64U numPendingStateful = 0; | Cpa64U numPendingStateful = 0; | ||||
icp_comms_trans_handle trans_handle = NULL; | icp_comms_trans_handle trans_handle = NULL; | ||||
dc_integrity_crc_fw_t *pDataIntegrityCrcs = NULL; | |||||
dc_sw_checksums_t *pSwCrcs = NULL; | |||||
LAC_CHECK_NULL_PARAM(pSessionHandle); | LAC_CHECK_NULL_PARAM(pSessionHandle); | ||||
pSessionDesc = DC_SESSION_DESC_FROM_CTX_GET(pSessionHandle); | pSessionDesc = DC_SESSION_DESC_FROM_CTX_GET(pSessionHandle); | ||||
LAC_CHECK_NULL_PARAM(pSessionDesc); | LAC_CHECK_NULL_PARAM(pSessionDesc); | ||||
if (CPA_TRUE == pSessionDesc->isDcDp) { | if (CPA_TRUE == pSessionDesc->isDcDp) { | ||||
insHandle = dcInstance; | insHandle = dcInstance; | ||||
} else { | } else { | ||||
if (CPA_INSTANCE_HANDLE_SINGLE == dcInstance) { | if (CPA_INSTANCE_HANDLE_SINGLE == dcInstance) { | ||||
insHandle = dcGetFirstHandle(); | insHandle = dcGetFirstHandle(); | ||||
} else { | } else { | ||||
insHandle = dcInstance; | insHandle = dcInstance; | ||||
} | } | ||||
} | } | ||||
LAC_CHECK_NULL_PARAM(insHandle); | LAC_CHECK_NULL_PARAM(insHandle); | ||||
SAL_CHECK_INSTANCE_TYPE(insHandle, SAL_SERVICE_TYPE_COMPRESSION); | SAL_CHECK_INSTANCE_TYPE(insHandle, SAL_SERVICE_TYPE_COMPRESSION); | ||||
/* Check if SAL is running otherwise return an error */ | /* Check if SAL is running otherwise return an error */ | ||||
SAL_RUNNING_CHECK(insHandle); | SAL_RUNNING_CHECK(insHandle); | ||||
if (CPA_TRUE == pSessionDesc->isDcDp) { | if (CPA_TRUE == pSessionDesc->isDcDp) { | ||||
trans_handle = ((sal_compression_service_t *)dcInstance) | trans_handle = ((sal_compression_service_t *)insHandle) | ||||
->trans_handle_compression_tx; | ->trans_handle_compression_tx; | ||||
if (CPA_TRUE == icp_adf_queueDataToSend(trans_handle)) { | if (CPA_TRUE == icp_adf_queueDataToSend(trans_handle)) { | ||||
/* Process the remaining messages on the ring */ | /* Process the remaining messages on the ring */ | ||||
SalQatMsg_updateQueueTail(trans_handle); | SalQatMsg_updateQueueTail(trans_handle); | ||||
QAT_UTILS_LOG( | QAT_UTILS_LOG( | ||||
"There are remaining messages on the ring\n"); | "There are remaining messages on the ring\n"); | ||||
return CPA_STATUS_RETRY; | return CPA_STATUS_RETRY; | ||||
} | } | ||||
Show All 29 Lines | if (CPA_TRUE == pSessionDesc->isDcDp) { | ||||
/* Reset pSessionDesc */ | /* Reset pSessionDesc */ | ||||
pSessionDesc->requestType = DC_REQUEST_FIRST; | pSessionDesc->requestType = DC_REQUEST_FIRST; | ||||
pSessionDesc->cumulativeConsumedBytes = 0; | pSessionDesc->cumulativeConsumedBytes = 0; | ||||
if (CPA_DC_ADLER32 == pSessionDesc->checksumType) { | if (CPA_DC_ADLER32 == pSessionDesc->checksumType) { | ||||
pSessionDesc->previousChecksum = 1; | pSessionDesc->previousChecksum = 1; | ||||
} else { | } else { | ||||
pSessionDesc->previousChecksum = 0; | pSessionDesc->previousChecksum = 0; | ||||
} | } | ||||
pSessionDesc->cnvErrorInjection = ICP_QAT_FW_COMP_NO_CNV_DFX; | |||||
/* Reset integrity CRCs to default parameters. */ | |||||
pDataIntegrityCrcs = &pSessionDesc->dataIntegrityCrcs; | |||||
memset(pDataIntegrityCrcs, 0, sizeof(dc_integrity_crc_fw_t)); | |||||
pDataIntegrityCrcs->adler32 = 1; | |||||
pService = (sal_compression_service_t *)insHandle; | |||||
if (isDcGen2x(pService)) { | |||||
pDataIntegrityCrcs->xorFlags = DC_XOR_FLAGS_DEFAULT; | |||||
pDataIntegrityCrcs->crcPoly = DC_CRC_POLY_DEFAULT; | |||||
pDataIntegrityCrcs->xorOut = DC_XOR_OUT_DEFAULT; | |||||
} else { | |||||
pDataIntegrityCrcs->crc64Poly = DC_CRC64_POLY_DEFAULT; | |||||
pDataIntegrityCrcs->xor64Out = DC_XOR64_OUT_DEFAULT; | |||||
} | } | ||||
/* Reset seed SW checksums. */ | |||||
pSwCrcs = &pSessionDesc->seedSwCrc; | |||||
memset(pSwCrcs, 0, sizeof(dc_sw_checksums_t)); | |||||
/* Reset integrity SW checksums. */ | |||||
pSwCrcs = &pSessionDesc->integritySwCrc; | |||||
memset(pSwCrcs, 0, sizeof(dc_sw_checksums_t)); | |||||
} | |||||
/* Reset the pending callback counters */ | /* Reset the pending callback counters */ | ||||
qatUtilsAtomicSet(0, &pSessionDesc->pendingStatelessCbCount); | qatUtilsAtomicSet(0, &pSessionDesc->pendingStatelessCbCount); | ||||
qatUtilsAtomicSet(0, &pSessionDesc->pendingStatefulCbCount); | qatUtilsAtomicSet(0, &pSessionDesc->pendingStatefulCbCount); | ||||
pSessionDesc->pendingDpStatelessCbCount = 0; | pSessionDesc->pendingDpStatelessCbCount = 0; | ||||
if (CPA_DC_STATEFUL == pSessionDesc->sessState) { | if (CPA_DC_STATEFUL == pSessionDesc->sessState) { | ||||
LAC_OS_BZERO(&pSessionDesc->stateRegistersComp, | LAC_OS_BZERO(&pSessionDesc->stateRegistersComp, | ||||
sizeof(pSessionDesc->stateRegistersComp)); | sizeof(pSessionDesc->stateRegistersComp)); | ||||
LAC_OS_BZERO(&pSessionDesc->stateRegistersDecomp, | LAC_OS_BZERO(&pSessionDesc->stateRegistersDecomp, | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | if (CPA_TRUE == pSessionDesc->isDcDp) { | ||||
if (0 != numPendingStateful) { | if (0 != numPendingStateful) { | ||||
QAT_UTILS_LOG( | QAT_UTILS_LOG( | ||||
"There are %llu stateful requests pending.\n", | "There are %llu stateful requests pending.\n", | ||||
(unsigned long long)numPendingStateful); | (unsigned long long)numPendingStateful); | ||||
status = CPA_STATUS_RETRY; | status = CPA_STATUS_RETRY; | ||||
} | } | ||||
if ((CPA_DC_STATEFUL == pSessionDesc->sessState) && | if ((CPA_DC_STATEFUL == pSessionDesc->sessState) && | ||||
(CPA_STATUS_SUCCESS == status)) { | (CPA_STATUS_SUCCESS == status)) { | ||||
if (CPA_STATUS_SUCCESS != | LAC_SPINLOCK_DESTROY(&(pSessionDesc->sessionLock)); | ||||
LAC_SPINLOCK_DESTROY( | |||||
&(pSessionDesc->sessionLock))) { | |||||
QAT_UTILS_LOG( | |||||
"Failed to destory session lock.\n"); | |||||
} | } | ||||
} | } | ||||
} | |||||
return status; | return status; | ||||
} | } | ||||
CpaStatus | CpaStatus | ||||
dcGetSessionSize(CpaInstanceHandle dcInstance, | dcGetSessionSize(CpaInstanceHandle dcInstance, | ||||
CpaDcSessionSetupData *pSessionData, | CpaDcSessionSetupData *pSessionData, | ||||
Cpa32U *pSessionSize, | Cpa32U *pSessionSize, | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
LAC_CHECK_NULL_PARAM(pContextSize); | LAC_CHECK_NULL_PARAM(pContextSize); | ||||
return dcGetSessionSize(dcInstance, | return dcGetSessionSize(dcInstance, | ||||
pSessionData, | pSessionData, | ||||
pSessionSize, | pSessionSize, | ||||
pContextSize); | pContextSize); | ||||
} | |||||
CpaStatus | |||||
dcSetCnvError(CpaInstanceHandle dcInstance, CpaDcSessionHandle pSessionHandle) | |||||
{ | |||||
LAC_CHECK_NULL_PARAM(pSessionHandle); | |||||
dc_session_desc_t *pSessionDesc = NULL; | |||||
CpaInstanceHandle insHandle = NULL; | |||||
sal_compression_service_t *pService = NULL; | |||||
if (CPA_INSTANCE_HANDLE_SINGLE == dcInstance) { | |||||
insHandle = dcGetFirstHandle(); | |||||
} else { | |||||
insHandle = dcInstance; | |||||
} | |||||
pService = (sal_compression_service_t *)insHandle; | |||||
if (isDcGen2x(pService)) { | |||||
QAT_UTILS_LOG("Unsupported compression feature.\n"); | |||||
return CPA_STATUS_UNSUPPORTED; | |||||
} | |||||
pSessionDesc = DC_SESSION_DESC_FROM_CTX_GET(pSessionHandle); | |||||
LAC_CHECK_NULL_PARAM(pSessionDesc); | |||||
pSessionDesc->cnvErrorInjection = ICP_QAT_FW_COMP_CNV_DFX; | |||||
return CPA_STATUS_SUCCESS; | |||||
} | } |