diff options
Diffstat (limited to 'Documentation/lguest')
-rw-r--r-- | Documentation/lguest/lguest.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index 018472cee151..b2bbbb7f8c57 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
@@ -84,6 +84,7 @@ static void *guest_base; | |||
84 | static unsigned long guest_limit, guest_max; | 84 | static unsigned long guest_limit, guest_max; |
85 | /* The pipe for signal hander to write to. */ | 85 | /* The pipe for signal hander to write to. */ |
86 | static int timeoutpipe[2]; | 86 | static int timeoutpipe[2]; |
87 | static unsigned int timeout_usec = 500; | ||
87 | 88 | ||
88 | /* a per-cpu variable indicating whose vcpu is currently running */ | 89 | /* a per-cpu variable indicating whose vcpu is currently running */ |
89 | static unsigned int __thread cpu_id; | 90 | static unsigned int __thread cpu_id; |
@@ -905,7 +906,7 @@ static void block_vq(struct virtqueue *vq) | |||
905 | itm.it_interval.tv_sec = 0; | 906 | itm.it_interval.tv_sec = 0; |
906 | itm.it_interval.tv_usec = 0; | 907 | itm.it_interval.tv_usec = 0; |
907 | itm.it_value.tv_sec = 0; | 908 | itm.it_value.tv_sec = 0; |
908 | itm.it_value.tv_usec = 500; | 909 | itm.it_value.tv_usec = timeout_usec; |
909 | 910 | ||
910 | setitimer(ITIMER_REAL, &itm, NULL); | 911 | setitimer(ITIMER_REAL, &itm, NULL); |
911 | } | 912 | } |
@@ -922,6 +923,7 @@ static void handle_net_output(int fd, struct virtqueue *vq, bool timeout) | |||
922 | unsigned int head, out, in, num = 0; | 923 | unsigned int head, out, in, num = 0; |
923 | int len; | 924 | int len; |
924 | struct iovec iov[vq->vring.num]; | 925 | struct iovec iov[vq->vring.num]; |
926 | static int last_timeout_num; | ||
925 | 927 | ||
926 | /* Keep getting output buffers from the Guest until we run out. */ | 928 | /* Keep getting output buffers from the Guest until we run out. */ |
927 | while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) { | 929 | while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) { |
@@ -939,6 +941,14 @@ static void handle_net_output(int fd, struct virtqueue *vq, bool timeout) | |||
939 | /* Block further kicks and set up a timer if we saw anything. */ | 941 | /* Block further kicks and set up a timer if we saw anything. */ |
940 | if (!timeout && num) | 942 | if (!timeout && num) |
941 | block_vq(vq); | 943 | block_vq(vq); |
944 | |||
945 | if (timeout) { | ||
946 | if (num < last_timeout_num) | ||
947 | timeout_usec += 10; | ||
948 | else if (timeout_usec > 1) | ||
949 | timeout_usec--; | ||
950 | last_timeout_num = num; | ||
951 | } | ||
942 | } | 952 | } |
943 | 953 | ||
944 | /* This is where we handle a packet coming in from the tun device to our | 954 | /* This is where we handle a packet coming in from the tun device to our |