From: Anthony L. <ali...@us...> - 2008-05-13 20:08:40
|
This patch converts virtio-net to use the new fragmented send interface. We should have always supported this. Signed-off-by: Anthony Liguori <ali...@us...> diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c index 85cc9d2..93bca1d 100644 --- a/qemu/hw/virtio-net.c +++ b/qemu/hw/virtio-net.c @@ -239,23 +239,15 @@ again: static void virtio_net_flush_tx(VirtIONet *n, VirtQueue *vq) { VirtQueueElement elem; - int count = 0; if (!(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) return; while (virtqueue_pop(vq, &elem)) { - int i; - size_t len = 0; + ssize_t len = 0; /* ignore the header for now */ - for (i = 1; i < elem.out_num; i++) { - qemu_send_packet(n->vc, elem.out_sg[i].iov_base, - elem.out_sg[i].iov_len); - len += elem.out_sg[i].iov_len; - } - - count++; + len = qemu_sendv_packet(n->vc, &elem.out_sg[1], elem.out_num - 1); virtqueue_push(vq, &elem, sizeof(struct virtio_net_hdr) + len); virtio_notify(&n->vdev, vq); |