diff options
author | Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com> | 2019-11-19 09:49:45 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-01-19 09:24:40 +0000 |
commit | 92ee1489ce4fb011f8a55fa7d2e8e3cb4ff75dab (patch) | |
tree | fbde4e6388aa3084c6d4f15eb58723d3c934c92d /devices/src/virtio/vhost/worker.rs | |
parent | 5de0604f2922681f1414bc05f8cfe9b30387e59e (diff) | |
download | crosvm-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/worker.rs')
-rw-r--r-- | devices/src/virtio/vhost/worker.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/devices/src/virtio/vhost/worker.rs b/devices/src/virtio/vhost/worker.rs index 21aabfd..17114a4 100644 --- a/devices/src/virtio/vhost/worker.rs +++ b/devices/src/virtio/vhost/worker.rs @@ -39,15 +39,17 @@ impl<T: Vhost> Worker<T> { } } - pub fn run<F>( + pub fn run<F1, F2>( &mut self, queue_evts: Vec<EventFd>, queue_sizes: &[u16], kill_evt: EventFd, - activate_vqs: F, + activate_vqs: F1, + cleanup_vqs: F2, ) -> Result<()> where - F: FnOnce(&T) -> Result<()>, + F1: FnOnce(&T) -> Result<()>, + F2: FnOnce(&T) -> Result<()>, { // Preliminary setup for vhost net. self.vhost_handle @@ -135,6 +137,7 @@ impl<T: Vhost> Worker<T> { } } } + cleanup_vqs(&self.vhost_handle)?; Ok(()) } } |