Skip to content

Commit

Permalink
vhost-net: initialize zcopy packet counters
Browse files Browse the repository at this point in the history
These packet counters are used to drive the zercopy
selection heuristic so nothing too bad happens if they are off a bit -
and they are also reset once in a while.
But it's cleaner to clear them when backend is set so that
we start in a known state.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
mstsirkin authored and davem330 committed Dec 3, 2012
1 parent 3e14bd3 commit 64e9a9b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/vhost/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,9 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
r = vhost_init_used(vq);
if (r)
goto err_vq;

n->tx_packets = 0;
n->tx_zcopy_err = 0;
}

mutex_unlock(&vq->mutex);
Expand Down

0 comments on commit 64e9a9b

Please sign in to comment.