Commit 2446a79f authored by Stefan Richter's avatar Stefan Richter

ieee1394: sbp2: optimize DMA direction of s/g tables

Unlike the name suggests, "cmd->scatter_gather_element" holds only the
s/g table, not the actual s/g elements.  Since the table is only read
but never written by the device, DMA_BIDIRECTIONAL can be replaced by
DMA_TO_DEVICE which may be cheaper on some architectures.
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 0555659d
...@@ -489,7 +489,7 @@ static int sbp2util_create_command_orb_pool(struct sbp2_lu *lu) ...@@ -489,7 +489,7 @@ static int sbp2util_create_command_orb_pool(struct sbp2_lu *lu)
cmd->sge_dma = dma_map_single(hi->host->device.parent, cmd->sge_dma = dma_map_single(hi->host->device.parent,
&cmd->scatter_gather_element, &cmd->scatter_gather_element,
sizeof(cmd->scatter_gather_element), sizeof(cmd->scatter_gather_element),
DMA_BIDIRECTIONAL); DMA_TO_DEVICE);
INIT_LIST_HEAD(&cmd->list); INIT_LIST_HEAD(&cmd->list);
list_add_tail(&cmd->list, &lu->cmd_orb_completed); list_add_tail(&cmd->list, &lu->cmd_orb_completed);
} }
...@@ -514,7 +514,7 @@ static void sbp2util_remove_command_orb_pool(struct sbp2_lu *lu) ...@@ -514,7 +514,7 @@ static void sbp2util_remove_command_orb_pool(struct sbp2_lu *lu)
DMA_TO_DEVICE); DMA_TO_DEVICE);
dma_unmap_single(host->device.parent, cmd->sge_dma, dma_unmap_single(host->device.parent, cmd->sge_dma,
sizeof(cmd->scatter_gather_element), sizeof(cmd->scatter_gather_element),
DMA_BIDIRECTIONAL); DMA_TO_DEVICE);
kfree(cmd); kfree(cmd);
} }
spin_unlock_irqrestore(&lu->cmd_orb_lock, flags); spin_unlock_irqrestore(&lu->cmd_orb_lock, flags);
...@@ -1633,7 +1633,7 @@ static void sbp2_link_orb_command(struct sbp2_lu *lu, ...@@ -1633,7 +1633,7 @@ static void sbp2_link_orb_command(struct sbp2_lu *lu,
DMA_TO_DEVICE); DMA_TO_DEVICE);
dma_sync_single_for_device(hi->host->device.parent, cmd->sge_dma, dma_sync_single_for_device(hi->host->device.parent, cmd->sge_dma,
sizeof(cmd->scatter_gather_element), sizeof(cmd->scatter_gather_element),
DMA_BIDIRECTIONAL); DMA_TO_DEVICE);
/* check to see if there are any previous orbs to use */ /* check to see if there are any previous orbs to use */
spin_lock_irqsave(&lu->cmd_orb_lock, flags); spin_lock_irqsave(&lu->cmd_orb_lock, flags);
...@@ -1799,7 +1799,7 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, ...@@ -1799,7 +1799,7 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid,
DMA_TO_DEVICE); DMA_TO_DEVICE);
dma_sync_single_for_cpu(hi->host->device.parent, cmd->sge_dma, dma_sync_single_for_cpu(hi->host->device.parent, cmd->sge_dma,
sizeof(cmd->scatter_gather_element), sizeof(cmd->scatter_gather_element),
DMA_BIDIRECTIONAL); DMA_TO_DEVICE);
/* Grab SCSI command pointers and check status. */ /* Grab SCSI command pointers and check status. */
/* /*
* FIXME: If the src field in the status is 1, the ORB DMA must * FIXME: If the src field in the status is 1, the ORB DMA must
...@@ -1931,7 +1931,7 @@ static void sbp2scsi_complete_all_commands(struct sbp2_lu *lu, u32 status) ...@@ -1931,7 +1931,7 @@ static void sbp2scsi_complete_all_commands(struct sbp2_lu *lu, u32 status)
DMA_TO_DEVICE); DMA_TO_DEVICE);
dma_sync_single_for_cpu(hi->host->device.parent, cmd->sge_dma, dma_sync_single_for_cpu(hi->host->device.parent, cmd->sge_dma,
sizeof(cmd->scatter_gather_element), sizeof(cmd->scatter_gather_element),
DMA_BIDIRECTIONAL); DMA_TO_DEVICE);
sbp2util_mark_command_completed(lu, cmd); sbp2util_mark_command_completed(lu, cmd);
if (cmd->Current_SCpnt) { if (cmd->Current_SCpnt) {
cmd->Current_SCpnt->result = status << 16; cmd->Current_SCpnt->result = status << 16;
...@@ -2062,7 +2062,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt) ...@@ -2062,7 +2062,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
dma_sync_single_for_cpu(hi->host->device.parent, dma_sync_single_for_cpu(hi->host->device.parent,
cmd->sge_dma, cmd->sge_dma,
sizeof(cmd->scatter_gather_element), sizeof(cmd->scatter_gather_element),
DMA_BIDIRECTIONAL); DMA_TO_DEVICE);
sbp2util_mark_command_completed(lu, cmd); sbp2util_mark_command_completed(lu, cmd);
if (cmd->Current_SCpnt) { if (cmd->Current_SCpnt) {
cmd->Current_SCpnt->result = DID_ABORT << 16; cmd->Current_SCpnt->result = DID_ABORT << 16;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment