diff options
author | Alex Williamson <alex.williamson@hp.com> | 2009-06-05 14:46:57 -0600 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2009-06-09 11:38:50 +0100 |
commit | feaf86c359fe919bade6aad3a0b1147918f4a22a (patch) | |
tree | 73028418320e015ef24038cc8e67342559fdee59 | |
parent | 2f33bae66277393d225e52cf20cdebbe1c495f4e (diff) | |
download | qemu-feaf86c359fe919bade6aad3a0b1147918f4a22a.tar.gz qemu-feaf86c359fe919bade6aad3a0b1147918f4a22a.tar.bz2 qemu-feaf86c359fe919bade6aad3a0b1147918f4a22a.zip |
virtio-net: Use a byte to store RX mode flags
There's no need to save 4 bytes for promisc and allmulti.
Use one byte each just to avoid the overhead of a bitmap.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
-rw-r--r-- | hw/virtio-net.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c index a77fdb29e0..13eb0d1f09 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -16,7 +16,7 @@ #include "qemu-timer.h" #include "virtio-net.h" -#define VIRTIO_NET_VM_VERSION 7 +#define VIRTIO_NET_VM_VERSION 8 #define MAC_TABLE_ENTRIES 32 #define MAX_VLAN (1 << 12) /* Per 802.1Q definition */ @@ -33,8 +33,8 @@ typedef struct VirtIONet QEMUTimer *tx_timer; int tx_timer_active; int mergeable_rx_bufs; - int promisc; - int allmulti; + uint8_t promisc; + uint8_t allmulti; struct { int in_use; uint8_t *macs; @@ -523,8 +523,8 @@ static void virtio_net_save(QEMUFile *f, void *opaque) qemu_put_be32(f, n->tx_timer_active); qemu_put_be32(f, n->mergeable_rx_bufs); qemu_put_be16(f, n->status); - qemu_put_be32(f, n->promisc); - qemu_put_be32(f, n->allmulti); + qemu_put_byte(f, n->promisc); + qemu_put_byte(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); @@ -548,8 +548,13 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) n->status = qemu_get_be16(f); if (version_id >= 4) { - n->promisc = qemu_get_be32(f); - n->allmulti = qemu_get_be32(f); + if (version_id < 8) { + n->promisc = qemu_get_be32(f); + n->allmulti = qemu_get_be32(f); + } else { + n->promisc = qemu_get_byte(f); + n->allmulti = qemu_get_byte(f); + } } if (version_id >= 5) { |