diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-02-05 22:36:04 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-02-05 22:36:04 +0000 |
commit | 9d6271b8a049372efd6b06bbb794f278777f7b86 (patch) | |
tree | b3bdd7418204330944dcc653ade698cd91cfb1a4 /hw/virtio-net.c | |
parent | b580763f863ef87a6491631e9cf65a5384dffb1e (diff) |
qemu:virtio-net: Save status and add some save infrastructure (Alex Williamson)
The status register should probably be saved since its guest visible.
Also add a little bit if infrastructure for handling various save
revisions.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6533 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/virtio-net.c')
-rw-r--r-- | 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 9e4067844a..2eb52b866a 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_NET_VM_VERSION 3 + typedef struct VirtIONet { VirtIODevice vdev; @@ -292,13 +294,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_be32(f, n->mergeable_rx_bufs); + qemu_put_be16(f, n->status); } static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) { VirtIONet *n = opaque; - if (version_id != 2) + if (version_id < 2 || version_id > VIRTIO_NET_VM_VERSION) return -EINVAL; virtio_load(&n->vdev, f); @@ -307,6 +310,9 @@ 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); + if (version_id >= 3) + 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); @@ -348,6 +354,6 @@ void 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++, 2, + register_savevm("virtio-net", virtio_net_id++, VIRTIO_NET_VM_VERSION, virtio_net_save, virtio_net_load, n); } |