diff --git a/lib/vhost/rte_vhost_compat.c b/lib/vhost/rte_vhost_compat.c index c93357de1..7ccc4355f 100644 --- a/lib/vhost/rte_vhost_compat.c +++ b/lib/vhost/rte_vhost_compat.c @@ -385,3 +385,21 @@ vhost_register_unix_socket(const char *path, const char *ctrl_name, return 0; } + +int +vhost_get_mem_table(int vid, struct rte_vhost_memory **mem) +{ + return rte_vhost_get_mem_table(vid, mem); +} + +int +vhost_driver_unregister(const char *path) +{ + return rte_vhost_driver_unregister(path); +} + +int +vhost_get_negotiated_features(int vid, uint64_t *negotiated_features) +{ + return rte_vhost_get_negotiated_features(vid, negotiated_features); +} diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 8f8413607..899182142 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -664,7 +664,7 @@ vhost_dev_unregister(struct spdk_vhost_dev *vdev) return -EBUSY; } - if (vdev->registered && rte_vhost_driver_unregister(vdev->path) != 0) { + if (vdev->registered && vhost_driver_unregister(vdev->path) != 0) { SPDK_ERRLOG("Could not unregister controller %s with vhost library\n" "Check if domain socket %s still exists\n", vdev->name, vdev->path); @@ -1074,12 +1074,12 @@ vhost_start_device_cb(int vid) vsession->max_queues = i + 1; } - if (rte_vhost_get_negotiated_features(vid, &vsession->negotiated_features) != 0) { + if (vhost_get_negotiated_features(vid, &vsession->negotiated_features) != 0) { SPDK_ERRLOG("vhost device %d: Failed to get negotiated driver features\n", vid); goto out; } - if (rte_vhost_get_mem_table(vid, &vsession->mem) != 0) { + if (vhost_get_mem_table(vid, &vsession->mem) != 0) { SPDK_ERRLOG("vhost device %d: Failed to get guest memory table\n", vid); goto out; } @@ -1436,7 +1436,7 @@ session_shutdown(void *arg) struct spdk_vhost_dev *vdev = NULL; TAILQ_FOREACH(vdev, &g_vhost_devices, tailq) { - rte_vhost_driver_unregister(vdev->path); + vhost_driver_unregister(vdev->path); vdev->registered = false; } diff --git a/lib/vhost/vhost_internal.h b/lib/vhost/vhost_internal.h index dc80165b7..507119a43 100644 --- a/lib/vhost/vhost_internal.h +++ b/lib/vhost/vhost_internal.h @@ -406,9 +406,11 @@ void vhost_session_stop_done(struct spdk_vhost_session *vsession, int response); struct spdk_vhost_session *vhost_session_find_by_vid(int vid); void vhost_session_install_rte_compat_hooks(struct spdk_vhost_session *vsession); - int vhost_register_unix_socket(const char *path, const char *ctrl_name, uint64_t virtio_features, uint64_t disabled_features); +int vhost_driver_unregister(const char *path); +int vhost_get_mem_table(int vid, struct rte_vhost_memory **mem); +int vhost_get_negotiated_features(int vid, uint64_t *negotiated_features); struct vhost_poll_group *vhost_get_poll_group(struct spdk_cpuset *cpumask); diff --git a/test/unit/lib/vhost/vhost.c/vhost_ut.c b/test/unit/lib/vhost/vhost.c/vhost_ut.c index 985ec259b..2059e768f 100644 --- a/test/unit/lib/vhost/vhost.c/vhost_ut.c +++ b/test/unit/lib/vhost/vhost.c/vhost_ut.c @@ -50,7 +50,7 @@ DEFINE_STUB_V(vhost_session_install_rte_compat_hooks, (struct spdk_vhost_session *vsession)); DEFINE_STUB(vhost_register_unix_socket, int, (const char *path, const char *name, uint64_t virtio_features, uint64_t disabled_features), 0); -DEFINE_STUB(rte_vhost_driver_unregister, int, (const char *path), 0); +DEFINE_STUB(vhost_driver_unregister, int, (const char *path), 0); DEFINE_STUB(spdk_mem_register, int, (void *vaddr, size_t len), 0); DEFINE_STUB(spdk_mem_unregister, int, (void *vaddr, size_t len), 0); DEFINE_STUB(rte_vhost_vring_call, int, (int vid, uint16_t vring_idx), 0);