aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorSteve Shin <jonshin@cisco.com>2016-07-14 12:06:01 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2016-07-14 22:09:09 +0000
commit7b053c5ecf27ffd7d515d7b2c9e4e8e248e5b81d (patch)
tree8205d4e959831a16d58c71a52739dc4413c8258b /vnet
parenta86e60f17669225bc5125dfa9eac3f39575e56cc (diff)
vhost-user: Reset virt-queue info when a vhost interface is disconnected.
When a vhost interface is disconneted, virt-queue info should be cleaned up. This will avoid any potential vpp crash due to unmmaped memory access. Change-Id: Ia20153da9eb45412bb41d76ef66ede175ea6fef1 Signed-off-by: Steve Shin <jonshin@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/devices/dpdk/vhost_user.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/vnet/vnet/devices/dpdk/vhost_user.c b/vnet/vnet/devices/dpdk/vhost_user.c
index 2e7ecb18fb7..2d9462f0f1b 100644
--- a/vnet/vnet/devices/dpdk/vhost_user.c
+++ b/vnet/vnet/devices/dpdk/vhost_user.c
@@ -909,6 +909,8 @@ dpdk_vhost_user_if_disconnect(dpdk_device_t * xd)
dpdk_vu_intf_t *vui = xd->vu_intf;
vnet_main_t * vnm = vnet_get_main();
dpdk_main_t * dm = &dpdk_main;
+ struct vhost_virtqueue *vq;
+ int q;
xd->admin_up = 0;
vnet_hw_interface_set_flags (vnm, xd->vlib_hw_if_index, 0);
@@ -924,6 +926,20 @@ dpdk_vhost_user_if_disconnect(dpdk_device_t * xd)
vui->unix_fd = -1;
vui->is_up = 0;
+ for (q = 0; q < vui->num_vrings; q++) {
+ vq = xd->vu_vhost_dev.virtqueue[q];
+ vui->vrings[q].enabled = 0; /* Reset local copy */
+ vui->vrings[q].callfd = -1; /* Reset FD */
+ vq->enabled = 0;
+#if RTE_VERSION >= RTE_VERSION_NUM(16, 4, 0, 0)
+ vq->log_guest_addr = 0;
+#endif
+ vq->desc = NULL;
+ vq->used = NULL;
+ vq->avail = NULL;
+ }
+ xd->vu_is_running = 0;
+
dpdk_unmap_all_mem_regions(xd);
DBG_SOCK("interface ifindex %d disconnected", xd->vlib_sw_if_index);
}