accel_engine.h File Reference

Acceleration engine abstraction layer. More...

Macros

#define ACCEL_FLAG_PERSISTENT   (1 << 0)
 

Typedefs

typedef void(* spdk_accel_completion_cb) (void *ref, int status)
 Acceleration operation callback. More...
 
typedef void(* spdk_accel_fini_cb) (void *cb_arg)
 Acceleration engine finish callback. More...
 

Enumerations

enum  accel_opcode {
  ACCEL_OPC_COPY = 0 , ACCEL_OPC_FILL = 1 , ACCEL_OPC_DUALCAST = 2 , ACCEL_OPC_COMPARE = 3 ,
  ACCEL_OPC_CRC32C = 4 , ACCEL_OPC_COPY_CRC32C = 5 , ACCEL_OPC_LAST = 6
}
 

Functions

int spdk_accel_engine_initialize (void)
 Initialize the acceleration engine. More...
 
void spdk_accel_engine_finish (spdk_accel_fini_cb cb_fn, void *cb_arg)
 Close the acceleration engine. More...
 
void spdk_accel_engine_module_finish (void)
 Close the acceleration engine module and perform any necessary cleanup.
 
struct spdk_io_channel * spdk_accel_engine_get_io_channel (void)
 Get the I/O channel registered on the acceleration engine. More...
 
int spdk_accel_submit_copy (struct spdk_io_channel *ch, void *dst, void *src, uint64_t nbytes, int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Submit a copy request. More...
 
int spdk_accel_submit_dualcast (struct spdk_io_channel *ch, void *dst1, void *dst2, void *src, uint64_t nbytes, int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Submit a dual cast copy request. More...
 
int spdk_accel_submit_compare (struct spdk_io_channel *ch, void *src1, void *src2, uint64_t nbytes, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Submit a compare request. More...
 
int spdk_accel_submit_fill (struct spdk_io_channel *ch, void *dst, uint8_t fill, uint64_t nbytes, int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Submit a fill request. More...
 
int spdk_accel_submit_crc32c (struct spdk_io_channel *ch, uint32_t *crc_dst, void *src, uint32_t seed, uint64_t nbytes, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Submit a CRC-32C calculation request. More...
 
int spdk_accel_submit_crc32cv (struct spdk_io_channel *ch, uint32_t *crc_dst, struct iovec *iovs, uint32_t iovcnt, uint32_t seed, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Submit a chained CRC-32C calculation request. More...
 
int spdk_accel_submit_copy_crc32c (struct spdk_io_channel *ch, void *dst, void *src, uint32_t *crc_dst, uint32_t seed, uint64_t nbytes, int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Submit a copy with CRC-32C calculation request. More...
 
int spdk_accel_submit_copy_crc32cv (struct spdk_io_channel *ch, void *dst, struct iovec *src_iovs, uint32_t iovcnt, uint32_t *crc_dst, uint32_t seed, int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Submit a chained copy + CRC-32C calculation request. More...
 
void spdk_accel_write_config_json (struct spdk_json_write_ctx *w)
 Write Acceleration subsystem configuration into provided JSON context. More...
 

Detailed Description

Acceleration engine abstraction layer.

Typedef Documentation

◆ spdk_accel_completion_cb

typedef void(* spdk_accel_completion_cb) (void *ref, int status)

Acceleration operation callback.

Parameters
ref'accel_task' passed to the corresponding spdk_accel_submit* call.
status0 if it completed successfully, or negative errno if it failed.

◆ spdk_accel_fini_cb

typedef void(* spdk_accel_fini_cb) (void *cb_arg)

Acceleration engine finish callback.

Parameters
cb_argCallback argument.

Function Documentation

◆ spdk_accel_engine_finish()

void spdk_accel_engine_finish ( spdk_accel_fini_cb  cb_fn,
void *  cb_arg 
)

Close the acceleration engine.

Parameters
cb_fnCalled when the close operation completes.
cb_argArgument passed to the callback function.

◆ spdk_accel_engine_get_io_channel()

struct spdk_io_channel* spdk_accel_engine_get_io_channel ( void  )

Get the I/O channel registered on the acceleration engine.

This I/O channel is used to submit copy request.

Returns
a pointer to the I/O channel on success, or NULL on failure.

◆ spdk_accel_engine_initialize()

int spdk_accel_engine_initialize ( void  )

Initialize the acceleration engine.

Returns
0 on success.

◆ spdk_accel_submit_compare()

int spdk_accel_submit_compare ( struct spdk_io_channel *  ch,
void *  src1,
void *  src2,
uint64_t  nbytes,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Submit a compare request.

Parameters
chI/O channel associated with this call.
src1First location to perform compare on.
src2Second location to perform compare on.
nbytesLength in bytes to compare.
cb_fnCalled when this compare operation completes.
cb_argCallback argument.
Returns
0 on success, any other value means there was a miscompare.

◆ spdk_accel_submit_copy()

int spdk_accel_submit_copy ( struct spdk_io_channel *  ch,
void *  dst,
void *  src,
uint64_t  nbytes,
int  flags,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Submit a copy request.

Parameters
chI/O channel associated with this call.
dstDestination to copy to.
srcSource to copy from.
nbytesLength in bytes to copy.
flagsAccel framework flags for operations.
cb_fnCalled when this copy operation completes.
cb_argCallback argument.
Returns
0 on success, negative errno on failure.

◆ spdk_accel_submit_copy_crc32c()

int spdk_accel_submit_copy_crc32c ( struct spdk_io_channel *  ch,
void *  dst,
void *  src,
uint32_t *  crc_dst,
uint32_t  seed,
uint64_t  nbytes,
int  flags,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Submit a copy with CRC-32C calculation request.

This operation will copy data and calculate the 4 byte CRC32-C for the given data.

Parameters
chI/O channel associated with this call.
dstDestination to write the data to.
srcThe source address for the data.
crc_dstDestination to write the CRC-32C to.
seedFour byte seed value.
nbytesLength in bytes.
flagsAccel framework flags for operations.
cb_fnCalled when this CRC-32C operation completes.
cb_argCallback argument.
Returns
0 on success, negative errno on failure.

◆ spdk_accel_submit_copy_crc32cv()

int spdk_accel_submit_copy_crc32cv ( struct spdk_io_channel *  ch,
void *  dst,
struct iovec *  src_iovs,
uint32_t  iovcnt,
uint32_t *  crc_dst,
uint32_t  seed,
int  flags,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Submit a chained copy + CRC-32C calculation request.

This operation will calculate the 4 byte CRC32-C for the given data.

Parameters
chI/O channel associated with this call.
dstDestination to write the data to.
src_iovsThe io vector array which stores the src data and len.
iovcntThe size of the io vectors.
crc_dstDestination to write the CRC-32C to.
seedFour byte seed value.
flagsAccel framework flags for operations.
cb_fnCalled when this CRC-32C operation completes.
cb_argCallback argument.
Returns
0 on success, negative errno on failure.

◆ spdk_accel_submit_crc32c()

int spdk_accel_submit_crc32c ( struct spdk_io_channel *  ch,
uint32_t *  crc_dst,
void *  src,
uint32_t  seed,
uint64_t  nbytes,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Submit a CRC-32C calculation request.

This operation will calculate the 4 byte CRC32-C for the given data.

Parameters
chI/O channel associated with this call.
crc_dstDestination to write the CRC-32C to.
srcThe source address for the data.
seedFour byte seed value.
nbytesLength in bytes.
cb_fnCalled when this CRC-32C operation completes.
cb_argCallback argument.
Returns
0 on success, negative errno on failure.

◆ spdk_accel_submit_crc32cv()

int spdk_accel_submit_crc32cv ( struct spdk_io_channel *  ch,
uint32_t *  crc_dst,
struct iovec *  iovs,
uint32_t  iovcnt,
uint32_t  seed,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Submit a chained CRC-32C calculation request.

This operation will calculate the 4 byte CRC32-C for the given data.

Parameters
chI/O channel associated with this call.
crc_dstDestination to write the CRC-32C to.
iovsThe io vector array which stores the src data and len.
iovcntThe size of the iov.
seedFour byte seed value.
cb_fnCalled when this CRC-32C operation completes.
cb_argCallback argument.
Returns
0 on success, negative errno on failure.

◆ spdk_accel_submit_dualcast()

int spdk_accel_submit_dualcast ( struct spdk_io_channel *  ch,
void *  dst1,
void *  dst2,
void *  src,
uint64_t  nbytes,
int  flags,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Submit a dual cast copy request.

Parameters
chI/O channel associated with this call.
dst1First destination to copy to (must be 4K aligned).
dst2Second destination to copy to (must be 4K aligned).
srcSource to copy from.
nbytesLength in bytes to copy.
flagsAccel framework flags for operations.
cb_fnCalled when this copy operation completes.
cb_argCallback argument.
Returns
0 on success, negative errno on failure.

◆ spdk_accel_submit_fill()

int spdk_accel_submit_fill ( struct spdk_io_channel *  ch,
void *  dst,
uint8_t  fill,
uint64_t  nbytes,
int  flags,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Submit a fill request.

This operation will fill the destination buffer with the specified value.

Parameters
chI/O channel associated with this call.
dstDestination to fill.
fillConstant byte to fill to the destination.
nbytesLength in bytes to fill.
flagsAccel framework flags for operations.
cb_fnCalled when this fill operation completes.
cb_argCallback argument.
Returns
0 on success, negative errno on failure.

◆ spdk_accel_write_config_json()

void spdk_accel_write_config_json ( struct spdk_json_write_ctx *  w)

Write Acceleration subsystem configuration into provided JSON context.

Parameters
wJSON write context