Loading...
Searching...
No Matches
idxd.h File Reference

IDXD driver public interface. More...

Macros

#define SPDK_IDXD_FLAG_NONTEMPORAL   IDXD_FLAG_CACHE_CONTROL
 

Typedefs

typedef void(* spdk_idxd_req_cb) (void *arg, int status)
 Signature for callback function invoked when a request is completed.
 
typedef void(* spdk_idxd_attach_cb) (void *cb_ctx, struct spdk_idxd_device *idxd)
 Callback for spdk_idxd_probe() to report a device that has been attached to the userspace IDXD driver.
 
typedef bool(* spdk_idxd_probe_cb) (void *cb_ctx, struct spdk_pci_device *dev)
 Callback for spdk_idxd_probe() to report a device that has been found.
 

Functions

uint32_t spdk_idxd_get_socket (struct spdk_idxd_device *idxd)
 Get the socket that this device is on.
 
int spdk_idxd_probe (void *cb_ctx, spdk_idxd_attach_cb attach_cb, spdk_idxd_probe_cb probe_cb)
 Enumerate the IDXD devices attached to the system and attach the userspace IDXD driver to them if desired.
 
void spdk_idxd_detach (struct spdk_idxd_device *idxd)
 Detach specified device returned by spdk_idxd_probe() from the IDXD driver.
 
int spdk_idxd_set_config (bool kernel_mode)
 Sets the IDXD configuration.
 
