aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-12-10 15:00:58 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-02-04 01:34:16 -0500
commit98a527aac1eb198dbc4405b800e102563ed8e4dd (patch)
tree9bb6a91ca35a969344314cb0e4b5173d18e5581a /drivers/vhost
parentaad9a1cec7dcd1d45809b64643fce37061b17788 (diff)
vhost: don't bother with copying iovec in handle_tx()
just advance the msg.msg_iter and be done with that. Cc: Michael S. Tsirkin <mst@redhat.com> Cc: kvm@vger.kernel.org Cc: virtualization@lists.linux-foundation.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/net.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 6906f76332f4..d86cc9bb9ea4 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -336,7 +336,7 @@ static void handle_tx(struct vhost_net *net)
336{ 336{
337 struct vhost_net_virtqueue *nvq = &net->vqs[VHOST_NET_VQ_TX]; 337 struct vhost_net_virtqueue *nvq = &net->vqs[VHOST_NET_VQ_TX];
338 struct vhost_virtqueue *vq = &nvq->vq; 338 struct vhost_virtqueue *vq = &nvq->vq;
339 unsigned out, in, s; 339 unsigned out, in;
340 int head; 340 int head;
341 struct msghdr msg = { 341 struct msghdr msg = {
342 .msg_name = NULL, 342 .msg_name = NULL,
@@ -395,16 +395,17 @@ static void handle_tx(struct vhost_net *net)
395 break; 395 break;
396 } 396 }
397 /* Skip header. TODO: support TSO. */ 397 /* Skip header. TODO: support TSO. */
398 s = move_iovec_hdr(vq->iov, nvq->hdr, hdr_size, out);
399 len = iov_length(vq->iov, out); 398 len = iov_length(vq->iov, out);
400 iov_iter_init(&msg.msg_iter, WRITE, vq->iov, out, len); 399 iov_iter_init(&msg.msg_iter, WRITE, vq->iov, out, len);
400 iov_iter_advance(&msg.msg_iter, hdr_size);
401 /* Sanity check */ 401 /* Sanity check */
402 if (!len) { 402 if (!iov_iter_count(&msg.msg_iter)) {
403 vq_err(vq, "Unexpected header len for TX: " 403 vq_err(vq, "Unexpected header len for TX: "
404 "%zd expected %zd\n", 404 "%zd expected %zd\n",
405 iov_length(nvq->hdr, s), hdr_size); 405 len, hdr_size);
406 break; 406 break;
407 } 407 }
408 len = iov_iter_count(&msg.msg_iter);
408 409
409 zcopy_used = zcopy && len >= VHOST_GOODCOPY_LEN 410 zcopy_used = zcopy && len >= VHOST_GOODCOPY_LEN
410 && (nvq->upend_idx + 1) % UIO_MAXIOV != 411 && (nvq->upend_idx + 1) % UIO_MAXIOV !=