This patch adds support for VRING_USED_F_NOTIFY_ON_FULL.  When this bit is
set, virtio ring notifications will be suppressed unless the virtio ring is
full.

Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]>

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 1302ac4..ee7936f 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -146,7 +146,9 @@ static void vring_kick(struct virtqueue *_vq)
        /* Need to update avail index before checking if we should notify */
        mb();
 
-       if (!(vq->vring.used->flags & VRING_USED_F_NO_NOTIFY))
+       if (!(vq->vring.used->flags & VRING_USED_F_NO_NOTIFY) &&
+           (!(vq->vring.used->flags & VRING_USED_F_NOTIFY_ON_FULL) ||
+            (vq->num_free == 0)))
                /* Prod other side to tell it about changes. */
                vq->notify(&vq->vq);
 
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index ea3be89..ae6092e 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -17,8 +17,13 @@
 
 /* This means don't notify other side when buffer added. */
 #define VRING_USED_F_NO_NOTIFY 1
+/* Don't notify the other side unless the buffer is full */
+#define VRING_USED_F_NOTIFY_ON_FULL 2
+
 /* This means don't interrupt guest when buffer consumed. */
 #define VRING_AVAIL_F_NO_INTERRUPT     1
+/* Don't notify the other side unless the buffer is full */
+#define VRING_AVAIL_F_NOTIFY_ON_FULL 2
 
 /* Virtio ring descriptors: 16 bytes.  These can chain together via "next". */
 struct vring_desc

-------------------------------------------------------------------------
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

Reply via email to