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 <[EMAIL PROTECTED]> 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 _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel