Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256627
b: refs/heads/master
c: 9e38082
h: refs/heads/master
i:
  256625: e3f178c
  256623: 3089bbf
v: v3
  • Loading branch information
Shirley Ma authored and Michael S. Tsirkin committed Jul 21, 2011
1 parent f31e20a commit 45e1325
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 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: c047e5f3170c2595e66ed67f87cec01afd717212
refs/heads/master: 9e380825ab3f5176f65306c4ac119fd23634ce03
12 changes: 9 additions & 3 deletions trunk/drivers/vhost/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,21 @@ static void handle_tx(struct vhost_net *net)
break;
/* Nothing new? Wait for eventfd to tell us they refilled. */
if (head == vq->num) {
int num_pends;

wmem = atomic_read(&sock->sk->sk_wmem_alloc);
if (wmem >= sock->sk->sk_sndbuf * 3 / 4) {
tx_poll_start(net, sock);
set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
break;
}
/* If more outstanding DMAs, queue the work */
if (unlikely(vq->upend_idx - vq->done_idx >
VHOST_MAX_PEND)) {
/* If more outstanding DMAs, queue the work.
* Handle upend_idx wrap around
*/
num_pends = likely(vq->upend_idx >= vq->done_idx) ?
(vq->upend_idx - vq->done_idx) :
(vq->upend_idx + UIO_MAXIOV - vq->done_idx);
if (unlikely(num_pends > VHOST_MAX_PEND)) {
tx_poll_start(net, sock);
set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
break;
Expand Down

0 comments on commit 45e1325

Please sign in to comment.