Re: [PATCH 5/5] tcm_qla2xxx: Fix confusion about DMA mapping direction

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

 



On 08/16/2011 02:09 PM, Nicholas A. Bellinger wrote:
<snip>
>> +static enum dma_data_direction tcm_qla2xxx_mapping_dir(struct se_cmd *se_cmd)
>> +{
>> +	if (se_cmd->t_tasks_bidi)
>> +		return DMA_BIDIRECTIONAL;
>> +
> 
> Mmmm, I don't think this is correct.  It's my understanding that
> DMA_BIDIRECTIONAL is different from SCSI bidi operation, and that the
> individual bidi payloads should be retaining their individual
> DMA_FROM_DEVICE and DMA_TO_DEVICE usage..  (Boaz CC'ed)
> 

Yes! DMA_BIDIRECTIONAL means that the same direct-access buffer could
be written to and read from at the same time. For example a shared
host-DSP buffer could be that case. It tells the (true) IOMMU to
let both type of access on this single buffer.

In SCSI bidi commands we have two *separate* buffers. One buffer is
only read to. Second buffer is only written from (Yes Initiator view).
But each buffer is always only DMA_FROM_DEVICE or DMA_TO_DEVICE.

You should I identify the two different buffers and only flip for
each one individually so something like

+	if (se_cmd->t_tasks_bidi)
+		// TODO: Call a routine to also flip the se_cmd->t_tasks_bidi direction

> 
>> +	switch (se_cmd->data_direction) {
>> +	case DMA_TO_DEVICE:
>> +		return DMA_FROM_DEVICE;
>> +	case DMA_FROM_DEVICE:
>> +		return DMA_TO_DEVICE;
>> +	case DMA_NONE:
>> +	default:
>> +		return DMA_NONE;
>> +	}
>> +}
>> +

Cheers
Boaz
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux