Virtio-net: add a new virtio-net receive buffer scheme
commit05f9278d75fc7b39e9585aab433635f5d7fda120
authorMark McLoughlin <markmc@redhat.com>
Wed, 26 Nov 2008 14:50:38 +0000 (26 14:50 +0000)
committerAvi Kivity <avi@redhat.com>
Thu, 27 Nov 2008 12:44:30 +0000 (27 14:44 +0200)
treec8d20f298903d1931ffbdc28b9bc8bd13780bee9
parent0cb0f5fc31e4125d3b59f86e7299bbcda79b2bce
Virtio-net: add a new virtio-net receive buffer scheme

Currently, in order to receive large packets, the guest must allocate
max-sized packet buffers and pass them to the host. Each of these
max-sized packets occupy 20 ring entries, which means we can only
transfer a maximum of 12 packets in a single batch with a 256 entry
ring.

When receiving packets from external networks, we only receive MTU
sized packets and so the throughput observed is throttled by the
number of packets the ring can hold.

Implement the VIRTIO_NET_F_MRG_RXBUF feature to let guests know that
we can merge smaller buffers together in order to handle large packets.

This scheme allows us to be efficient in our use of ring entries
while still supporting large packets. Benchmarking using netperf from
an external machine to a guest over a 10Gb/s network shows a 100%
improvement from ~1Gb/s to ~2Gb/s. With a local host->guest benchmark
with GSO disabled on the host side, throughput was seen to increase
from 700Mb/s to 1.7Gb/s.

Based on a patch from Herbert Xu.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
hw/virtio-net.c
hw/virtio.c
hw/virtio.h