diff --git a/lib/idxd/idxd.c b/lib/idxd/idxd.c index 128a20dd0..4ffa947db 100644 --- a/lib/idxd/idxd.c +++ b/lib/idxd/idxd.c @@ -175,6 +175,26 @@ spdk_idxd_chan_get_max_operations(struct spdk_idxd_io_channel *chan) return chan->idxd->total_wq_size / chan->idxd->chan_per_device; } +inline static int +_vtophys(const void *buf, uint64_t *buf_addr, uint64_t size) +{ + uint64_t updated_size = size; + + *buf_addr = spdk_vtophys(buf, &updated_size); + + if (*buf_addr == SPDK_VTOPHYS_ERROR) { + SPDK_ERRLOG("Error translating address\n"); + return -EINVAL; + } + + if (updated_size < size) { + SPDK_ERRLOG("Error translating size (0x%lx), return size (0x%lx)\n", size, updated_size); + return -EINVAL; + } + + return 0; +} + int spdk_idxd_configure_chan(struct spdk_idxd_io_channel *chan) { @@ -330,26 +350,6 @@ spdk_idxd_detach(struct spdk_idxd_device *idxd) idxd_device_destruct(idxd); } -inline static int -_vtophys(const void *buf, uint64_t *buf_addr, uint64_t size) -{ - uint64_t updated_size = size; - - *buf_addr = spdk_vtophys(buf, &updated_size); - - if (*buf_addr == SPDK_VTOPHYS_ERROR) { - SPDK_ERRLOG("Error translating address\n"); - return -EINVAL; - } - - if (updated_size < size) { - SPDK_ERRLOG("Error translating size (0x%lx), return size (0x%lx)\n", size, updated_size); - return -EINVAL; - } - - return 0; -} - static int _idxd_prep_command(struct spdk_idxd_io_channel *chan, spdk_idxd_req_cb cb_fn, void *cb_arg, struct idxd_hw_desc **_desc, struct idxd_ops **_op)