summary refs log tree commit diff
path: root/devices/src/virtio/vhost/vsock.rs
diff options
context:
space:
mode:
authorChuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com>2019-11-19 09:49:45 +0800
committerCommit Bot <commit-bot@chromium.org>2020-01-19 09:24:40 +0000
commit92ee1489ce4fb011f8a55fa7d2e8e3cb4ff75dab (patch)
treefbde4e6388aa3084c6d4f15eb58723d3c934c92d /devices/src/virtio/vhost/vsock.rs
parent5de0604f2922681f1414bc05f8cfe9b30387e59e (diff)
downloadcrosvm-92ee1489ce4fb011f8a55fa7d2e8e3cb4ff75dab.tar
crosvm-92ee1489ce4fb011f8a55fa7d2e8e3cb4ff75dab.tar.gz
crosvm-92ee1489ce4fb011f8a55fa7d2e8e3cb4ff75dab.tar.bz2
crosvm-92ee1489ce4fb011f8a55fa7d2e8e3cb4ff75dab.tar.lz
crosvm-92ee1489ce4fb011f8a55fa7d2e8e3cb4ff75dab.tar.xz
crosvm-92ee1489ce4fb011f8a55fa7d2e8e3cb4ff75dab.tar.zst
crosvm-92ee1489ce4fb011f8a55fa7d2e8e3cb4ff75dab.zip
vhost: add cleanup_vqs to do some cleanup stuff
Activate_vqs is used to do the queue preparation before really
running. The virtio-vhost device might need to do some cleanup
to allow a second round activate in the future. How to do the
cleanup is depending on how the vhost virtio devices.

Just add an interface called cleanup_vqs to allow the vhost virtio
devices to do their own cleanup stuff.

BUG=None
TEST=launch Crosvm guest with vhost-net and vsock. Both of them can work
TEST=cargo test -p devices

Change-Id: I2472e79a8b63c9336f886cde55ffef6a78008ad8
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1954172
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'devices/src/virtio/vhost/vsock.rs')
-rw-r--r--devices/src/virtio/vhost/vsock.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/devices/src/virtio/vhost/vsock.rs b/devices/src/virtio/vhost/vsock.rs
index 32f2c99..192e5ce 100644
--- a/devices/src/virtio/vhost/vsock.rs
+++ b/devices/src/virtio/vhost/vsock.rs
@@ -173,8 +173,14 @@ impl VirtioDevice for Vsock {
                                 handle.start().map_err(Error::VhostVsockStart)?;
                                 Ok(())
                             };
-                            let result =
-                                worker.run(queue_evts, QUEUE_SIZES, kill_evt, activate_vqs);
+                            let cleanup_vqs = |_handle: &VhostVsockHandle| -> Result<()> { Ok(()) };
+                            let result = worker.run(
+                                queue_evts,
+                                QUEUE_SIZES,
+                                kill_evt,
+                                activate_vqs,
+                                cleanup_vqs,
+                            );
                             if let Err(e) = result {
                                 error!("vsock worker thread exited with error: {:?}", e);
                             }