diff options
author | Chirantan Ekbote <chirantan@chromium.org> | 2017-08-25 14:51:23 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-08-30 13:04:22 -0700 |
commit | 86fb9567b588a11ed1f7ed2e3223c25fad07cc6f (patch) | |
tree | c0e847396b1f2b8ac6cf2f4f6c674c9572d9e740 /src/main.rs | |
parent | ee73bf34a841fd7720e1af0c7a1a3346fc6c5768 (diff) | |
download | crosvm-86fb9567b588a11ed1f7ed2e3223c25fad07cc6f.tar crosvm-86fb9567b588a11ed1f7ed2e3223c25fad07cc6f.tar.gz crosvm-86fb9567b588a11ed1f7ed2e3223c25fad07cc6f.tar.bz2 crosvm-86fb9567b588a11ed1f7ed2e3223c25fad07cc6f.tar.lz crosvm-86fb9567b588a11ed1f7ed2e3223c25fad07cc6f.tar.xz crosvm-86fb9567b588a11ed1f7ed2e3223c25fad07cc6f.tar.zst crosvm-86fb9567b588a11ed1f7ed2e3223c25fad07cc6f.zip |
Refactor the VhostNet virtio device
Split the VhostNet virtio device into generic and specific bits. Almost the entire Worker implementation is generic between all vhost devices. The only non-generic bit is a device-specific ioctl to activate a virtqueue. To deal with this add a callback to the Worker's Run function to activate all the virtqueues after they have been set up. BUG=chromium:708267 TEST=build and run with a vhost-net enabled kernel and see that everything still works Change-Id: I262c07e4d2c289f9528924ba708d0b88bd0379bb Signed-off-by: Chirantan Ekbote <chirantan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/636121 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/main.rs')
-rw-r--r-- | src/main.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index d480aff..c538c01 100644 --- a/src/main.rs +++ b/src/main.rs @@ -52,7 +52,7 @@ enum Error { Disk(std::io::Error), BlockDeviceNew(sys_util::Error), BlockDeviceRootSetup(sys_util::Error), - VhostNetDeviceNew(hw::virtio::VhostNetError), + VhostNetDeviceNew(hw::virtio::vhost::Error), NetDeviceNew(hw::virtio::NetError), NetDeviceRootSetup(sys_util::Error), MacAddressNeedsNetConfig, @@ -300,7 +300,7 @@ fn run_config(cfg: Config) -> Result<()> { if let Some(host_ip) = cfg.host_ip { if let Some(netmask) = cfg.netmask { let net_box: Box<hw::virtio::VirtioDevice> = if cfg.vhost_net { - Box::new(hw::virtio::VhostNet::new(host_ip, netmask, &guest_mem) + Box::new(hw::virtio::vhost::Net::new(host_ip, netmask, &guest_mem) .map_err(|e| Error::VhostNetDeviceNew(e))?) } else { Box::new(hw::virtio::Net::new(host_ip, netmask) |