DPDK  24.11.0
Data Structures | Macros | Enumerations | Functions
rte_comp.h File Reference
#include <rte_mbuf.h>

Go to the source code of this file.

Data Structures

struct  rte_comp_deflate_params
 
struct  rte_comp_lz4_params
 
struct  rte_comp_compress_xform
 
struct  rte_comp_decompress_xform
 
struct  rte_comp_xform
 
struct  rte_comp_op
 

Macros

#define RTE_COMP_FF_STATEFUL_COMPRESSION   (1ULL << 0)
 
#define RTE_COMP_FF_STATEFUL_DECOMPRESSION   (1ULL << 1)
 
#define RTE_COMP_FF_OOP_SGL_IN_SGL_OUT   (1ULL << 2)
 
#define RTE_COMP_FF_OOP_SGL_IN_LB_OUT   (1ULL << 3)
 
#define RTE_COMP_FF_OOP_LB_IN_SGL_OUT   (1ULL << 4)
 
#define RTE_COMP_FF_ADLER32_CHECKSUM   (1ULL << 5)
 
#define RTE_COMP_FF_CRC32_CHECKSUM   (1ULL << 6)
 
#define RTE_COMP_FF_CRC32_ADLER32_CHECKSUM   (1ULL << 7)
 
#define RTE_COMP_FF_MULTI_PKT_CHECKSUM   (1ULL << 8)
 
#define RTE_COMP_FF_SHA1_HASH   (1ULL << 9)
 
#define RTE_COMP_FF_SHA2_SHA256_HASH   (1ULL << 10)
 
#define RTE_COMP_FF_NONCOMPRESSED_BLOCKS   (1ULL << 11)
 
#define RTE_COMP_FF_SHAREABLE_PRIV_XFORM   (1ULL << 12)
 
#define RTE_COMP_FF_HUFFMAN_FIXED   (1ULL << 13)
 
#define RTE_COMP_FF_HUFFMAN_DYNAMIC   (1ULL << 14)
 
#define RTE_COMP_FF_XXHASH32_CHECKSUM   (1ULL << 15)
 
#define RTE_COMP_FF_LZ4_DICT_ID   (1ULL << 16)
 
#define RTE_COMP_FF_LZ4_CONTENT_WITH_CHECKSUM   (1ULL << 17)
 
#define RTE_COMP_FF_LZ4_CONTENT_SIZE   (1ULL << 18)
 
#define RTE_COMP_FF_LZ4_BLOCK_INDEPENDENCE   (1ULL << 19)
 
#define RTE_COMP_FF_LZ4_BLOCK_WITH_CHECKSUM   (1ULL << 20)
 
#define RTE_COMP_LEVEL_NONE   (0)
 
#define RTE_COMP_LEVEL_MIN   (1)
 
#define RTE_COMP_LEVEL_MAX   (9)
 
#define RTE_COMP_LZ4_FLAG_DICT_ID   (1 << 0)
 
#define RTE_COMP_LZ4_FLAG_CONTENT_CHECKSUM   (1 << 2)
 
#define RTE_COMP_LZ4_FLAG_CONTENT_SIZE   (1 << 3)
 
#define RTE_COMP_LZ4_FLAG_BLOCK_CHECKSUM   (1 << 4)
 
#define RTE_COMP_LZ4_FLAG_BLOCK_INDEPENDENCE   (1 << 5)
 

Enumerations

enum  rte_comp_op_status {
  RTE_COMP_OP_STATUS_SUCCESS = 0, RTE_COMP_OP_STATUS_NOT_PROCESSED, RTE_COMP_OP_STATUS_INVALID_ARGS, RTE_COMP_OP_STATUS_ERROR,
  RTE_COMP_OP_STATUS_INVALID_STATE, RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED, RTE_COMP_OP_STATUS_OUT_OF_SPACE_RECOVERABLE
}
 
enum  rte_comp_algorithm { , RTE_COMP_ALGO_NULL, RTE_COMP_ALGO_DEFLATE, RTE_COMP_ALGO_LZS, RTE_COMP_ALGO_LZ4 }
 
enum  rte_comp_hash_algorithm { RTE_COMP_HASH_ALGO_NONE = 0, RTE_COMP_HASH_ALGO_SHA1, RTE_COMP_HASH_ALGO_SHA2_256 }
 
