virtio-net: Remove old migration version support
virtio-net has had version 11 since 0ce0e8f4 in 2009 (v0.11.0-rc0-1480-g0ce0e8f) - remove the code to support loading anything earlier. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
		
							parent
							
								
									209b27bbe9
								
							
						
					
					
						commit
						76010cb320
					
				@ -1543,7 +1543,7 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
 | 
				
			|||||||
    VirtIONet *n = opaque;
 | 
					    VirtIONet *n = opaque;
 | 
				
			||||||
    VirtIODevice *vdev = VIRTIO_DEVICE(n);
 | 
					    VirtIODevice *vdev = VIRTIO_DEVICE(n);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (version_id < 2 || version_id > VIRTIO_NET_VM_VERSION)
 | 
					    if (version_id != VIRTIO_NET_VM_VERSION)
 | 
				
			||||||
        return -EINVAL;
 | 
					        return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return virtio_load(vdev, f, version_id);
 | 
					    return virtio_load(vdev, f, version_id);
 | 
				
			||||||
@ -1562,68 +1562,49 @@ static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f,
 | 
				
			|||||||
                               virtio_vdev_has_feature(vdev,
 | 
					                               virtio_vdev_has_feature(vdev,
 | 
				
			||||||
                                                       VIRTIO_F_VERSION_1));
 | 
					                                                       VIRTIO_F_VERSION_1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (version_id >= 3)
 | 
					    n->status = qemu_get_be16(f);
 | 
				
			||||||
        n->status = qemu_get_be16(f);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (version_id >= 4) {
 | 
					    n->promisc = qemu_get_byte(f);
 | 
				
			||||||
        if (version_id < 8) {
 | 
					    n->allmulti = qemu_get_byte(f);
 | 
				
			||||||
            n->promisc = qemu_get_be32(f);
 | 
					
 | 
				
			||||||
            n->allmulti = qemu_get_be32(f);
 | 
					    n->mac_table.in_use = qemu_get_be32(f);
 | 
				
			||||||
        } else {
 | 
					    /* MAC_TABLE_ENTRIES may be different from the saved image */
 | 
				
			||||||
            n->promisc = qemu_get_byte(f);
 | 
					    if (n->mac_table.in_use <= MAC_TABLE_ENTRIES) {
 | 
				
			||||||
            n->allmulti = qemu_get_byte(f);
 | 
					        qemu_get_buffer(f, n->mac_table.macs,
 | 
				
			||||||
 | 
					                        n->mac_table.in_use * ETH_ALEN);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        int64_t i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /* Overflow detected - can happen if source has a larger MAC table.
 | 
				
			||||||
 | 
					         * We simply set overflow flag so there's no need to maintain the
 | 
				
			||||||
 | 
					         * table of addresses, discard them all.
 | 
				
			||||||
 | 
					         * Note: 64 bit math to avoid integer overflow.
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        for (i = 0; i < (int64_t)n->mac_table.in_use * ETH_ALEN; ++i) {
 | 
				
			||||||
 | 
					            qemu_get_byte(f);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        n->mac_table.multi_overflow = n->mac_table.uni_overflow = 1;
 | 
				
			||||||
 | 
					        n->mac_table.in_use = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
    if (version_id >= 5) {
 | 
					    qemu_get_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3);
 | 
				
			||||||
        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 {
 | 
					 | 
				
			||||||
            int64_t i;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Overflow detected - can happen if source has a larger MAC table.
 | 
					    if (qemu_get_be32(f) && !peer_has_vnet_hdr(n)) {
 | 
				
			||||||
             * We simply set overflow flag so there's no need to maintain the
 | 
					        error_report("virtio-net: saved image requires vnet_hdr=on");
 | 
				
			||||||
             * table of addresses, discard them all.
 | 
					        return -1;
 | 
				
			||||||
             * Note: 64 bit math to avoid integer overflow.
 | 
					 | 
				
			||||||
             */
 | 
					 | 
				
			||||||
            for (i = 0; i < (int64_t)n->mac_table.in_use * ETH_ALEN; ++i) {
 | 
					 | 
				
			||||||
                qemu_get_byte(f);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            n->mac_table.multi_overflow = n->mac_table.uni_overflow = 1;
 | 
					 | 
				
			||||||
            n->mac_table.in_use = 0;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (version_id >= 6)
 | 
					    n->mac_table.multi_overflow = qemu_get_byte(f);
 | 
				
			||||||
        qemu_get_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3);
 | 
					    n->mac_table.uni_overflow = qemu_get_byte(f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (version_id >= 7) {
 | 
					    n->alluni = qemu_get_byte(f);
 | 
				
			||||||
        if (qemu_get_be32(f) && !peer_has_vnet_hdr(n)) {
 | 
					    n->nomulti = qemu_get_byte(f);
 | 
				
			||||||
            error_report("virtio-net: saved image requires vnet_hdr=on");
 | 
					    n->nouni = qemu_get_byte(f);
 | 
				
			||||||
            return -1;
 | 
					    n->nobcast = qemu_get_byte(f);
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (version_id >= 9) {
 | 
					    if (qemu_get_byte(f) && !peer_has_ufo(n)) {
 | 
				
			||||||
        n->mac_table.multi_overflow = qemu_get_byte(f);
 | 
					        error_report("virtio-net: saved image requires TUN_F_UFO support");
 | 
				
			||||||
        n->mac_table.uni_overflow = qemu_get_byte(f);
 | 
					        return -1;
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (version_id >= 10) {
 | 
					 | 
				
			||||||
        n->alluni = qemu_get_byte(f);
 | 
					 | 
				
			||||||
        n->nomulti = qemu_get_byte(f);
 | 
					 | 
				
			||||||
        n->nouni = qemu_get_byte(f);
 | 
					 | 
				
			||||||
        n->nobcast = qemu_get_byte(f);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (version_id >= 11) {
 | 
					 | 
				
			||||||
        if (qemu_get_byte(f) && !peer_has_ufo(n)) {
 | 
					 | 
				
			||||||
            error_report("virtio-net: saved image requires TUN_F_UFO support");
 | 
					 | 
				
			||||||
            return -1;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (n->max_queues > 1) {
 | 
					    if (n->max_queues > 1) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user