aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@hp.com>2009-06-05 14:46:52 -0600
committerMark McLoughlin <markmc@redhat.com>2009-06-09 11:38:50 +0100
commit6c042c16fc2453e147e8aed66510820302f50702 (patch)
tree935e15200cc9a026e46cc90e7fcf04379f8ca852 /hw
parent8aeff62d75b72263d855a0b5892b8d52ad6f09e0 (diff)
virtio-net: Add version_id 7 placeholder for vnet header support
Signed-off-by: Alex Williamson <alex.williamson@hp.com> Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio-net.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index a3ba890312..a77fdb29e0 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -16,7 +16,7 @@
#include "qemu-timer.h"
#include "virtio-net.h"
-#define VIRTIO_NET_VM_VERSION 6
+#define VIRTIO_NET_VM_VERSION 7
#define MAC_TABLE_ENTRIES 32
#define MAX_VLAN (1 << 12) /* Per 802.1Q definition */
@@ -528,6 +528,7 @@ static void virtio_net_save(QEMUFile *f, void *opaque)
qemu_put_be32(f, n->mac_table.in_use);
qemu_put_buffer(f, n->mac_table.macs, n->mac_table.in_use * ETH_ALEN);
qemu_put_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3);
+ qemu_put_be32(f, 0); /* vnet-hdr placeholder */
}
static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
@@ -567,6 +568,12 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
if (version_id >= 6)
qemu_get_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3);
+ if (version_id >= 7 && qemu_get_be32(f)) {
+ fprintf(stderr,
+ "virtio-net: saved image requires vnet header support\n");
+ exit(1);
+ }
+
if (n->tx_timer_active) {
qemu_mod_timer(n->tx_timer,
qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL);