From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M4Z1T-0001aS-Pv for qemu-devel@nongnu.org; Thu, 14 May 2009 07:22:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M4Z1O-0001aG-8I for qemu-devel@nongnu.org; Thu, 14 May 2009 07:22:46 -0400 Received: from [199.232.76.173] (port=41211 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M4Z1O-0001aD-0O for qemu-devel@nongnu.org; Thu, 14 May 2009 07:22:42 -0400 Received: from mx2.redhat.com ([66.187.237.31]:59639) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M4Z1N-0003VS-K0 for qemu-devel@nongnu.org; Thu, 14 May 2009 07:22:41 -0400 From: Mark McLoughlin In-Reply-To: References: Content-Type: text/plain Date: Thu, 14 May 2009 12:22:35 +0100 Message-Id: <1242300155.17366.20.camel@blaa> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: user space virtio-net exits with "truncating packet" error Reply-To: Mark McLoughlin List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Or Gerlitz Cc: netdev@vger.kernel.org, Rusty Russell , Gregory Haskins , Avi Kivity , qemu-devel On Thu, 2009-05-14 at 13:07 +0300, Or Gerlitz wrote: > Hi, > > When running with jumbo frames (i.e set tap0 and guest nic mtu to 9k) > and using 8k sized packets with iperf, the qemu process exits with > "virtio-net truncating packet" which I see in the code of qemu/hw/virtio-net.c > :: virtio_net_receive(). This happens only when the VM is receiving, if I > send 8K packets from the VM things go fine. > > I use virtio based NIC in the VM and Linux 2.6.29.1 in both the VM and the host. > Qemu is the one provided by kvm release 84 That sounds like a bug in qemu's mergeable receive buffers implementation - the host is running out of buffers for the packet, even though it supposedly has already checked that there is enough buffers available on the ring. Hmm, I think I see the bug - does the patch below work? Please try several mtu values around the 9k mark to be sure Cheers, Mark. diff --git a/hw/virtio-net.c b/hw/virtio-net.c index f125edc..3ffd2c0 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -438,16 +438,16 @@ static void virtio_net_receive(void *opaque, const uint8_t *buf, int size) struct virtio_net_hdr_mrg_rxbuf *mhdr = NULL; size_t hdr_len, offset, i; - if (!do_virtio_net_can_receive(n, size)) + /* hdr_len refers to the header we supply to the guest */ + hdr_len = n->mergeable_rx_bufs ? + sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr); + + if (!do_virtio_net_can_receive(n, size + hdr_len)) return; if (!receive_filter(n, buf, size)) return; - /* hdr_len refers to the header we supply to the guest */ - hdr_len = n->mergeable_rx_bufs ? - sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr); - offset = i = 0; while (offset < size) {