Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nu6Oe-0001sq-3K for qemu-devel@nongnu.org; Tue, 23 Mar 2010 11:52:00 -0400 Received: from [199.232.76.173] (port=50934 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nu6Od-0001sP-Ke for qemu-devel@nongnu.org; Tue, 23 Mar 2010 11:51:59 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nu6Oc-0002qv-AH for qemu-devel@nongnu.org; Tue, 23 Mar 2010 11:51:59 -0400 Received: from mx20.gnu.org ([199.232.41.8]:32310) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nu6Oa-0002ja-E1 for qemu-devel@nongnu.org; Tue, 23 Mar 2010 11:51:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nu6O8-0005Uv-G3 for qemu-devel@nongnu.org; Tue, 23 Mar 2010 11:51:28 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2NFpF0L012755 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 23 Mar 2010 11:51:16 -0400 Date: Tue, 23 Mar 2010 21:19:47 +0530 From: Amit Shah Message-ID: <20100323154947.GE3080@amit-x200.redhat.com> References: <1269354619-10201-1-git-send-email-amit.shah@redhat.com> <1269354619-10201-2-git-send-email-amit.shah@redhat.com> <1269354619-10201-3-git-send-email-amit.shah@redhat.com> <1269354619-10201-4-git-send-email-amit.shah@redhat.com> <1269354619-10201-5-git-send-email-amit.shah@redhat.com> <1269354619-10201-6-git-send-email-amit.shah@redhat.com> <1269354619-10201-7-git-send-email-amit.shah@redhat.com> <1269354619-10201-8-git-send-email-amit.shah@redhat.com> <1269354619-10201-9-git-send-email-amit.shah@redhat.com> <1269354619-10201-10-git-send-email-amit.shah@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1269354619-10201-10-git-send-email-amit.shah@redhat.com> Subject: [Qemu-devel] Re: [PATCH 9/9] virtio-serial: Handle scatter/gather input from the guest List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Avi Kivity , quintela@redhat.com, Gerd Hoffmann , "Michael S. Tsirkin" On (Tue) Mar 23 2010 [20:00:19], Amit Shah wrote: > @@ -369,16 +370,23 @@ static void handle_output(VirtIODevice *vdev, VirtQueue *vq) > * with it. Just ignore the data in that case. > */ > if (!port->info->have_data) { > - ret = 0; > goto next_buf; > } > > - /* The guest always sends only one sg */ > - ret = port->info->have_data(port, elem.out_sg[0].iov_base, > - elem.out_sg[0].iov_len); > + for (i = 0; i < elem.out_num; i++) { > + size_t ret; > + > + ret = port->info->have_data(port, elem.out_sg[0].iov_base, > + elem.out_sg[0].iov_len); > + if (ret < elem.out_sg[0].iov_len) { > + /* We couldn't write the entire iov; stop processing now */ > + break; We should increment len here if ret > 0. I'll post a followup patch that does this. > + } > + len += ret; > + } > > next_buf: > - virtqueue_push(vq, &elem, ret); > + virtqueue_push(vq, &elem, len); > } > virtio_notify(vdev, vq); > } > -- > 1.6.2.5 > Amit