int spdk_idxd_submit_copy (struct spdk_idxd_io_channel *chan, struct iovec *diov, uint32_t diovcnt, struct iovec *siov, uint32_t siovcnt, int flags, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit an idxd memory copy request.
 
int spdk_idxd_submit_dualcast (struct spdk_idxd_io_channel *chan, void *dst1, void *dst2, const void *src, uint64_t nbytes, int flags, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit an idxd dualcast request.
 
int spdk_idxd_submit_compare (struct spdk_idxd_io_channel *chan, struct iovec *siov1, size_t siov1cnt, struct iovec *siov2, size_t siov2cnt, int flags, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit a memory compare request.
 
int spdk_idxd_submit_fill (struct spdk_idxd_io_channel *chan, struct iovec *diov, size_t diovcnt, uint64_t fill_pattern, int flags, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit a idxd memory fill request.
 
int spdk_idxd_submit_crc32c (struct spdk_idxd_io_channel *chan, struct iovec *siov, size_t siovcnt, uint32_t seed, uint32_t *crc_dst, int flags, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit a memory CRC32-C request.
 
int spdk_idxd_submit_copy_crc32c (struct spdk_idxd_io_channel *chan, struct iovec *diov, size_t diovcnt, struct iovec *siov, size_t siovcnt, uint32_t seed, uint32_t *crc_dst, int flags, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit a copy combined with CRC32-C request.
 
int spdk_idxd_submit_compress (struct spdk_idxd_io_channel *chan, void *dst, uint64_t nbytes, struct iovec *siov, uint32_t siovcnt, uint32_t *output_size, int flags, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit an IAA memory compress request.
 
int spdk_idxd_submit_decompress (struct spdk_idxd_io_channel *chan, struct iovec *diov, uint32_t diovcnt, struct iovec *siov, uint32_t siovcnt, int flags, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit an IAA memory decompress request.
 
int spdk_idxd_submit_dif_check (struct spdk_idxd_io_channel *chan, struct iovec *siov, size_t siovcnt, uint32_t num_blocks, const struct spdk_dif_ctx *ctx, int flags, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit a DIF check request.
 
int spdk_idxd_submit_dif_insert (struct spdk_idxd_io_channel *chan, struct iovec *diov, size_t diovcnt, struct iovec *siov, size_t siovcnt, uint32_t num_blocks, const struct spdk_dif_ctx *ctx, int flags, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit a DIF insert request.
 
int spdk_idxd_submit_dif_strip (struct spdk_idxd_io_channel *chan, struct iovec *diov, size_t diovcnt, struct iovec *siov, size_t siovcnt, uint32_t num_blocks, const struct spdk_dif_ctx *ctx, int flags, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit a DIF strip request.
 
int spdk_idxd_submit_raw_desc (struct spdk_idxd_io_channel *chan, struct idxd_hw_desc *desc, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit an IDXD raw request.
 
int spdk_idxd_process_events (struct spdk_idxd_io_channel *chan)
 Check for completed requests on an IDXD channel.
 
struct spdk_idxd_io_channel * spdk_idxd_get_channel (struct spdk_idxd_device *idxd)
 Returns an IDXD channel for a given IDXD device.
 
void spdk_idxd_put_channel (struct spdk_idxd_io_channel *chan)
 Free an IDXD channel.
 

Detailed Description

IDXD driver public interface.

Typedef Documentation

◆ spdk_idxd_attach_cb

typedef void(* spdk_idxd_attach_cb) (void *cb_ctx, struct spdk_idxd_device *idxd)

Callback for spdk_idxd_probe() to report a device that has been attached to the userspace IDXD driver.

Parameters
cb_ctxUser-specified opaque value corresponding to cb_ctx from spdk_idxd_probe().
idxdIDXD device that was attached to the driver.

◆ spdk_idxd_probe_cb

typedef bool(* spdk_idxd_probe_cb) (void *cb_ctx, struct spdk_pci_device *dev)

Callback for spdk_idxd_probe() to report a device that has been found.

Parameters
cb_ctxUser-specified opaque value corresponding to cb_ctx from spdk_idxd_probe().
devPCI device that is in question.
Returns
true if the caller wants the device, false if not..

◆ spdk_idxd_req_cb

typedef void(* spdk_idxd_req_cb) (void *arg, int status)

Signature for callback function invoked when a request is completed.

Parameters
argUser-specified opaque value corresponding to cb_arg from the request submission.
status0 on success, negative errno on failure.

Function Documentation

◆ spdk_idxd_detach()

void spdk_idxd_detach ( struct spdk_idxd_device * idxd)

Detach specified device returned by spdk_idxd_probe() from the IDXD driver.

Parameters
idxdIDXD device to detach from the driver.

◆ spdk_idxd_get_channel()

struct spdk_idxd_io_channel * spdk_idxd_get_channel ( struct spdk_idxd_device * idxd)

Returns an IDXD channel for a given IDXD device.

Parameters
idxdIDXD device to get a channel for.
Returns
pointer to an IDXD channel.

◆ spdk_idxd_get_socket()

uint32_t spdk_idxd_get_socket ( struct spdk_idxd_device * idxd)

Get the socket that this device is on.

Parameters
idxddevice to query
Returns
socket number.

◆ spdk_idxd_probe()

int spdk_idxd_probe ( void * cb_ctx,
spdk_idxd_attach_cb attach_cb,
spdk_idxd_probe_cb probe_cb )

Enumerate the IDXD devices attached to the system and attach the userspace IDXD driver to them if desired.

If called more than once, only devices that are not already attached to the SPDK IDXD driver will be reported.

To stop using the controller and release its associated resources, call spdk_idxd_detach() with the idxd_channel instance returned by this function.

Parameters
cb_ctxOpaque value which will be passed back in cb_ctx parameter of the callbacks.
probe_cbcallback to determine if the device being probe should be attached.
attach_cbwill be called for devices for which probe_cb returned true. once the IDXD controller has been attached to the userspace driver.
Returns
0 on success, -1 on failure.

◆ spdk_idxd_process_events()

int spdk_idxd_process_events ( struct spdk_idxd_io_channel * chan)

Check for completed requests on an IDXD channel.

Parameters
chanIDXD channel to check for completions.
Returns
number of operations completed.

◆ spdk_idxd_put_channel()

void spdk_idxd_put_channel ( struct spdk_idxd_io_channel * chan)

Free an IDXD channel.

Parameters
chanIDXD channel to free.

◆ spdk_idxd_set_config()

int spdk_idxd_set_config ( bool kernel_mode)

Sets the IDXD configuration.

Parameters
kernel_modetrue if using kernel driver.
Returns
0 on success, negative errno on failure.

◆ spdk_idxd_submit_compare()

int spdk_idxd_submit_compare ( struct spdk_idxd_io_channel * chan,
struct iovec * siov1,
size_t siov1cnt,
struct iovec * siov2,
size_t siov2cnt,
int flags,
spdk_idxd_req_cb cb_fn,
void * cb_arg )

Build and submit a memory compare request.

This function will build the compare descriptor and then immediately submit by writing to the proper device portal.

Parameters
chanIDXD channel to submit request.
siov1First source iovec.
siov1cntNumber of elements in siov1.
siov2Second source iovec.
siov2cntNumber of elements in siov2.
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_idxd_submit_compress()

int spdk_idxd_submit_compress ( struct spdk_idxd_io_channel * chan,
void * dst,
uint64_t nbytes,
struct iovec * siov,
uint32_t siovcnt,
uint32_t * output_size,
int flags,
spdk_idxd_req_cb cb_fn,
void * cb_arg )

Build and submit an IAA memory compress request.

This function will build the compress descriptor and then immediately submit by writing to the proper device portal.

Parameters
chanIDXD channel to submit request.
dstDestination to write the compressed data to.
nbytesLength in bytes. The dst buffer should be large enough to hold the compressed data.
siovSource iovec.
siovcntNumber of elements in siov.
output_sizeThe size of the compressed data.
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_idxd_submit_copy()

int spdk_idxd_submit_copy ( struct spdk_idxd_io_channel * chan,
struct iovec * diov,
uint32_t diovcnt,
struct iovec * siov,
uint32_t siovcnt,
int flags,
spdk_idxd_req_cb cb_fn,
void * cb_arg )

Build and submit an idxd memory copy request.

This function will build the copy descriptor and then immediately submit by writing to the proper device portal.

Parameters
chanIDXD channel to submit request.
diovDestination iovec.
diovcntNumber of elements in diov.
siovSource iovec.
siovcntNumber of elements in siov.
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_idxd_submit_copy_crc32c()

int spdk_idxd_submit_copy_crc32c ( struct spdk_idxd_io_channel * chan,
struct iovec * diov,
size_t diovcnt,
struct iovec * siov,
size_t siovcnt,
uint32_t seed,
uint32_t * crc_dst,
int flags,
spdk_idxd_req_cb cb_fn,
void * cb_arg )

Build and submit a copy combined with CRC32-C request.

This function will build the descriptor for copy plus CRC32-C and then immediately submit by writing to the proper device portal.

Parameters
chanIDXD channel to submit request.
diovDestination iovec.
diovcntNumber of elements in diov.
siovSource iovec.
siovcntNumber of elements in siov.
seedFour byte CRC-32C seed value.
crc_dstResulting calculation.
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 cb_arg parameter in the completion callback.
Returns
0 on success, negative errno on failure.

◆ spdk_idxd_submit_crc32c()

int spdk_idxd_submit_crc32c ( struct spdk_idxd_io_channel * chan,
struct iovec * siov,
size_t siovcnt,
uint32_t seed,
uint32_t * crc_dst,
int flags,
spdk_idxd_req_cb cb_fn,
void * cb_arg )

Build and submit a memory CRC32-C request.

This function will build the CRC-32C descriptor and then immediately submit by writing to the proper device portal.

Parameters
chanIDXD channel to submit request.
siovSource iovec.
siovcntNumber of elements in siov.
seedFour byte CRC-32C seed value.
crc_dstResulting calculation.
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 cb_arg parameter in the completion callback.
Returns
0 on success, negative errno on failure.

◆ spdk_idxd_submit_decompress()

int spdk_idxd_submit_decompress ( struct spdk_idxd_io_channel * chan,
struct iovec * diov,
uint32_t diovcnt,
struct iovec * siov,
uint32_t siovcnt,
int flags,
spdk_idxd_req_cb cb_fn,
void * cb_arg )

Build and submit an IAA memory decompress request.

This function will build the decompress descriptor and then immediately submit by writing to the proper device portal.

Parameters
chanIDXD channel to submit request.
diovDestination iovec. diov with diovcnt must be large enough to hold decompressed data.
diovcntNumber of elements in diov for decompress buffer.
siovSource iovec.
siovcntNumber of elements in siov.
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_idxd_submit_dif_check()

int spdk_idxd_submit_dif_check ( struct spdk_idxd_io_channel * chan,
struct iovec * siov,
size_t siovcnt,
uint32_t num_blocks,
const struct spdk_dif_ctx * ctx,
int flags,
spdk_idxd_req_cb cb_fn,
void * cb_arg )

Build and submit a DIF check request.

This function will build the DIF check descriptor and then immediately submit by writing to the proper device portal.

Parameters
chanIDXD channel to submit request.
siovSource iovec.
siovcntNumber of elements in siov.
num_blocksTotal number of blocks to process.
ctxDIF context. Contains the DIF configuration values, including the reference Application Tag value and initial value of the Reference Tag to check.
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 cb_arg parameter in the completion callback.
Returns
0 on success, negative errno on failure.

◆ spdk_idxd_submit_dif_insert()

int spdk_idxd_submit_dif_insert ( struct spdk_idxd_io_channel * chan,
struct iovec * diov,
size_t diovcnt,
struct iovec * siov,
size_t siovcnt,
uint32_t num_blocks,
const struct spdk_dif_ctx * ctx,
int flags,
spdk_idxd_req_cb cb_fn,
void * cb_arg )

Build and submit a DIF insert request.

This function will build the DIF insert descriptor and then immediately submit by writing to the proper device portal.

Parameters
chanIDXD channel to submit request.
diovDestination iovec.
diovcntNumber of elements in diov.
siovSource iovec.
siovcntNumber of elements in siov.
num_blocksTotal number of 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.
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 cb_arg parameter in the completion callback.
Returns
0 on success, negative errno on failure.

◆ spdk_idxd_submit_dif_strip()

int spdk_idxd_submit_dif_strip ( struct spdk_idxd_io_channel * chan,
struct iovec * diov,
size_t diovcnt,
struct iovec * siov,
size_t siovcnt,
uint32_t num_blocks,
const struct spdk_dif_ctx * ctx,
int flags,
spdk_idxd_req_cb cb_fn,
void * cb_arg )

Build and submit a DIF strip request.

This function will build the DIF strip descriptor and then immediately submit by writing to the proper device portal. The transfer size must be a multiple of the source block size plus metadata for each source block. The number of bytes written to the destination is the transfer size minus metadata for each source block. The source and destination data can be scattered across several different buffers, but each source buffer has to be a multiple of a block size and each destination buffer has to be a multiple of a data block size excluding metadata. Moreover, the length of each element in the source array (siov) must be exactly the same as the corresponding element in the destination array (diov) excluding metadata size.

Parameters
chanIDXD channel to submit request.
diovDestination iovec.
diovcntNumber of elements in diov.
siovSource iovec.
siovcntNumber of elements in siov.
num_blocksTotal number of blocks to process.
ctxDIF context. Contains the DIF configuration values, including the reference Application Tag value and initial value of the Reference Tag.
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 cb_arg parameter in the completion callback.
Returns
0 on success, negative errno on failure.

◆ spdk_idxd_submit_dualcast()

int spdk_idxd_submit_dualcast ( struct spdk_idxd_io_channel * chan,
void * dst1,
void * dst2,
const void * src,
uint64_t nbytes,
int flags,
spdk_idxd_req_cb cb_fn,
void * cb_arg )

Build and submit an idxd dualcast request.

This function will build the dual cast descriptor and then immediately submit by writing to the proper device portal.

Parameters
chanIDXD channel to submit request.
dst1First destination virtual address (must be 4K aligned).
dst2Second destination virtual address (must be 4K aligned).
srcSource virtual address.
nbytesNumber of bytes to copy.
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_idxd_submit_fill()

int spdk_idxd_submit_fill ( struct spdk_idxd_io_channel * chan,
struct iovec * diov,
size_t diovcnt,
uint64_t fill_pattern,
int flags,
spdk_idxd_req_cb cb_fn,
void * cb_arg )

Build and submit a idxd memory fill request.

This function will build the fill descriptor and then immediately submit by writing to the proper device portal.

Parameters
chanIDXD channel to submit request.
diovDestination iovec.
diovcntNumber of elements in diov.
fill_patternRepeating eight-byte pattern to use for memory fill.
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 cb_arg parameter in the completion callback.
Returns
0 on success, negative errno on failure.

◆ spdk_idxd_submit_raw_desc()

int spdk_idxd_submit_raw_desc ( struct spdk_idxd_io_channel * chan,
struct idxd_hw_desc * desc,
spdk_idxd_req_cb cb_fn,
void * cb_arg )

Build and submit an IDXD raw request.

This function will process the supplied descriptor and then immediately submit by writing to the proper device portal.

Parameters
chanIDXD channel to submit request.
descproperly formatted IDXD descriptor. Memory addresses should be physical. The completion address will be filled in by the lower level library.
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.