From: Bart Van Assche <bart.vanassche@sandisk.com>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: sc_data_direction and bidi commands
Date: Thu, 22 Jan 2015 12:51:19 +0100 [thread overview]
Message-ID: <54C0E437.5090102@sandisk.com> (raw)
In-Reply-To: <1421923168.7061.66.camel@haakon3.risingtidesystems.com>
On 01/22/15 11:39, Nicholas A. Bellinger wrote:
> 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.
I think I figured out why several SCSI LLDs are comparing
sc_data_direction with DMA_BIDIRECTIONAL. In code that has been removed
eight years ago I found the following construct (see also
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=21b2f0c803adaf00fce1b606c50b49ae8b106773):
if (inlen == 0) {
data_direction = DMA_FROM_DEVICE;
} else if (outlen == 0 ) {
data_direction = DMA_TO_DEVICE;
} else {
/*
* Can this ever happen?
*/
data_direction = DMA_BIDIRECTIONAL;
}
Here is some more removed code from the same timeframe
(https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=beb40487508290f5d6565598c60a3f44261beef2):
struct scsi_request *scsi_allocate_request(struct scsi_device *sdev,
gfp_t gfp_mask)
{
const int offset = ALIGN(sizeof(struct scsi_request), 4);
const int size = offset + sizeof(struct request);
struct scsi_request *sreq;
sreq = kzalloc(size, gfp_mask);
if (likely(sreq != NULL)) {
sreq->sr_request = (struct request *)(((char *)sreq)
+ offset);
sreq->sr_device = sdev;
sreq->sr_host = sdev->host;
sreq->sr_magic = SCSI_REQ_MAGIC;
sreq->sr_data_direction = DMA_BIDIRECTIONAL;
}
return sreq;
}
Bart.
prev parent reply other threads:[~2015-01-22 11:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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=54C0E437.5090102@sandisk.com \
--to=bart.vanassche@sandisk.com \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@linux-iscsi.org \
/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.