summaryrefslogtreecommitdiffstats
path: root/drivers/vhost/net.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin2012-12-03 08:31:51 +0100
committerDavid S. Miller2012-12-03 19:42:17 +0100
commit64e9a9b8a0eef9cbd9f86f0e79fc4eeea24abe76 (patch)
treeeab1d3f85c5d09d5efaa86a532b31048db10f198 /drivers/vhost/net.c
parentstmmac: remove two repeated macros (diff)
downloadkernel-qcow2-linux-64e9a9b8a0eef9cbd9f86f0e79fc4eeea24abe76.tar.gz
kernel-qcow2-linux-64e9a9b8a0eef9cbd9f86f0e79fc4eeea24abe76.tar.xz
kernel-qcow2-linux-64e9a9b8a0eef9cbd9f86f0e79fc4eeea24abe76.zip
vhost-net: initialize zcopy packet counters
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>
Diffstat (limited to 'drivers/vhost/net.c')
-rw-r--r--drivers/vhost/net.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 67898fa9c447..ff6c91995c96 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -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);