You are not logged in.

#1 2023-02-06 16:55:05

Registered: 2005-02-08
Posts: 63

QEMU: slow network performance with virtio_net driver

I'm running QEMU 7.2.0 with Linux for both host and guest (kernel 6.1.6). For the VM networking, I'm using bridge on host to which guest attaches its NIC via the tap device.

In terms of QEMU, the virtual network driver virtio_net is supposed to have the best performance. However, it gives me only ~0.3 MB/s download speed in the guest, while switching the driver to e1000 gives me ~400 MB/s.

Through trial and error I have found out that if I set napi_weight=1 parameter for virtio_net module in guest VM, the performance returns to normal.

After reading about NAPI I have come to understand that napi_weight parameter is used to switch between interrupt-based and polling-based servicing of received packets. Normally, the parameter defaults to NAPI_POLL_WEIGHT constant which is 64. I cannot understand the root cause of the problem and I don't want to be setting this parameter blindly just because it "seems to do the trick". It just feels wrong, i.e. why would virtio_net need this to be explicitly set while e1000 works out of the box? I'm also concerned about potential high CPU usage if I was to use this parameter.

Does anybody have any ideas what could be behind it and what I could try? Thanks!

Last edited by bachtiar (2023-02-06 17:00:20)


Board footer

Powered by FluxBB