enum  rte_comp_checksum_type {
  RTE_COMP_CHECKSUM_NONE, RTE_COMP_CHECKSUM_CRC32, RTE_COMP_CHECKSUM_ADLER32, RTE_COMP_CHECKSUM_CRC32_ADLER32,
  RTE_COMP_CHECKSUM_XXHASH32
}
 
enum  rte_comp_huffman { RTE_COMP_HUFFMAN_DEFAULT, RTE_COMP_HUFFMAN_FIXED, RTE_COMP_HUFFMAN_DYNAMIC }
 
enum  rte_comp_flush_flag { RTE_COMP_FLUSH_NONE, RTE_COMP_FLUSH_SYNC, RTE_COMP_FLUSH_FULL, RTE_COMP_FLUSH_FINAL }
 
enum  rte_comp_xform_type { RTE_COMP_COMPRESS, RTE_COMP_DECOMPRESS }
 
enum  rte_comp_op_type { RTE_COMP_OP_STATELESS, RTE_COMP_OP_STATEFUL }
 

Functions

struct rte_mempoolrte_comp_op_pool_create (const char *name, unsigned int nb_elts, unsigned int cache_size, uint16_t user_size, int socket_id)
 
struct rte_comp_oprte_comp_op_alloc (struct rte_mempool *mempool)
 
int rte_comp_op_bulk_alloc (struct rte_mempool *mempool, struct rte_comp_op **ops, uint16_t nb_ops)
 
void rte_comp_op_free (struct rte_comp_op *op)
 
void rte_comp_op_bulk_free (struct rte_comp_op **ops, uint16_t nb_ops)
 
const char * rte_comp_get_feature_name (uint64_t flag)
 

Detailed Description

RTE definitions for Data Compression Service

Definition in file rte_comp.h.

Macro Definition Documentation

◆ RTE_COMP_FF_STATEFUL_COMPRESSION

#define RTE_COMP_FF_STATEFUL_COMPRESSION   (1ULL << 0)

compression service feature flags

Note
New features flags should be added to the end of the list

Keep these flags synchronised with rte_comp_get_feature_name()Stateful compression is supported

Definition at line 27 of file rte_comp.h.

◆ RTE_COMP_FF_STATEFUL_DECOMPRESSION

#define RTE_COMP_FF_STATEFUL_DECOMPRESSION   (1ULL << 1)

Stateful decompression is supported

Definition at line 29 of file rte_comp.h.

◆ RTE_COMP_FF_OOP_SGL_IN_SGL_OUT

#define RTE_COMP_FF_OOP_SGL_IN_SGL_OUT   (1ULL << 2)

Out-of-place Scatter-gather (SGL) buffers, with multiple segments, are supported in input and output

Definition at line 31 of file rte_comp.h.

◆ RTE_COMP_FF_OOP_SGL_IN_LB_OUT

#define RTE_COMP_FF_OOP_SGL_IN_LB_OUT   (1ULL << 3)

Out-of-place Scatter-gather (SGL) buffers are supported in input, combined with linear buffers (LB), with a single segment, in output

Definition at line 35 of file rte_comp.h.

◆ RTE_COMP_FF_OOP_LB_IN_SGL_OUT

#define RTE_COMP_FF_OOP_LB_IN_SGL_OUT   (1ULL << 4)

Out-of-place Scatter-gather (SGL) buffers are supported in output, combined with linear buffers (LB) in input

Definition at line 40 of file rte_comp.h.

◆ RTE_COMP_FF_ADLER32_CHECKSUM

#define RTE_COMP_FF_ADLER32_CHECKSUM   (1ULL << 5)

Adler-32 Checksum is supported

Definition at line 44 of file rte_comp.h.

◆ RTE_COMP_FF_CRC32_CHECKSUM

#define RTE_COMP_FF_CRC32_CHECKSUM   (1ULL << 6)

CRC32 Checksum is supported

Definition at line 46 of file rte_comp.h.

◆ RTE_COMP_FF_CRC32_ADLER32_CHECKSUM

#define RTE_COMP_FF_CRC32_ADLER32_CHECKSUM   (1ULL << 7)

Adler-32/CRC32 Checksum is supported

Definition at line 48 of file rte_comp.h.

◆ RTE_COMP_FF_MULTI_PKT_CHECKSUM

#define RTE_COMP_FF_MULTI_PKT_CHECKSUM   (1ULL << 8)

Generation of checksum across multiple stateless packets is supported

Definition at line 50 of file rte_comp.h.

