linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Madhavi Manchala <madhavi.lscsi@gmail.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: Bidirectional data transfers from SCSI layer
Date: Tue, 18 Aug 2009 13:00:20 +0300	[thread overview]
Message-ID: <4A8A7BB4.90102@panasas.com> (raw)
In-Reply-To: <97a757510908180203h7c10c63fx19f436e72de25c5@mail.gmail.com>

On 08/18/2009 12:03 PM, Madhavi Manchala wrote:
> On Tue, Aug 18, 2009 at 1:34 PM, Boaz Harrosh<bharrosh@panasas.com> wrote:
> 
> Dear Boaz,
> 
> Thanks for the information.
> 
>> drivers/scsi/osd/osd_initiator.c
> 
> I did not find this file in my 2.6.28 sources.
> 

If you are developing new code for Linux it is best
to base the work on latest git tree. Either Linus's or the
maintainer tree that will receive your work. See here:
http://git.kernel.org/

The file above you can see here:
http://git.open-osd.org/gitweb.cgi?p=open-osd.git;a=tree;f=drivers/scsi/osd;h=803721b1c52bcd52822976b515de817a8b765969;hb=ec34ca8bdef55a47c3b1f82b1021609570ccb283
Only 2.6.30 and up have osd support

>> On the scsi-driver side you do:
>>
>>        if (scsi_bidi_cmnd(cmnd)) {
>>                in_sgl = scsi_in(cmnd)->table.sgl;
>>                in_nents = scsi_in(cmnd)->table.nents;
>>                in_bytes = scsi_in(cmnd)->length;
>>
>>                /* Same thing for out */
>>                out_sgl = scsi_out(cmnd)->table.sgl;
>>                ...
>>        }
> 
> Do I need to modify the SCSI driver files to handle  the
> bi-directional comamnds or Is this already supported?
> 

Yes only very few drivers support bidi commands.
i.e. iscsi is the only one that supports them in general.

>> What type of scsi-device are you using?
> 
> I am working for USB Attached SCSI (UAS) device which supports
> bi-directional commands. I'm modifying USB Mass storage driver
> according to UAS requirements. 

Yes, Current "USB Mass storage driver" does not support bidi as well
as many other standard scsi things like NCQ.

> Whenever there is command to process,
> SCSI layer sends scsi_cmnd structure pointer to UAS class driver (my
> driver - modified mass storage driver). But I did not find two data
> pointers and two data length variables (one IN and one OUT) in this
> structure to handle bi-directional data.
> 

As I said use scsi_in() and scsi_out() at driver. But you need an initiator
to issue these type of commands. The Kernel does not use these type of commands
for normal I/O. Only osd initiator with osd-scsi targets does.

You can also use bsg driver to issue bidi commands from user mode. You will
need that your driver set the bidi queue-bit on initialization. (See iscsi_tcp)

(Tell me if you need example code for bsg use in user-mode).

> I found only one struct scsi_data_buffer pointer in scsi_cmnd
> structure. So, how do SCSI layer sends IN and OUT buffer pointers and
> their lengths to my class driver?
> 

Again: 
	if (scsi_bidi_cmnd(cmnd)) {
		in_sdb = scsi_in(cmnd);
		out_sdb = scsi_out(cmnd);
	}
It works, look at the code.

>> what bidi commands?
> 
> I did not understand this. Could you please elaborate it? Are there
> any bidi commands like READ_10 or WRITE_10 which are specific to any
> device?
> 

There is the XOR_10 I think and others. But I'm not sure. You'll have to look
it up yourself at the different T10 scsi standards. Also scsi_debug.c as some emulation
for a command or two. I only use scsi-osd type commands which are all potentially bidi
capable.

> Thanks and Regards,
> Madhavi M.

Boaz

  reply	other threads:[~2009-08-18 10:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-18  6:22 Bidirectional data transfers from SCSI layer Madhavi Manchala
2009-08-18  8:04 ` Boaz Harrosh
2009-08-18  9:03   ` Madhavi Manchala
2009-08-18 10:00     ` Boaz Harrosh [this message]
2009-08-18 10:35       ` Madhavi Manchala
2009-08-18 11:46         ` Boaz Harrosh
2009-08-18 13:42           ` Madhavi Manchala
2009-08-19  8:22             ` Boaz Harrosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A8A7BB4.90102@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=madhavi.lscsi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).