From: Anthony Liguori Subject: [PATCH 2/3] Add support for VRING_USED_F_NOTIFY_ON_FULL Date: Mon, 7 Jan 2008 15:41:29 -0600 Message-ID: <1199742091998-git-send-email-aliguori@us.ibm.com> References: <11997420901032-git-send-email-aliguori@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Anthony Liguori , Avi Kivity To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Return-path: In-Reply-To: <11997420901032-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.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 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