idxd.h File Reference

IDXD accel engine driver public interface. More...

Typedefs

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

Functions

int spdk_idxd_configure_chan (struct spdk_idxd_io_channel *chan)
 Signature for configuring a channel. More...
 
int spdk_idxd_reconfigure_chan (struct spdk_idxd_io_channel *chan, uint32_t num_channels)
 Reconfigures this channel based on how many current channels there are. More...
 
int spdk_idxd_probe (void *cb_ctx, spdk_idxd_probe_cb probe_cb, spdk_idxd_attach_cb attach_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...
 
void spdk_idxd_set_config (uint32_t config_number)
 Sets the IDXD configuration. More...
 
int spdk_idxd_submit_copy (struct spdk_idxd_io_channel *chan, void *dst, const void *src, uint64_t nbytes, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit a accel engine 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, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit an accel engine dual cast copy request. More...
 
int spdk_idxd_submit_compare (struct spdk_idxd_io_channel *chan, void *src1, const void *src2, uint64_t nbytes, 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, void *dst, uint64_t fill_pattern, uint64_t nbytes, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit a accel engine memory fill request. More...
 
int spdk_idxd_submit_crc32c (struct spdk_idxd_io_channel *chan, uint32_t *dst, void *src, uint32_t seed, uint64_t nbytes, spdk_idxd_req_cb cb_fn, void *cb_arg)
 Build and submit a memory CRC32-C request. More...
 
void 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 accel engine driver public interface.

Typedef Documentation

◆ spdk_idxd_attach_cb

typedef void(* spdk_idxd_attach_cb) (void *cb_ctx, struct spdk_pci_device *pci_dev, 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().
pci_devPCI device that was attached to the driver.
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 *pci_dev)

Callback for spdk_idxd_probe() enumeration.

Parameters
cb_ctxUser-specified opaque value corresponding to cb_ctx from spdk_idxd_probe().
pci_devPCI device that is being probed.
Returns
true to attach to this device.

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

int spdk_idxd_configure_chan ( struct spdk_idxd_io_channel *  chan)

Signature for configuring a channel.

Parameters
chanIDXD channel to be configured.
Returns
0 on success, negative errno on failure.

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

int spdk_idxd_probe ( void *  cb_ctx,
spdk_idxd_probe_cb  probe_cb,
spdk_idxd_attach_cb  attach_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_cbwill be called once per IDXD device found in the system.
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()

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

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

int spdk_idxd_reconfigure_chan ( struct spdk_idxd_io_channel *  chan,
uint32_t  num_channels 
)

Reconfigures this channel based on how many current channels there are.

Parameters
chanIDXD channel to be set.
num_channelstotal number of channels in use.
Returns
0 on success, negative errno on failure.

◆ spdk_idxd_set_config()

void spdk_idxd_set_config ( uint32_t  config_number)

Sets the IDXD configuration.

Parameters
config_numberthe configuration number for a valid IDXD config.

◆ spdk_idxd_submit_compare()

int spdk_idxd_submit_compare ( struct spdk_idxd_io_channel *  chan,
void *  src1,
const void *  src2,
uint64_t  nbytes,
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.
src1First source to compare.
src2Second source to compare.
nbytesNumber of bytes to compare.
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,
void *  dst,
const void *  src,
uint64_t  nbytes,
spdk_idxd_req_cb  cb_fn,
void *  cb_arg 
)

Build and submit a accel engine 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.
dstDestination virtual address.
srcSource virtual address.
nbytesNumber of bytes to copy.
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_crc32c()

int spdk_idxd_submit_crc32c ( struct spdk_idxd_io_channel *  chan,
uint32_t *  dst,
void *  src,
uint32_t  seed,
uint64_t  nbytes,
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.
dstResulting calculation.
srcSource virtual address.
seedFour byte CRC-32C seed value.
nbytesNumber of bytes to calculate on.
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,
spdk_idxd_req_cb  cb_fn,
void *  cb_arg 
)

Build and submit an accel engine dual cast copy 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.
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,
void *  dst,
uint64_t  fill_pattern,
uint64_t  nbytes,
spdk_idxd_req_cb  cb_fn,
void *  cb_arg 
)

Build and submit a accel engine 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.
dstDestination virtual address.
fill_patternRepeating eight-byte pattern to use for memory fill.
nbytesNumber of bytes to fill.
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.