diff mbox

vhost-net: initialize zcopy packet counters

Message ID 20121203173151.GA30949@redhat.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Michael S. Tsirkin Dec. 3, 2012, 5:31 p.m. UTC
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>
---
 drivers/vhost/net.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

David Miller Dec. 3, 2012, 6:42 p.m. UTC | #1
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Mon, 3 Dec 2012 19:31:51 +0200

> 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>

Applied to net-next, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 67898fa..ff6c9199 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);