From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRvlH-0004Hd-1X for qemu-devel@nongnu.org; Wed, 01 Jun 2011 20:27:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QRvl7-0004jI-9W for qemu-devel@nongnu.org; Wed, 01 Jun 2011 20:27:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRnpf-0007zn-Re for qemu-devel@nongnu.org; Wed, 01 Jun 2011 11:59:44 -0400 Message-ID: <4DE661E0.6080709@redhat.com> Date: Wed, 01 Jun 2011 17:59:28 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <4DD6246F.4080802@gnu.org> <20110601084922.GA5863@redhat.com> <4DE62992.9070705@redhat.com> <20110601125124.GB12294@redhat.com> <4DE63F3E.6040805@redhat.com> <20110601143619.GB14626@redhat.com> In-Reply-To: <20110601143619.GB14626@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] virtio scsi host draft specification, v2 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel , Stefan Hajnoczi On 06/01/2011 04:36 PM, Michael S. Tsirkin wrote: > Ah, I think I understand now. Both sense and data have in > fields that might only be used partially? > In that case I think I agree: it's best to require the use of separate > buffers for them, in this way used len will give you useful information > and you won't need sense_len and data_len: just a flag to > mark the fact that there*is* a sense buffer following. If the device wants a sense buffer to be there always, that's sensible. No flag needed here, then. Also, sense is always "in", there is no out. But I do not understand how the used len helps me. If I read the spec correctly, the length will be the number of bytes written, but this will always point to after the last field. If sense or data are written partially, this will not be written in the fields---in fact, virtio_blk does contain both sense_len and residual. Its sense field is fixed size, which is probably why it doesn't contain something like datain_size (there is just one variable-size field). Strictly speaking I wouldn't need dataout_size too, because I have only one variable-size read-only field, but I prefer to be future-proof. I think the following is a good compromise: 1) keep dataout_size, datain_size and sense_size; 2) dataout, datain and sense shall each start a separate buffer, and sense shall be contained in a single buffer; it is permissible to put sense and the subsequent fields in the same buffer. This will make it easy for the QEMU implementation to pick up its iovecs. It will also let the device detect mistakes in filling the data sizes. In practice I expect 3 descriptors will be used (one direct for read-only stuff up to data; one possibly indirect for data; one direct for sense and other write-only stuff). > However some questions: > 1. I think you don't need numdatain/numdataout: each > buffer can include in and out segments. Just tell device how many > buffers are there. I don't understand. Paolo