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>
This commit is contained in:
Alex Williamson 2009-06-05 14:46:52 -06:00 committed by Mark McLoughlin
parent 8aeff62d75
commit 6c042c16fc

View File

@ -16,7 +16,7 @@
#include "qemu-timer.h" #include "qemu-timer.h"
#include "virtio-net.h" #include "virtio-net.h"
#define VIRTIO_NET_VM_VERSION 6 #define VIRTIO_NET_VM_VERSION 7
#define MAC_TABLE_ENTRIES 32 #define MAC_TABLE_ENTRIES 32
#define MAX_VLAN (1 << 12) /* Per 802.1Q definition */ #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_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, n->mac_table.macs, n->mac_table.in_use * ETH_ALEN);
qemu_put_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3); 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) 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) if (version_id >= 6)
qemu_get_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3); 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) { if (n->tx_timer_active) {
qemu_mod_timer(n->tx_timer, qemu_mod_timer(n->tx_timer,
qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL); qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL);