aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/net.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index a935c254749e..14419a8ccbb6 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -343,7 +343,6 @@ static void handle_tx(struct vhost_net *net)
343 .msg_namelen = 0, 343 .msg_namelen = 0,
344 .msg_control = NULL, 344 .msg_control = NULL,
345 .msg_controllen = 0, 345 .msg_controllen = 0,
346 .msg_iov = vq->iov,
347 .msg_flags = MSG_DONTWAIT, 346 .msg_flags = MSG_DONTWAIT,
348 }; 347 };
349 size_t len, total_len = 0; 348 size_t len, total_len = 0;
@@ -397,8 +396,8 @@ static void handle_tx(struct vhost_net *net)
397 } 396 }
398 /* Skip header. TODO: support TSO. */ 397 /* Skip header. TODO: support TSO. */
399 s = move_iovec_hdr(vq->iov, nvq->hdr, hdr_size, out); 398 s = move_iovec_hdr(vq->iov, nvq->hdr, hdr_size, out);
400 msg.msg_iovlen = out;
401 len = iov_length(vq->iov, out); 399 len = iov_length(vq->iov, out);
400 iov_iter_init(&msg.msg_iter, WRITE, vq->iov, out, len);
402 /* Sanity check */ 401 /* Sanity check */
403 if (!len) { 402 if (!len) {
404 vq_err(vq, "Unexpected header len for TX: " 403 vq_err(vq, "Unexpected header len for TX: "
@@ -568,7 +567,6 @@ static void handle_rx(struct vhost_net *net)
568 .msg_namelen = 0, 567 .msg_namelen = 0,
569 .msg_control = NULL, /* FIXME: get and handle RX aux data. */ 568 .msg_control = NULL, /* FIXME: get and handle RX aux data. */
570 .msg_controllen = 0, 569 .msg_controllen = 0,
571 .msg_iov = vq->iov,
572 .msg_flags = MSG_DONTWAIT, 570 .msg_flags = MSG_DONTWAIT,
573 }; 571 };
574 struct virtio_net_hdr_mrg_rxbuf hdr = { 572 struct virtio_net_hdr_mrg_rxbuf hdr = {
@@ -606,7 +604,7 @@ static void handle_rx(struct vhost_net *net)
606 break; 604 break;
607 /* On overrun, truncate and discard */ 605 /* On overrun, truncate and discard */
608 if (unlikely(headcount > UIO_MAXIOV)) { 606 if (unlikely(headcount > UIO_MAXIOV)) {
609 msg.msg_iovlen = 1; 607 iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1);
610 err = sock->ops->recvmsg(NULL, sock, &msg, 608 err = sock->ops->recvmsg(NULL, sock, &msg,
611 1, MSG_DONTWAIT | MSG_TRUNC); 609 1, MSG_DONTWAIT | MSG_TRUNC);
612 pr_debug("Discarded rx packet: len %zd\n", sock_len); 610 pr_debug("Discarded rx packet: len %zd\n", sock_len);
@@ -632,7 +630,7 @@ static void handle_rx(struct vhost_net *net)
632 /* Copy the header for use in VIRTIO_NET_F_MRG_RXBUF: 630 /* Copy the header for use in VIRTIO_NET_F_MRG_RXBUF:
633 * needed because recvmsg can modify msg_iov. */ 631 * needed because recvmsg can modify msg_iov. */
634 copy_iovec_hdr(vq->iov, nvq->hdr, sock_hlen, in); 632 copy_iovec_hdr(vq->iov, nvq->hdr, sock_hlen, in);
635 msg.msg_iovlen = in; 633 iov_iter_init(&msg.msg_iter, READ, vq->iov, in, sock_len);
636 err = sock->ops->recvmsg(NULL, sock, &msg, 634 err = sock->ops->recvmsg(NULL, sock, &msg,
637 sock_len, MSG_DONTWAIT | MSG_TRUNC); 635 sock_len, MSG_DONTWAIT | MSG_TRUNC);
638 /* Userspace might have consumed the packet meanwhile: 636 /* Userspace might have consumed the packet meanwhile: