Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82816
b: refs/heads/master
c: 426e3e0
h: refs/heads/master
v: v3
  • Loading branch information
Rusty Russell committed Feb 4, 2008
1 parent ea18d4a commit 4e5c53a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3309daaad724dd08eb598bf9c12b7bb9daddd706
refs/heads/master: 426e3e0af5d2473e67d4256fc1340b7faebd1cc7
9 changes: 5 additions & 4 deletions trunk/Documentation/lguest/lguest.c
Original file line number Diff line number Diff line change
Expand Up @@ -923,10 +923,10 @@ static void handle_output(int fd, unsigned long addr)
/* Check each virtqueue. */
for (i = devices.dev; i; i = i->next) {
for (vq = i->vq; vq; vq = vq->next) {
if (vq->config.pfn == addr/getpagesize()
&& vq->handle_output) {
if (vq->config.pfn == addr/getpagesize()) {
verbose("Output to %s\n", vq->dev->name);
vq->handle_output(fd, vq);
if (vq->handle_output)
vq->handle_output(fd, vq);
return;
}
}
Expand Down Expand Up @@ -1068,7 +1068,8 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
* virtqueue. */
vq->handle_output = handle_output;

/* Set the "Don't Notify Me" flag if we don't have a handler */
/* As an optimization, set the advisory "Don't Notify Me" flag if we
* don't have a handler */
if (!handle_output)
vq->vring.used->flags = VRING_USED_F_NO_NOTIFY;
}
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/virtio/virtio_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ static int vring_add_buf(struct virtqueue *_vq,
if (vq->num_free < out + in) {
pr_debug("Can't add buf len %i - avail = %i\n",
out + in, vq->num_free);
/* We notify *even if* VRING_USED_F_NO_NOTIFY is set here. */
vq->notify(&vq->vq);
END_USE(vq);
return -ENOSPC;
}
Expand Down
8 changes: 6 additions & 2 deletions trunk/include/linux/virtio_ring.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
/* This marks a buffer as write-only (otherwise read-only). */
#define VRING_DESC_F_WRITE 2

/* This means don't notify other side when buffer added. */
/* The Host uses this in used->flags to advise the Guest: don't kick me when
* you add a buffer. It's unreliable, so it's simply an optimization. Guest
* will still kick if it's out of buffers. */
#define VRING_USED_F_NO_NOTIFY 1
/* This means don't interrupt guest when buffer consumed. */
/* The Guest uses this in avail->flags to advise the Host: don't interrupt me
* when you consume a buffer. It's unreliable, so it's simply an
* optimization. */
#define VRING_AVAIL_F_NO_INTERRUPT 1

/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */
Expand Down

0 comments on commit 4e5c53a

Please sign in to comment.