diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 8db14c5a4f..dfcc8da262 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -530,15 +530,15 @@ vhost_session_find_by_vid(int vid) #define CEIL_2MB(x) ((((uintptr_t)x) + SIZE_2MB - 1) / SIZE_2MB) << SHIFT_2MB static void -vhost_session_mem_register(struct spdk_vhost_session *vsession) +vhost_session_mem_register(struct rte_vhost_memory *mem) { struct rte_vhost_mem_region *region; uint32_t i; uint64_t previous_start = UINT64_MAX; - for (i = 0; i < vsession->mem->nregions; i++) { + for (i = 0; i < mem->nregions; i++) { uint64_t start, end, len; - region = &vsession->mem->regions[i]; + region = &mem->regions[i]; start = FLOOR_2MB(region->mmap_addr); end = CEIL_2MB(region->mmap_addr + region->mmap_size); if (start == previous_start) { @@ -558,15 +558,15 @@ vhost_session_mem_register(struct spdk_vhost_session *vsession) } static void -vhost_session_mem_unregister(struct spdk_vhost_session *vsession) +vhost_session_mem_unregister(struct rte_vhost_memory *mem) { struct rte_vhost_mem_region *region; uint32_t i; uint64_t previous_start = UINT64_MAX; - for (i = 0; i < vsession->mem->nregions; i++) { + for (i = 0; i < mem->nregions; i++) { uint64_t start, end, len; - region = &vsession->mem->regions[i]; + region = &mem->regions[i]; start = FLOOR_2MB(region->mmap_addr); end = CEIL_2MB(region->mmap_addr + region->mmap_size); if (start == previous_start) { @@ -1055,7 +1055,7 @@ _stop_session(struct spdk_vhost_session *vsession) rte_vhost_set_vring_base(vsession->vid, i, q->last_avail_idx, q->last_used_idx); } - vhost_session_mem_unregister(vsession); + vhost_session_mem_unregister(vsession->mem); free(vsession->mem); return 0; @@ -1163,11 +1163,11 @@ vhost_start_device_cb(int vid) } vhost_session_set_coalescing(vdev, vsession, NULL); - vhost_session_mem_register(vsession); + vhost_session_mem_register(vsession->mem); vsession->initialized = true; rc = vdev->backend->start_session(vsession); if (rc != 0) { - vhost_session_mem_unregister(vsession); + vhost_session_mem_unregister(vsession->mem); free(vsession->mem); goto out; }