diff options
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_transport.c')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_transport.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index e03dc0b1e1a0..5c65da519e39 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_transport.c +++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c | |||
@@ -1041,7 +1041,7 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1041 | if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { | 1041 | if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { |
1042 | printk(MPT2SAS_ERR_FMT "%s: multiple segments req %u %u, " | 1042 | printk(MPT2SAS_ERR_FMT "%s: multiple segments req %u %u, " |
1043 | "rsp %u %u\n", ioc->name, __func__, req->bio->bi_vcnt, | 1043 | "rsp %u %u\n", ioc->name, __func__, req->bio->bi_vcnt, |
1044 | req->data_len, rsp->bio->bi_vcnt, rsp->data_len); | 1044 | blk_rq_bytes(req), rsp->bio->bi_vcnt, blk_rq_bytes(rsp)); |
1045 | return -EINVAL; | 1045 | return -EINVAL; |
1046 | } | 1046 | } |
1047 | 1047 | ||
@@ -1104,7 +1104,7 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1104 | *((u64 *)&mpi_request->SASAddress) = (rphy) ? | 1104 | *((u64 *)&mpi_request->SASAddress) = (rphy) ? |
1105 | cpu_to_le64(rphy->identify.sas_address) : | 1105 | cpu_to_le64(rphy->identify.sas_address) : |
1106 | cpu_to_le64(ioc->sas_hba.sas_address); | 1106 | cpu_to_le64(ioc->sas_hba.sas_address); |
1107 | mpi_request->RequestDataLength = cpu_to_le16(req->data_len - 4); | 1107 | mpi_request->RequestDataLength = cpu_to_le16(blk_rq_bytes(req) - 4); |
1108 | psge = &mpi_request->SGL; | 1108 | psge = &mpi_request->SGL; |
1109 | 1109 | ||
1110 | /* WRITE sgel first */ | 1110 | /* WRITE sgel first */ |
@@ -1112,13 +1112,13 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1112 | MPI2_SGE_FLAGS_END_OF_BUFFER | MPI2_SGE_FLAGS_HOST_TO_IOC); | 1112 | MPI2_SGE_FLAGS_END_OF_BUFFER | MPI2_SGE_FLAGS_HOST_TO_IOC); |
1113 | sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; | 1113 | sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; |
1114 | dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio), | 1114 | dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio), |
1115 | req->data_len, PCI_DMA_BIDIRECTIONAL); | 1115 | blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL); |
1116 | if (!dma_addr_out) { | 1116 | if (!dma_addr_out) { |
1117 | mpt2sas_base_free_smid(ioc, le16_to_cpu(smid)); | 1117 | mpt2sas_base_free_smid(ioc, le16_to_cpu(smid)); |
1118 | goto unmap; | 1118 | goto unmap; |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | ioc->base_add_sg_single(psge, sgl_flags | (req->data_len - 4), | 1121 | ioc->base_add_sg_single(psge, sgl_flags | (blk_rq_bytes(req) - 4), |
1122 | dma_addr_out); | 1122 | dma_addr_out); |
1123 | 1123 | ||
1124 | /* incr sgel */ | 1124 | /* incr sgel */ |
@@ -1129,14 +1129,14 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1129 | MPI2_SGE_FLAGS_LAST_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER | | 1129 | MPI2_SGE_FLAGS_LAST_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER | |
1130 | MPI2_SGE_FLAGS_END_OF_LIST); | 1130 | MPI2_SGE_FLAGS_END_OF_LIST); |
1131 | sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; | 1131 | sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; |
1132 | dma_addr_in = pci_map_single(ioc->pdev, bio_data(rsp->bio), | 1132 | dma_addr_in = pci_map_single(ioc->pdev, bio_data(rsp->bio), |
1133 | rsp->data_len, PCI_DMA_BIDIRECTIONAL); | 1133 | blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL); |
1134 | if (!dma_addr_in) { | 1134 | if (!dma_addr_in) { |
1135 | mpt2sas_base_free_smid(ioc, le16_to_cpu(smid)); | 1135 | mpt2sas_base_free_smid(ioc, le16_to_cpu(smid)); |
1136 | goto unmap; | 1136 | goto unmap; |
1137 | } | 1137 | } |
1138 | 1138 | ||
1139 | ioc->base_add_sg_single(psge, sgl_flags | (rsp->data_len + 4), | 1139 | ioc->base_add_sg_single(psge, sgl_flags | (blk_rq_bytes(rsp) + 4), |
1140 | dma_addr_in); | 1140 | dma_addr_in); |
1141 | 1141 | ||
1142 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s - " | 1142 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s - " |
@@ -1170,9 +1170,8 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1170 | 1170 | ||
1171 | memcpy(req->sense, mpi_reply, sizeof(*mpi_reply)); | 1171 | memcpy(req->sense, mpi_reply, sizeof(*mpi_reply)); |
1172 | req->sense_len = sizeof(*mpi_reply); | 1172 | req->sense_len = sizeof(*mpi_reply); |
1173 | req->data_len = 0; | 1173 | req->resid_len = 0; |
1174 | rsp->data_len -= mpi_reply->ResponseDataLength; | 1174 | rsp->resid_len -= mpi_reply->ResponseDataLength; |
1175 | |||
1176 | } else { | 1175 | } else { |
1177 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT | 1176 | dtransportprintk(ioc, printk(MPT2SAS_DEBUG_FMT |
1178 | "%s - no reply\n", ioc->name, __func__)); | 1177 | "%s - no reply\n", ioc->name, __func__)); |
@@ -1188,10 +1187,10 @@ transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1188 | 1187 | ||
1189 | unmap: | 1188 | unmap: |
1190 | if (dma_addr_out) | 1189 | if (dma_addr_out) |
1191 | pci_unmap_single(ioc->pdev, dma_addr_out, req->data_len, | 1190 | pci_unmap_single(ioc->pdev, dma_addr_out, blk_rq_bytes(req), |
1192 | PCI_DMA_BIDIRECTIONAL); | 1191 | PCI_DMA_BIDIRECTIONAL); |
1193 | if (dma_addr_in) | 1192 | if (dma_addr_in) |
1194 | pci_unmap_single(ioc->pdev, dma_addr_in, rsp->data_len, | 1193 | pci_unmap_single(ioc->pdev, dma_addr_in, blk_rq_bytes(rsp), |
1195 | PCI_DMA_BIDIRECTIONAL); | 1194 | PCI_DMA_BIDIRECTIONAL); |
1196 | 1195 | ||
1197 | out: | 1196 | out: |