aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ibmvscsi/ibmvstgt.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-05 16:30:44 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-05 16:30:44 -0400
commit4f7a307dc6e4d8bfeb56f7cf7231b08cb845687c (patch)
tree3bf90522c87fcb32373cb2a5ff25b1ead33405f5 /drivers/scsi/ibmvscsi/ibmvstgt.c
parentfabb5c4e4a474ff0f7d6c1d3466a1b79bbce5f49 (diff)
parent7297824581755593535fc97d2c8b6c47e2dc2db6 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (87 commits) [SCSI] fusion: fix domain validation loops [SCSI] qla2xxx: fix regression on sparc64 [SCSI] modalias for scsi devices [SCSI] sg: cap reserved_size values at max_sectors [SCSI] BusLogic: stop using check_region [SCSI] tgt: fix rdma transfer bugs [SCSI] aacraid: fix aacraid not finding device [SCSI] aacraid: Correct SMC products in aacraid.txt [SCSI] scsi_error.c: Add EH Start Unit retry [SCSI] aacraid: [Fastboot] Panics for AACRAID driver during 'insmod' for kexec test. [SCSI] ipr: Driver version to 2.3.2 [SCSI] ipr: Faster sg list fetch [SCSI] ipr: Return better qc_issue errors [SCSI] ipr: Disrupt device error [SCSI] ipr: Improve async error logging level control [SCSI] ipr: PCI unblock config access fix [SCSI] ipr: Fix for oops following SATA request sense [SCSI] ipr: Log error for SAS dual path switch [SCSI] ipr: Enable logging of debug error data for all devices [SCSI] ipr: Add new PCI-E IDs to device table ...
Diffstat (limited to 'drivers/scsi/ibmvscsi/ibmvstgt.c')
-rw-r--r--drivers/scsi/ibmvscsi/ibmvstgt.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index a39a478bb39a..6d223dd76440 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,45 +265,35 @@ 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 }
275out:
276
277 return 0; 275 return 0;
278} 276}
279 277
280static int ibmvstgt_transfer_data(struct scsi_cmnd *sc,
281 void (*done)(struct scsi_cmnd *))
282{
283 struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr;
284 int err;
285
286 err = srp_transfer_data(sc, &vio_iu(iue)->srp.cmd, ibmvstgt_rdma, 1, 1);
287
288 done(sc);
289
290 return err;
291}
292
293static int ibmvstgt_cmd_done(struct scsi_cmnd *sc, 278static int ibmvstgt_cmd_done(struct scsi_cmnd *sc,
294 void (*done)(struct scsi_cmnd *)) 279 void (*done)(struct scsi_cmnd *))
295{ 280{
296 unsigned long flags; 281 unsigned long flags;
297 struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr; 282 struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr;
298 struct srp_target *target = iue->target; 283 struct srp_target *target = iue->target;
284 int err = 0;
299 285
300 dprintk("%p %p %x\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);
288
289 if (sc->use_sg)
290 err = srp_transfer_data(sc, &vio_iu(iue)->srp.cmd, ibmvstgt_rdma, 1, 1);
301 291
302 spin_lock_irqsave(&target->lock, flags); 292 spin_lock_irqsave(&target->lock, flags);
303 list_del(&iue->ilist); 293 list_del(&iue->ilist);
304 spin_unlock_irqrestore(&target->lock, flags); 294 spin_unlock_irqrestore(&target->lock, flags);
305 295
306 if (sc->result != SAM_STAT_GOOD) { 296 if (err|| sc->result != SAM_STAT_GOOD) {
307 eprintk("operation failed %p %d %x\n", 297 eprintk("operation failed %p %d %x\n",
308 iue, sc->result, vio_iu(iue)->srp.cmd.cdb[0]); 298 iue, sc->result, vio_iu(iue)->srp.cmd.cdb[0]);
309 send_rsp(iue, sc, HARDWARE_ERROR, 0x00); 299 send_rsp(iue, sc, HARDWARE_ERROR, 0x00);
@@ -503,7 +493,8 @@ static void process_iu(struct viosrp_crq *crq, struct srp_target *target)
503{ 493{
504 struct vio_port *vport = target_to_port(target); 494 struct vio_port *vport = target_to_port(target);
505 struct iu_entry *iue; 495 struct iu_entry *iue;
506 long err, done; 496 long err;
497 int done = 1;
507 498
508 iue = srp_iu_get(target); 499 iue = srp_iu_get(target);
509 if (!iue) { 500 if (!iue) {
@@ -518,7 +509,6 @@ static void process_iu(struct viosrp_crq *crq, struct srp_target *target)
518 509
519 if (err != H_SUCCESS) { 510 if (err != H_SUCCESS) {
520 eprintk("%ld transferring data error %p\n", err, iue); 511 eprintk("%ld transferring data error %p\n", err, iue);
521 done = 1;
522 goto out; 512 goto out;
523 } 513 }
524 514
@@ -794,7 +784,6 @@ static struct scsi_host_template ibmvstgt_sht = {
794 .use_clustering = DISABLE_CLUSTERING, 784 .use_clustering = DISABLE_CLUSTERING,
795 .max_sectors = DEFAULT_MAX_SECTORS, 785 .max_sectors = DEFAULT_MAX_SECTORS,
796 .transfer_response = ibmvstgt_cmd_done, 786 .transfer_response = ibmvstgt_cmd_done,
797 .transfer_data = ibmvstgt_transfer_data,
798 .eh_abort_handler = ibmvstgt_eh_abort_handler, 787 .eh_abort_handler = ibmvstgt_eh_abort_handler,
799 .tsk_mgmt_response = ibmvstgt_tsk_mgmt_response, 788 .tsk_mgmt_response = ibmvstgt_tsk_mgmt_response,
800 .shost_attrs = ibmvstgt_attrs, 789 .shost_attrs = ibmvstgt_attrs,