On Wed, Dec 02, 2009 at 01:04:26PM +0100, Juan Quintela wrote: > This fixes endianess problems. Using ints and saving the state as bytes > break cross-endian migration. > > Signed-off-by: Juan Quintela <quint...@redhat.com>
Good catch in itself, but relies on a broken patch before that. > --- > hw/virtio-net.c | 12 ++++++------ > 1 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/hw/virtio-net.c b/hw/virtio-net.c > index cf13e94..05cc67f 100644 > --- a/hw/virtio-net.c > +++ b/hw/virtio-net.c > @@ -56,7 +56,7 @@ typedef struct VirtIONet > uint8_t uni_overflow; > uint8_t *macs; > } mac_table; > - uint32_t vlans[MAX_VLAN >> 5]; > + uint8_t vlans[MAX_VLAN >> 3]; > } VirtIONet; > > /* TODO > @@ -65,17 +65,17 @@ typedef struct VirtIONet > > static void vlan_add(VirtIONet *n, int vid) > { > - n->vlans[vid >> 5] |= (1U << (vid & 0x1f)); > + n->vlans[vid >> 3] |= (1U << (vid & 0x7)); > } > > static void vlan_del(VirtIONet *n, int vid) > { > - n->vlans[vid >> 5] &= ~(1U << (vid & 0x1f)); > + n->vlans[vid >> 3] &= ~(1U << (vid & 0x7)); > } > > static bool vlan_is_set(VirtIONet *n, int vid) > { > - return n->vlans[vid >> 5] & ~(1U << (vid & 0x1f)); > + return n->vlans[vid >> 3] & ~(1U << (vid & 0x7)); > } > > static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config) > @@ -717,7 +717,7 @@ static void virtio_net_save(QEMUFile *f, void *opaque) > qemu_put_8s(f, &n->allmulti); > 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, (uint8_t *)n->vlans, MAX_VLAN >> 3); > + qemu_put_buffer(f, n->vlans, MAX_VLAN >> 3); > qemu_put_be32(f, n->has_vnet_hdr); > qemu_put_8s(f, &n->mac_table.multi_overflow); > qemu_put_8s(f, &n->mac_table.uni_overflow); > @@ -762,7 +762,7 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int > version_id) > } > > if (version_id >= 6) > - qemu_get_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3); > + qemu_get_buffer(f, n->vlans, MAX_VLAN >> 3); > > if (version_id >= 7) { > if (qemu_get_be32(f) && !peer_has_vnet_hdr(n)) { > -- > 1.6.5.2