From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56002 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLXiE-0006OO-I3 for qemu-devel@nongnu.org; Thu, 25 Nov 2010 04:01:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLXiD-0004pC-8h for qemu-devel@nongnu.org; Thu, 25 Nov 2010 04:01:54 -0500 Received: from gate.crashing.org ([63.228.1.57]:50015) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PLXiC-0004p7-Nu for qemu-devel@nongnu.org; Thu, 25 Nov 2010 04:01:53 -0500 Subject: Re: [Qemu-devel] Re: [PATCH] scsi-generic: bugfixes for 'SCSIRequest' conversion From: Benjamin Herrenschmidt In-Reply-To: <4CEE2343.3090505@redhat.com> References: <1290586723-8724-1-git-send-email-nab@linux-iscsi.org> <4CECD36E.50401@suse.de> <4CECD50F.9060501@redhat.com> <4CECE609.7080600@suse.de> <4CECEA2A.40008@redhat.com> <4CECED12.5020109@suse.de> <1290674774.32570.106.camel@pasglop> <4CEE2343.3090505@redhat.com> Content-Type: text/plain; charset="UTF-8" Date: Thu, 25 Nov 2010 20:01:44 +1100 Message-ID: <1290675704.32570.114.camel@pasglop> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Kevin Wolf , Stefan Hajnoczi , qemu-devel , "Nicholas A. Bellinger" , Hannes Reinecke , Paolo Bonzini , linux-iscsi-target-dev@googlegroups.com On Thu, 2010-11-25 at 09:50 +0100, Gerd Hoffmann wrote: > On 11/25/10 09:46, Benjamin Herrenschmidt wrote: > > > So far tho, it appears that I can (at least with scsi-disk) rely on > > always been eventually called with SCSI_REASON_DONE so my code (and > > maybe the usb-msd code too, I haven't verified) relies on that to > > complete requests... Is that incorrect ? > > Yes. Well, so far it works :-) But I suppose I must be lucky.. I must admit that it's very unclear how that SCSI "stack" is meant to be used from the HBA standpoint. Right now, I've somewhat come up with: - client request occurs - call device send_command() - if result is 0, assume my complete() was called with SCSI_REASON_DONE - else, use sign of result for transfer direction, store the absolute value as the total expected transfer len and call the device scsi_data_read()/write() and wait for complete() - when complete() is called: - if SCSI_REASON_DONE, complete client request - else perform the client "DMA" for "arg" bytes - call the device scsi_data_read()/write() again So far it seems to work with scsi-disk but maybe I miss something in which case I would very much enjoy being corrected :-) Cheers, Ben.