summary refs log tree commit diff
path: root/src/hw/virtio/vhost_net.rs
diff options
context:
space:
mode:
authorChirantan Ekbote <chirantan@chromium.org>2017-08-23 15:02:37 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-08-28 21:15:36 -0700
commit195457e48494e5a3082a35e7b3d570dc7c292de1 (patch)
treeace6461ca76ecaf781df3ade6dae82c059777cdb /src/hw/virtio/vhost_net.rs
parent56158c873a446d8026b32a719616be2911865335 (diff)
downloadcrosvm-195457e48494e5a3082a35e7b3d570dc7c292de1.tar
crosvm-195457e48494e5a3082a35e7b3d570dc7c292de1.tar.gz
crosvm-195457e48494e5a3082a35e7b3d570dc7c292de1.tar.bz2
crosvm-195457e48494e5a3082a35e7b3d570dc7c292de1.tar.lz
crosvm-195457e48494e5a3082a35e7b3d570dc7c292de1.tar.xz
crosvm-195457e48494e5a3082a35e7b3d570dc7c292de1.tar.zst
crosvm-195457e48494e5a3082a35e7b3d570dc7c292de1.zip
Refactor VhostNet into separate vhost and net pieces
A large portion of the VhostNet implementation is common to all vhost
devices.  Create a new Vhost trait that encapsulates this behavior and
split the network specific bits into a new Net type and implement the
Vhost trait for it.

BUG=chromium:708267
TEST=build and run with a VHOST_NET enabled kernel and see that
     everything still works fine

Change-Id: Ia6b7591f9428c1fba1e13b11791fe40e1bd3942b
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/630060
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'src/hw/virtio/vhost_net.rs')
-rw-r--r--src/hw/virtio/vhost_net.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hw/virtio/vhost_net.rs b/src/hw/virtio/vhost_net.rs
index e1304f1..8e4c5f9 100644
--- a/src/hw/virtio/vhost_net.rs
+++ b/src/hw/virtio/vhost_net.rs
@@ -13,7 +13,7 @@ use std::thread::spawn;
 use net_sys;
 use net_util::{Tap, Error as TapError};
 use sys_util::{Error as SysError, EventFd, GuestMemory, Poller};
-use vhost::{VhostNet as VhostNetHandle, Error as VhostError};
+use vhost::{Error as VhostError, Net as VhostNetHandle, Vhost};
 use virtio_sys::{vhost, virtio_net};
 use virtio_sys::virtio_net::virtio_net_hdr_mrg_rxbuf;
 
@@ -131,7 +131,7 @@ impl Worker {
                 .set_vring_kick(queue_index, &queue_evts[queue_index])
                 .map_err(VhostNetError::VhostSetVringKick)?;
             self.vhost_net_handle
-                .net_set_backend(queue_index, &self.tap)
+                .set_backend(queue_index, &self.tap)
                 .map_err(VhostNetError::VhostNetSetBackend)?;
         }