Re: sc_data_direction and bidi commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux