rte_compressdev.h(3)
πΈ rte_compressdev.h(3) β Library Functions Manual πΈ
okay bestie, sit DOWN, because we're about to talk about the RTE Compression Device APIs and honestly? it's giving infrastructure. it's giving plumbing that makes the whole building work. no cap. π
β¨ NAME β¨
rte_compressdev.h β the header you include when you want to do compression stuff in DPDK, periodt. π
π¦ SYNOPSIS π¦
#include 'rte_comp.h'
π Data Structures π
struct rte_param_log2_rangestruct rte_compressdev_capabilitiesstruct rte_compressdev_infostruct rte_compressdev_statsstruct rte_compressdev_config
π Macros π
#define RTE_COMP_END_OF_CAPABILITIES_LIST()#define RTE_COMPDEV_FF_HW_ACCELERATED (1ULL << 0)#define RTE_COMPDEV_FF_CPU_SSE (1ULL << 1)#define RTE_COMPDEV_FF_CPU_AVX (1ULL << 2)#define RTE_COMPDEV_FF_CPU_AVX2 (1ULL << 3)#define RTE_COMPDEV_FF_CPU_AVX512 (1ULL << 4)#define RTE_COMPDEV_FF_CPU_NEON (1ULL << 5)#define RTE_COMPDEV_FF_OP_DONE_IN_DEQUEUE (1ULL << 6)
π Functions π
const char * rte_compressdev_get_feature_name (uint64_t flag)
int rte_compressdev_get_dev_id (const char *name)
const char * rte_compressdev_name_get (uint8_t dev_id)
uint8_t rte_compressdev_count (void)
uint8_t rte_compressdev_devices_get (const char *driver_name, uint8_t
*devices, uint8_t nb_devices)
int rte_compressdev_configure (uint8_t dev_id, struct
rte_compressdev_config *config)
int rte_compressdev_start (uint8_t dev_id)
void rte_compressdev_stop (uint8_t dev_id)
int rte_compressdev_close (uint8_t dev_id)
int rte_compressdev_queue_pair_setup (uint8_t dev_id, uint16_t
queue_pair_id, uint32_t max_inflight_ops, int socket_id)
uint16_t rte_compressdev_queue_pair_count (uint8_t dev_id)
int rte_compressdev_stats_get (uint8_t dev_id, struct
rte_compressdev_stats *stats)
void rte_compressdev_stats_reset (uint8_t dev_id)
void rte_compressdev_info_get (uint8_t dev_id, struct
rte_compressdev_info *dev_info)
uint16_t rte_compressdev_dequeue_burst (uint8_t dev_id, uint16_t qp_id,
struct rte_comp_op **ops, uint16_t nb_ops)
uint16_t rte_compressdev_enqueue_burst (uint8_t dev_id, uint16_t qp_id,
struct rte_comp_op **ops, uint16_t nb_ops)
int rte_compressdev_stream_create (uint8_t dev_id, const struct
rte_comp_xform *xform, void **stream)
int rte_compressdev_stream_free (uint8_t dev_id, void *stream)
int rte_compressdev_private_xform_create (uint8_t dev_id, const struct
rte_comp_xform *xform, void **private_xform)
int rte_compressdev_private_xform_free (uint8_t dev_id, void
*private_xform)
π DETAILED DESCRIPTION π
RTE Compression Device APIs.
Defines comp device APIs for the provisioning of compression operations.
Definition in file rte_compressdev.h.
π MACRO DEFINITION DOCUMENTATION π
π #define RTE_COMP_END_OF_CAPABILITIES_LIST()
Value:
{ RTE_COMP_ALGO_UNSPECIFIED }
Macro used at end of comp PMD list
Definition at line 48 of file rte_compressdev.h.
π #define RTE_COMPDEV_FF_HW_ACCELERATED (1ULL << 0)
compression device supported feature flags
Note π«Ά New features flags should be added to the end of the list
Keep these flags synchronised with rte_compressdev_get_feature_name()
Operations are off-loaded to an external hardware accelerator
Definition at line 62 of file rte_compressdev.h.
π #define RTE_COMPDEV_FF_CPU_SSE (1ULL << 1)
Utilises CPU SIMD SSE instructions
Definition at line 64 of file rte_compressdev.h.
π #define RTE_COMPDEV_FF_CPU_AVX (1ULL << 2)
Utilises CPU SIMD AVX instructions
Definition at line 66 of file rte_compressdev.h.
π #define RTE_COMPDEV_FF_CPU_AVX2 (1ULL << 3)
Utilises CPU SIMD AVX2 instructions
Definition at line 68 of file rte_compressdev.h.
π #define RTE_COMPDEV_FF_CPU_AVX512 (1ULL << 4)
Utilises CPU SIMD AVX512 instructions
Definition at line 70 of file rte_compressdev.h.
π #define RTE_COMPDEV_FF_CPU_NEON (1ULL << 5)
Utilises CPU NEON instructions
Definition at line 72 of file rte_compressdev.h.
π #define RTE_COMPDEV_FF_OP_DONE_IN_DEQUEUE (1ULL << 6)
A PMD should set this if the bulk of the processing is done during the dequeue. It should leave it cleared if the processing is done during the enqueue (default). Applications can use this as a hint for tuning.
Definition at line 74 of file rte_compressdev.h.
π₯ FUNCTION DOCUMENTATION π₯
β const char * rte_compressdev_get_feature_name (uint64_t flag)
Get the name of a compress device 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.
β int rte_compressdev_get_dev_id (const char * name)
Get the device identifier for the named compress device.
Parameters
- name β Device name to select the device structure
Returns
- Returns compress device identifier on success.
- Return
-1on failure to find named compress device.
β const char * rte_compressdev_name_get (uint8_t dev_id)
Get the compress device name given a device identifier.
Parameters
- dev_id β Compress device identifier
Returns
- Returns compress device name.
- Returns
NULLif compress device is not present.
β uint8_t rte_compressdev_count (void )
Get the total number of compress devices that have been successfully initialised.
Returns
- The total number of usable compress devices.
β uint8_t rte_compressdev_devices_get (const char * driver_name, uint8_t * devices, uint8_t nb_devices)
Get number and identifiers of attached comp devices that use the same compress driver.
Parameters
- driver_name β Driver name
- devices β Output devices identifiers
- nb_devices β Maximal number of devices
Returns
Returns number of attached compress devices.
β int rte_compressdev_configure (uint8_t dev_id, struct rte_compressdev_config * config)
Configure a device.
This function must be invoked first before any other function in the API. This function can also be re-invoked when a device is in the stopped state. π«Ά
Parameters
- dev_id β Compress device identifier
- config β The compress device configuration
Returns
0: Success, device configured.<0: Error code returned by the driver configuration function.
β int rte_compressdev_start (uint8_t dev_id)
Start a device.
The device start step is called after configuring the device and setting up its queue pairs. On success, data-path functions exported by the API (enqueue/dequeue, etc) can be invoked.
Parameters
- dev_id β Compress device identifier
Returns
0: Success, device started.<0: Error code of the driver device start function.
β void rte_compressdev_stop (uint8_t dev_id)
Stop a device. The device can be restarted with a call to rte_compressdev_start()
Parameters
- dev_id β Compress device identifier
β int rte_compressdev_close (uint8_t dev_id)
Close an device. The memory allocated in the device gets freed. After calling this function, in order to use the device again, it is required to configure the device again. π (yes, again again, we said what we said)
Parameters
- dev_id β Compress device identifier
Returns
0on successfully closing device<0on failure to close device
β int rte_compressdev_queue_pair_setup (uint8_t dev_id, uint16_t queue_pair_id, uint32_t max_inflight_ops, int socket_id)
Allocate and set up a receive queue pair for a device. This should only be called when the device is stopped.
Parameters
- dev_id β Compress device identifier
- queue_pair_id β The index of the queue pairs to set up. The value must be in the range
[0, nb_queue_pair - 1]previously supplied torte_compressdev_configure() - max_inflight_ops β Max number of ops which the qp will have to accommodate simultaneously
- socket_id β The
socket_idargument is the socket identifier in case of NUMA. The value can beSOCKET_ID_ANYif there is no NUMA constraint for the DMA memory allocated for the receive queue pair
Returns
0: Success, queue pair correctly set up.<0: Queue pair configuration failed
β uint16_t rte_compressdev_queue_pair_count (uint8_t dev_id)
Get the number of queue pairs on a specific comp device
Parameters
- dev_id β Compress device identifier
Returns
- The number of configured queue pairs.
β int rte_compressdev_stats_get (uint8_t dev_id, struct rte_compressdev_stats * stats)
Retrieve the general I/O statistics of a device.
Parameters
- dev_id β The identifier of the device
- stats β A pointer to a structure of type
rte_compressdev_statsto be filled with the values of device counters
Returns
- Zero if successful.
- Non-zero otherwise.
β void rte_compressdev_stats_reset (uint8_t dev_id)
Reset the general I/O statistics of a device.
Parameters
- dev_id β The identifier of the device.
β void rte_compressdev_info_get (uint8_t dev_id, struct rte_compressdev_info * dev_info)
Retrieve the contextual information of a device.
Parameters
- dev_id β Compress device identifier
- dev_info β A pointer to a structure of type
rte_compressdev_infoto be filled with the contextual information of the device
Note π§ Thecapabilitiesfield of dev_info is set to point to the first element of an array ofstruct rte_compressdev_capabilities. The element after the last valid element has it'sopfield set toRTE_COMP_ALGO_UNSPECIFIED.
β uint16_t rte_compressdev_dequeue_burst (uint8_t dev_id, uint16_t qp_id, struct rte_comp_op ** ops, uint16_t nb_ops)
Dequeue a burst of processed compression operations from a queue on the comp device. The dequeued operation are stored in rte_comp_op structures whose pointers are supplied in the ops array.
The rte_compressdev_dequeue_burst() function returns the number of ops actually dequeued, which is the number of rte_comp_op data structures effectively supplied into the ops array.
A return value equal to nb_ops indicates that the queue contained at least nb_ops operations, and this is likely to signify that other processed operations remain in the devices output queue. Applications implementing a "retrieve as many processed operations as possible" policy can check this specific case and keep invoking the rte_compressdev_dequeue_burst() function until a value less than nb_ops is returned.
The rte_compressdev_dequeue_burst() function does not provide any error notification to avoid the corresponding overhead. (iconic behaviour tbh, silently efficient β¨)
Note π : operation ordering is not maintained within the queue pair. : In case op status =OUT_OF_SPACE_TERMINATED,op.consumed=0and the op must be resubmitted with the same input data and a larger output buffer.op.producedis usually 0, but in decompression cases a PMD may return > 0 and the application may find it useful to inspect that data. This status is only returned onSTATELESSops.
to be continued, bestie β the rest of the functions are coming up in part 2 π
okay so we're picking right back up inside the rte_compressdev_dequeue_burst() notes β no heading, we been here, we're just finishing the vibe check π
- bestie listen: in case
op status = OUT_OF_SPACE_RECOVERABLE,op.producedcan be used, and the next op in the stream should continue on fromop.consumed+1with a fresh output buffer.Consumed=0, produced=0is an unusual but allowed case. There may be useful state/history stored in the PMD, even though no output was produced yet. π«Ά
Parameters
dev_idβ Compress device identifierqp_idβ the index of the queue pair you're pulling processed operations from. It has to be in the range[0, nb_queue_pair - 1], and you gotta have already handed those values torte_compressdev_configure()opsβ the address of an array of pointers torte_comp_opstructures, and it has to be big enough to holdnb_opspointers in itnb_opsβ the maximum number of operations to dequeue
Returns
- the number of operations actually dequeued, which is literally just the number of pointers to
rte_comp_opstructures that actually made it into theopsarray
rte_compressdev_enqueue_burst
uint16_t rte_compressdev_enqueue_burst (uint8_t dev_id, uint16_t qp_id,
struct rte_comp_op ** ops, uint16_t nb_ops)
Enqueue a burst of operations for processing on a compression device. π
You call rte_compressdev_enqueue_burst() to place comp operations on the queue qp_id of the device that its dev_id designates. That's the whole move, no cap.
The nb_ops parameter is the number of operations to process, which are supplied in the ops array of rte_comp_op structures.
So then β rte_compressdev_enqueue_burst() tells you back the number of operations it actually enqueued for processing. If the return value equals nb_ops, then all the packets have been enqueued. slay β¨
Note β read this part, bestie, it's lowkey the whole assignment: - All compression operations are Out-of-place (OOP) operations, because the size of the output data is different from the size of the input data. like they are literally not the same size, that's the point. - Therte_comp_opholds both input and output parameters, and it's the vehicle for the application to pass data into and out of the PMD. While an op is inflight β i.e. once it has been enqueued β theprivate_xformor stream attached to it, plus any mbufs or memory referenced by it, should not be altered or freed by the application. The PMD may use or change some of this data at any time until it has been returned in a dequeue operation. π - The flush flag only applies to operations which returnSUCCESS. InOUT_OF_SPACEcases β whetherSTATEFULorSTATELESSβ the data in the dest buffer is as if the flush flag wasFLUSH_NONE. - The flush flag only applies in the compression direction. It has no meaning for decompression. periodt. - Operation ordering is not maintained within the queue pair. π
Parameters
dev_idβ Compress device identifierqp_idβ the index of the queue pair the operations are gonna be enqueued onto for processing. Gotta be in the range[0, nb_queue_pairs - 1], previously supplied torte_compressdev_configureopsβ the address of an array ofnb_opspointers torte_comp_opstructures which contain the operations to be processednb_opsβ the number of operations to process
Returns
The number of operations actually enqueued on the device. Heads up: this return value can be less than the value of the nb_ops parameter when the comp device's queue is full, or if invalid parameters are specified in a rte_comp_op. π
rte_compressdev_stream_create
int rte_compressdev_stream_create (uint8_t dev_id, const struct
rte_comp_xform * xform, void ** stream)
This should alloc a stream from the device's mempool and initialise it. π
Call this API when you're setting up for the stateful processing of a set of data on a device. You can call it multiple times to set up a stream for each data set β no limits, we love that for you. The handle you get back is only for use with ops of op_type STATEFUL, and it must be passed to the PMD with every op in the data stream. every. single. one.
Parameters
dev_idβ Compress device identifierxformβ xform datastreamβ pointer to where the PMD's private stream handle should be stored
Returns
0if successful and valid stream handle π<0in error cases- Returns
-EINVALif input parameters are invalid. - Returns
-ENOTSUPif the comp device does not supportSTATEFULoperations. - Returns
-ENOTSUPif the comp device does not support the comp transform. - Returns
-ENOMEMif the private stream could not be allocated.
rte_compressdev_stream_free
int rte_compressdev_stream_free (uint8_t dev_id, void * stream)
This should clear the stream and return it to the device's mempool. bye bestie, thanks for the memories π¦
Parameters
dev_idβ Compress device identifierstreamβ PMD's private stream data
Returns
0if successful<0in error cases- Returns
-EINVALif input parameters are invalid. - Returns
-ENOTSUPif the comp device does not supportSTATEFULoperations. - Returns
-EBUSYif it can't free the stream because there are inflight operations. π the ops are still in there!!
rte_compressdev_private_xform_create
int rte_compressdev_private_xform_create (uint8_t dev_id, const struct
rte_comp_xform * xform, void ** private_xform)
This should alloc a private_xform from the device's mempool and initialise it. πΈ
Call this API when you're setting up for stateless processing on a device. If it returns non-shareable, then the appl cannot share this handle with multiple in-flight ops, and should call this API again to get a separate handle for every in-flight op. one handle per op, no sharing, we don't do that here. The handle returned is only valid for use with ops of op_type STATELESS.
Parameters
dev_idβ Compress device identifierxformβ xform dataprivate_xformβ pointer to where the PMD'sprivate_xformhandle should be stored
Returns
- if successful, returns
0and a validprivate_xformhandle β <0in error cases- Returns
-EINVALif input parameters are invalid. - Returns
-ENOTSUPif the comp device does not support the comp transform. - Returns
-ENOMEMif theprivate_xformcould not be allocated.
rte_compressdev_private_xform_free
int rte_compressdev_private_xform_free (uint8_t dev_id, void *
private_xform)
This should clear the private_xform and return it to the device's mempool. π«Ά
And this part is on you, bestie: it is the application's responsibility to make sure that private_xform data is not cleared while there are still in-flight operations using it. iykyk. π
Parameters
dev_idβ Compress device identifierprivate_xformβ PMD'sprivate_xformdata
Returns
0if successful<0in error cases- Returns
-EINVALif input parameters are invalid.
π Author
Generated automatically by Doxygen for DPDK from the source code. (not me being a whole author, it's the robots π)
and that's the whole page, bestie!! π this was DPDK, version 25.11.3, page rte_compressdev.h(3) β go forth and compress, main character energy only, no cap β¨π
π₯
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms