diff options
Diffstat (limited to 'src/vnet/devices')
-rw-r--r-- | src/vnet/devices/virtio/vhost_user.c | 22 | ||||
-rw-r--r-- | src/vnet/devices/virtio/vhost_user.h | 3 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/vnet/devices/virtio/vhost_user.c b/src/vnet/devices/virtio/vhost_user.c index c06f78ce1bb..7094a00fb33 100644 --- a/src/vnet/devices/virtio/vhost_user.c +++ b/src/vnet/devices/virtio/vhost_user.c @@ -571,6 +571,24 @@ vhost_user_socket_read (clib_file_t * uf) vui->nregions++; } + + /* + * Re-compute desc, used, and avail descriptor table if vring address + * is set. + */ + for (q = 0; q < VHOST_VRING_MAX_N; q++) + { + if (vui->vrings[q].desc_user_addr && + vui->vrings[q].used_user_addr && vui->vrings[q].avail_user_addr) + { + vui->vrings[q].desc = + map_user_mem (vui, vui->vrings[q].desc_user_addr); + vui->vrings[q].used = + map_user_mem (vui, vui->vrings[q].used_user_addr); + vui->vrings[q].avail = + map_user_mem (vui, vui->vrings[q].avail_user_addr); + } + } vlib_worker_thread_barrier_release (vm); break; @@ -614,6 +632,10 @@ vhost_user_socket_read (clib_file_t * uf) goto close_socket; } + vui->vrings[msg.state.index].desc_user_addr = msg.addr.desc_user_addr; + vui->vrings[msg.state.index].used_user_addr = msg.addr.used_user_addr; + vui->vrings[msg.state.index].avail_user_addr = msg.addr.avail_user_addr; + vlib_worker_thread_barrier_sync (vm); vui->vrings[msg.state.index].desc = desc; vui->vrings[msg.state.index].used = used; diff --git a/src/vnet/devices/virtio/vhost_user.h b/src/vnet/devices/virtio/vhost_user.h index c7a4206fa1d..90669a7dfbe 100644 --- a/src/vnet/devices/virtio/vhost_user.h +++ b/src/vnet/devices/virtio/vhost_user.h @@ -263,6 +263,9 @@ typedef struct vring_desc_t *desc; vring_avail_t *avail; vring_used_t *used; + uword desc_user_addr; + uword used_user_addr; + uword avail_user_addr; f64 int_deadline; u8 started; u8 enabled; |