lib/idxd: move _vtophys() up
In prep for upcoming patch Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: Iebc5bf5f6715c85cc09b404128338cd6f08c421e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9072 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
f3b423dc84
commit
f93f3ee3f9
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user