◆ RTE_COMP_FF_SHA1_HASH

#define RTE_COMP_FF_SHA1_HASH   (1ULL << 9)

SHA1 Hash is supported

Definition at line 52 of file rte_comp.h.

◆ RTE_COMP_FF_SHA2_SHA256_HASH

#define RTE_COMP_FF_SHA2_SHA256_HASH   (1ULL << 10)

SHA256 Hash of SHA2 family is supported

Definition at line 54 of file rte_comp.h.

◆ RTE_COMP_FF_NONCOMPRESSED_BLOCKS

#define RTE_COMP_FF_NONCOMPRESSED_BLOCKS   (1ULL << 11)

Creation of non-compressed blocks using RTE_COMP_LEVEL_NONE is supported

Definition at line 56 of file rte_comp.h.

◆ RTE_COMP_FF_SHAREABLE_PRIV_XFORM

#define RTE_COMP_FF_SHAREABLE_PRIV_XFORM   (1ULL << 12)

Private xforms created by the PMD can be shared across multiple stateless operations. If not set, then app needs to create as many priv_xforms as it expects to have stateless operations in-flight.

Definition at line 58 of file rte_comp.h.

◆ RTE_COMP_FF_HUFFMAN_FIXED

#define RTE_COMP_FF_HUFFMAN_FIXED   (1ULL << 13)

Fixed huffman encoding is supported

Definition at line 64 of file rte_comp.h.

◆ RTE_COMP_FF_HUFFMAN_DYNAMIC

#define RTE_COMP_FF_HUFFMAN_DYNAMIC   (1ULL << 14)

Dynamic huffman encoding is supported

Definition at line 66 of file rte_comp.h.

◆ RTE_COMP_FF_XXHASH32_CHECKSUM

#define RTE_COMP_FF_XXHASH32_CHECKSUM   (1ULL << 15)

xxHash-32 Checksum is supported

Definition at line 68 of file rte_comp.h.

◆ RTE_COMP_FF_LZ4_DICT_ID

#define RTE_COMP_FF_LZ4_DICT_ID   (1ULL << 16)

LZ4 dictionary ID is supported

Definition at line 70 of file rte_comp.h.

◆ RTE_COMP_FF_LZ4_CONTENT_WITH_CHECKSUM

#define RTE_COMP_FF_LZ4_CONTENT_WITH_CHECKSUM   (1ULL << 17)

LZ4 content with checksum is supported

Definition at line 72 of file rte_comp.h.

◆ RTE_COMP_FF_LZ4_CONTENT_SIZE

#define RTE_COMP_FF_LZ4_CONTENT_SIZE   (1ULL << 18)

LZ4 content size is supported

Definition at line 74 of file rte_comp.h.

◆ RTE_COMP_FF_LZ4_BLOCK_INDEPENDENCE

#define RTE_COMP_FF_LZ4_BLOCK_INDEPENDENCE   (1ULL << 19)

LZ4 block independent is supported

Definition at line 76 of file rte_comp.h.

◆ RTE_COMP_FF_LZ4_BLOCK_WITH_CHECKSUM

#define RTE_COMP_FF_LZ4_BLOCK_WITH_CHECKSUM   (1ULL << 20)

LZ4 block with checksum is supported

Definition at line 78 of file rte_comp.h.

◆ RTE_COMP_LEVEL_NONE

#define RTE_COMP_LEVEL_NONE   (0)

Use PMD Default

Definition at line 145 of file rte_comp.h.

◆ RTE_COMP_LEVEL_MIN

#define RTE_COMP_LEVEL_MIN   (1)

Output uncompressed blocks if supported by the specified algorithm

Definition at line 147 of file rte_comp.h.

◆ RTE_COMP_LEVEL_MAX

#define RTE_COMP_LEVEL_MAX   (9)

Use minimum compression level supported by the PMD

Definition at line 149 of file rte_comp.h.

◆ RTE_COMP_LZ4_FLAG_DICT_ID

#define RTE_COMP_LZ4_FLAG_DICT_ID   (1 << 0)

Dictionary ID flag If this flag is set, a 4-byte dict-ID field will be present, after the descriptor flags and the content size.

Definition at line 237 of file rte_comp.h.

◆ RTE_COMP_LZ4_FLAG_CONTENT_CHECKSUM

#define RTE_COMP_LZ4_FLAG_CONTENT_CHECKSUM   (1 << 2)

