diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2010-09-02 09:00:50 -0600 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2010-09-07 20:29:24 +0300 |
commit | f0c07c7c7b4fe4f9b63c88341fd32707def5a058 (patch) | |
tree | 189a2c3e3a0a4877cf5e18c9e5968443eb3482c9 /hw/virtio-net.c | |
parent | ca736c8e748e3bf77abe401231a412b9cdccb9d3 (diff) |
virtio-net: Make tx_timer timeout configurable
Add an option to make the TX mitigation timer adjustable as a device
option. The 150us hard coded default used currently is reasonable,
but may not be suitable for all workloads, this gives us a way to
adjust it using a single binary. We can't support any random option
though, so use the "x-" prefix to indicate this is a developer
option. Usage:
-device virtio-net-pci,x-txtimer=500000,... # .5ms timeout
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio-net.c')
-rw-r--r-- | hw/virtio-net.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 075f72df2d..d5b03ab368 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -36,6 +36,7 @@ typedef struct VirtIONet VirtQueue *ctrl_vq; NICState *nic; QEMUTimer *tx_timer; + uint32_t tx_timeout; int tx_timer_active; uint32_t has_vnet_hdr; uint8_t has_ufo; @@ -702,7 +703,7 @@ static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq) virtio_net_flush_tx(n, vq); } else { qemu_mod_timer(n->tx_timer, - qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL); + qemu_get_clock(vm_clock) + n->tx_timeout); n->tx_timer_active = 1; virtio_queue_set_notification(vq, 0); } @@ -842,7 +843,7 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) if (n->tx_timer_active) { qemu_mod_timer(n->tx_timer, - qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL); + qemu_get_clock(vm_clock) + n->tx_timeout); } return 0; } @@ -903,7 +904,8 @@ static void virtio_net_vmstate_change(void *opaque, int running, int reason) virtio_net_set_status(&n->vdev, n->vdev.status & status); } -VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf) +VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf, + virtio_net_conf *net) { VirtIONet *n; @@ -931,6 +933,7 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf) n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n); n->tx_timer_active = 0; + n->tx_timeout = net->txtimer; n->mergeable_rx_bufs = 0; n->promisc = 1; /* for compatibility */ |