aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_scsi.c
diff options
context:
space:
mode:
authorMaxim Shchetynin <maxim@de.ibm.com>2005-09-13 15:50:38 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-09-19 14:03:00 -0400
commit8a36e4532ea10471f0a8605207d071361d7be2c3 (patch)
treef34e5928de7d73b9aaf385f3fb0847a6c52c297b /drivers/s390/scsi/zfcp_scsi.c
parent810f1e3ea5cc0a812816af97020a27c73441f8e9 (diff)
[SCSI] zfcp: enhancement of zfcp debug features
Debug features (DBFs) els_dbf, cmd_dbf and abt_dbf were removed and san_dbf, hba_dbf and scsi_dbf were introduced. The erp_dbf did not change. The new traces improve debugging of problems with zfcp, scsi-stack, multipath and hardware in the SAN. san_dbf traces things like ELS and CT commands, hba_dbf saves HBA specific information of requests, and scsi_dbf saves FCP and SCSI specific information of requests. Common to all new DBFs is that they provide a so called structured view. This significantly improves readability of the traces. Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_scsi.c')
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index eeb5152854ed..c1403a23174f 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -44,7 +44,8 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *);
44static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *); 44static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *);
45static int zfcp_scsi_eh_bus_reset_handler(struct scsi_cmnd *); 45static int zfcp_scsi_eh_bus_reset_handler(struct scsi_cmnd *);
46static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *); 46static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *);
47static int zfcp_task_management_function(struct zfcp_unit *, u8); 47static int zfcp_task_management_function(struct zfcp_unit *, u8,
48 struct scsi_cmnd *);
48 49
49static struct zfcp_unit *zfcp_unit_lookup(struct zfcp_adapter *, int, scsi_id_t, 50static struct zfcp_unit *zfcp_unit_lookup(struct zfcp_adapter *, int, scsi_id_t,
50 scsi_lun_t); 51 scsi_lun_t);
@@ -242,7 +243,10 @@ static void
242zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result) 243zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
243{ 244{
244 set_host_byte(&scpnt->result, result); 245 set_host_byte(&scpnt->result, result);
245 zfcp_cmd_dbf_event_scsi("failing", scpnt); 246 if ((scpnt->device != NULL) && (scpnt->device->host != NULL))
247 zfcp_scsi_dbf_event_result("fail", 4,
248 (struct zfcp_adapter*) scpnt->device->host->hostdata[0],
249 scpnt);
246 /* return directly */ 250 /* return directly */
247 scpnt->scsi_done(scpnt); 251 scpnt->scsi_done(scpnt);
248} 252}
@@ -434,7 +438,8 @@ zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
434 struct zfcp_adapter *adapter; 438 struct zfcp_adapter *adapter;
435 struct zfcp_unit *unit; 439 struct zfcp_unit *unit;
436 int retval = SUCCESS; 440 int retval = SUCCESS;
437 struct zfcp_fsf_req *new_fsf_req, *old_fsf_req; 441 struct zfcp_fsf_req *new_fsf_req = NULL;
442 struct zfcp_fsf_req *old_fsf_req;
438 unsigned long flags; 443 unsigned long flags;
439 444
440 scsi_host = scpnt->device->host; 445 scsi_host = scpnt->device->host;
@@ -457,11 +462,8 @@ zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
457 old_fsf_req = (struct zfcp_fsf_req *) scpnt->host_scribble; 462 old_fsf_req = (struct zfcp_fsf_req *) scpnt->host_scribble;
458 if (!old_fsf_req) { 463 if (!old_fsf_req) {
459 write_unlock_irqrestore(&adapter->abort_lock, flags); 464 write_unlock_irqrestore(&adapter->abort_lock, flags);
460 ZFCP_LOG_NORMAL("bug: no old fsf request found\n"); 465 zfcp_scsi_dbf_event_abort("lte1", adapter, scpnt, new_fsf_req);
461 ZFCP_LOG_NORMAL("scsi_cmnd:\n"); 466 retval = SUCCESS;
462 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,
463 (char *) scpnt, sizeof (struct scsi_cmnd));
464 retval = FAILED;
465 goto out; 467 goto out;
466 } 468 }
467 old_fsf_req->data = 0; 469 old_fsf_req->data = 0;
@@ -473,25 +475,27 @@ zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
473 new_fsf_req = zfcp_fsf_abort_fcp_command((unsigned long) old_fsf_req, 475 new_fsf_req = zfcp_fsf_abort_fcp_command((unsigned long) old_fsf_req,
474 adapter, unit, 0); 476 adapter, unit, 0);
475 if (!new_fsf_req) { 477 if (!new_fsf_req) {
478 ZFCP_LOG_INFO("error: initiation of Abort FCP Cmnd failed\n");
476 retval = FAILED; 479 retval = FAILED;
477 ZFCP_LOG_NORMAL("error: initiation of Abort FCP Cmnd "
478 "failed\n");
479 goto out; 480 goto out;
480 } 481 }
481 482
482 /* wait for completion of abort */ 483 /* wait for completion of abort */
483 __wait_event(new_fsf_req->completion_wq, 484 __wait_event(new_fsf_req->completion_wq,
484 new_fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED); 485 new_fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
485 zfcp_fsf_req_free(new_fsf_req);
486 486
487 /* status should be valid since signals were not permitted */ 487 /* status should be valid since signals were not permitted */
488 if (new_fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED) { 488 if (new_fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED) {
489 zfcp_scsi_dbf_event_abort("okay", adapter, scpnt, new_fsf_req);
489 retval = SUCCESS; 490 retval = SUCCESS;
490 } else if (new_fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED) { 491 } else if (new_fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED) {
492 zfcp_scsi_dbf_event_abort("lte2", adapter, scpnt, new_fsf_req);
491 retval = SUCCESS; 493 retval = SUCCESS;
492 } else { 494 } else {
495 zfcp_scsi_dbf_event_abort("fail", adapter, scpnt, new_fsf_req);
493 retval = FAILED; 496 retval = FAILED;
494 } 497 }
498 zfcp_fsf_req_free(new_fsf_req);
495 out: 499 out:
496 return retval; 500 return retval;
497} 501}
@@ -525,8 +529,9 @@ zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)
525 */ 529 */
526 if (!atomic_test_mask(ZFCP_STATUS_UNIT_NOTSUPPUNITRESET, 530 if (!atomic_test_mask(ZFCP_STATUS_UNIT_NOTSUPPUNITRESET,
527 &unit->status)) { 531 &unit->status)) {
528 retval = 532 retval = zfcp_task_management_function(unit,
529 zfcp_task_management_function(unit, FCP_LOGICAL_UNIT_RESET); 533 FCP_LOGICAL_UNIT_RESET,
534 scpnt);
530 if (retval) { 535 if (retval) {
531 ZFCP_LOG_DEBUG("unit reset failed (unit=%p)\n", unit); 536 ZFCP_LOG_DEBUG("unit reset failed (unit=%p)\n", unit);
532 if (retval == -ENOTSUPP) 537 if (retval == -ENOTSUPP)
@@ -542,7 +547,7 @@ zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)
542 goto out; 547 goto out;
543 } 548 }
544 } 549 }
545 retval = zfcp_task_management_function(unit, FCP_TARGET_RESET); 550 retval = zfcp_task_management_function(unit, FCP_TARGET_RESET, scpnt);
546 if (retval) { 551 if (retval) {
547 ZFCP_LOG_DEBUG("target reset failed (unit=%p)\n", unit); 552 ZFCP_LOG_DEBUG("target reset failed (unit=%p)\n", unit);
548 retval = FAILED; 553 retval = FAILED;
@@ -555,7 +560,8 @@ zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)
555} 560}
556 561
557static int 562static int
558zfcp_task_management_function(struct zfcp_unit *unit, u8 tm_flags) 563zfcp_task_management_function(struct zfcp_unit *unit, u8 tm_flags,
564 struct scsi_cmnd *scpnt)
559{ 565{
560 struct zfcp_adapter *adapter = unit->port->adapter; 566 struct zfcp_adapter *adapter = unit->port->adapter;
561 struct zfcp_fsf_req *fsf_req; 567 struct zfcp_fsf_req *fsf_req;
@@ -569,6 +575,7 @@ zfcp_task_management_function(struct zfcp_unit *unit, u8 tm_flags)
569 "failed for unit 0x%016Lx on port 0x%016Lx on " 575 "failed for unit 0x%016Lx on port 0x%016Lx on "
570 "adapter %s\n", unit->fcp_lun, unit->port->wwpn, 576 "adapter %s\n", unit->fcp_lun, unit->port->wwpn,
571 zfcp_get_busid_by_adapter(adapter)); 577 zfcp_get_busid_by_adapter(adapter));
578 zfcp_scsi_dbf_event_devreset("nres", tm_flags, unit, scpnt);
572 retval = -ENOMEM; 579 retval = -ENOMEM;
573 goto out; 580 goto out;
574 } 581 }
@@ -576,11 +583,17 @@ zfcp_task_management_function(struct zfcp_unit *unit, u8 tm_flags)
576 __wait_event(fsf_req->completion_wq, 583 __wait_event(fsf_req->completion_wq,
577 fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED); 584 fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
578 585
579 /* check completion status of task management function */ 586 /*
580 if (fsf_req->status & ZFCP_STATUS_FSFREQ_TMFUNCFAILED) 587 * check completion status of task management function
588 */
589 if (fsf_req->status & ZFCP_STATUS_FSFREQ_TMFUNCFAILED) {
590 zfcp_scsi_dbf_event_devreset("fail", tm_flags, unit, scpnt);
581 retval = -EIO; 591 retval = -EIO;
582 else if (fsf_req->status & ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP) 592 } else if (fsf_req->status & ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP) {
593 zfcp_scsi_dbf_event_devreset("nsup", tm_flags, unit, scpnt);
583 retval = -ENOTSUPP; 594 retval = -ENOTSUPP;
595 } else
596 zfcp_scsi_dbf_event_devreset("okay", tm_flags, unit, scpnt);
584 597
585 zfcp_fsf_req_free(fsf_req); 598 zfcp_fsf_req_free(fsf_req);
586 out: 599 out: