diff options
| author | Nicholas Bellinger <nab@daterainc.com> | 2013-08-21 17:54:54 -0400 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-09-10 19:48:35 -0400 |
| commit | b3faa2e87ce04e48f16f3823977329b7c367b3f9 (patch) | |
| tree | 796a8722df5ffa66e29936f5cfdf4624e536208a /include/target | |
| parent | cf6d1f0964fa9db57fc660caf51939d7a03359a1 (diff) | |
target/tcm_qla2xxx: Add/use target_reverse_dma_direction() in target_core_fabric.h
Reversing the dma_data_direction for pci_map_sg() friends is useful
for other drivers, so move it from tcm_qla2xxx into inline code
within target_core_fabric.h.
Also drop internal usage of equivlient in tcm_qla2xxx fabric code.
Reported-by: Christoph Hellwig <hch@lst.de>
Cc: Roland Dreier <roland@purestorage.com>
Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
Cc: Chad Dupuis <chad.dupuis@qlogic.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Nicholas Bellinger <nab@daterainc.com>
Diffstat (limited to 'include/target')
| -rw-r--r-- | include/target/target_core_fabric.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 192eb52684e9..882b650e32be 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h | |||
| @@ -179,4 +179,30 @@ u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl * | |||
| 179 | char *iscsi_parse_pr_out_transport_id(struct se_portal_group *, const char *, | 179 | char *iscsi_parse_pr_out_transport_id(struct se_portal_group *, const char *, |
| 180 | u32 *, char **); | 180 | u32 *, char **); |
| 181 | 181 | ||
| 182 | /* | ||
| 183 | * The LIO target core uses DMA_TO_DEVICE to mean that data is going | ||
| 184 | * to the target (eg handling a WRITE) and DMA_FROM_DEVICE to mean | ||
| 185 | * that data is coming from the target (eg handling a READ). However, | ||
| 186 | * this is just the opposite of what we have to tell the DMA mapping | ||
| 187 | * layer -- eg when handling a READ, the HBA will have to DMA the data | ||
| 188 | * out of memory so it can send it to the initiator, which means we | ||
| 189 | * need to use DMA_TO_DEVICE when we map the data. | ||
| 190 | */ | ||
| 191 | static inline enum dma_data_direction | ||
| 192 | target_reverse_dma_direction(struct se_cmd *se_cmd) | ||
| 193 | { | ||
| 194 | if (se_cmd->se_cmd_flags & SCF_BIDI) | ||
| 195 | return DMA_BIDIRECTIONAL; | ||
| 196 | |||
| 197 | switch (se_cmd->data_direction) { | ||
| 198 | case DMA_TO_DEVICE: | ||
| 199 | return DMA_FROM_DEVICE; | ||
| 200 | case DMA_FROM_DEVICE: | ||
| 201 | return DMA_TO_DEVICE; | ||
| 202 | case DMA_NONE: | ||
| 203 | default: | ||
| 204 | return DMA_NONE; | ||
| 205 | } | ||
| 206 | } | ||
| 207 | |||
| 182 | #endif /* TARGET_CORE_FABRICH */ | 208 | #endif /* TARGET_CORE_FABRICH */ |