Content checksum flag If this flag is set, a 32-bit content checksum will be appended after the end mark.

Definition at line 244 of file rte_comp.h.

◆ RTE_COMP_LZ4_FLAG_CONTENT_SIZE

#define RTE_COMP_LZ4_FLAG_CONTENT_SIZE   (1 << 3)

Content size flag If this flag is set, the uncompressed size of data included within the frame will be present as an 8-byte unsigned little-endian value, after the flags. Content size usage is optional.

Definition at line 252 of file rte_comp.h.

◆ RTE_COMP_LZ4_FLAG_BLOCK_CHECKSUM

#define RTE_COMP_LZ4_FLAG_BLOCK_CHECKSUM   (1 << 4)

Block checksum flag. If this flag is set, each data block will be followed by a 4-byte checksum, calculated with the xxHash-32 algorithm on the raw (compressed) data block. The intent is to detect data corruption (storage or transmission errors) immediately, before decoding. Block checksum usage is optional.

Definition at line 262 of file rte_comp.h.

◆ RTE_COMP_LZ4_FLAG_BLOCK_INDEPENDENCE

#define RTE_COMP_LZ4_FLAG_BLOCK_INDEPENDENCE   (1 << 5)

Block independence flag. If this flag is set to 1, blocks are independent. If this flag is set to 0, each block depends on previous ones (up to LZ4 window size, which is 64 KB). In such case, it is necessary to decode all blocks in sequence. Block dependency improves compression ratio, especially for small blocks. On the other hand, it makes random access or multi-threaded decoding impossible.

Definition at line 273 of file rte_comp.h.

Enumeration Type Documentation

◆ rte_comp_op_status

Status of comp operation

Enumerator
RTE_COMP_OP_STATUS_SUCCESS 

Operation completed successfully

RTE_COMP_OP_STATUS_NOT_PROCESSED 

Operation has not yet been processed by the device

RTE_COMP_OP_STATUS_INVALID_ARGS 

Operation failed due to invalid arguments in request

RTE_COMP_OP_STATUS_ERROR 

Error handling operation

RTE_COMP_OP_STATUS_INVALID_STATE 

Operation is invoked in invalid state

RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED 

Output buffer ran out of space before operation completed. Error case. Application must resubmit all data with a larger output buffer.

RTE_COMP_OP_STATUS_OUT_OF_SPACE_RECOVERABLE 

Output buffer ran out of space before operation completed, but this is not an error case. Output data up to op.produced can be used and next op in the stream should continue on from op.consumed+1.

Definition at line 82 of file rte_comp.h.

◆ rte_comp_algorithm

Compression Algorithms

Enumerator
RTE_COMP_ALGO_NULL 

No Compression algorithm No compression. Pass-through, data is copied unchanged from source buffer to destination buffer.

RTE_COMP_ALGO_DEFLATE 

DEFLATE compression algorithm https://tools.ietf.org/html/rfc1951

RTE_COMP_ALGO_LZS 

LZS compression algorithm https://tools.ietf.org/html/rfc2395

RTE_COMP_ALGO_LZ4 

LZ4 compression algorithm https://github.com/lz4/lz4

Definition at line 106 of file rte_comp.h.

◆ rte_comp_hash_algorithm

Compression Hash Algorithms

Enumerator
RTE_COMP_HASH_ALGO_NONE 

No hash

RTE_COMP_HASH_ALGO_SHA1 

SHA1 hash algorithm

RTE_COMP_HASH_ALGO_SHA2_256 

SHA256 hash algorithm of SHA2 family

Definition at line 129 of file rte_comp.h.

◆ rte_comp_checksum_type

Use maximum compression level supported by the PMD Compression checksum types

Enumerator
RTE_COMP_CHECKSUM_NONE 

No checksum generated

RTE_COMP_CHECKSUM_CRC32 

Generates a CRC32 checksum, as used by gzip

RTE_COMP_CHECKSUM_ADLER32 

Generates an Adler-32 checksum, as used by zlib

RTE_COMP_CHECKSUM_CRC32_ADLER32 

Generates both Adler-32 and CRC32 checksums, concatenated. CRC32 is in the lower 32bits, Adler-32 in the upper 32 bits.

RTE_COMP_CHECKSUM_XXHASH32 

Generates a xxHash-32 checksum, as used by LZ4. https://github.com/Cyan4973/xxHash/blob/dev/doc/xxhash_spec.md

Definition at line 153 of file rte_comp.h.

