diff mbox

[31/41] virtio-net: we know macs size at compile time, make it static

Message ID 3c7c499f0a21f08a0f5d5f1496cb3180e5a179b7.1259754427.git.quintela@redhat.com
State New
Headers show

Commit Message

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

Comments

Michael S. Tsirkin Dec. 2, 2009, 2:54 p.m. UTC | #1
No objection to this or similar change with vlans,
but I'd like to know why was this made a separate buffer
originally.


On Wed, Dec 02, 2009 at 01:04:29PM +0100, Juan Quintela wrote:
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  hw/virtio-net.c |    6 +-----
>  1 files changed, 1 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/virtio-net.c b/hw/virtio-net.c
> index c515e0e..550a814 100644
> --- a/hw/virtio-net.c
> +++ b/hw/virtio-net.c
> @@ -54,7 +54,7 @@ typedef struct VirtIONet
>          uint32_t first_multi;
>          uint8_t multi_overflow;
>          uint8_t uni_overflow;
> -        uint8_t *macs;
> +        uint8_t macs[MAC_TABLE_ENTRIES * ETH_ALEN];
>      } mac_table;
>      uint8_t vlans[MAX_VLAN >> 3];
>  } VirtIONet;
> @@ -860,8 +860,6 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)
>      n->mergeable_rx_bufs = 0;
>      n->promisc = 1; /* for compatibility */
> 
> -    n->mac_table.macs = qemu_mallocz(MAC_TABLE_ENTRIES * ETH_ALEN);
> -
>      register_savevm("virtio-net", virtio_net_id++, VIRTIO_NET_VM_VERSION,
>                      virtio_net_save, virtio_net_load, n);
> 
> @@ -876,8 +874,6 @@ void virtio_net_exit(VirtIODevice *vdev)
> 
>      unregister_savevm("virtio-net", n);
> 
> -    qemu_free(n->mac_table.macs);
> -
>      qemu_del_timer(n->tx_timer);
>      qemu_free_timer(n->tx_timer);
> 
> -- 
> 1.6.5.2
Juan Quintela Dec. 2, 2009, 6:33 p.m. UTC | #2
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> No objection to this or similar change with vlans,
> but I'd like to know why was this made a separate buffer
> originally.

Dunno, either, but I think that this has been always that way.

commit b6503ed9b8815ecfb82fe9faba28936365321248  was when it was introduced

Alex, any objection?

>
> On Wed, Dec 02, 2009 at 01:04:29PM +0100, Juan Quintela wrote:
>> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  hw/virtio-net.c |    6 +-----
>>  1 files changed, 1 insertions(+), 5 deletions(-)
>> 
>> diff --git a/hw/virtio-net.c b/hw/virtio-net.c
>> index c515e0e..550a814 100644
>> --- a/hw/virtio-net.c
>> +++ b/hw/virtio-net.c
>> @@ -54,7 +54,7 @@ typedef struct VirtIONet
>>          uint32_t first_multi;
>>          uint8_t multi_overflow;
>>          uint8_t uni_overflow;
>> -        uint8_t *macs;
>> +        uint8_t macs[MAC_TABLE_ENTRIES * ETH_ALEN];
>>      } mac_table;
>>      uint8_t vlans[MAX_VLAN >> 3];
>>  } VirtIONet;
>> @@ -860,8 +860,6 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)
>>      n->mergeable_rx_bufs = 0;
>>      n->promisc = 1; /* for compatibility */
>> 
>> -    n->mac_table.macs = qemu_mallocz(MAC_TABLE_ENTRIES * ETH_ALEN);
>> -
>>      register_savevm("virtio-net", virtio_net_id++, VIRTIO_NET_VM_VERSION,
>>                      virtio_net_save, virtio_net_load, n);
>> 
>> @@ -876,8 +874,6 @@ void virtio_net_exit(VirtIODevice *vdev)
>> 
>>      unregister_savevm("virtio-net", n);
>> 
>> -    qemu_free(n->mac_table.macs);
>> -
>>      qemu_del_timer(n->tx_timer);
>>      qemu_free_timer(n->tx_timer);
>> 
>> -- 
>> 1.6.5.2
Alex Williamson Dec. 2, 2009, 6:48 p.m. UTC | #3
On Wed, 2009-12-02 at 19:33 +0100, Juan Quintela wrote:
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > No objection to this or similar change with vlans,
> > but I'd like to know why was this made a separate buffer
> > originally.
> 
> Dunno, either, but I think that this has been always that way.
> 
> commit b6503ed9b8815ecfb82fe9faba28936365321248  was when it was introduced
> 
> Alex, any objection?

No objection.  I'd guess it may have been left over from earlier
versions when I was thinking the guest could specify a MAC filter table
size.

Alex
diff mbox

Patch

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index c515e0e..550a814 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -54,7 +54,7 @@  typedef struct VirtIONet
         uint32_t first_multi;
         uint8_t multi_overflow;
         uint8_t uni_overflow;
-        uint8_t *macs;
+        uint8_t macs[MAC_TABLE_ENTRIES * ETH_ALEN];
     } mac_table;
     uint8_t vlans[MAX_VLAN >> 3];
 } VirtIONet;
@@ -860,8 +860,6 @@  VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)
     n->mergeable_rx_bufs = 0;
     n->promisc = 1; /* for compatibility */

-    n->mac_table.macs = qemu_mallocz(MAC_TABLE_ENTRIES * ETH_ALEN);
-
     register_savevm("virtio-net", virtio_net_id++, VIRTIO_NET_VM_VERSION,
                     virtio_net_save, virtio_net_load, n);

@@ -876,8 +874,6 @@  void virtio_net_exit(VirtIODevice *vdev)

     unregister_savevm("virtio-net", n);

-    qemu_free(n->mac_table.macs);
-
     qemu_del_timer(n->tx_timer);
     qemu_free_timer(n->tx_timer);