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