◆ rte_comp_huffman

Compression Huffman Type - used by DEFLATE algorithm

Enumerator
RTE_COMP_HUFFMAN_DEFAULT 

PMD may choose which Huffman codes to use

RTE_COMP_HUFFMAN_FIXED 

Use Fixed Huffman codes

RTE_COMP_HUFFMAN_DYNAMIC 

Use Dynamic Huffman codes

Definition at line 171 of file rte_comp.h.

◆ rte_comp_flush_flag

Compression flush flags

Enumerator
RTE_COMP_FLUSH_NONE 

Data is not flushed. Output may remain in the compressor and be processed during a following op. It may not be possible to decompress output until a later op with some other flush flag has been sent.

RTE_COMP_FLUSH_SYNC 

All data should be flushed to output buffer. Output data can be decompressed. However state and history is not cleared, so future operations may use history from this operation.

RTE_COMP_FLUSH_FULL 

All data should be flushed to output buffer. Output data can be decompressed. State and history data is cleared, so future ops will be independent of ops processed before this.

RTE_COMP_FLUSH_FINAL 

Same as RTE_COMP_FLUSH_FULL but if op.algo is RTE_COMP_ALGO_DEFLATE then bfinal bit is set in the last block.

Definition at line 181 of file rte_comp.h.

◆ rte_comp_xform_type

Compression transform types

Enumerator
RTE_COMP_COMPRESS 

Compression service - compress

RTE_COMP_DECOMPRESS 

Compression service - decompress

Definition at line 204 of file rte_comp.h.

◆ rte_comp_op_type

Compression operation type

Enumerator
RTE_COMP_OP_STATELESS 

All data to be processed is submitted in the op, no state or history from previous ops is used and none will be stored for future ops. Flush flag must be set to either FLUSH_FULL or FLUSH_FINAL.

RTE_COMP_OP_STATEFUL 

There may be more data to be processed after this op, it's part of a stream of data. State and history from previous ops can be used and resulting state and history can be stored for future ops, depending on flush flag.

Definition at line 212 of file rte_comp.h.

Function Documentation

◆ rte_comp_op_pool_create()

struct rte_mempool* rte_comp_op_pool_create ( const char *  name,
unsigned int  nb_elts,
unsigned int  cache_size,
uint16_t  user_size,
int  socket_id 
)

Creates an operation pool

Parameters
nameCompress pool name
nb_eltsNumber of elements in pool
cache_sizeNumber of elements to cache on lcore, see rte_mempool_create for further details about cache size
user_sizeSize of private data to allocate for user with each operation
socket_idSocket to identifier allocate memory on
Returns
  • On success pointer to mempool
  • On failure NULL

◆ rte_comp_op_alloc()

struct rte_comp_op* rte_comp_op_alloc ( struct rte_mempool mempool)

Allocate an operation from a mempool with default parameters set

Parameters
mempoolCompress operation mempool
Returns
  • On success returns a valid rte_comp_op structure
  • On failure returns NULL

◆ rte_comp_op_bulk_alloc()

int rte_comp_op_bulk_alloc ( struct rte_mempool mempool,
struct rte_comp_op **  ops,
uint16_t  nb_ops 
)

Bulk allocate operations from a mempool with default parameters set

Parameters
mempoolCompress operation mempool
opsArray to place allocated operations
nb_opsNumber of operations to allocate
Returns
  • nb_ops: Success, the nb_ops requested was allocated
  • 0: Not enough entries in the mempool; no ops are retrieved.

◆ rte_comp_op_free()

void rte_comp_op_free ( struct rte_comp_op op)

Free operation structure If operation has been allocate from a rte_mempool, then the operation will be returned to the mempool.

Parameters
opCompress operation pointer allocated from rte_comp_op_alloc() If op is NULL, no operation is performed.

◆ rte_comp_op_bulk_free()

void rte_comp_op_bulk_free ( struct rte_comp_op **  ops,
uint16_t  nb_ops 
)

Bulk free operation structures If operations have been allocated from an rte_mempool, then the operations will be returned to the mempool. The array entry will be cleared.

Parameters
opsArray of Compress operations
nb_opsNumber of operations to free

◆ rte_comp_get_feature_name()

const char* rte_comp_get_feature_name ( uint64_t  flag)

Get the name of a compress service feature flag

Parameters
flagThe mask describing the flag
Returns
The name of this flag, or NULL if it's not a valid feature flag.