From: Alex Williamson <alex.williamson@hp.com>
To: kvm <kvm@vger.kernel.org>, qemu-devel <qemu-devel@nongnu.org>
Cc: Mark McLoughlin <markmc@redhat.com>
Subject: [PATCH 2/5][RFC] virtio-net: Add load/save for status bits
Date: Wed, 07 Jan 2009 10:37:38 -0700 [thread overview]
Message-ID: <1231349858.7109.81.camel@lappy> (raw)
virtio-net: Add load/save for status bits
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---
hw/virtio-net.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index bfb7510..77e3077 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -16,6 +16,8 @@
#include "qemu-timer.h"
#include "virtio-net.h"
+#define VIRTIO_VM_VERSION 2
+
typedef struct VirtIONet
{
VirtIODevice vdev;
@@ -307,13 +309,14 @@ 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_be16(f, n->status);
}
static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
{
VirtIONet *n = opaque;
- if (version_id != 1)
+ if (version_id < 1 || version_id > VIRTIO_VM_VERSION)
return -EINVAL;
virtio_load(&n->vdev, f);
@@ -321,6 +324,9 @@ 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);
+ if (version_id >= 2)
+ n->status = qemu_get_be16(f);
+
if (n->tx_timer_active) {
qemu_mod_timer(n->tx_timer,
qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL);
@@ -363,7 +369,7 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
n->tx_timer_active = 0;
n->mergeable_rx_bufs = 0;
- register_savevm("virtio-net", virtio_net_id++, 1,
+ register_savevm("virtio-net", virtio_net_id++, VIRTIO_VM_VERSION,
virtio_net_save, virtio_net_load, n);
return (PCIDevice *)n;
WARNING: multiple messages have this Message-ID (diff)
From: Alex Williamson <alex.williamson@hp.com>
To: kvm <kvm@vger.kernel.org>, qemu-devel <qemu-devel@nongnu.org>
Cc: Mark McLoughlin <markmc@redhat.com>
Subject: [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for status bits
Date: Wed, 07 Jan 2009 10:37:38 -0700 [thread overview]
Message-ID: <1231349858.7109.81.camel@lappy> (raw)
virtio-net: Add load/save for status bits
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---
hw/virtio-net.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index bfb7510..77e3077 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -16,6 +16,8 @@
#include "qemu-timer.h"
#include "virtio-net.h"
+#define VIRTIO_VM_VERSION 2
+
typedef struct VirtIONet
{
VirtIODevice vdev;
@@ -307,13 +309,14 @@ 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_be16(f, n->status);
}
static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
{
VirtIONet *n = opaque;
- if (version_id != 1)
+ if (version_id < 1 || version_id > VIRTIO_VM_VERSION)
return -EINVAL;
virtio_load(&n->vdev, f);
@@ -321,6 +324,9 @@ 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);
+ if (version_id >= 2)
+ n->status = qemu_get_be16(f);
+
if (n->tx_timer_active) {
qemu_mod_timer(n->tx_timer,
qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL);
@@ -363,7 +369,7 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
n->tx_timer_active = 0;
n->mergeable_rx_bufs = 0;
- register_savevm("virtio-net", virtio_net_id++, 1,
+ register_savevm("virtio-net", virtio_net_id++, VIRTIO_VM_VERSION,
virtio_net_save, virtio_net_load, n);
return (PCIDevice *)n;
next reply other threads:[~2009-01-07 17:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-07 17:37 Alex Williamson [this message]
2009-01-07 17:37 ` [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for status bits Alex Williamson
2009-01-07 18:12 ` Anthony Liguori
2009-01-07 18:12 ` [Qemu-devel] " Anthony Liguori
2009-01-12 18:35 ` [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for statusbits Krumme, Chris
2009-01-12 20:41 ` Dor Laor
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=1231349858.7109.81.camel@lappy \
--to=alex.williamson@hp.com \
--cc=kvm@vger.kernel.org \
--cc=markmc@redhat.com \
--cc=qemu-devel@nongnu.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.