Commit 6c042c16fc2453e147e8aed66510820302f50702
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,7 +16,7 @@ | ||
16 | #include "qemu-timer.h" | 16 | #include "qemu-timer.h" |
17 | #include "virtio-net.h" | 17 | #include "virtio-net.h" |
18 | 18 | ||
19 | -#define VIRTIO_NET_VM_VERSION 6 | 19 | +#define VIRTIO_NET_VM_VERSION 7 |
20 | 20 | ||
21 | #define MAC_TABLE_ENTRIES 32 | 21 | #define MAC_TABLE_ENTRIES 32 |
22 | #define MAX_VLAN (1 << 12) /* Per 802.1Q definition */ | 22 | #define MAX_VLAN (1 << 12) /* Per 802.1Q definition */ |
@@ -528,6 +528,7 @@ static void virtio_net_save(QEMUFile *f, void *opaque) | @@ -528,6 +528,7 @@ static void virtio_net_save(QEMUFile *f, void *opaque) | ||
528 | qemu_put_be32(f, n->mac_table.in_use); | 528 | qemu_put_be32(f, n->mac_table.in_use); |
529 | qemu_put_buffer(f, n->mac_table.macs, n->mac_table.in_use * ETH_ALEN); | 529 | qemu_put_buffer(f, n->mac_table.macs, n->mac_table.in_use * ETH_ALEN); |
530 | qemu_put_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3); | 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 | static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) | 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,6 +568,12 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) | ||
567 | if (version_id >= 6) | 568 | if (version_id >= 6) |
568 | qemu_get_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3); | 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 | if (n->tx_timer_active) { | 577 | if (n->tx_timer_active) { |
571 | qemu_mod_timer(n->tx_timer, | 578 | qemu_mod_timer(n->tx_timer, |
572 | qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL); | 579 | qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL); |