constchar*rte_compressdev_get_feature_name(uint64_tflag)
Get the name of a compress device feature flag.
Parametersflag The mask describing the flag
Returns
The name of this flag, or NULL if it's not a valid feature flag.
intrte_compressdev_get_dev_id(constchar*name)
Get the device identifier for the named compress device.
Parametersname Device name to select the device structure
Returns
• Returns compress device identifier on success.
• Return -1 on failure to find named compress device.
constchar*rte_compressdev_name_get(uint8_tdev_id)
Get the compress device name given a device identifier.
Parametersdev_id Compress device identifier
Returns
• Returns compress device name.
• Returns NULL if compress device is not present.
uint8_trte_compressdev_count(void)
Get the total number of compress devices that have been successfully initialised.
Returns
• The total number of usable compress devices.
uint8_trte_compressdev_devices_get(constchar*driver_name,uint8_t*devices,uint8_tnb_devices)
Get number and identifiers of attached comp devices that use the same compress driver.
Parametersdriver_name Driver name
devices Output devices identifiers
nb_devices Maximal number of devices
Returns
Returns number of attached compress devices.
intrte_compressdev_configure(uint8_tdev_id,structrte_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.
Parametersdev_id Compress device identifier
config The compress device configuration
Returns
• 0: Success, device configured.
• <0: Error code returned by the driver configuration function.
intrte_compressdev_start(uint8_tdev_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.
Parametersdev_id Compress device identifier
Returns
• 0: Success, device started.
• <0: Error code of the driver device start function.
voidrte_compressdev_stop(uint8_tdev_id)
Stop a device. The device can be restarted with a call to rte_compressdev_start()Parametersdev_id Compress device identifier
intrte_compressdev_close(uint8_tdev_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.
Parametersdev_id Compress device identifier
Returns
• 0 on successfully closing device
• <0 on failure to close device
intrte_compressdev_queue_pair_setup(uint8_tdev_id,uint16_tqueue_pair_id,uint32_tmax_inflight_ops,intsocket_id)
Allocate and set up a receive queue pair for a device. This should only be called when the device is
stopped.
Parametersdev_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 to rte_compressdev_configure()max_inflight_ops Max number of ops which the qp will have to accommodate simultaneously
socket_id The socket_id argument is the socket identifier in case of NUMA. The value can be
SOCKET_ID_ANY if 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_trte_compressdev_queue_pair_count(uint8_tdev_id)
Get the number of queue pairs on a specific comp device
Parametersdev_id Compress device identifier
Returns
• The number of configured queue pairs.
intrte_compressdev_stats_get(uint8_tdev_id,structrte_compressdev_stats*stats)
Retrieve the general I/O statistics of a device.
Parametersdev_id The identifier of the device
stats A pointer to a structure of type rte_compressdev_statstobefilledwiththevaluesofdevicecountersReturns
• Zero if successful.
• Non-zero otherwise.
voidrte_compressdev_stats_reset(uint8_tdev_id)
Reset the general I/O statistics of a device.
Parametersdev_id The identifier of the device.
voidrte_compressdev_info_get(uint8_tdev_id,structrte_compressdev_info*dev_info)
Retrieve the contextual information of a device.
Parametersdev_id Compress device identifier
dev_info A pointer to a structure of type rte_compressdev_infotobefilledwiththecontextualinformationofthedeviceNote
The capabilities field of dev_info is set to point to the first element of an array of struct
rte_compressdev_capabilities. The element after the last valid element has it's op field set to
RTE_COMP_ALGO_UNSPECIFIED.
uint16_trte_compressdev_dequeue_burst(uint8_tdev_id,uint16_tqp_id,structrte_comp_op**ops,uint16_tnb_ops)
Dequeue a burst of processed compression operations from a queue on the comp device. The dequeued
operation are stored in rte_comp_opstructureswhosepointersaresuppliedintheopsarray.
The rte_compressdev_dequeue_burst() function returns the number of ops actually dequeued, which is the
number of rte_comp_opdatastructureseffectivelysuppliedintotheopsarray.
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.
Note
: operation ordering is not maintained within the queue pair.
: In case op status = OUT_OF_SPACE_TERMINATED, op.consumed=0 and the op must be resubmitted with the
same input data and a larger output buffer. op.produced is 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 on STATELESS ops.
: In case op status = OUT_OF_SPACE_RECOVERABLE, op.produced can be used and next op in stream should
continue on from op.consumed+1 with a fresh output buffer. Consumed=0, produced=0 is an unusual but
allowed case. There may be useful state/history stored in the PMD, even though no output was produced
yet.
Parametersdev_id Compress device identifier
qp_id The index of the queue pair from which to retrieve processed operations. The value must be in
the range [0, nb_queue_pair - 1] previously supplied to rte_compressdev_configure()ops The address of an array of pointers to rte_comp_opstructuresthatmustbelargeenoughtostorenb_opspointersinitnb_opsThemaximumnumberofoperationstodequeueReturns
• The number of operations actually dequeued, which is the number of pointers to rte_comp_opstructureseffectivelysuppliedtotheopsarray.uint16_trte_compressdev_enqueue_burst(uint8_tdev_id,uint16_tqp_id,structrte_comp_op**ops,uint16_tnb_ops)
Enqueue a burst of operations for processing on a compression device.
The rte_compressdev_enqueue_burst() function is invoked to place comp operations on the queue qp_id of
the device designated by its dev_id.
The nb_ops parameter is the number of operations to process which are supplied in the ops array of
rte_comp_opstructures.
The rte_compressdev_enqueue_burst() function returns the number of operations it actually enqueued for
processing. A return value equal to nb_ops means that all packets have been enqueued.
Note
All compression operations are Out-of-place (OOP) operations, as the size of the output data is
different to the size of the input data.
The rte_comp_op contains both input and output parameters and is 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, the
private_xform or stream attached to it and 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 return SUCCESS. In OUT_OF_SPACE cases whether
STATEFUL or STATELESS, data in dest buffer is as if flush flag was FLUSH_NONE.
flush flag only applies in compression direction. It has no meaning for decompression.
: operation ordering is not maintained within the queue pair.
Parametersdev_id Compress device identifier
qp_id The index of the queue pair on which operations are to be enqueued for processing. The value
must be in the range [0, nb_queue_pairs - 1] previously supplied to rte_compressdev_configureops The address of an array of nb_ops pointers to rte_comp_opstructureswhichcontaintheoperationstobeprocessednb_opsThenumberofoperationstoprocessReturns
The number of operations actually enqueued on the device. The return value can be less than the value
of the nb_ops parameter when the comp devices queue is full or if invalid parameters are specified in
a rte_comp_op.intrte_compressdev_stream_create(uint8_tdev_id,conststructrte_comp_xform*xform,void**stream)
This should alloc a stream from the device's mempool and initialise it. The application should call this
API when setting up for the stateful processing of a set of data on a device. The API can be called
multiple times to set up a stream for each data set. The handle returned is only for use with ops of
op_type STATEFUL and must be passed to the PMD with every op in the data stream
Parametersdev_id Compress device identifier
xform xform data
stream Pointer to where PMD's private stream handle should be stored
Returns
• 0 if successful and valid stream handle
• <0 in error cases
• Returns -EINVAL if input parameters are invalid.
• Returns -ENOTSUP if comp device does not support STATEFUL operations.
• Returns -ENOTSUP if comp device does not support the comp transform.
• Returns -ENOMEM if the private stream could not be allocated.
intrte_compressdev_stream_free(uint8_tdev_id,void*stream)
This should clear the stream and return it to the device's mempool.
Parametersdev_id Compress device identifier
stream PMD's private stream data
Returns
• 0 if successful
• <0 in error cases
• Returns -EINVAL if input parameters are invalid.
• Returns -ENOTSUP if comp device does not support STATEFUL operations.
• Returns -EBUSY if can't free stream as there are inflight operations
intrte_compressdev_private_xform_create(uint8_tdev_id,conststructrte_comp_xform*xform,void**private_xform)
This should alloc a private_xform from the device's mempool and initialise it. The application should
call this API when 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. The handle returned is only valid for use with ops of op_type
STATELESS.
Parametersdev_id Compress device identifier
xform xform data
private_xform Pointer to where PMD's private_xform handle should be stored
Returns
• if successful returns 0 and valid private_xform handle
• <0 in error cases
• Returns -EINVAL if input parameters are invalid.
• Returns -ENOTSUP if comp device does not support the comp transform.
• Returns -ENOMEM if the private_xform could not be allocated.
intrte_compressdev_private_xform_free(uint8_tdev_id,void*private_xform)
This should clear the private_xform and return it to the device's mempool. It is the application's
responsibility to ensure that private_xform data is not cleared while there are still in-flight
operations using it.
Parametersdev_id Compress device identifier
private_xform PMD's private_xform data
Returns
• 0 if successful
• <0 in error cases
• Returns -EINVAL if input parameters are invalid.