qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Re: user space virtio-net exits with "truncating packet" error
       [not found] <Pine.LNX.4.64.0905141258570.31748@zuben.voltaire.com>
@ 2009-05-14 11:22 ` Mark McLoughlin
  2009-05-14 12:25   ` Or Gerlitz
  0 siblings, 1 reply; 2+ messages in thread
From: Mark McLoughlin @ 2009-05-14 11:22 UTC (permalink / raw)
  To: Or Gerlitz; +Cc: netdev, 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) {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: user space virtio-net exits with "truncating packet" error
  2009-05-14 11:22 ` [Qemu-devel] Re: user space virtio-net exits with "truncating packet" error Mark McLoughlin
@ 2009-05-14 12:25   ` Or Gerlitz
  0 siblings, 0 replies; 2+ messages in thread
From: Or Gerlitz @ 2009-05-14 12:25 UTC (permalink / raw)
  To: Mark McLoughlin
  Cc: netdev, Rusty Russell, qemu-devel, Avi Kivity, Gregory Haskins

Mark McLoughlin wrote:
> 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

No, it doesn't help, same crash.

Or.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-14 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.64.0905141258570.31748@zuben.voltaire.com>
2009-05-14 11:22 ` [Qemu-devel] Re: user space virtio-net exits with "truncating packet" error Mark McLoughlin
2009-05-14 12:25   ` Or Gerlitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).