Thread (4 messages) 4 messages, 3 authors, 2012-12-19

Re: [PATCH v2 1/5] virtio: add functions for piecewise addition of buffers

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2012-12-19 16:49:59
Also in: kvm, linux-scsi, lkml

On Wed, Dec 19, 2012 at 06:51:30PM +0200, Michael S. Tsirkin wrote:
On Wed, Dec 19, 2012 at 01:04:08PM +0100, Paolo Bonzini wrote:
quoted
Il 19/12/2012 11:47, Stefan Hajnoczi ha scritto:
quoted
On Tue, Dec 18, 2012 at 01:32:48PM +0100, Paolo Bonzini wrote:
quoted
+/**
+ * virtqueue_start_buf - start building buffer for the other end
+ * @vq: the struct virtqueue we're talking about.
+ * @buf: a struct keeping the state of the buffer
+ * @data: the token identifying the buffer.
+ * @count: the number of buffers that will be added
Perhaps count should be named count_bufs or num_bufs.
Ok.
quoted
quoted
+ * @count_sg: the number of sg lists that will be added
What is the purpose of count_sg?
It is needed to decide whether to use an indirect or a direct buffer.
The idea is to avoid a memory allocation if the driver is providing us
with separate sg elements (under the assumption that they will be few).

Originally I wanted to use a mix of direct and indirect buffer (direct
if add_buf received a one-element scatterlist, otherwise indirect).  It
would have had the same effect, without having to specify count_sg in
advance.  The spec is not clear if that is allowed or not, but in the
end they do not work with either QEMU or vhost, so I chose this
alternative instead.

Paolo
Hmm it should work with vhost.
BTW passing in num_in + num_out would be nicer than explicit direction:
closer to the current add_buf.
quoted
quoted
Stefan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help