diff --git a/include/spdk/idxd.h b/include/spdk/idxd.h index cadb680ed..933b5ac0a 100644 --- a/include/spdk/idxd.h +++ b/include/spdk/idxd.h @@ -333,6 +333,25 @@ int spdk_idxd_submit_decompress(struct spdk_idxd_io_channel *chan, struct iovec *siov, uint32_t siovcnt, int flags, 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. + * + * \param chan IDXD channel to submit request. + * \param desc proprely formatted IDXD descriptor. Memory addresses should be physical. + * The completion address will be filled in by the lower level library. + * \param cb_fn Callback function which will be called when the request is complete. + * \param cb_arg Opaque value which will be passed back as the arg parameter in + * the completion callback. + * + * \return 0 on success, negative errno on failure. + */ +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); + /** * Check for completed requests on an IDXD channel. * diff --git a/lib/idxd/idxd.c b/lib/idxd/idxd.c index a122e0534..10e24a6f2 100644 --- a/lib/idxd/idxd.c +++ b/lib/idxd/idxd.c @@ -1274,6 +1274,38 @@ spdk_idxd_submit_decompress(struct spdk_idxd_io_channel *chan, return -EINVAL; } +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) +{ + struct idxd_hw_desc *desc; + struct idxd_ops *op; + int rc, flags = 0; + uint64_t comp_addr; + + assert(chan != NULL); + assert(_desc != NULL); + + /* Common prep. */ + rc = _idxd_prep_command(chan, cb_fn, cb_arg, flags, &desc, &op); + if (rc) { + return rc; + } + + /* Command specific. */ + flags = desc->flags; + comp_addr = desc->completion_addr; + memcpy(desc, _desc, sizeof(*desc)); + desc->flags |= flags; + desc->completion_addr = comp_addr; + + /* Submit operation. */ + _submit_to_hw(chan, op); + + return 0; +} + static inline void _dump_sw_error_reg(struct spdk_idxd_io_channel *chan) { diff --git a/lib/idxd/spdk_idxd.map b/lib/idxd/spdk_idxd.map index 9f96b5fa3..d603d23a2 100644 --- a/lib/idxd/spdk_idxd.map +++ b/lib/idxd/spdk_idxd.map @@ -24,6 +24,7 @@ spdk_idxd_submit_fill; spdk_idxd_submit_compress; spdk_idxd_submit_decompress; + spdk_idxd_submit_raw_desc; spdk_idxd_process_events; spdk_idxd_get_channel; spdk_idxd_put_channel;