aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-07-29 09:58:35 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-07-29 09:58:35 +1000
commit5dae785a82c1a8c05b5b4f9709bd9ce658dcf1b6 (patch)
treee737c655acb7ea53644392263d9dd99aae76aec9
parentb5111790fa6695b1502d4f5d389f6b22b9de10c3 (diff)
lguest: net block unneeded receive queue update notifications
Number of exits transmitting 10GB Guest->Host before: network xmit 7858610 recv 118136 After: network xmit 7750233 recv 1 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--Documentation/lguest/lguest.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 31a688e105c..46f4c5b09e9 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -933,6 +933,11 @@ static bool handle_tun_input(int fd, struct device *dev)
/* FIXME: Actually want DRIVER_ACTIVE here. */
if (dev->desc->status & VIRTIO_CONFIG_S_DRIVER_OK)
warn("network: no dma buffer!");
+
+ /* Now tell it we want to know if new things appear. */
+ dev->vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
+ wmb();
+
/* We'll turn this back on if input buffers are registered. */
return false;
} else if (out_num)
@@ -969,6 +974,13 @@ static void enable_fd(int fd, struct virtqueue *vq)
write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd));
}
+static void net_enable_fd(int fd, struct virtqueue *vq)
+{
+ /* We don't need to know again when Guest refills receive buffer. */
+ vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
+ enable_fd(fd, vq);
+}
+
/* When the Guest tells us they updated the status field, we handle it. */
static void update_device_status(struct device *dev)
{
@@ -1426,7 +1438,7 @@ static void setup_tun_net(char *arg)
/* Network devices need a receive and a send queue, just like
* console. */
- add_virtqueue(dev, VIRTQUEUE_NUM, enable_fd);
+ add_virtqueue(dev, VIRTQUEUE_NUM, net_enable_fd);
add_virtqueue(dev, VIRTQUEUE_NUM, handle_net_output);
/* We need a socket to perform the magic network ioctls to bring up the