summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorRob Bradford <robert.bradford@intel.com>2018-02-19 16:31:11 +0000
committerchrome-bot <chrome-bot@chromium.org>2018-02-19 17:23:41 -0800
commit8f002f5c4a4c294b8838560948649b655dd3d772 (patch)
tree8e15494c59bc5e332771dd5f091d6838b1de21ac /src/main.rs
parent0db8f412452ac12353d4a81a71968f84ae58c1c1 (diff)
downloadcrosvm-8f002f5c4a4c294b8838560948649b655dd3d772.tar
crosvm-8f002f5c4a4c294b8838560948649b655dd3d772.tar.gz
crosvm-8f002f5c4a4c294b8838560948649b655dd3d772.tar.bz2
crosvm-8f002f5c4a4c294b8838560948649b655dd3d772.tar.lz
crosvm-8f002f5c4a4c294b8838560948649b655dd3d772.tar.xz
crosvm-8f002f5c4a4c294b8838560948649b655dd3d772.tar.zst
crosvm-8f002f5c4a4c294b8838560948649b655dd3d772.zip
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 <robert.bradford@intel.com>
Change-Id: Idfd3f59cc7ff68a3cab7d1855c7d6b8f046f7cec
Reviewed-on: https://chromium-review.googlesource.com/925361
Commit-Ready: Stephen Barber <smbarber@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs6
1 files changed, 5 insertions, 1 deletions
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();