Patchwork [25/41] virtio-net: MAC_TABLE_ENTRIES has never been bigger

login
register
mail settings
Submitter Juan Quintela
Date Dec. 2, 2009, 12:04 p.m.
Message ID <e1f4b44012dc7d901cdc18d92b361e775e768a0b.1259754427.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/40030/
State New
Headers show

Comments

Juan Quintela - Dec. 2, 2009, 12:04 p.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/virtio-net.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

Patch

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 57ad20b..e5c6ea0 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -20,6 +20,8 @@ 

 #define VIRTIO_NET_VM_VERSION    11

+/* MAC_TABLE_ENTRIES can only grow, you can't make it smaller, or you
+   broke VMState backward compatiblity */
 #define MAC_TABLE_ENTRIES    64
 #define MAX_VLAN    (1 << 12)   /* Per 802.1Q definition */

@@ -740,15 +742,8 @@  static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)

     if (version_id >= 5) {
         n->mac_table.in_use = qemu_get_be32(f);
-        /* MAC_TABLE_ENTRIES may be different from the saved image */
-        if (n->mac_table.in_use <= MAC_TABLE_ENTRIES) {
-            qemu_get_buffer(f, n->mac_table.macs,
-                            n->mac_table.in_use * ETH_ALEN);
-        } else if (n->mac_table.in_use) {
-            qemu_fseek(f, n->mac_table.in_use * ETH_ALEN, SEEK_CUR);
-            n->mac_table.multi_overflow = n->mac_table.uni_overflow = 1;
-            n->mac_table.in_use = 0;
-        }
+        qemu_get_buffer(f, n->mac_table.macs,
+                        n->mac_table.in_use * ETH_ALEN);
     }
  
     if (version_id >= 6)