| NVIDIA DOCA SDK | Data Center on a Chip Framework Documentation |
#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#include <time.h>#include <doca_buf.h>#include <doca_ctx.h>#include <doca_log.h>#include <doca_error.h>#include <doca_pe.h>#include <doca_argp.h>#include <doca_compress.h>#include "../common.h"#include "compress_common.h"
Go to the source code of this file.
Data Structures | |
| struct | compress_deflate_result |
| struct | compress_lz4_result |
Macros | |
| #define | ZLIB_CMF_CM 8 /* Compression Method - DEFLATE compression */ |
| #define | ZLIB_CMF_CINFO |
| #define | ZLIB_CMF_CM_MASK 0x0F /* Mask for Compression Method bits in the CMF byte */ |
| #define | ZLIB_CMF_CINFO_MASK 0xF0 /* Mask for Compression Info bits in the CMF byte */ |
| #define | ZLIB_CMF_CINFO_SHIFT 4 /* Shift for Compression Info bits in the CMF byte */ |
| #define | ZLIB_FLG_FLEVEL 2 /* Use the default algorithm for the DEFLATE compression method (CM=8) */ |
| #define | ZLIB_FLG_FDICT |
| #define | ZLIB_FLG_FCHECK_MASK 0x1F /* Mask for FCHECK bits in the FLG byte */ |
| #define | ZLIB_FLG_FDICT_MASK 0x20 /* Mask for FDICT flag in the FLG byte */ |
| #define | ZLIB_FLG_FDICT_SHIFT 5 /* Shift for FDICT flag in the FLG byte */ |
| #define | ZLIB_FLG_FLEVEL_MASK 0xC0 /* Mask for FLEVEL bits in the FLG byte */ |
| #define | ZLIB_FLG_FLEVEL_SHIFT 6 /* Shift for FLEVEL bits in the FLG byte */ |
| #define | LZ4_MAGIC_NUMBER 0x184D2204 /* Magic number for LZ4 files */ |
| #define | LZ4_VERSION_NUMER 0x01 /* The LZ4 frame format version */ |
| #define | LZ4_FLAGS_DICT_ID_MASK 0x1 /* Mask for dictionary ID bits in the FLG byte */ |
| #define | LZ4_FLAGS_CONTENT_CHECKSUM_SHIFT 2 /* Shift for content checksum flag bit in the FLG byte */ |
| #define | LZ4_FLAGS_CONTENT_CHECKSUM_MASK 0x4 /* Mask for content checksum flag bit in the FLG byte */ |
| #define | LZ4_FLAGS_CONTENT_SIZE_SHIFT 3 /* Shift for content size flag bit in the FLG byte */ |
| #define | LZ4_FLAGS_CONTENT_SIZE_MASK 0x8 /* Mask for content size flag bit in the FLG byte */ |
| #define | LZ4_FLAGS_BLOCK_CHECKSUM_SHIFT 4 /* Shift for block checksum flag bit in the FLG byte */ |
| #define | LZ4_FLAGS_BLOCK_CHECKSUM_MASK 0x10 /* Mask for block checksum flag bit in the FLG byte */ |
| #define | LZ4_FLAGS_BLOCK_INDEPENDENT_SHIFT 5 /* Shift for block independent flag bit in the FLG byte */ |
| #define | LZ4_FLAGS_BLOCK_INDEPENDENT_MASK 0x20 /* Mask for block independent flag bit in the FLG byte */ |
| #define | LZ4_FLAGS_VERSION_NUMBER_SHIFT 6 /* Shift for version number bits in the FLG byte */ |
| #define | LZ4_FLAGS_VERSION_NUMBER_MASK 0xC0 /* Mask for version number bits in the FLG byte */ |
| #define | LZ4_END_MARK_LEN 4 /* The length of the end mark */ |
Functions | |
| DOCA_LOG_REGISTER (COMPRESS::COMMON) | |
| static doca_error_t | pci_address_callback (void *param, void *config) |
| static doca_error_t | file_callback (void *param, void *config) |
| static doca_error_t | output_callback (void *param, void *config) |
| static doca_error_t | output_checksum_callback (void *param, void *config) |
| doca_error_t | register_compress_params (void) |
| static doca_error_t | is_with_frame_callback (void *param, void *config) |
| doca_error_t | register_deflate_params (void) |
| static doca_error_t | has_block_checksum_callback (void *param, void *config) |
| static doca_error_t | are_blocks_independent_callback (void *param, void *config) |
| doca_error_t | register_lz4_stream_params (void) |
| static uint8_t | compute_zlib_header_fcheck (struct compress_zlib_header *zlib_header) |
| void | init_compress_zlib_header (struct compress_zlib_header *zlib_header) |
| doca_error_t | verify_compress_zlib_header (struct compress_zlib_header *zlib_header) |
| doca_error_t | parse_lz4_frame (struct doca_buf *src_buf, struct compress_cfg *cfg, bool *has_content_checksum, uint32_t *content_checksum) |
| static void | compress_state_changed_callback (const union doca_data user_data, struct doca_ctx *ctx, enum doca_ctx_states prev_state, enum doca_ctx_states next_state) |
| doca_error_t | allocate_compress_resources (const char *pci_addr, uint32_t max_bufs, struct compress_resources *resources) |
| doca_error_t | destroy_compress_resources (struct compress_resources *resources) |
| static uint64_t | calculate_checksum (uint32_t crc_checksum, uint32_t adler_checksum) |
| doca_error_t | submit_compress_deflate_task (struct compress_resources *resources, struct doca_buf *src_buf, struct doca_buf *dst_buf, uint64_t *output_checksum) |
| doca_error_t | submit_decompress_deflate_task (struct compress_resources *resources, struct doca_buf *src_buf, struct doca_buf *dst_buf, uint64_t *output_checksum) |
| doca_error_t | submit_decompress_lz4_stream_task (struct compress_resources *resources, uint8_t has_block_checksum, uint8_t are_blocks_independent, struct doca_buf *src_buf, struct doca_buf *dst_buf, uint32_t *output_crc_checksum, uint32_t *output_xxh_checksum) |
| doca_error_t | compress_task_compress_deflate_is_supported (struct doca_devinfo *devinfo) |
| doca_error_t | compress_task_decompress_deflate_is_supported (struct doca_devinfo *devinfo) |
| doca_error_t | compress_task_decompress_lz4_stream_is_supported (struct doca_devinfo *devinfo) |
| void | compress_completed_callback (struct doca_compress_task_compress_deflate *compress_task, union doca_data task_user_data, union doca_data ctx_user_data) |
| void | compress_error_callback (struct doca_compress_task_compress_deflate *compress_task, union doca_data task_user_data, union doca_data ctx_user_data) |
| void | decompress_deflate_completed_callback (struct doca_compress_task_decompress_deflate *decompress_task, union doca_data task_user_data, union doca_data ctx_user_data) |
| void | decompress_deflate_error_callback (struct doca_compress_task_decompress_deflate *decompress_task, union doca_data task_user_data, union doca_data ctx_user_data) |
| void | decompress_lz4_stream_completed_callback (struct doca_compress_task_decompress_lz4_stream *decompress_task, union doca_data task_user_data, union doca_data ctx_user_data) |
| void | decompress_lz4_stream_error_callback (struct doca_compress_task_decompress_lz4_stream *decompress_task, union doca_data task_user_data, union doca_data ctx_user_data) |
| #define LZ4_END_MARK_LEN 4 /* The length of the end mark */ |
Definition at line 85 of file compress_common.c.
| #define LZ4_FLAGS_BLOCK_CHECKSUM_MASK 0x10 /* Mask for block checksum flag bit in the FLG byte */ |
Definition at line 79 of file compress_common.c.
| #define LZ4_FLAGS_BLOCK_CHECKSUM_SHIFT 4 /* Shift for block checksum flag bit in the FLG byte */ |
Definition at line 78 of file compress_common.c.
| #define LZ4_FLAGS_BLOCK_INDEPENDENT_MASK 0x20 /* Mask for block independent flag bit in the FLG byte */ |
Definition at line 81 of file compress_common.c.
| #define LZ4_FLAGS_BLOCK_INDEPENDENT_SHIFT 5 /* Shift for block independent flag bit in the FLG byte */ |
Definition at line 80 of file compress_common.c.
| #define LZ4_FLAGS_CONTENT_CHECKSUM_MASK 0x4 /* Mask for content checksum flag bit in the FLG byte */ |
Definition at line 75 of file compress_common.c.
| #define LZ4_FLAGS_CONTENT_CHECKSUM_SHIFT 2 /* Shift for content checksum flag bit in the FLG byte */ |
Definition at line 74 of file compress_common.c.
| #define LZ4_FLAGS_CONTENT_SIZE_MASK 0x8 /* Mask for content size flag bit in the FLG byte */ |
Definition at line 77 of file compress_common.c.
| #define LZ4_FLAGS_CONTENT_SIZE_SHIFT 3 /* Shift for content size flag bit in the FLG byte */ |
Definition at line 76 of file compress_common.c.
| #define LZ4_FLAGS_DICT_ID_MASK 0x1 /* Mask for dictionary ID bits in the FLG byte */ |
Definition at line 73 of file compress_common.c.
| #define LZ4_FLAGS_VERSION_NUMBER_MASK 0xC0 /* Mask for version number bits in the FLG byte */ |
Definition at line 83 of file compress_common.c.
| #define LZ4_FLAGS_VERSION_NUMBER_SHIFT 6 /* Shift for version number bits in the FLG byte */ |
Definition at line 82 of file compress_common.c.
| #define LZ4_MAGIC_NUMBER 0x184D2204 /* Magic number for LZ4 files */ |
Definition at line 70 of file compress_common.c.
| #define LZ4_VERSION_NUMER 0x01 /* The LZ4 frame format version */ |
Definition at line 71 of file compress_common.c.
| #define ZLIB_CMF_CINFO |
Definition at line 49 of file compress_common.c.
| #define ZLIB_CMF_CINFO_MASK 0xF0 /* Mask for Compression Info bits in the CMF byte */ |
Definition at line 52 of file compress_common.c.
| #define ZLIB_CMF_CINFO_SHIFT 4 /* Shift for Compression Info bits in the CMF byte */ |
Definition at line 53 of file compress_common.c.
| #define ZLIB_CMF_CM 8 /* Compression Method - DEFLATE compression */ |
Definition at line 48 of file compress_common.c.
| #define ZLIB_CMF_CM_MASK 0x0F /* Mask for Compression Method bits in the CMF byte */ |
Definition at line 51 of file compress_common.c.
| #define ZLIB_FLG_FCHECK_MASK 0x1F /* Mask for FCHECK bits in the FLG byte */ |
Definition at line 61 of file compress_common.c.
| #define ZLIB_FLG_FDICT |
Definition at line 59 of file compress_common.c.
| #define ZLIB_FLG_FDICT_MASK 0x20 /* Mask for FDICT flag in the FLG byte */ |
Definition at line 62 of file compress_common.c.
| #define ZLIB_FLG_FDICT_SHIFT 5 /* Shift for FDICT flag in the FLG byte */ |
Definition at line 63 of file compress_common.c.
| #define ZLIB_FLG_FLEVEL 2 /* Use the default algorithm for the DEFLATE compression method (CM=8) */ |
Definition at line 58 of file compress_common.c.
| #define ZLIB_FLG_FLEVEL_MASK 0xC0 /* Mask for FLEVEL bits in the FLG byte */ |
Definition at line 64 of file compress_common.c.
| #define ZLIB_FLG_FLEVEL_SHIFT 6 /* Shift for FLEVEL bits in the FLG byte */ |
Definition at line 65 of file compress_common.c.
| doca_error_t allocate_compress_resources | ( | const char * | pci_addr, |
| uint32_t | max_bufs, | ||
| struct compress_resources * | resources | ||
| ) |
Definition at line 659 of file compress_common.c.
|
static |
Definition at line 333 of file compress_common.c.
|
static |
Definition at line 832 of file compress_common.c.
| void compress_completed_callback | ( | struct doca_compress_task_compress_deflate * | compress_task, |
| union doca_data | task_user_data, | ||
| union doca_data | ctx_user_data | ||
| ) |
Definition at line 1043 of file compress_common.c.
| void compress_error_callback | ( | struct doca_compress_task_compress_deflate * | compress_task, |
| union doca_data | task_user_data, | ||
| union doca_data | ctx_user_data | ||
| ) |
Definition at line 1066 of file compress_common.c.
|
static |
Callback triggered whenever Compress context state changes
@user_data [in]: User data associated with the Compress context. Will hold struct compress_resources * @ctx [in]: The Compress context that had a state change @prev_state [in]: Previous context state @next_state [in]: Next context state (context is already in this state when the callback is called)
The context is in starting state, this is unexpected for Compress.
doca_ctx_stop() has been called. In this sample, this happens either due to a failure encountered, in which case doca_pe_progress() will cause any inflight task to be flushed, or due to the successful compilation of the sample flow. In both cases, in this sample, doca_pe_progress() will eventually transition the context to idle state.
Definition at line 618 of file compress_common.c.
| doca_error_t compress_task_compress_deflate_is_supported | ( | struct doca_devinfo * | devinfo | ) |
Definition at line 1028 of file compress_common.c.
| doca_error_t compress_task_decompress_deflate_is_supported | ( | struct doca_devinfo * | devinfo | ) |
Definition at line 1033 of file compress_common.c.
| doca_error_t compress_task_decompress_lz4_stream_is_supported | ( | struct doca_devinfo * | devinfo | ) |
Definition at line 1038 of file compress_common.c.
|
inlinestatic |
Definition at line 418 of file compress_common.c.
| void decompress_deflate_completed_callback | ( | struct doca_compress_task_decompress_deflate * | decompress_task, |
| union doca_data | task_user_data, | ||
| union doca_data | ctx_user_data | ||
| ) |
Definition at line 1086 of file compress_common.c.
| void decompress_deflate_error_callback | ( | struct doca_compress_task_decompress_deflate * | decompress_task, |
| union doca_data | task_user_data, | ||
| union doca_data | ctx_user_data | ||
| ) |
Definition at line 1109 of file compress_common.c.
| void decompress_lz4_stream_completed_callback | ( | struct doca_compress_task_decompress_lz4_stream * | decompress_task, |
| union doca_data | task_user_data, | ||
| union doca_data | ctx_user_data | ||
| ) |
Definition at line 1129 of file compress_common.c.
| void decompress_lz4_stream_error_callback | ( | struct doca_compress_task_decompress_lz4_stream * | decompress_task, |
| union doca_data | task_user_data, | ||
| union doca_data | ctx_user_data | ||
| ) |
Definition at line 1152 of file compress_common.c.
| doca_error_t destroy_compress_resources | ( | struct compress_resources * | resources | ) |
Definition at line 793 of file compress_common.c.
| DOCA_LOG_REGISTER | ( | COMPRESS::COMMON | ) |
|
static |
Definition at line 131 of file compress_common.c.
|
static |
Definition at line 316 of file compress_common.c.
| void init_compress_zlib_header | ( | struct compress_zlib_header * | zlib_header | ) |
Definition at line 429 of file compress_common.c.
|
static |
Definition at line 269 of file compress_common.c.
|
static |
Definition at line 153 of file compress_common.c.
|
static |
Definition at line 175 of file compress_common.c.
| doca_error_t parse_lz4_frame | ( | struct doca_buf * | src_buf, |
| struct compress_cfg * | cfg, | ||
| bool * | has_content_checksum, | ||
| uint32_t * | content_checksum | ||
| ) |
Definition at line 487 of file compress_common.c.
|
static |
Definition at line 108 of file compress_common.c.
| doca_error_t register_compress_params | ( | void | ) |
Definition at line 190 of file compress_common.c.
| doca_error_t register_deflate_params | ( | void | ) |
Definition at line 284 of file compress_common.c.
| doca_error_t register_lz4_stream_params | ( | void | ) |
Definition at line 348 of file compress_common.c.
| doca_error_t submit_compress_deflate_task | ( | struct compress_resources * | resources, |
| struct doca_buf * | src_buf, | ||
| struct doca_buf * | dst_buf, | ||
| uint64_t * | output_checksum | ||
| ) |
Definition at line 843 of file compress_common.c.
| doca_error_t submit_decompress_deflate_task | ( | struct compress_resources * | resources, |
| struct doca_buf * | src_buf, | ||
| struct doca_buf * | dst_buf, | ||
| uint64_t * | output_checksum | ||
| ) |
Definition at line 902 of file compress_common.c.
| doca_error_t submit_decompress_lz4_stream_task | ( | struct compress_resources * | resources, |
| uint8_t | has_block_checksum, | ||
| uint8_t | are_blocks_independent, | ||
| struct doca_buf * | src_buf, | ||
| struct doca_buf * | dst_buf, | ||
| uint32_t * | output_crc_checksum, | ||
| uint32_t * | output_xxh_checksum | ||
| ) |
Definition at line 961 of file compress_common.c.
| doca_error_t verify_compress_zlib_header | ( | struct compress_zlib_header * | zlib_header | ) |
Definition at line 444 of file compress_common.c.