diff options
author | Bastian Blank <bastian@waldi.eu.org> | 2007-04-07 05:10:00 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-04-17 18:03:31 -0400 |
commit | ad1331a792f9f253bef362de9b6872c6b8f88c0c (patch) | |
tree | 188cc1e7384dfce2a97c9db493bc3067445c134e /drivers/scsi/libsrp.c | |
parent | 4def7fa11208f779f22e6ba7344370b0220d3350 (diff) |
[SCSI] tgt: fix rdma transfer bugs
- ibmstgt hits the max rdma transfer size (128k).
- libsrp returns a rdma transfer error properly.
Signed-off-by: Bastian Blank <bastian@waldi.eu.org>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/libsrp.c')
-rw-r--r-- | drivers/scsi/libsrp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c index 89403b00e042..37a0f4dd6186 100644 --- a/drivers/scsi/libsrp.c +++ b/drivers/scsi/libsrp.c | |||
@@ -225,8 +225,7 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd, | |||
225 | struct srp_direct_buf *md = NULL; | 225 | struct srp_direct_buf *md = NULL; |
226 | struct scatterlist dummy, *sg = NULL; | 226 | struct scatterlist dummy, *sg = NULL; |
227 | dma_addr_t token = 0; | 227 | dma_addr_t token = 0; |
228 | long err; | 228 | int err = 0; |
229 | unsigned int done = 0; | ||
230 | int nmd, nsg = 0, len; | 229 | int nmd, nsg = 0, len; |
231 | 230 | ||
232 | if (dma_map || ext_desc) { | 231 | if (dma_map || ext_desc) { |
@@ -258,8 +257,8 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd, | |||
258 | sg_dma_address(&dummy) = token; | 257 | sg_dma_address(&dummy) = token; |
259 | err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE, | 258 | err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE, |
260 | id->table_desc.len); | 259 | id->table_desc.len); |
261 | if (err < 0) { | 260 | if (err) { |
262 | eprintk("Error copying indirect table %ld\n", err); | 261 | eprintk("Error copying indirect table %d\n", err); |
263 | goto free_mem; | 262 | goto free_mem; |
264 | } | 263 | } |
265 | } else { | 264 | } else { |
@@ -272,6 +271,7 @@ rdma: | |||
272 | nsg = dma_map_sg(iue->target->dev, sg, sc->use_sg, DMA_BIDIRECTIONAL); | 271 | nsg = dma_map_sg(iue->target->dev, sg, sc->use_sg, DMA_BIDIRECTIONAL); |
273 | if (!nsg) { | 272 | if (!nsg) { |
274 | eprintk("fail to map %p %d\n", iue, sc->use_sg); | 273 | eprintk("fail to map %p %d\n", iue, sc->use_sg); |
274 | err = -EIO; | ||
275 | goto free_mem; | 275 | goto free_mem; |
276 | } | 276 | } |
277 | len = min(sc->request_bufflen, id->len); | 277 | len = min(sc->request_bufflen, id->len); |
@@ -287,7 +287,7 @@ free_mem: | |||
287 | if (token && dma_map) | 287 | if (token && dma_map) |
288 | dma_free_coherent(iue->target->dev, id->table_desc.len, md, token); | 288 | dma_free_coherent(iue->target->dev, id->table_desc.len, md, token); |
289 | 289 | ||
290 | return done; | 290 | return err; |
291 | } | 291 | } |
292 | 292 | ||
293 | static int data_out_desc_size(struct srp_cmd *cmd) | 293 | static int data_out_desc_size(struct srp_cmd *cmd) |
@@ -352,7 +352,7 @@ int srp_transfer_data(struct scsi_cmnd *sc, struct srp_cmd *cmd, | |||
352 | break; | 352 | break; |
353 | default: | 353 | default: |
354 | eprintk("Unknown format %d %x\n", dir, format); | 354 | eprintk("Unknown format %d %x\n", dir, format); |
355 | break; | 355 | err = -EINVAL; |
356 | } | 356 | } |
357 | 357 | ||
358 | return err; | 358 | return err; |