From 8f002f5c4a4c294b8838560948649b655dd3d772 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 19 Feb 2018 16:31:11 +0000 Subject: crosvm: add flag to enable vhost networking crosvm supports using vhost for improved networking peformance however there is no runtime control to enable it. Add a flag to the command line arguments to enable vhost networking. This defaults to off, as before, since /dev/vhost-net may not be accessible to the current user. TEST=With permissions to open /dev/vhost-net check that running with --vhost-net shows significantly improved performance. Tested with and without sandbox. BUG=none Signed-off-by: Rob Bradford Change-Id: Idfd3f59cc7ff68a3cab7d1855c7d6b8f046f7cec Reviewed-on: https://chromium-review.googlesource.com/925361 Commit-Ready: Stephen Barber Tested-by: Stephen Barber Reviewed-by: Stephen Barber Reviewed-by: Dylan Reid --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 0e95db6..bb6692d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -306,7 +306,10 @@ fn set_argument(cfg: &mut Config, name: &str, value: Option<&str>) -> argument:: }) } cfg.plugin = Some(plugin); - } + }, + "vhost-net" => { + cfg.vhost_net = true + }, "help" => return Err(argument::Error::PrintHelp), _ => unreachable!(), } @@ -353,6 +356,7 @@ fn run_vm(args: std::env::Args) -> std::result::Result<(), ()> { Argument::value("seccomp-policy-dir", "PATH", "Path to seccomp .policy files."), #[cfg(feature = "plugin")] Argument::value("plugin", "PATH", "Absolute path to plugin process to run under crosvm."), + Argument::flag("vhost-net", "Use vhost for networking."), Argument::short_flag('h', "help", "Print help message.")]; let mut cfg = Config::default(); -- cgit 1.4.1