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. More...
 
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. More...
 
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. More...
 

Functions

uint32_t spdk_idxd_get_socket (struct spdk_idxd_device *idxd)
 Get the socket that this device is on. More...
 
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. More...
 
void spdk_idxd_detach (struct spdk_idxd_device *idxd)
 Detach specified device returned by spdk_idxd_probe() from the IDXD driver. More...
 
int spdk_idxd_set_config (bool kernel_mode)
 Sets the IDXD configuration. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int spdk_idxd_process_events (struct spdk_idxd_io_channel *chan)
 Check for completed requests on an IDXD channel. More...
 
struct spdk_idxd_io_channel * spdk_idxd_get_channel (struct spdk_idxd_device *idxd)
 Returns an IDXD channel for a given IDXD device. More...
 
void spdk_idxd_put_channel (struct spdk_idxd_io_channel *chan)
 Free an IDXD channel. More...
 

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_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.
descproprely 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.