From f93f3ee3f947296d70489e7b1f62c091b479e110 Mon Sep 17 00:00:00 2001 From: paul luse Date: Wed, 4 Aug 2021 11:57:44 -0400 Subject: [PATCH] lib/idxd: move _vtophys() up In prep for upcoming patch Signed-off-by: paul luse Change-Id: Iebc5bf5f6715c85cc09b404128338cd6f08c421e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9072 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Community-CI: Broadcom CI Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- lib/idxd/idxd.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/idxd/idxd.c b/lib/idxd/idxd.c index 128a20dd07..4ffa947db7 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)