Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106985
b: refs/heads/master
c: aa12498
h: refs/heads/master
i:
  106983: 5b5def8
v: v3
  • Loading branch information
Rusty Russell committed Jul 28, 2008
1 parent 5020371 commit f7098ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 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: a161883a29bf6100efe7b5346bec274e5023c29c
refs/heads/master: aa1249840bfc8d62431eed5796bf99887b963ab6
12 changes: 11 additions & 1 deletion trunk/Documentation/lguest/lguest.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ static void *guest_base;
static unsigned long guest_limit, guest_max;
/* The pipe for signal hander to write to. */
static int timeoutpipe[2];
static unsigned int timeout_usec = 500;

/* a per-cpu variable indicating whose vcpu is currently running */
static unsigned int __thread cpu_id;
Expand Down Expand Up @@ -905,7 +906,7 @@ static void block_vq(struct virtqueue *vq)
itm.it_interval.tv_sec = 0;
itm.it_interval.tv_usec = 0;
itm.it_value.tv_sec = 0;
itm.it_value.tv_usec = 500;
itm.it_value.tv_usec = timeout_usec;

setitimer(ITIMER_REAL, &itm, NULL);
}
Expand All @@ -922,6 +923,7 @@ static void handle_net_output(int fd, struct virtqueue *vq, bool timeout)
unsigned int head, out, in, num = 0;
int len;
struct iovec iov[vq->vring.num];
static int last_timeout_num;

/* Keep getting output buffers from the Guest until we run out. */
while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) {
Expand All @@ -939,6 +941,14 @@ static void handle_net_output(int fd, struct virtqueue *vq, bool timeout)
/* Block further kicks and set up a timer if we saw anything. */
if (!timeout && num)
block_vq(vq);

if (timeout) {
if (num < last_timeout_num)
timeout_usec += 10;
else if (timeout_usec > 1)
timeout_usec--;
last_timeout_num = num;
}
}

/* This is where we handle a packet coming in from the tun device to our
Expand Down

0 comments on commit f7098ff

Please sign in to comment.