public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: Anthony Liguori
	<aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
	Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Subject: [PATCH 2/3] Add support for VRING_USED_F_NOTIFY_ON_FULL
Date: Mon,  7 Jan 2008 15:41:29 -0600	[thread overview]
Message-ID: <1199742091998-git-send-email-aliguori@us.ibm.com> (raw)
In-Reply-To: <11997420901032-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

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 <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

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

  parent reply	other threads:[~2008-01-07 21:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-07 21:41 [PATCH 1/3] Remove the TX timer from virtio_net Anthony Liguori
     [not found] ` <11997420901032-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-01-07 21:41   ` Anthony Liguori [this message]
     [not found]     ` <1199742091998-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-01-07 21:41       ` [PATCH 3/3][QEMU] Support TX mitigation in QEMU's virtio_net device Anthony Liguori
     [not found]         ` <1199742091954-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-01-08 13:53           ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1199742091998-git-send-email-aliguori@us.ibm.com \
    --to=aliguori-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox