accel.h File Reference

Acceleration Framework. More...

Data Structures

struct  spdk_accel_crypto_key_create_param
 
struct  spdk_accel_opts
 
struct  spdk_accel_opcode_stats
 
struct  spdk_accel_operation_exec_ctx
 Context for the spdk_accel_get_buf_align() function. More...
 

Macros

#define SPDK_ACCEL_AES_XTS_128_KEY_SIZE   16
 
#define SPDK_ACCEL_AES_XTS_256_KEY_SIZE   32
 

Typedefs

typedef void(* spdk_accel_completion_cb) (void *cb_arg, int status)
 Acceleration operation callback. More...
 
typedef void(* spdk_accel_fini_cb) (void *cb_arg)
 Acceleration framework finish callback. More...
 
typedef void(* spdk_accel_step_cb) (void *cb_arg)
 Completion callback of a single operation within a sequence. More...
 

Enumerations

enum  spdk_accel_opcode {
  SPDK_ACCEL_OPC_COPY = 0 , SPDK_ACCEL_OPC_FILL = 1 , SPDK_ACCEL_OPC_DUALCAST = 2 , SPDK_ACCEL_OPC_COMPARE = 3 ,
  SPDK_ACCEL_OPC_CRC32C = 4 , SPDK_ACCEL_OPC_COPY_CRC32C = 5 , SPDK_ACCEL_OPC_COMPRESS = 6 , SPDK_ACCEL_OPC_DECOMPRESS = 7 ,
  SPDK_ACCEL_OPC_ENCRYPT = 8 , SPDK_ACCEL_OPC_DECRYPT = 9 , SPDK_ACCEL_OPC_XOR = 10 , SPDK_ACCEL_OPC_DIF_VERIFY = 11 ,
  SPDK_ACCEL_OPC_DIF_GENERATE = 12 , SPDK_ACCEL_OPC_DIF_GENERATE_COPY = 13 , SPDK_ACCEL_OPC_LAST = 14
}
 
enum  spdk_accel_cipher { SPDK_ACCEL_CIPHER_AES_CBC , SPDK_ACCEL_CIPHER_AES_XTS }
 

Functions

int spdk_accel_initialize (void)
 Initialize the acceleration framework. More...
 
void spdk_accel_finish (spdk_accel_fini_cb cb_fn, void *cb_arg)
 Close the acceleration framework. More...
 
struct spdk_io_channel * spdk_accel_get_io_channel (void)
 Get an I/O channel for the acceleration framework. More...
 
int spdk_accel_crypto_key_create (const struct spdk_accel_crypto_key_create_param *param)
 Create a crypto key with given parameters. More...
 
int spdk_accel_crypto_key_destroy (struct spdk_accel_crypto_key *key)
 Destroy a crypto key. More...
 
struct spdk_accel_crypto_keyspdk_accel_crypto_key_get (const char *name)
 Find a crypto key structure by name. 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...
 
int spdk_accel_submit_compress (struct spdk_io_channel *ch, void *dst, uint64_t nbytes, struct iovec *src_iovs, size_t src_iovcnt, uint32_t *output_size, int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Build and submit a memory compress request. More...
 
int spdk_accel_submit_decompress (struct spdk_io_channel *ch, struct iovec *dst_iovs, size_t dst_iovcnt, struct iovec *src_iovs, size_t src_iovcnt, uint32_t *output_size, int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Build and submit a memory decompress request. More...
 
int spdk_accel_submit_xor (struct spdk_io_channel *ch, void *dst, void **sources, uint32_t nsrcs, uint64_t nbytes, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Submit an xor request. More...
 
int spdk_accel_submit_encrypt (struct spdk_io_channel *ch, struct spdk_accel_crypto_key *key, struct iovec *dst_iovs, uint32_t dst_iovcnt, struct iovec *src_iovs, uint32_t src_iovcnt, uint64_t iv, uint32_t block_size, int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Build and submit a data encryption request. More...
 
int spdk_accel_submit_decrypt (struct spdk_io_channel *ch, struct spdk_accel_crypto_key *key, struct iovec *dst_iovs, uint32_t dst_iovcnt, struct iovec *src_iovs, uint32_t src_iovcnt, uint64_t iv, uint32_t block_size, int flags, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Build and submit a data decryption request. More...
 
int spdk_accel_submit_dif_verify (struct spdk_io_channel *ch, struct iovec *iovs, size_t iovcnt, uint32_t num_blocks, const struct spdk_dif_ctx *ctx, struct spdk_dif_error *err, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Submit a Data Integrity Field (DIF) verify request. More...
 
int spdk_accel_submit_dif_generate (struct spdk_io_channel *ch, struct iovec *iovs, size_t iovcnt, uint32_t num_blocks, const struct spdk_dif_ctx *ctx, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Submit a Data Integrity Field (DIF) generate request. More...
 
int spdk_accel_submit_dif_generate_copy (struct spdk_io_channel *ch, struct iovec *dst_iovs, size_t dst_iovcnt, struct iovec *src_iovs, size_t src_iovcnt, uint32_t num_blocks, const struct spdk_dif_ctx *ctx, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Submit a Data Integrity Field (DIF) copy and generate request. More...
 
int spdk_accel_append_copy (struct spdk_accel_sequence **seq, struct spdk_io_channel *ch, struct iovec *dst_iovs, uint32_t dst_iovcnt, struct spdk_memory_domain *dst_domain, void *dst_domain_ctx, struct iovec *src_iovs, uint32_t src_iovcnt, struct spdk_memory_domain *src_domain, void *src_domain_ctx, int flags, spdk_accel_step_cb cb_fn, void *cb_arg)
 Append a copy operation to a sequence. More...
 
int spdk_accel_append_fill (struct spdk_accel_sequence **seq, struct spdk_io_channel *ch, void *buf, uint64_t len, struct spdk_memory_domain *domain, void *domain_ctx, uint8_t pattern, int flags, spdk_accel_step_cb cb_fn, void *cb_arg)
 Append a fill operation to a sequence. More...
 
int spdk_accel_append_decompress (struct spdk_accel_sequence **seq, struct spdk_io_channel *ch, struct iovec *dst_iovs, size_t dst_iovcnt, struct spdk_memory_domain *dst_domain, void *dst_domain_ctx, struct iovec *src_iovs, size_t src_iovcnt, struct spdk_memory_domain *src_domain, void *src_domain_ctx, int flags, spdk_accel_step_cb cb_fn, void *cb_arg)
 Append a decompress operation to a sequence. More...
 
int spdk_accel_append_encrypt (struct spdk_accel_sequence **seq, struct spdk_io_channel *ch, struct spdk_accel_crypto_key *key, struct iovec *dst_iovs, uint32_t dst_iovcnt, struct spdk_memory_domain *dst_domain, void *dst_domain_ctx, struct iovec *src_iovs, uint32_t src_iovcnt, struct spdk_memory_domain *src_domain, void *src_domain_ctx, uint64_t iv, uint32_t block_size, int flags, spdk_accel_step_cb cb_fn, void *cb_arg)
 Append an encrypt operation to a sequence. More...
 
int spdk_accel_append_decrypt (struct spdk_accel_sequence **seq, struct spdk_io_channel *ch, struct spdk_accel_crypto_key *key, struct iovec *dst_iovs, uint32_t dst_iovcnt, struct spdk_memory_domain *dst_domain, void *dst_domain_ctx, struct iovec *src_iovs, uint32_t src_iovcnt, struct spdk_memory_domain *src_domain, void *src_domain_ctx, uint64_t iv, uint32_t block_size, int flags, spdk_accel_step_cb cb_fn, void *cb_arg)
 Append a decrypt operation to a sequence. More...
 
int spdk_accel_append_crc32c (struct spdk_accel_sequence **seq, struct spdk_io_channel *ch, uint32_t *dst, struct iovec *iovs, uint32_t iovcnt, struct spdk_memory_domain *domain, void *domain_ctx, uint32_t seed, spdk_accel_step_cb cb_fn, void *cb_arg)
 Append a crc32c operation to a sequence. More...
 
void spdk_accel_sequence_finish (struct spdk_accel_sequence *seq, spdk_accel_completion_cb cb_fn, void *cb_arg)
 Finish a sequence and execute all its operations. More...
 
void spdk_accel_sequence_reverse (struct spdk_accel_sequence *seq)
 Reverse a sequence, so that the last operation becomes the first and vice versa. More...
 
void spdk_accel_sequence_abort (struct spdk_accel_sequence *seq)
 Abort a sequence. More...
 
int spdk_accel_get_buf (struct spdk_io_channel *ch, uint64_t len, void **buf, struct spdk_memory_domain **domain, void **domain_ctx)
 Allocate a buffer from accel domain. More...
 
void spdk_accel_put_buf (struct spdk_io_channel *ch, void *buf, struct spdk_memory_domain *domain, void *domain_ctx)
 Release a buffer allocated via spdk_accel_get_buf(). More...
 
int spdk_accel_get_opc_module_name (enum spdk_accel_opcode opcode, const char **module_name)
 Return the name of the module assigned to a specific opcode. More...
 
int spdk_accel_assign_opc (enum spdk_accel_opcode opcode, const char *name)
 Override the assignment of an opcode to an module. More...
 
void spdk_accel_write_config_json (struct spdk_json_write_ctx *w)
 Write Acceleration subsystem configuration into provided JSON context. More...
 
int spdk_accel_set_driver (const char *name)
 Select platform driver to execute operation chains. More...
 
struct spdk_memory_domain * spdk_accel_get_memory_domain (void)
 Retrieves accel memory domain. More...
 
int spdk_accel_set_opts (const struct spdk_accel_opts *opts)
 Set the options for the accel framework. More...
 
void spdk_accel_get_opts (struct spdk_accel_opts *opts)
 Get the options for the accel framework. More...
 
void spdk_accel_get_opcode_stats (struct spdk_io_channel *ch, enum spdk_accel_opcode opcode, struct spdk_accel_opcode_stats *stats, size_t size)
 Retrieve opcode statistics for a given IO channel. More...
 
uint8_t spdk_accel_get_buf_align (enum spdk_accel_opcode opcode, const struct spdk_accel_operation_exec_ctx *ctx)
 Get minimum buffer alignment to execute a given operation. More...
 
const char * spdk_accel_get_opcode_name (enum spdk_accel_opcode opcode)
 Return the name of an operation based on the opcode. More...
 

Detailed Description

Acceleration Framework.

Typedef Documentation

◆ spdk_accel_completion_cb

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

Acceleration operation callback.

Parameters
cb_argCallback argument specified in the 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 framework finish callback.

Parameters
cb_argCallback argument.

◆ spdk_accel_step_cb

typedef void(* spdk_accel_step_cb) (void *cb_arg)

Completion callback of a single operation within a sequence.

After it's executed, the sequence object might be freed, so users should not touch it.

Function Documentation

◆ spdk_accel_append_copy()

int spdk_accel_append_copy ( struct spdk_accel_sequence **  seq,
struct spdk_io_channel *  ch,
struct iovec *  dst_iovs,
uint32_t  dst_iovcnt,
struct spdk_memory_domain *  dst_domain,
void *  dst_domain_ctx,
struct iovec *  src_iovs,
uint32_t  src_iovcnt,
struct spdk_memory_domain *  src_domain,
void *  src_domain_ctx,
int  flags,
spdk_accel_step_cb  cb_fn,
void *  cb_arg 
)

Append a copy operation to a sequence.

Copy operation in a sequence is special, as it is not guaranteed that the data will be actually copied. If it's possible, it will only change source / destination buffers of some of the operations in a sequence.

Parameters
seqSequence object. If NULL, a new sequence object will be created.
chI/O channel.
dst_iovsDestination I/O vector array.
dst_iovcntSize of the dst_iovs array.
dst_domainMemory domain to which the destination buffers belong.
dst_domain_ctxDestination buffer domain context.
src_iovsSource I/O vector array.
src_iovcntSize of the src_iovs array.
src_domainMemory domain to which the source buffers belong.
src_domain_ctxSource buffer domain context.
flagsAccel operation flags.
cb_fnCallback to be executed once this operation is completed.
cb_argArgument to be passed to cb_fn.
Returns
0 if operation was successfully added to the sequence, negative errno otherwise.

◆ spdk_accel_append_crc32c()

int spdk_accel_append_crc32c ( struct spdk_accel_sequence **  seq,
struct spdk_io_channel *  ch,
uint32_t *  dst,
struct iovec *  iovs,
uint32_t  iovcnt,
struct spdk_memory_domain *  domain,
void *  domain_ctx,
uint32_t  seed,
spdk_accel_step_cb  cb_fn,
void *  cb_arg 
)

Append a crc32c operation to a sequence.

Parameters
seqSequence object. If NULL, a new sequence object will be created.
chI/O channel.
dstDestination to write the calculated value.
iovsSource I/O vector array.
iovcntSize of the iovs array.
domainMemory domain to which the source buffers belong.
domain_ctxSource buffer domain context.
seedInitial value.
cb_fnCallback to be executed once this operation is completed.
cb_argArgument to be passed to cb_fn.
Returns
0 if operation was successfully added to the sequence, negative errno otherwise.

◆ spdk_accel_append_decompress()

int spdk_accel_append_decompress ( struct spdk_accel_sequence **  seq,
struct spdk_io_channel *  ch,
struct iovec *  dst_iovs,
size_t  dst_iovcnt,
struct spdk_memory_domain *  dst_domain,
void *  dst_domain_ctx,
struct iovec *  src_iovs,
size_t  src_iovcnt,
struct spdk_memory_domain *  src_domain,
void *  src_domain_ctx,
int  flags,
spdk_accel_step_cb  cb_fn,
void *  cb_arg 
)

Append a decompress operation to a sequence.

Parameters
seqSequence object. If NULL, a new sequence object will be created.
chI/O channel.
dst_iovsDestination I/O vector array.
dst_iovcntSize of the dst_iovs array.
dst_domainMemory domain to which the destination buffers belong.
dst_domain_ctxDestination buffer domain context.
src_iovsSource I/O vector array.
src_iovcntSize of the src_iovs array.
src_domainMemory domain to which the source buffers belong.
src_domain_ctxSource buffer domain context.
flagsAccel operation flags.
cb_fnCallback to be executed once this operation is completed.
cb_argArgument to be passed to cb_fn.
Returns
0 if operation was successfully added to the sequence, negative errno otherwise.

◆ spdk_accel_append_decrypt()

int spdk_accel_append_decrypt ( struct spdk_accel_sequence **  seq,
struct spdk_io_channel *  ch,
struct spdk_accel_crypto_key key,
struct iovec *  dst_iovs,
uint32_t  dst_iovcnt,
struct spdk_memory_domain *  dst_domain,
void *  dst_domain_ctx,
struct iovec *  src_iovs,
uint32_t  src_iovcnt,
struct spdk_memory_domain *  src_domain,
void *  src_domain_ctx,
uint64_t  iv,
uint32_t  block_size,
int  flags,
spdk_accel_step_cb  cb_fn,
void *  cb_arg 
)

Append a decrypt operation to a sequence.

nbytes must be multiple of block_size. iv is used to decrypt the first logical block of size block_size. If src_iovs describes more than one logical block then iv will be incremented for each next logical block. Data Encryption Key identifier should be created before calling this function using methods specific to the accel module being used.

Parameters
seqSequence object. If NULL, a new sequence object will be created.
chI/O channel.
keyData Encryption Key identifier
dst_iovsDestination I/O vector array.
dst_iovcntSize of the dst_iovs array.
dst_domainMemory domain to which the destination buffers belong.
dst_domain_ctxDestination buffer domain context.
src_iovsSource I/O vector array.
src_iovcntSize of the src_iovs array.
src_domainMemory domain to which the source buffers belong.
src_domain_ctxSource buffer domain context.
ivInitialization vector (tweak) used for decryption. Should be the same as iv used for encryption of a data block.
block_sizeLogical block size, if src contains more than 1 logical block, subsequent logical blocks will be decrypted with incremented iv.
flagsAccel operation flags.
cb_fnCallback to be executed once this operation is completed.
cb_argArgument to be passed to cb_fn.
Returns
0 if operation was successfully added to the sequence, negative errno otherwise.

◆ spdk_accel_append_encrypt()

int spdk_accel_append_encrypt ( struct spdk_accel_sequence **  seq,
struct spdk_io_channel *  ch,
struct spdk_accel_crypto_key key,
struct iovec *  dst_iovs,
uint32_t  dst_iovcnt,
struct spdk_memory_domain *  dst_domain,
void *  dst_domain_ctx,
struct iovec *  src_iovs,
uint32_t  src_iovcnt,
struct spdk_memory_domain *  src_domain,
void *  src_domain_ctx,
uint64_t  iv,
uint32_t  block_size,
int  flags,
spdk_accel_step_cb  cb_fn,
void *  cb_arg 
)

Append an encrypt operation to a sequence.

nbytes must be multiple of block_size. iv is used to encrypt the first logical block of size block_size. If src_iovs describes more than one logical block then iv will be incremented for each next logical block. Data Encryption Key identifier should be created before calling this function using methods specific to the accel module being used.

Parameters
seqSequence object. If NULL, a new sequence object will be created.
chI/O channel.
keyData Encryption Key identifier
dst_iovsDestination I/O vector array.
dst_iovcntSize of the dst_iovs array.
dst_domainMemory domain to which the destination buffers belong.
dst_domain_ctxDestination buffer domain context.
src_iovsSource I/O vector array.
src_iovcntSize of the src_iovs array.
src_domainMemory domain to which the source buffers belong.
src_domain_ctxSource buffer domain context.
ivInitialization vector (tweak) used for encryption
block_sizeLogical block size, if src contains more than 1 logical block, subsequent logical blocks will be encrypted with incremented iv.
flagsAccel operation flags.
cb_fnCallback to be executed once this operation is completed.
cb_argArgument to be passed to cb_fn.
Returns
0 if operation was successfully added to the sequence, negative errno otherwise.

◆ spdk_accel_append_fill()

int spdk_accel_append_fill ( struct spdk_accel_sequence **  seq,
struct spdk_io_channel *  ch,
void *  buf,
uint64_t  len,
struct spdk_memory_domain *  domain,
void *  domain_ctx,
uint8_t  pattern,
int  flags,
spdk_accel_step_cb  cb_fn,
void *  cb_arg 
)

Append a fill operation to a sequence.

Parameters
seqSequence object. If NULL, a new sequence object will be created.
chI/O channel.
bufData buffer.
lenLength of the data buffer.
domainMemory domain to which the data buffer belongs.
domain_ctxBuffer domain context.
patternPattern to fill the buffer with.
flagsAccel operation flags.
cb_fnCallback to be executed once this operation is completed.
cb_argArgument to be passed to cb_fn.
Returns
0 if operation was successfully added to the sequence, negative errno otherwise.

◆ spdk_accel_assign_opc()

int spdk_accel_assign_opc ( enum spdk_accel_opcode  opcode,
const char *  name 
)

Override the assignment of an opcode to an module.

Parameters
opcodeAccel Framework Opcode enum value. Valid codes can be retrieved using accel_get_opc_assignments or spdk_accel_get_opcode_name.
nameName of the module to assign. Valid module names may be retrieved with spdk_accel_get_opc_module_name
Returns
0 if a valid opcode name was provided. -EINVAL for invalid opcode or if the framework has started (cannot change modules after startup)

◆ spdk_accel_crypto_key_create()

int spdk_accel_crypto_key_create ( const struct spdk_accel_crypto_key_create_param param)

Create a crypto key with given parameters.

Accel module copies content of param structure

Parameters
paramKey parameters
Returns
0 on success, negated errno on error

◆ spdk_accel_crypto_key_destroy()

int spdk_accel_crypto_key_destroy ( struct spdk_accel_crypto_key key)

Destroy a crypto key.

Parameters
keyKey to destroy
Returns
0 on success, negated errno on error

◆ spdk_accel_crypto_key_get()

struct spdk_accel_crypto_key* spdk_accel_crypto_key_get ( const char *  name)

Find a crypto key structure by name.

Parameters
nameKey name
Returns
Crypto key structure or NULL

◆ spdk_accel_finish()

void spdk_accel_finish ( spdk_accel_fini_cb  cb_fn,
void *  cb_arg 
)

Close the acceleration framework.

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

◆ spdk_accel_get_buf()

int spdk_accel_get_buf ( struct spdk_io_channel *  ch,
uint64_t  len,
void **  buf,
struct spdk_memory_domain **  domain,
void **  domain_ctx 
)

Allocate a buffer from accel domain.

These buffers can be only used with operations appended to a sequence. The actual data buffer won't be allocated immediately, but only when it's necessary to execute a given operation. In some cases, this might even mean that a data buffer won't be allocated at all, if a sequence can be executed without it.

A buffer can only be a part of one sequence, but it can be used by multiple operations within that sequence.

Parameters
chI/O channel.
lenLength of the buffer to allocate.
bufPointer to the allocated buffer.
domainMemory domain in which the buffer is allocated.
domain_ctxMemory domain context related to the allocated buffer.
Returns
0 if a buffer was successfully allocated, negative errno otherwise.

◆ spdk_accel_get_buf_align()

uint8_t spdk_accel_get_buf_align ( enum spdk_accel_opcode  opcode,
const struct spdk_accel_operation_exec_ctx ctx 
)

Get minimum buffer alignment to execute a given operation.

It accounts for constraints of a module assigned to execute a given operation and the driver (if set). The alignment is returned as a power of 2. The value of 0 means that the buffers don't need to be aligned.

Parameters
opcodeOpcode.
ctxContext in which the operation will be executed.
Returns
Minimum alignment.

◆ spdk_accel_get_io_channel()

struct spdk_io_channel* spdk_accel_get_io_channel ( void  )

Get an I/O channel for the acceleration framework.

This I/O channel is used to submit requests.

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

◆ spdk_accel_get_memory_domain()

struct spdk_memory_domain* spdk_accel_get_memory_domain ( void  )

Retrieves accel memory domain.

Returns
Accel memory domain.

◆ spdk_accel_get_opc_module_name()

int spdk_accel_get_opc_module_name ( enum spdk_accel_opcode  opcode,
const char **  module_name 
)

Return the name of the module assigned to a specific opcode.

Parameters
opcodeAccel Framework Opcode enum value. Valid codes can be retrieved using accel_get_opc_assignments or spdk_accel_get_opcode_name.
module_namePointer to update with module name.
Returns
0 if a valid module name was provided. -EINVAL for invalid opcode or -ENOENT no module was found at this time for the provided opcode.

◆ spdk_accel_get_opcode_name()

const char* spdk_accel_get_opcode_name ( enum spdk_accel_opcode  opcode)

Return the name of an operation based on the opcode.

Parameters
opcodeOpcode.
Returns
Name of the operation.

◆ spdk_accel_get_opcode_stats()

void spdk_accel_get_opcode_stats ( struct spdk_io_channel *  ch,
enum spdk_accel_opcode  opcode,
struct spdk_accel_opcode_stats stats,
size_t  size 
)

Retrieve opcode statistics for a given IO channel.

Parameters
chI/O channel.
opcodeOperation to retrieve statistics.
statsPer-channel statistics.
sizeSize of the stats structure.

◆ spdk_accel_get_opts()

void spdk_accel_get_opts ( struct spdk_accel_opts opts)

Get the options for the accel framework.

Parameters
optsAccel options.

◆ spdk_accel_initialize()

int spdk_accel_initialize ( void  )

Initialize the acceleration framework.

Returns
0 on success.

◆ spdk_accel_put_buf()

void spdk_accel_put_buf ( struct spdk_io_channel *  ch,
void *  buf,
struct spdk_memory_domain *  domain,
void *  domain_ctx 
)

Release a buffer allocated via spdk_accel_get_buf().

Parameters
chI/O channel.
bufBuffer allocated via spdk_accel_get_buf().
domainMemory domain in which the buffer is allocated.
domain_ctxMemory domain context related to the allocated buffer.

◆ spdk_accel_sequence_abort()

void spdk_accel_sequence_abort ( struct spdk_accel_sequence *  seq)

Abort a sequence.

This will execute the completion callbacks of all operations that were added to the sequence and will then free the sequence object.

Parameters
seqSequence to abort.

◆ spdk_accel_sequence_finish()

void spdk_accel_sequence_finish ( struct spdk_accel_sequence *  seq,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Finish a sequence and execute all its operations.

After the completion callback is executed, the sequence object is automatically freed.

Parameters
seqSequence to finish.
cb_fnCompletion callback to be executed once all operations are executed.
cb_argArgument to be passed to cb_fn.

◆ spdk_accel_sequence_reverse()

void spdk_accel_sequence_reverse ( struct spdk_accel_sequence *  seq)

Reverse a sequence, so that the last operation becomes the first and vice versa.

Parameters
seqSequence to reverse.

◆ spdk_accel_set_driver()

int spdk_accel_set_driver ( const char *  name)

Select platform driver to execute operation chains.

Parameters
nameName of the driver.
Returns
0 on success, negetive errno otherwise.

◆ spdk_accel_set_opts()

int spdk_accel_set_opts ( const struct spdk_accel_opts opts)

Set the options for the accel framework.

Parameters
optsAccel options.
Returns
0 on success, negative errno otherwise.

◆ 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_compress()

int spdk_accel_submit_compress ( struct spdk_io_channel *  ch,
void *  dst,
uint64_t  nbytes,
struct iovec *  src_iovs,
size_t  src_iovcnt,
uint32_t *  output_size,
int  flags,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Build and submit a memory compress request.

This function will build the compress descriptor and submit it.

Parameters
chI/O channel associated with this call
dstDestination to write the data to.
nbytesLength in bytes.
src_iovsThe io vector array which stores the src data and len.
src_iovcntThe size of the src io vectors.
output_sizeThe size of the compressed data (may be NULL if not desired)
flagsFlags, optional flags that can vary per operation.
cb_fnCallback function which will be called when the request is complete.
cb_argOpaque value which will be passed back as the arg parameter in the completion callback.
Returns
0 on success, negative errno on failure.

◆ 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_decompress()

int spdk_accel_submit_decompress ( struct spdk_io_channel *  ch,
struct iovec *  dst_iovs,
size_t  dst_iovcnt,
struct iovec *  src_iovs,
size_t  src_iovcnt,
uint32_t *  output_size,
int  flags,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Build and submit a memory decompress request.

This function will build the decompress descriptor and submit it.

Parameters
chI/O channel associated with this call
dst_iovsThe io vector array which stores the dst data and len.
dst_iovcntThe size of the dst io vectors.
src_iovsThe io vector array which stores the src data and len.
src_iovcntThe size of the src io vectors.
output_sizeThe size of the compressed data (may be NULL if not desired)
flagsFlags, optional flags that can vary per operation.
cb_fnCallback function which will be called when the request is complete.
cb_argOpaque value which will be passed back as the arg parameter in the completion callback.
Returns
0 on success, negative errno on failure.

◆ spdk_accel_submit_decrypt()

int spdk_accel_submit_decrypt ( struct spdk_io_channel *  ch,
struct spdk_accel_crypto_key key,
struct iovec *  dst_iovs,
uint32_t  dst_iovcnt,
struct iovec *  src_iovs,
uint32_t  src_iovcnt,
uint64_t  iv,
uint32_t  block_size,
int  flags,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Build and submit a data decryption request.

This function will build the decryption request and submit it. nbytes must be multiple of block_size. iv is used to decrypt the first logical block of size block_size. If src_iovs describes more than one logical block then iv will be incremented for each next logical block. Data Encryption Key identifier should be created before calling this function using methods specific to the accel module being used.

Parameters
chI/O channel associated with this call
keyData Encryption Key identifier
dst_iovsThe io vector array which stores the dst data and len.
dst_iovcntThe size of the destination io vectors.
src_iovsThe io vector array which stores the src data and len.
src_iovcntThe size of the source io vectors.
ivInitialization vector (tweak) used for decryption. Should be the same as iv used for encryption of a data block
block_sizeLogical block size, if src contains more than 1 logical block, subsequent logical blocks will be decrypted with incremented iv
flagsAccel framework flags for operations.
cb_fnCallback function which will be called when the request is complete.
cb_argOpaque value which will be passed back as the arg parameter in the completion callback.
Returns
0 on success, negative errno on failure.

◆ spdk_accel_submit_dif_generate()

int spdk_accel_submit_dif_generate ( struct spdk_io_channel *  ch,
struct iovec *  iovs,
size_t  iovcnt,
uint32_t  num_blocks,
const struct spdk_dif_ctx ctx,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Submit a Data Integrity Field (DIF) generate request.

This operation compute the DIF on the source data and inserting the DIF in place into the source data.

Parameters
chI/O channel associated with this call.
iovsThe io vector array. The total allocated memory size needs to be at least: num_blocks * block_size (including metadata)
iovcntThe size of the io vectors array.
num_blocksNumber of data blocks.
ctxDIF context. Contains the DIF configuration values, including the reference Application Tag value and initial value of the Reference Tag to insert
cb_fnCalled when this operation completes.
cb_argCallback argument.
Returns
0 on success, negative errno on failure.

◆ spdk_accel_submit_dif_generate_copy()

int spdk_accel_submit_dif_generate_copy ( struct spdk_io_channel *  ch,
struct iovec *  dst_iovs,
size_t  dst_iovcnt,
struct iovec *  src_iovs,
size_t  src_iovcnt,
uint32_t  num_blocks,
const struct spdk_dif_ctx ctx,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Submit a Data Integrity Field (DIF) copy and generate request.

This operation copies memory from the source to the destination address, while computing the DIF on the source data and inserting the DIF into the output data.

Parameters
chI/O channel associated with this call.
dst_iovsThe destination io vector array. The total allocated memory size needs to be at least: num_blocks * block_size (provided to spdk_dif_ctx_init())
dst_iovcntThe size of the destination io vectors array.
src_iovsThe source io vector array. The total allocated memory size needs to be at least: num_blocks * block_size_no_md
src_iovcntThe size of the source io vectors array.
num_blocksNumber of data blocks to process.
ctxDIF context. Contains the DIF configuration values, including the reference Application Tag value and initial value of the Reference Tag to insert
cb_fnCalled when this operation completes.
cb_argCallback argument.
Returns
0 on success, negative errno on failure.

◆ spdk_accel_submit_dif_verify()

int spdk_accel_submit_dif_verify ( struct spdk_io_channel *  ch,
struct iovec *  iovs,
size_t  iovcnt,
uint32_t  num_blocks,
const struct spdk_dif_ctx ctx,
struct spdk_dif_error err,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Submit a Data Integrity Field (DIF) verify request.

This operation computes the DIF on the data and compares it against the DIF contained in the metadata.

Parameters
chI/O channel associated with this call.
iovsThe io vector array. The total allocated memory size needs to be at least: num_blocks * block_size (including metadata)
iovcntThe size of the io vectors array.
num_blocksNumber of data blocks to check.
ctxDIF context. Contains the DIF configuration values, including the reference Application Tag value and initial value of the Reference Tag to check Note: the user must ensure the validity of this pointer throughout the entire operation because it is not validated along the processing path.
errDIF error detailed information. Note: the user must ensure the validity of this pointer throughout the entire operation because it is not validated along the processing path.
cb_fnCalled when this 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_encrypt()

int spdk_accel_submit_encrypt ( struct spdk_io_channel *  ch,
struct spdk_accel_crypto_key key,
struct iovec *  dst_iovs,
uint32_t  dst_iovcnt,
struct iovec *  src_iovs,
uint32_t  src_iovcnt,
uint64_t  iv,
uint32_t  block_size,
int  flags,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Build and submit a data encryption request.

This function will build the encryption request and submit it. nbytes must be multiple of block_size. iv is used to encrypt the first logical block of size block_size. If src_iovs describes more than one logical block then iv will be incremented for each next logical block. Data Encryption Key identifier should be created before calling this function using methods specific to the accel module being used.

Parameters
chI/O channel associated with this call
keyData Encryption Key identifier
dst_iovsThe io vector array which stores the dst data and len.
dst_iovcntThe size of the destination io vectors.
src_iovsThe io vector array which stores the src data and len.
src_iovcntThe size of the source io vectors.
ivInitialization vector (tweak) used for encryption
block_sizeLogical block size, if src contains more than 1 logical block, subsequent logical blocks will be encrypted with incremented iv
flagsAccel framework flags for operations.
cb_fnCallback function which will be called when the request is complete.
cb_argOpaque value which will be passed back as the arg parameter in the completion callback.
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_submit_xor()

int spdk_accel_submit_xor ( struct spdk_io_channel *  ch,
void *  dst,
void **  sources,
uint32_t  nsrcs,
uint64_t  nbytes,
spdk_accel_completion_cb  cb_fn,
void *  cb_arg 
)

Submit an xor request.

Parameters
chI/O channel associated with this call.
dstDestination to write the data to.
sourcesArray of source buffers.
nsrcsNumber of source buffers in the array.
nbytesLength in bytes.
cb_fnCalled when this copy 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