From: Mark McLoughlin <markmc@redhat.com>
To: Or Gerlitz <ogerlitz@voltaire.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
Avi Kivity <avi@redhat.com>,
netdev@vger.kernel.org, Gregory Haskins <ghaskins@novell.com>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: user space virtio-net exits with "truncating packet" error
Date: Thu, 14 May 2009 12:22:35 +0100 [thread overview]
Message-ID: <1242300155.17366.20.camel@blaa> (raw)
In-Reply-To: <Pine.LNX.4.64.0905141258570.31748@zuben.voltaire.com>
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) {
WARNING: multiple messages have this Message-ID (diff)
From: Mark McLoughlin <markmc@redhat.com>
To: Or Gerlitz <ogerlitz@voltaire.com>
Cc: netdev@vger.kernel.org, Rusty Russell <rusty@rustcorp.com.au>,
Gregory Haskins <ghaskins@novell.com>,
Avi Kivity <avi@redhat.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: user space virtio-net exits with "truncating packet" error
Date: Thu, 14 May 2009 12:22:35 +0100 [thread overview]
Message-ID: <1242300155.17366.20.camel@blaa> (raw)
In-Reply-To: <Pine.LNX.4.64.0905141258570.31748@zuben.voltaire.com>
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) {
next prev parent reply other threads:[~2009-05-14 11:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-14 10:07 user space virtio-net exits with "truncating packet" error Or Gerlitz
2009-05-14 11:22 ` Mark McLoughlin [this message]
2009-05-14 11:22 ` [Qemu-devel] " Mark McLoughlin
2009-05-14 12:25 ` Or Gerlitz
2009-05-14 12:25 ` [Qemu-devel] " Or Gerlitz
2009-05-14 11:58 ` Rusty Russell
2009-05-14 14:04 ` Or Gerlitz
2009-05-14 18:04 ` Or Gerlitz
2009-05-15 5:18 ` Rusty Russell
2009-05-19 12:19 ` Or Gerlitz
2009-05-20 2:47 ` Rusty Russell
2009-05-20 6:20 ` Or Gerlitz
2009-05-20 6:59 ` Avi Kivity
2009-05-21 5:53 ` Rusty Russell
2009-05-15 7:07 ` Michael Tokarev
2009-05-19 10:00 ` Or Gerlitz
2009-05-19 10:13 ` Avi Kivity
2009-05-14 15:34 ` Sridhar Samudrala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1242300155.17366.20.camel@blaa \
--to=markmc@redhat.com \
--cc=avi@redhat.com \
--cc=ghaskins@novell.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@voltaire.com \
--cc=qemu-devel@nongnu.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.