---
name: "rte_comp.h"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_comp.h"
---

# rte\_comp.h(3)

## NAME

rte\_comp.h

## SYNOPSIS

`#include <rte_mbuf.h>`\

### 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** {  }\
 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\_mempool** \* **rte\_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\_op** \* **rte\_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

### #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 **28** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_STATEFUL\_DECOMPRESSION (1ULL \<\< 1)

Stateful decompression is supported

Definition at line **30** of file **rte\_comp.h**.

### #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 **34** of file **rte\_comp.h**.

### #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 **39** of file **rte\_comp.h**.

### #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 **43** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_ADLER32\_CHECKSUM (1ULL \<\< 5)

Adler-32 Checksum is supported

Definition at line **45** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_CRC32\_CHECKSUM (1ULL \<\< 6)

CRC32 Checksum is supported

Definition at line **47** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_CRC32\_ADLER32\_CHECKSUM (1ULL \<\< 7)

Adler-32/CRC32 Checksum is supported

Definition at line **49** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_MULTI\_PKT\_CHECKSUM (1ULL \<\< 8)

Generation of checksum across multiple stateless packets is supported

Definition at line **51** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_SHA1\_HASH (1ULL \<\< 9)

SHA1 Hash is supported

Definition at line **53** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_SHA2\_SHA256\_HASH (1ULL \<\< 10)

SHA256 Hash of SHA2 family is supported

Definition at line **55** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_NONCOMPRESSED\_BLOCKS (1ULL \<\< 11)

Creation of non-compressed blocks using RTE\_COMP\_LEVEL\_NONE is supported

Definition at line **57** of file **rte\_comp.h**.

### #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 **63** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_HUFFMAN\_FIXED (1ULL \<\< 13)

Fixed huffman encoding is supported

Definition at line **65** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_HUFFMAN\_DYNAMIC (1ULL \<\< 14)

Dynamic huffman encoding is supported

Definition at line **67** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_XXHASH32\_CHECKSUM (1ULL \<\< 15)

xxHash-32 Checksum is supported

Definition at line **69** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_LZ4\_DICT\_ID (1ULL \<\< 16)

LZ4 dictionary ID is supported

Definition at line **71** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_LZ4\_CONTENT\_WITH\_CHECKSUM (1ULL \<\< 17)

LZ4 content with checksum is supported

Definition at line **73** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_LZ4\_CONTENT\_SIZE (1ULL \<\< 18)

LZ4 content size is supported

Definition at line **75** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_LZ4\_BLOCK\_INDEPENDENCE (1ULL \<\< 19)

LZ4 block independent is supported

Definition at line **77** of file **rte\_comp.h**.

### #define RTE\_COMP\_FF\_LZ4\_BLOCK\_WITH\_CHECKSUM (1ULL \<\< 20)

LZ4 block with checksum is supported

Definition at line **79** of file **rte\_comp.h**.

### #define RTE\_COMP\_LEVEL\_NONE (0)

Use PMD Default

Definition at line **145** of file **rte\_comp.h**.

### #define RTE\_COMP\_LEVEL\_MIN (1)

Output uncompressed blocks if supported by the specified algorithm

Definition at line **147** of file **rte\_comp.h**.

### #define RTE\_COMP\_LEVEL\_MAX (9)

Use minimum compression level supported by the PMD

Definition at line **149** of file **rte\_comp.h**.

### #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**.

### #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**.

### #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**.

### #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**.

### #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

### enum 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***.*

### enum 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***.*

### enum 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***.*

### enum 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***.*

### enum 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***.*

### enum 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***.*

### enum 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***.*

### enum 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

### 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**

*name Compress pool name* \
 *nb\_elts Number of elements in pool* \
 *cache\_size Number of elements to cache on lcore, see rte\_mempool\_create for further details about cache size* \
 *user\_size Size of private data to allocate for user with each operation* \
 *socket\_id Socket to identifier allocate memory on*

**Returns**

- •

  *On success pointer to mempool*

- •

  *On failure NULL*

### struct rte\_comp\_op \* rte\_comp\_op\_alloc (struct rte\_mempool \* mempool)

*Allocate an operation from a mempool with default parameters set*

**Parameters**

*mempool Compress operation mempool*

**Returns**

- •

  *On success returns a valid* **rte\_comp\_op** *structure*

- •

  *On failure returns NULL*

### 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**

*mempool Compress operation mempool* \
 *ops Array to place allocated operations* \
 *nb\_ops Number 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.*

### 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**

*op Compress operation pointer allocated from* **rte\_comp\_op\_alloc()** *If op is NULL, no operation is performed.*

### 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**

*ops Array of Compress operations* \
 *nb\_ops Number of operations to free*

### const char \* rte\_comp\_get\_feature\_name (uint64\_t flag)

*Get the name of a compress service feature flag*

**Parameters**

*flag The mask describing the flag*

**Returns**

*The name of this flag, or NULL if it's not a valid feature flag.*

## Author

*Generated automatically by Doxygen for DPDK from the source code.*
