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>

+13 -1
+13 -1
Documentation/lguest/lguest.c
··· 933 933 /* FIXME: Actually want DRIVER_ACTIVE here. */ 934 934 if (dev->desc->status & VIRTIO_CONFIG_S_DRIVER_OK) 935 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 941 /* We'll turn this back on if input buffers are registered. */ 937 942 return false; 938 943 } else if (out_num) ··· 972 967 add_device_fd(vq->dev->fd); 973 968 /* Tell waker to listen to it again */ 974 969 write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd)); 970 + } 971 + 972 + static void net_enable_fd(int fd, struct virtqueue *vq) 973 + { 974 + /* We don't need to know again when Guest refills receive buffer. */ 975 + vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY; 976 + enable_fd(fd, vq); 975 977 } 976 978 977 979 /* When the Guest tells us they updated the status field, we handle it. */ ··· 1438 1426 1439 1427 /* Network devices need a receive and a send queue, just like 1440 1428 * console. */ 1441 - add_virtqueue(dev, VIRTQUEUE_NUM, enable_fd); 1429 + add_virtqueue(dev, VIRTQUEUE_NUM, net_enable_fd); 1442 1430 add_virtqueue(dev, VIRTQUEUE_NUM, handle_net_output); 1443 1431 1444 1432 /* We need a socket to perform the magic network ioctls to bring up the