vhost-net: restart tx poll on sk_sndbuf full
authorSridhar Samudrala <samudrala@us.ibm.com>
Sun, 28 Feb 2010 17:39:16 +0000 (19:39 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 28 Feb 2010 17:50:33 +0000 (19:50 +0200)
guest to remote communication with vhost net sometimes stops until
guest driver is restarted. This happens when we get guest kick precisely
when the backend send queue is full, as a result handle_tx() returns without
polling backend. This patch fixes this by restarting tx poll on this condition.

Signed-off-by: Sridhar Samudrala <samudrala@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Tom Lendacky <toml@us.ibm.com>
drivers/vhost/net.c

index 91a324cc22982510bbb27420fdefd6bbd95dc37c..ad37da2b6cb5bba78ac91664d93088f7ec2fb59c 100644 (file)
@@ -114,8 +114,12 @@ static void handle_tx(struct vhost_net *net)
                return;
 
        wmem = atomic_read(&sock->sk->sk_wmem_alloc);
-       if (wmem >= sock->sk->sk_sndbuf)
+       if (wmem >= sock->sk->sk_sndbuf) {
+               mutex_lock(&vq->mutex);
+               tx_poll_start(net, sock);
+               mutex_unlock(&vq->mutex);
                return;
+       }
 
        use_mm(net->dev.mm);
        mutex_lock(&vq->mutex);