[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 28/41] virtio-net: make vlan operations on uint8
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] Re: [PATCH 28/41] virtio-net: make vlan operations on uint8_t, not uint32_t |
Date: |
Wed, 2 Dec 2009 16:50:27 +0200 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
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 <address@hidden>
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
- [Qemu-devel] [PATCH 23/41] virtio-net: change mergeable_rx_bufs to uint32_t, (continued)
- [Qemu-devel] [PATCH 23/41] virtio-net: change mergeable_rx_bufs to uint32_t, Juan Quintela, 2009/12/02
- [Qemu-devel] [PATCH 24/41] virtio-net: use type checking version of qemu_put/get-*, Juan Quintela, 2009/12/02
- [Qemu-devel] [PATCH 25/41] virtio-net: MAC_TABLE_ENTRIES has never been bigger, Juan Quintela, 2009/12/02
- [Qemu-devel] [PATCH 26/41] virtio-net: we know vlans size at compile time, make it static, Juan Quintela, 2009/12/02
- [Qemu-devel] [PATCH 27/41] virtio-net: abstract vlans operations, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 28/41] virtio-net: make vlan operations on uint8_t, not uint32_t, Juan Quintela, 2009/12/02
- [Qemu-devel] Re: [PATCH 28/41] virtio-net: make vlan operations on uint8_t, not uint32_t,
Michael S. Tsirkin <=
[Qemu-devel] [PATCH 29/41] virtio-net: in_use and first_multi only handle unsigned values, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 30/41] virtio-net: use save/load type chek functions for has_vent_hdr, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 32/41] virtio-net: split virtio_net_post_load, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 31/41] virtio-net: we know macs size at compile time, make it static, Juan Quintela, 2009/12/02