Commit 6c042c16fc2453e147e8aed66510820302f50702

Authored by Alex Williamson
Committed by Mark McLoughlin
1 parent 8aeff62d

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>
Showing 1 changed file with 8 additions and 1 deletions
hw/virtio-net.c
... ... @@ -16,7 +16,7 @@
16 16 #include "qemu-timer.h"
17 17 #include "virtio-net.h"
18 18  
19   -#define VIRTIO_NET_VM_VERSION 6
  19 +#define VIRTIO_NET_VM_VERSION 7
20 20  
21 21 #define MAC_TABLE_ENTRIES 32
22 22 #define MAX_VLAN (1 << 12) /* Per 802.1Q definition */
... ... @@ -528,6 +528,7 @@ static void virtio_net_save(QEMUFile *f, void *opaque)
528 528 qemu_put_be32(f, n->mac_table.in_use);
529 529 qemu_put_buffer(f, n->mac_table.macs, n->mac_table.in_use * ETH_ALEN);
530 530 qemu_put_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3);
  531 + qemu_put_be32(f, 0); /* vnet-hdr placeholder */
531 532 }
532 533  
533 534 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)
567 568 if (version_id >= 6)
568 569 qemu_get_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3);
569 570  
  571 + if (version_id >= 7 && qemu_get_be32(f)) {
  572 + fprintf(stderr,
  573 + "virtio-net: saved image requires vnet header support\n");
  574 + exit(1);
  575 + }
  576 +
570 577 if (n->tx_timer_active) {
571 578 qemu_mod_timer(n->tx_timer,
572 579 qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL);
... ...