aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/lguest/lguest.c9
-rw-r--r--drivers/virtio/virtio_ring.c2
-rw-r--r--include/linux/virtio_ring.h8
3 files changed, 13 insertions, 6 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 4df1804169dc..8ff2d8bc690a 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -923,10 +923,10 @@ static void handle_output(int fd, unsigned long addr)
923 /* Check each virtqueue. */ 923 /* Check each virtqueue. */
924 for (i = devices.dev; i; i = i->next) { 924 for (i = devices.dev; i; i = i->next) {
925 for (vq = i->vq; vq; vq = vq->next) { 925 for (vq = i->vq; vq; vq = vq->next) {
926 if (vq->config.pfn == addr/getpagesize() 926 if (vq->config.pfn == addr/getpagesize()) {
927 && vq->handle_output) {
928 verbose("Output to %s\n", vq->dev->name); 927 verbose("Output to %s\n", vq->dev->name);
929 vq->handle_output(fd, vq); 928 if (vq->handle_output)
929 vq->handle_output(fd, vq);
930 return; 930 return;
931 } 931 }
932 } 932 }
@@ -1068,7 +1068,8 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
1068 * virtqueue. */ 1068 * virtqueue. */
1069 vq->handle_output = handle_output; 1069 vq->handle_output = handle_output;
1070 1070
1071 /* Set the "Don't Notify Me" flag if we don't have a handler */ 1071 /* As an optimization, set the advisory "Don't Notify Me" flag if we
1072 * don't have a handler */
1072 if (!handle_output) 1073 if (!handle_output)
1073 vq->vring.used->flags = VRING_USED_F_NO_NOTIFY; 1074 vq->vring.used->flags = VRING_USED_F_NO_NOTIFY;
1074} 1075}
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 342bb0363fbe..dbe1d35db32a 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -87,6 +87,8 @@ static int vring_add_buf(struct virtqueue *_vq,
87 if (vq->num_free < out + in) { 87 if (vq->num_free < out + in) {
88 pr_debug("Can't add buf len %i - avail = %i\n", 88 pr_debug("Can't add buf len %i - avail = %i\n",
89 out + in, vq->num_free); 89 out + in, vq->num_free);
90 /* We notify *even if* VRING_USED_F_NO_NOTIFY is set here. */
91 vq->notify(&vq->vq);
90 END_USE(vq); 92 END_USE(vq);
91 return -ENOSPC; 93 return -ENOSPC;
92 } 94 }
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index ea3be89a0e83..abe481ed990e 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -15,9 +15,13 @@
15/* This marks a buffer as write-only (otherwise read-only). */ 15/* This marks a buffer as write-only (otherwise read-only). */
16#define VRING_DESC_F_WRITE 2 16#define VRING_DESC_F_WRITE 2
17 17
18/* This means don't notify other side when buffer added. */ 18/* The Host uses this in used->flags to advise the Guest: don't kick me when
19 * you add a buffer. It's unreliable, so it's simply an optimization. Guest
20 * will still kick if it's out of buffers. */
19#define VRING_USED_F_NO_NOTIFY 1 21#define VRING_USED_F_NO_NOTIFY 1
20/* This means don't interrupt guest when buffer consumed. */ 22/* The Guest uses this in avail->flags to advise the Host: don't interrupt me
23 * when you consume a buffer. It's unreliable, so it's simply an
24 * optimization. */
21#define VRING_AVAIL_F_NO_INTERRUPT 1 25#define VRING_AVAIL_F_NO_INTERRUPT 1
22 26
23/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ 27/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */