* sc_data_direction and bidi commands
@ 2015-01-21 16:18 Bart Van Assche
2015-01-22 10:02 ` Nicholas A. Bellinger
0 siblings, 1 reply; 5+ messages in thread
From: Bart Van Assche @ 2015-01-21 16:18 UTC (permalink / raw)
To: linux-scsi@vger.kernel.org
Hello,
Although several SCSI LLDs compare sc_data_direction with the value
DMA_BIDIRECTIONAL apparently scsi_setup_cmnd() never sets
sc_data_direction to the value DMA_BIDIRECTIONAL. Is this behavior on
purpose ? I discovered this while debugging bidi support in a SCSI LLD.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sc_data_direction and bidi commands
2015-01-21 16:18 sc_data_direction and bidi commands Bart Van Assche
@ 2015-01-22 10:02 ` Nicholas A. Bellinger
2015-01-22 10:14 ` Bart Van Assche
0 siblings, 1 reply; 5+ messages in thread
From: Nicholas A. Bellinger @ 2015-01-22 10:02 UTC (permalink / raw)
To: Bart Van Assche; +Cc: linux-scsi@vger.kernel.org
On Wed, 2015-01-21 at 17:18 +0100, Bart Van Assche wrote:
> Hello,
>
> Although several SCSI LLDs compare sc_data_direction with the value
> DMA_BIDIRECTIONAL apparently scsi_setup_cmnd() never sets
> sc_data_direction to the value DMA_BIDIRECTIONAL. Is this behavior on
> purpose ?
>
Yes. Bi-directional CDBs are signaled using scsi_bidi_cmnd(), and IIRC
->sc_data_direction = DMA_TO_DEVICE is set for those cases.
There is an example in drivers/target/loopback/tcm_loop.c, btw.
--nab
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sc_data_direction and bidi commands
2015-01-22 10:02 ` Nicholas A. Bellinger
@ 2015-01-22 10:14 ` Bart Van Assche
2015-01-22 10:39 ` Nicholas A. Bellinger
0 siblings, 1 reply; 5+ messages in thread
From: Bart Van Assche @ 2015-01-22 10:14 UTC (permalink / raw)
To: Nicholas A. Bellinger; +Cc: linux-scsi@vger.kernel.org
On 01/22/15 11:02, Nicholas A. Bellinger wrote:
> On Wed, 2015-01-21 at 17:18 +0100, Bart Van Assche wrote:
>> Although several SCSI LLDs compare sc_data_direction with the value
>> DMA_BIDIRECTIONAL apparently scsi_setup_cmnd() never sets
>> sc_data_direction to the value DMA_BIDIRECTIONAL. Is this behavior on
>> purpose ?
>
> Yes. Bi-directional CDBs are signaled using scsi_bidi_cmnd(), and IIRC
> ->sc_data_direction = DMA_TO_DEVICE is set for those cases.
But why is sc_data_direction set to DMA_BIDIRECTIONAL in
scsi_ioctl_reset() in drivers/scsi/scsi_error.c ? I think
scsi_bidi_cmnd() will return false for the SCSI command submitted by
scsi_ioctl_reset() since in this case scmd->request->next_rq == NULL.
Bart.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sc_data_direction and bidi commands
2015-01-22 10:14 ` Bart Van Assche
@ 2015-01-22 10:39 ` Nicholas A. Bellinger
2015-01-22 11:51 ` Bart Van Assche
0 siblings, 1 reply; 5+ messages in thread
From: Nicholas A. Bellinger @ 2015-01-22 10:39 UTC (permalink / raw)
To: Bart Van Assche; +Cc: linux-scsi@vger.kernel.org
On Thu, 2015-01-22 at 11:14 +0100, Bart Van Assche wrote:
> On 01/22/15 11:02, Nicholas A. Bellinger wrote:
> > On Wed, 2015-01-21 at 17:18 +0100, Bart Van Assche wrote:
> >> Although several SCSI LLDs compare sc_data_direction with the value
> >> DMA_BIDIRECTIONAL apparently scsi_setup_cmnd() never sets
> >> sc_data_direction to the value DMA_BIDIRECTIONAL. Is this behavior on
> >> purpose ?
> >
> > Yes. Bi-directional CDBs are signaled using scsi_bidi_cmnd(), and IIRC
> > ->sc_data_direction = DMA_TO_DEVICE is set for those cases.
>
> But why is sc_data_direction set to DMA_BIDIRECTIONAL in
> scsi_ioctl_reset() in drivers/scsi/scsi_error.c ? I think
> scsi_bidi_cmnd() will return false for the SCSI command submitted by
> scsi_ioctl_reset() since in this case scmd->request->next_rq == NULL.
>
Well, according to DMA-API.txt it's classified as:
DMA_BIDIRECTIONAL direction isn't known
and is unrelated to any actual SCSI bidi commands containing both WRITE
and READ payload buffers.
scsi_ioctl_reset() is only generating TMFs btw, and can't inject any
SCSI bidi commands.
--nab
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-01-22 11:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-21 16:18 sc_data_direction and bidi commands Bart Van Assche
2015-01-22 10:02 ` Nicholas A. Bellinger
2015-01-22 10:14 ` Bart Van Assche
2015-01-22 10:39 ` Nicholas A. Bellinger
2015-01-22 11:51 ` Bart Van Assche
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.