diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-03-04 08:20:06 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-03-04 08:20:06 -0600 |
commit | bf5363efcff81226d779d1cc1117cb277b458ecb (patch) | |
tree | 6ddc5b835994a9d2fc463b914211b1bebf70f609 /hw | |
parent | 806f352d3d6f7b326b0ab3a49c622b124459dc8d (diff) | |
parent | af347aa5a521555f5342e67993eb717d4f542ba8 (diff) | |
download | qemu-bf5363efcff81226d779d1cc1117cb277b458ecb.zip qemu-bf5363efcff81226d779d1cc1117cb277b458ecb.tar.gz qemu-bf5363efcff81226d779d1cc1117cb277b458ecb.tar.bz2 |
Merge remote-tracking branch 'stefanha/net' into staging
# By Jason Wang (2) and others
# Via Stefan Hajnoczi
* stefanha/net:
qmp: netdev_add is like -netdev, not -net, fix documentation
doc: document -netdev hubport
net: reduce the unnecessary memory allocation of multiqueue
tap: set IFF_ONE_QUEUE per default
tap: forbid creating multiqueue tap when hub is used
net: fix unbounded NetQueue
net: fix qemu_flush_queued_packets() in presence of a hub
Diffstat (limited to 'hw')
-rw-r--r-- | hw/virtio-net.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 573c669..bb2c26c 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -44,7 +44,7 @@ typedef struct VirtIONet VirtIODevice vdev; uint8_t mac[ETH_ALEN]; uint16_t status; - VirtIONetQueue vqs[MAX_QUEUE_NUM]; + VirtIONetQueue *vqs; VirtQueue *ctrl_vq; NICState *nic; uint32_t tx_timeout; @@ -1326,8 +1326,9 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf, n->vdev.set_status = virtio_net_set_status; n->vdev.guest_notifier_mask = virtio_net_guest_notifier_mask; n->vdev.guest_notifier_pending = virtio_net_guest_notifier_pending; + n->max_queues = MAX(conf->queues, 1); + n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queues); n->vqs[0].rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx); - n->max_queues = conf->queues; n->curr_queues = 1; n->vqs[0].n = n; n->tx_timeout = net->txtimer; @@ -1412,6 +1413,7 @@ void virtio_net_exit(VirtIODevice *vdev) } } + g_free(n->vqs); qemu_del_nic(n->nic); virtio_cleanup(&n->vdev); } |