aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost/net.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vhost/net.c')
-rw-r--r--drivers/vhost/net.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 8d626d7c2e7e..c7bdeb655646 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -778,16 +778,6 @@ static void handle_rx(struct vhost_net *net)
778 /* On error, stop handling until the next kick. */ 778 /* On error, stop handling until the next kick. */
779 if (unlikely(headcount < 0)) 779 if (unlikely(headcount < 0))
780 goto out; 780 goto out;
781 if (nvq->rx_array)
782 msg.msg_control = vhost_net_buf_consume(&nvq->rxq);
783 /* On overrun, truncate and discard */
784 if (unlikely(headcount > UIO_MAXIOV)) {
785 iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1);
786 err = sock->ops->recvmsg(sock, &msg,
787 1, MSG_DONTWAIT | MSG_TRUNC);
788 pr_debug("Discarded rx packet: len %zd\n", sock_len);
789 continue;
790 }
791 /* OK, now we need to know about added descriptors. */ 781 /* OK, now we need to know about added descriptors. */
792 if (!headcount) { 782 if (!headcount) {
793 if (unlikely(vhost_enable_notify(&net->dev, vq))) { 783 if (unlikely(vhost_enable_notify(&net->dev, vq))) {
@@ -800,6 +790,16 @@ static void handle_rx(struct vhost_net *net)
800 * they refilled. */ 790 * they refilled. */
801 goto out; 791 goto out;
802 } 792 }
793 if (nvq->rx_array)
794 msg.msg_control = vhost_net_buf_consume(&nvq->rxq);
795 /* On overrun, truncate and discard */
796 if (unlikely(headcount > UIO_MAXIOV)) {
797 iov_iter_init(&msg.msg_iter, READ, vq->iov, 1, 1);
798 err = sock->ops->recvmsg(sock, &msg,
799 1, MSG_DONTWAIT | MSG_TRUNC);
800 pr_debug("Discarded rx packet: len %zd\n", sock_len);
801 continue;
802 }
803 /* We don't need to be notified again. */ 803 /* We don't need to be notified again. */
804 iov_iter_init(&msg.msg_iter, READ, vq->iov, in, vhost_len); 804 iov_iter_init(&msg.msg_iter, READ, vq->iov, in, vhost_len);
805 fixup = msg.msg_iter; 805 fixup = msg.msg_iter;