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 11:04:29 +0300 [thread overview]
Message-ID: <4A8A608D.9000909@panasas.com> (raw)
In-Reply-To: <97a757510908172322y7a42df80n5bf7f21fbca16e13@mail.gmail.com>
On 08/18/2009 09:22 AM, Madhavi Manchala wrote:
> Dear All,
>
> I have seen that SCSI supports bi-directional commands
> DMA_BIDIRECTIONAL. However, I did not get such type of commands in my
> mass storage driver. My device supports bi-directional data transfers.
> My question is, how can I get such type of requests to my mass storage
> driver? If so, how can I handle the IN and OUT buffers? Are there
> separate buffers for both? Is there any support for the bi-directional
> in the current SCSI implementation? I am currently using the 2.6.28
> kernel code.
>
> We have only one pointer for data buffer instead of two, one for data
> OUT and one for data IN in command block. There is only one length
> variable. How can we use the OUT and IN buffers? How can I pass
> different IN length and OUT length to lower stack from SCSI layer?
>
> Is there any thing need to be changed in the SCSI layer code to handle
> the bi-directional data transfers?
>
> Please point to me some links which shows the bi-directional data transfers.
>
> Thanks in advance.
>
> With Regards,
> Madhavi M.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Bidi is fully supported since 2.6.25
If you want example of how to issue bidi commands you can see these two files:
block/bsg.c
drivers/scsi/osd/osd_initiator.c
Basically you allocate two struct request one for OUT one for IN. You map
some memory on them and do "out_req->next_rq = in_req;" And you execute
the out_req.
These two request will go together as one bidi request.
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;
...
}
scsi_in() and scsi_out() will return a pointer or NULL if the
cmnd does not have a buffer in this direction. So for example
scsi_in() is always used on receive regardless if it is a bidi
or a uni_read.
NOTE: in bidi_commands
scsi_bidi_cmnd(cmnd) == true;
but
cmnd->sc_data_direction == DMA_TO_DEVICE;
DMA_BIDIRECTIONAL is *never* returned from scsi
and it means something else inside the DMA engines.
For example driver that supports bidi see:
drivers/scsi/iscsi_tcp.c
drivers/scsi/scsi_debug.c
(Search for "scsi_in" and "scsi_out")
What type of scsi-device are you using? what bidi commands?
Have a good day
Boaz
next prev parent reply other threads:[~2009-08-18 8:04 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 [this message]
2009-08-18 9:03 ` Madhavi Manchala
2009-08-18 10:00 ` Boaz Harrosh
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=4A8A608D.9000909@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.