public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>, Mark McLoughlin <markmc@redhat.com>,
	kvm-devel <kvm@vger.kernel.org>
Subject: Re: [PATCH] kvm: qemu: virtio-net: migration fixes
Date: Sun, 11 Jan 2009 19:45:22 -0600	[thread overview]
Message-ID: <496AA0B2.1080909@codemonkey.ws> (raw)
In-Reply-To: <20090111142130.3EEC625000B@cleopatra.tlv.redhat.com>

Avi Kivity wrote:
> From: Mark McLoughlin <markmc@redhat.com>
>
> We were failing to save 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 this fix a guest using mergeable rx buffers and
> GSO passes a simple "ping while migrating" test.
>
> Signed-off-by: Mark McLoughlin <markmc@redhat.com>
> Signed-off-by: Avi Kivity <avi@redhat.com>
>
> diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c
> index e2ba322..1f9dc16 100644
> --- a/qemu/hw/virtio-net.c
> +++ b/qemu/hw/virtio-net.c
> @@ -361,6 +361,10 @@ 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
>   

This should increment the save/restore format version number to preserve 
backwards compatibility.  It'll also be required for merging into QEMU 
upstream.

As a rule, if new fields are added to a save/load function, the version 
number should be incremented.

Regards,

Anthony Liguori

>  }
>  
>  static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
> @@ -376,6 +380,11 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
>      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,
>                         qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL);
> --
> To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>   


       reply	other threads:[~2009-01-12  1:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090111142130.3EEC625000B@cleopatra.tlv.redhat.com>
2009-01-12  1:45 ` Anthony Liguori [this message]
2009-01-12  7:09   ` [PATCH] kvm: qemu: virtio-net: migration fixes 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=496AA0B2.1080909@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=markmc@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox