All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark McLoughlin <markmc@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org, Mark McLoughlin <markmc@redhat.com>
Subject: [PATCH 1/1] kvm: qemu: virtio-net: migration fixes
Date: Tue,  6 Jan 2009 11:48:18 +0000	[thread overview]
Message-ID: <1231242498-3191-1-git-send-email-markmc@redhat.com> (raw)

We were failing to save two important pieces of state:

  1) Whether the guest will supply us rx buffers using the
     new mergeable format; this caused the migrated guest
     to crash with "virtio-net header not in first element"

  2) Whether the tx/rx buffers we exchange with the tap
     code should include a virtio_net_hdr header; this
     caused the migrated guest to receive garbage packets
     because the tap code was stripping away the header
     and virtio_net was interpreting packet data as the
     virtio_net header

With these fixes a guest using mergeable rx buffers and
GSO passes a simple "ping while migrating" test.

The mergeable rx buffers part has been sent upstream to
qemu-devel, but the GSO part is KVM specific.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 qemu/hw/virtio-net.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c
index ef8f591..e47a0a4 100644
--- a/qemu/hw/virtio-net.c
+++ b/qemu/hw/virtio-net.c
@@ -360,6 +360,11 @@ static void virtio_net_save(QEMUFile *f, void *opaque)
 
     qemu_put_buffer(f, n->mac, 6);
     qemu_put_be32(f, n->tx_timer_active);
+    qemu_put_be32(f, n->mergeable_rx_bufs);
+
+#ifdef TAP_VNET_HDR
+    qemu_put_be32(f, tap_has_vnet_hdr(n->vc->vlan->first_client));
+#endif
 }
 
 static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
@@ -373,6 +378,12 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
 
     qemu_get_buffer(f, n->mac, 6);
     n->tx_timer_active = qemu_get_be32(f);
+    n->mergeable_rx_bufs = qemu_get_be32(f);
+
+#ifdef TAP_VNET_HDR
+    if (qemu_get_be32(f))
+      tap_using_vnet_hdr(n->vc->vlan->first_client, 1);
+#endif
 
     if (n->tx_timer_active) {
         qemu_mod_timer(n->tx_timer,
-- 
1.6.0.6


             reply	other threads:[~2009-01-06 11:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-06 11:48 Mark McLoughlin [this message]
2009-01-07 10:23 ` [PATCH 1/1] kvm: qemu: virtio-net: migration fixes Mark McLoughlin
2009-01-08 14:11   ` Avi Kivity
2009-01-11 15:50   ` Avi Kivity
2009-01-11 15:51     ` Avi Kivity

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=1231242498-3191-1-git-send-email-markmc@redhat.com \
    --to=markmc@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    /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.