From 4cbcc26f5c34d8254a9f98e065a923abb194ba8b Mon Sep 17 00:00:00 2001 From: Xiong Zhang Date: Thu, 13 Feb 2020 19:36:49 +0800 Subject: Virtio-net: Add multi queues in multi threads In order to support 2 vq pairs for virtio-net, this patch create 2 sockets in one tap interface, 2 vq pairs(rx/tx) and 2 threads in device model, So one vq pair has one thread and one socket in tap corresponding. On my SkyLake desktop with crosvm and ubuntu 18.04 guest: If run one iperf server on host and one iperf client in guest, 2 vq pairs has the same netwrok bandwidth as 1 vq pair, the bandwidth is 5.99Gbits/sec If run two iperf server on host and two iperf client in guest, In 1 vq pair mode, two iperf cliens bandwidth are 3.19Gbits/sec and 3.18Gbits/sec. In 2 vq pairs mode, two iperf clients bandwidth are 4.87Gbits/sec and 4.86Gbits/sec. So 2 vq pairs improve net bandwidth 52.7% compared with 1 vq pair in this case. BUG=chromium:1064482 TEST=Run iperf test in guest Change-Id: I1fa14d7e24085552dc828a89a883d4a2ada34789 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2099754 Tested-by: kokoro Commit-Queue: Xiong Zhang Reviewed-by: Stephen Barber --- src/linux.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/linux.rs') diff --git a/src/linux.rs b/src/linux.rs index 3370c1e..6eb1ef7 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -593,7 +593,7 @@ fn create_tap_net_device(cfg: &Config, tap_fd: RawFd) -> DeviceResult { .map_err(Error::CreateTapDevice)? }; - let dev = virtio::Net::from(tap).map_err(Error::NetDeviceNew)?; + let dev = virtio::Net::from(tap, 1).map_err(Error::NetDeviceNew)?; Ok(VirtioDeviceStub { dev: Box::new(dev), -- cgit 1.4.1