aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-07-29 10:58:35 -0400
committerRusty Russell <rusty@rustcorp.com.au>2008-07-28 19:58:35 -0400
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 31a688e105ca..46f4c5b09e9e 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)
933 /* FIXME: Actually want DRIVER_ACTIVE here. */ 933 /* FIXME: Actually want DRIVER_ACTIVE here. */
934 if (dev->desc->status & VIRTIO_CONFIG_S_DRIVER_OK) 934 if (dev->desc->status & VIRTIO_CONFIG_S_DRIVER_OK)
935 warn("network: no dma buffer!"); 935 warn("network: no dma buffer!");
936
937 /* Now tell it we want to know if new things appear. */
938 dev->vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
939 wmb();
940
936 /* We'll turn this back on if input buffers are registered. */ 941 /* We'll turn this back on if input buffers are registered. */
937 return false; 942 return false;
938 } else if (out_num) 943 } else if (out_num)
@@ -969,6 +974,13 @@ static void enable_fd(int fd, struct virtqueue *vq)
969 write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd)); 974 write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd));
970} 975}
971 976
977static void net_enable_fd(int fd, struct virtqueue *vq)
978{
979 /* We don't need to know again when Guest refills receive buffer. */
980 vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
981 enable_fd(fd, vq);
982}
983
972/* When the Guest tells us they updated the status field, we handle it. */ 984/* When the Guest tells us they updated the status field, we handle it. */
973static void update_device_status(struct device *dev) 985static void update_device_status(struct device *dev)
974{ 986{
@@ -1426,7 +1438,7 @@ static void setup_tun_net(char *arg)
1426 1438
1427 /* Network devices need a receive and a send queue, just like 1439 /* Network devices need a receive and a send queue, just like
1428 * console. */ 1440 * console. */
1429 add_virtqueue(dev, VIRTQUEUE_NUM, enable_fd); 1441 add_virtqueue(dev, VIRTQUEUE_NUM, net_enable_fd);
1430 add_virtqueue(dev, VIRTQUEUE_NUM, handle_net_output); 1442 add_virtqueue(dev, VIRTQUEUE_NUM, handle_net_output);
1431 1443
1432 /* We need a socket to perform the magic network ioctls to bring up the 1444 /* We need a socket to perform the magic network ioctls to bring up the