net.c (e42f6f9be4f83c537aa81b4c6239ea94ff5b29ce) net.c (fe8dd45bb7556246c6b76277b1ba4296c91c2505)
1/* Copyright (C) 2009 Red Hat, Inc.
2 * Author: Michael S. Tsirkin <mst@redhat.com>
3 *
4 * This work is licensed under the terms of the GNU GPL, version 2.
5 *
6 * virtio-net server in host kernel.
7 */
8

--- 606 unchanged lines hidden (view full) ---

615 int head;
616 struct msghdr msg = {
617 .msg_name = NULL,
618 .msg_namelen = 0,
619 .msg_control = NULL,
620 .msg_controllen = 0,
621 .msg_flags = MSG_DONTWAIT,
622 };
1/* Copyright (C) 2009 Red Hat, Inc.
2 * Author: Michael S. Tsirkin <mst@redhat.com>
3 *
4 * This work is licensed under the terms of the GNU GPL, version 2.
5 *
6 * virtio-net server in host kernel.
7 */
8

--- 606 unchanged lines hidden (view full) ---

615 int head;
616 struct msghdr msg = {
617 .msg_name = NULL,
618 .msg_namelen = 0,
619 .msg_control = NULL,
620 .msg_controllen = 0,
621 .msg_flags = MSG_DONTWAIT,
622 };
623 struct tun_msg_ctl ctl;
623 size_t len, total_len = 0;
624 int err;
625 struct vhost_net_ubuf_ref *uninitialized_var(ubufs);
626 bool zcopy_used;
627 int sent_pkts = 0;
628
629 for (;;) {
630 bool busyloop_intr;

--- 28 unchanged lines hidden (view full) ---

659 ubuf = nvq->ubuf_info + nvq->upend_idx;
660
661 vq->heads[nvq->upend_idx].id = cpu_to_vhost32(vq, head);
662 vq->heads[nvq->upend_idx].len = VHOST_DMA_IN_PROGRESS;
663 ubuf->callback = vhost_zerocopy_callback;
664 ubuf->ctx = nvq->ubufs;
665 ubuf->desc = nvq->upend_idx;
666 refcount_set(&ubuf->refcnt, 1);
624 size_t len, total_len = 0;
625 int err;
626 struct vhost_net_ubuf_ref *uninitialized_var(ubufs);
627 bool zcopy_used;
628 int sent_pkts = 0;
629
630 for (;;) {
631 bool busyloop_intr;

--- 28 unchanged lines hidden (view full) ---

660 ubuf = nvq->ubuf_info + nvq->upend_idx;
661
662 vq->heads[nvq->upend_idx].id = cpu_to_vhost32(vq, head);
663 vq->heads[nvq->upend_idx].len = VHOST_DMA_IN_PROGRESS;
664 ubuf->callback = vhost_zerocopy_callback;
665 ubuf->ctx = nvq->ubufs;
666 ubuf->desc = nvq->upend_idx;
667 refcount_set(&ubuf->refcnt, 1);
667 msg.msg_control = ubuf;
668 msg.msg_controllen = sizeof(ubuf);
668 msg.msg_control = &ctl;
669 ctl.type = TUN_MSG_UBUF;
670 ctl.ptr = ubuf;
671 msg.msg_controllen = sizeof(ctl);
669 ubufs = nvq->ubufs;
670 atomic_inc(&ubufs->refcount);
671 nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV;
672 } else {
673 msg.msg_control = NULL;
674 ubufs = NULL;
675 }
676 total_len += len;

--- 937 unchanged lines hidden ---
672 ubufs = nvq->ubufs;
673 atomic_inc(&ubufs->refcount);
674 nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV;
675 } else {
676 msg.msg_control = NULL;
677 ubufs = NULL;
678 }
679 total_len += len;

--- 937 unchanged lines hidden ---