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/ibmvscsi | |
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/ibmvscsi')
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvstgt.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c index a7fbd10817a0..84363c181620 100644 --- a/drivers/scsi/ibmvscsi/ibmvstgt.c +++ b/drivers/scsi/ibmvscsi/ibmvstgt.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include "ibmvscsi.h" | 35 | #include "ibmvscsi.h" |
36 | 36 | ||
37 | #define INITIAL_SRP_LIMIT 16 | 37 | #define INITIAL_SRP_LIMIT 16 |
38 | #define DEFAULT_MAX_SECTORS 512 | 38 | #define DEFAULT_MAX_SECTORS 256 |
39 | 39 | ||
40 | #define TGT_NAME "ibmvstgt" | 40 | #define TGT_NAME "ibmvstgt" |
41 | 41 | ||
@@ -248,8 +248,8 @@ static int ibmvstgt_rdma(struct scsi_cmnd *sc, struct scatterlist *sg, int nsg, | |||
248 | md[i].va + mdone); | 248 | md[i].va + mdone); |
249 | 249 | ||
250 | if (err != H_SUCCESS) { | 250 | if (err != H_SUCCESS) { |
251 | eprintk("rdma error %d %d\n", dir, slen); | 251 | eprintk("rdma error %d %d %ld\n", dir, slen, err); |
252 | goto out; | 252 | return -EIO; |
253 | } | 253 | } |
254 | 254 | ||
255 | mlen -= slen; | 255 | mlen -= slen; |
@@ -265,14 +265,13 @@ static int ibmvstgt_rdma(struct scsi_cmnd *sc, struct scatterlist *sg, int nsg, | |||
265 | if (sidx > nsg) { | 265 | if (sidx > nsg) { |
266 | eprintk("out of sg %p %d %d\n", | 266 | eprintk("out of sg %p %d %d\n", |
267 | iue, sidx, nsg); | 267 | iue, sidx, nsg); |
268 | goto out; | 268 | return -EIO; |
269 | } | 269 | } |
270 | } | 270 | } |
271 | }; | 271 | }; |
272 | 272 | ||
273 | rest -= mlen; | 273 | rest -= mlen; |
274 | } | 274 | } |
275 | out: | ||
276 | return 0; | 275 | return 0; |
277 | } | 276 | } |
278 | 277 | ||
@@ -282,18 +281,19 @@ static int ibmvstgt_cmd_done(struct scsi_cmnd *sc, | |||
282 | unsigned long flags; | 281 | unsigned long flags; |
283 | struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr; | 282 | struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr; |
284 | struct srp_target *target = iue->target; | 283 | struct srp_target *target = iue->target; |
284 | int err = 0; | ||
285 | 285 | ||
286 | dprintk("%p %p %x %u\n", iue, target, vio_iu(iue)->srp.cmd.cdb[0], | 286 | dprintk("%p %p %x %u\n", iue, target, vio_iu(iue)->srp.cmd.cdb[0], |
287 | cmd->usg_sg); | 287 | cmd->usg_sg); |
288 | 288 | ||
289 | if (sc->use_sg) | 289 | if (sc->use_sg) |
290 | srp_transfer_data(sc, &vio_iu(iue)->srp.cmd, ibmvstgt_rdma, 1, 1); | 290 | err = srp_transfer_data(sc, &vio_iu(iue)->srp.cmd, ibmvstgt_rdma, 1, 1); |
291 | 291 | ||
292 | spin_lock_irqsave(&target->lock, flags); | 292 | spin_lock_irqsave(&target->lock, flags); |
293 | list_del(&iue->ilist); | 293 | list_del(&iue->ilist); |
294 | spin_unlock_irqrestore(&target->lock, flags); | 294 | spin_unlock_irqrestore(&target->lock, flags); |
295 | 295 | ||
296 | if (sc->result != SAM_STAT_GOOD) { | 296 | if (err|| sc->result != SAM_STAT_GOOD) { |
297 | eprintk("operation failed %p %d %x\n", | 297 | eprintk("operation failed %p %d %x\n", |
298 | iue, sc->result, vio_iu(iue)->srp.cmd.cdb[0]); | 298 | iue, sc->result, vio_iu(iue)->srp.cmd.cdb[0]); |
299 | send_rsp(iue, sc, HARDWARE_ERROR, 0x00); | 299 | send_rsp(iue, sc, HARDWARE_ERROR, 0x00); |
@@ -493,7 +493,8 @@ static void process_iu(struct viosrp_crq *crq, struct srp_target *target) | |||
493 | { | 493 | { |
494 | struct vio_port *vport = target_to_port(target); | 494 | struct vio_port *vport = target_to_port(target); |
495 | struct iu_entry *iue; | 495 | struct iu_entry *iue; |
496 | long err, done; | 496 | long err; |
497 | int done = 1; | ||
497 | 498 | ||
498 | iue = srp_iu_get(target); | 499 | iue = srp_iu_get(target); |
499 | if (!iue) { | 500 | if (!iue) { |
@@ -508,7 +509,6 @@ static void process_iu(struct viosrp_crq *crq, struct srp_target *target) | |||
508 | 509 | ||
509 | if (err != H_SUCCESS) { | 510 | if (err != H_SUCCESS) { |
510 | eprintk("%ld transferring data error %p\n", err, iue); | 511 | eprintk("%ld transferring data error %p\n", err, iue); |
511 | done = 1; | ||
512 | goto out; | 512 | goto out; |
513 | } | 513 | } |
514 | 514 | ||