* [PATCH] Fixup virtio_net TX timer
@ 2008-01-08 16:07 Anthony Liguori
[not found] ` <11998084753122-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Anthony Liguori @ 2008-01-08 16:07 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f; +Cc: Anthony Liguori, Avi Kivity
Instead of introducing a new flag, I think we decided that we would make the
NO_NOTIFY flag be a hint and have both ends always notify when the ring is
full or empty. This patch updates the QEMU virtio code to reflect this.
Signed-off-by: Anthony Liguori <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c
index 9cd0789..296edf6 100644
--- a/qemu/hw/virtio-net.c
+++ b/qemu/hw/virtio-net.c
@@ -29,8 +29,6 @@
#define VIRTIO_NET_F_TSO6 4
#define VIRTIO_NET_F_MAC 5
-#define USE_TX_TIMER
-
#define TX_TIMER_INTERVAL (1000 / 500)
/* The config defining mac address (6 bytes) */
@@ -261,14 +259,15 @@ static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq)
if (n->tx_timer_active &&
(vq->vring.avail->idx - vq->last_avail_idx) == 64) {
- vq->vring.used->flags &= ~VRING_USED_F_NOTIFY_ON_FULL;
+ vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
qemu_del_timer(n->tx_timer);
n->tx_timer_active = 0;
virtio_net_flush_tx(n, vq);
} else {
- qemu_mod_timer(n->tx_timer, qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL);
+ qemu_mod_timer(n->tx_timer,
+ qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL);
n->tx_timer_active = 1;
- vq->vring.used->flags |= VRING_USED_F_NOTIFY_ON_FULL;
+ vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
}
}
@@ -276,7 +275,7 @@ static void virtio_net_tx_timer(void *opaque)
{
VirtIONet *n = opaque;
- n->tx_vq->vring.used->flags &= ~VRING_USED_F_NOTIFY_ON_FULL;
+ n->tx_vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
n->tx_timer_active = 0;
virtio_net_flush_tx(n, n->tx_vq);
}
diff --git a/qemu/hw/virtio.c b/qemu/hw/virtio.c
index e7fcfa3..b78c2c5 100644
--- a/qemu/hw/virtio.c
+++ b/qemu/hw/virtio.c
@@ -380,7 +380,9 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
void virtio_notify(VirtIODevice *vdev, VirtQueue *vq)
{
- if (vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
+ /* Always notify when queue is empty */
+ if (vq->vring.avail->idx != vq->last_avail_idx &&
+ (vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
return;
vdev->isr = 1;
diff --git a/qemu/hw/virtio.h b/qemu/hw/virtio.h
index 21b96a3..dee97ba 100644
--- a/qemu/hw/virtio.h
+++ b/qemu/hw/virtio.h
@@ -39,7 +39,6 @@
/* This means don't notify other side when buffer added. */
#define VRING_USED_F_NO_NOTIFY 1
-#define VRING_USED_F_NOTIFY_ON_FULL 2
/* This means don't interrupt guest when buffer consumed. */
#define VRING_AVAIL_F_NO_INTERRUPT 1
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fixup virtio_net TX timer
[not found] ` <11998084753122-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2008-01-08 16:39 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-01-08 16:39 UTC (permalink / raw)
To: Anthony Liguori; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Anthony Liguori wrote:
> Instead of introducing a new flag, I think we decided that we would make the
> NO_NOTIFY flag be a hint and have both ends always notify when the ring is
> full or empty. This patch updates the QEMU virtio code to reflect this.
>
Thanks, applied.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-08 16:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-08 16:07 [PATCH] Fixup virtio_net TX timer Anthony Liguori
[not found] ` <11998084753122-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-01-08 16:39 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox