aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_dbf.c
diff options
context:
space:
mode:
authorSwen Schillig <swen@vnet.ibm.com>2009-03-02 07:09:04 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-03-12 13:58:20 -0400
commit5ffd51a5e495a2a002efd523aef0001912b080bd (patch)
tree422e72fe3674c230a9d8e5cebe71f902ac7f0bec /drivers/s390/scsi/zfcp_dbf.c
parentcf13c08223148e525d28f4a740f2e73518ec6abe (diff)
[SCSI] zfcp: replace current ERP logging with a more convenient version
The current number based id ERP logging is replaced by a string based tag version. The benefit is an easier location of the code in question and the removal of the lengthy array referencing the individual messages. The string (7 bytes) based version does not use more space since those bytes were "used" anyway due to the alignment of the structure. The encoding of the 7 byte string is as follows [0-1] = filename [2-5] = task/function [6] = section Due to the character of this string (fixed length) a string termination is not required here. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.c')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c188
1 files changed, 17 insertions, 171 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index ab843f23d428..0a1a5dd8d018 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -490,172 +490,17 @@ static const char *zfcp_rec_dbf_tags[] = {
490 [ZFCP_REC_DBF_ID_ACTION] = "action", 490 [ZFCP_REC_DBF_ID_ACTION] = "action",
491}; 491};
492 492
493static const char *zfcp_rec_dbf_ids[] = {
494 [1] = "new",
495 [2] = "ready",
496 [3] = "kill",
497 [4] = "down sleep",
498 [5] = "down wakeup",
499 [6] = "down sleep ecd",
500 [7] = "down wakeup ecd",
501 [8] = "down sleep epd",
502 [9] = "down wakeup epd",
503 [10] = "online",
504 [11] = "operational",
505 [12] = "scsi slave destroy",
506 [13] = "propagate failed adapter",
507 [14] = "propagate failed port",
508 [15] = "block adapter",
509 [16] = "unblock adapter",
510 [17] = "block port",
511 [18] = "unblock port",
512 [19] = "block unit",
513 [20] = "unblock unit",
514 [21] = "unit recovery failed",
515 [22] = "port recovery failed",
516 [23] = "adapter recovery failed",
517 [24] = "qdio queues down",
518 [25] = "p2p failed",
519 [26] = "nameserver lookup failed",
520 [27] = "nameserver port failed",
521 [28] = "link up",
522 [29] = "link down",
523 [30] = "link up status read",
524 [31] = "open port failed",
525 [32] = "",
526 [33] = "close port",
527 [34] = "open unit failed",
528 [35] = "exclusive open unit failed",
529 [36] = "shared open unit failed",
530 [37] = "link down",
531 [38] = "link down status read no link",
532 [39] = "link down status read fdisc login",
533 [40] = "link down status read firmware update",
534 [41] = "link down status read unknown reason",
535 [42] = "link down ecd incomplete",
536 [43] = "link down epd incomplete",
537 [44] = "sysfs adapter recovery",
538 [45] = "sysfs port recovery",
539 [46] = "sysfs unit recovery",
540 [47] = "port boxed abort",
541 [48] = "unit boxed abort",
542 [49] = "port boxed ct",
543 [50] = "port boxed close physical",
544 [51] = "port boxed open unit",
545 [52] = "port boxed close unit",
546 [53] = "port boxed fcp",
547 [54] = "unit boxed fcp",
548 [55] = "port access denied",
549 [56] = "",
550 [57] = "",
551 [58] = "",
552 [59] = "unit access denied",
553 [60] = "shared unit access denied open unit",
554 [61] = "",
555 [62] = "request timeout",
556 [63] = "adisc link test reject or timeout",
557 [64] = "adisc link test d_id changed",
558 [65] = "adisc link test failed",
559 [66] = "recovery out of memory",
560 [67] = "adapter recovery repeated after state change",
561 [68] = "port recovery repeated after state change",
562 [69] = "unit recovery repeated after state change",
563 [70] = "port recovery follow-up after successful adapter recovery",
564 [71] = "adapter recovery escalation after failed adapter recovery",
565 [72] = "port recovery follow-up after successful physical port "
566 "recovery",
567 [73] = "adapter recovery escalation after failed physical port "
568 "recovery",
569 [74] = "unit recovery follow-up after successful port recovery",
570 [75] = "physical port recovery escalation after failed port "
571 "recovery",
572 [76] = "port recovery escalation after failed unit recovery",
573 [77] = "",
574 [78] = "duplicate request id",
575 [79] = "link down",
576 [80] = "exclusive read-only unit access unsupported",
577 [81] = "shared read-write unit access unsupported",
578 [82] = "incoming rscn",
579 [83] = "incoming wwpn",
580 [84] = "wka port handle not valid close port",
581 [85] = "online",
582 [86] = "offline",
583 [87] = "ccw device gone",
584 [88] = "ccw device no path",
585 [89] = "ccw device operational",
586 [90] = "ccw device shutdown",
587 [91] = "sysfs port addition",
588 [92] = "sysfs port removal",
589 [93] = "sysfs adapter recovery",
590 [94] = "sysfs unit addition",
591 [95] = "sysfs unit removal",
592 [96] = "sysfs port recovery",
593 [97] = "sysfs unit recovery",
594 [98] = "sequence number mismatch",
595 [99] = "link up",
596 [100] = "error state",
597 [101] = "status read physical port closed",
598 [102] = "link up status read",
599 [103] = "too many failed status read buffers",
600 [104] = "port handle not valid abort",
601 [105] = "lun handle not valid abort",
602 [106] = "port handle not valid ct",
603 [107] = "port handle not valid close port",
604 [108] = "port handle not valid close physical port",
605 [109] = "port handle not valid open unit",
606 [110] = "port handle not valid close unit",
607 [111] = "lun handle not valid close unit",
608 [112] = "port handle not valid fcp",
609 [113] = "lun handle not valid fcp",
610 [114] = "handle mismatch fcp",
611 [115] = "lun not valid fcp",
612 [116] = "qdio send failed",
613 [117] = "version mismatch",
614 [118] = "incompatible qtcb type",
615 [119] = "unknown protocol status",
616 [120] = "unknown fsf command",
617 [121] = "no recommendation for status qualifier",
618 [122] = "",
619 [123] = "fc service class not supported",
620 [124] = "",
621 [125] = "need newer zfcp",
622 [126] = "need newer microcode",
623 [127] = "arbitrated loop not supported",
624 [128] = "",
625 [129] = "qtcb size mismatch",
626 [130] = "unknown fsf status ecd",
627 [131] = "fcp request too big",
628 [132] = "",
629 [133] = "data direction not valid fcp",
630 [134] = "command length not valid fcp",
631 [135] = "status read act update",
632 [136] = "status read cfdc update",
633 [137] = "hbaapi port open",
634 [138] = "hbaapi unit open",
635 [139] = "hbaapi unit shutdown",
636 [140] = "qdio error outbound",
637 [141] = "scsi host reset",
638 [142] = "dismissing fsf request for recovery action",
639 [143] = "recovery action timed out",
640 [144] = "recovery action gone",
641 [145] = "recovery action being processed",
642 [146] = "recovery action ready for next step",
643 [147] = "qdio error inbound",
644 [148] = "nameserver needed for port scan",
645 [149] = "port scan",
646 [150] = "ptp attach",
647 [151] = "port validation failed",
648};
649
650static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view, 493static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view,
651 char *buf, const char *_rec) 494 char *buf, const char *_rec)
652{ 495{
653 struct zfcp_rec_dbf_record *r = (struct zfcp_rec_dbf_record *)_rec; 496 struct zfcp_rec_dbf_record *r = (struct zfcp_rec_dbf_record *)_rec;
654 char *p = buf; 497 char *p = buf;
498 char hint[ZFCP_DBF_ID_SIZE + 1];
655 499
500 memcpy(hint, r->id2, ZFCP_DBF_ID_SIZE);
501 hint[ZFCP_DBF_ID_SIZE] = 0;
656 zfcp_dbf_outs(&p, "tag", zfcp_rec_dbf_tags[r->id]); 502 zfcp_dbf_outs(&p, "tag", zfcp_rec_dbf_tags[r->id]);
657 zfcp_dbf_outs(&p, "hint", zfcp_rec_dbf_ids[r->id2]); 503 zfcp_dbf_outs(&p, "hint", hint);
658 zfcp_dbf_out(&p, "id", "%d", r->id2);
659 switch (r->id) { 504 switch (r->id) {
660 case ZFCP_REC_DBF_ID_THREAD: 505 case ZFCP_REC_DBF_ID_THREAD:
661 zfcp_dbf_out(&p, "total", "%d", r->u.thread.total); 506 zfcp_dbf_out(&p, "total", "%d", r->u.thread.total);
@@ -707,7 +552,7 @@ static struct debug_view zfcp_rec_dbf_view = {
707 * @adapter: adapter 552 * @adapter: adapter
708 * This function assumes that the caller is holding erp_lock. 553 * This function assumes that the caller is holding erp_lock.
709 */ 554 */
710void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter) 555void zfcp_rec_dbf_event_thread(char *id2, struct zfcp_adapter *adapter)
711{ 556{
712 struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; 557 struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf;
713 unsigned long flags = 0; 558 unsigned long flags = 0;
@@ -723,7 +568,7 @@ void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter)
723 spin_lock_irqsave(&adapter->rec_dbf_lock, flags); 568 spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
724 memset(r, 0, sizeof(*r)); 569 memset(r, 0, sizeof(*r));
725 r->id = ZFCP_REC_DBF_ID_THREAD; 570 r->id = ZFCP_REC_DBF_ID_THREAD;
726 r->id2 = id2; 571 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE);
727 r->u.thread.total = total; 572 r->u.thread.total = total;
728 r->u.thread.ready = ready; 573 r->u.thread.ready = ready;
729 r->u.thread.running = running; 574 r->u.thread.running = running;
@@ -737,7 +582,7 @@ void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter)
737 * @adapter: adapter 582 * @adapter: adapter
738 * This function assumes that the caller does not hold erp_lock. 583 * This function assumes that the caller does not hold erp_lock.
739 */ 584 */
740void zfcp_rec_dbf_event_thread_lock(u8 id2, struct zfcp_adapter *adapter) 585void zfcp_rec_dbf_event_thread_lock(char *id2, struct zfcp_adapter *adapter)
741{ 586{
742 unsigned long flags; 587 unsigned long flags;
743 588
@@ -746,7 +591,7 @@ void zfcp_rec_dbf_event_thread_lock(u8 id2, struct zfcp_adapter *adapter)
746 read_unlock_irqrestore(&adapter->erp_lock, flags); 591 read_unlock_irqrestore(&adapter->erp_lock, flags);
747} 592}
748 593
749static void zfcp_rec_dbf_event_target(u8 id2, void *ref, 594static void zfcp_rec_dbf_event_target(char *id2, void *ref,
750 struct zfcp_adapter *adapter, 595 struct zfcp_adapter *adapter,
751 atomic_t *status, atomic_t *erp_count, 596 atomic_t *status, atomic_t *erp_count,
752 u64 wwpn, u32 d_id, u64 fcp_lun) 597 u64 wwpn, u32 d_id, u64 fcp_lun)
@@ -757,7 +602,7 @@ static void zfcp_rec_dbf_event_target(u8 id2, void *ref,
757 spin_lock_irqsave(&adapter->rec_dbf_lock, flags); 602 spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
758 memset(r, 0, sizeof(*r)); 603 memset(r, 0, sizeof(*r));
759 r->id = ZFCP_REC_DBF_ID_TARGET; 604 r->id = ZFCP_REC_DBF_ID_TARGET;
760 r->id2 = id2; 605 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE);
761 r->u.target.ref = (unsigned long)ref; 606 r->u.target.ref = (unsigned long)ref;
762 r->u.target.status = atomic_read(status); 607 r->u.target.status = atomic_read(status);
763 r->u.target.wwpn = wwpn; 608 r->u.target.wwpn = wwpn;
@@ -774,7 +619,8 @@ static void zfcp_rec_dbf_event_target(u8 id2, void *ref,
774 * @ref: additional reference (e.g. request) 619 * @ref: additional reference (e.g. request)
775 * @adapter: adapter 620 * @adapter: adapter
776 */ 621 */
777void zfcp_rec_dbf_event_adapter(u8 id, void *ref, struct zfcp_adapter *adapter) 622void zfcp_rec_dbf_event_adapter(char *id, void *ref,
623 struct zfcp_adapter *adapter)
778{ 624{
779 zfcp_rec_dbf_event_target(id, ref, adapter, &adapter->status, 625 zfcp_rec_dbf_event_target(id, ref, adapter, &adapter->status,
780 &adapter->erp_counter, 0, 0, 0); 626 &adapter->erp_counter, 0, 0, 0);
@@ -786,7 +632,7 @@ void zfcp_rec_dbf_event_adapter(u8 id, void *ref, struct zfcp_adapter *adapter)
786 * @ref: additional reference (e.g. request) 632 * @ref: additional reference (e.g. request)
787 * @port: port 633 * @port: port
788 */ 634 */
789void zfcp_rec_dbf_event_port(u8 id, void *ref, struct zfcp_port *port) 635void zfcp_rec_dbf_event_port(char *id, void *ref, struct zfcp_port *port)
790{ 636{
791 struct zfcp_adapter *adapter = port->adapter; 637 struct zfcp_adapter *adapter = port->adapter;
792 638
@@ -801,7 +647,7 @@ void zfcp_rec_dbf_event_port(u8 id, void *ref, struct zfcp_port *port)
801 * @ref: additional reference (e.g. request) 647 * @ref: additional reference (e.g. request)
802 * @unit: unit 648 * @unit: unit
803 */ 649 */
804void zfcp_rec_dbf_event_unit(u8 id, void *ref, struct zfcp_unit *unit) 650void zfcp_rec_dbf_event_unit(char *id, void *ref, struct zfcp_unit *unit)
805{ 651{
806 struct zfcp_port *port = unit->port; 652 struct zfcp_port *port = unit->port;
807 struct zfcp_adapter *adapter = port->adapter; 653 struct zfcp_adapter *adapter = port->adapter;
@@ -822,7 +668,7 @@ void zfcp_rec_dbf_event_unit(u8 id, void *ref, struct zfcp_unit *unit)
822 * @port: port 668 * @port: port
823 * @unit: unit 669 * @unit: unit
824 */ 670 */
825void zfcp_rec_dbf_event_trigger(u8 id2, void *ref, u8 want, u8 need, 671void zfcp_rec_dbf_event_trigger(char *id2, void *ref, u8 want, u8 need,
826 void *action, struct zfcp_adapter *adapter, 672 void *action, struct zfcp_adapter *adapter,
827 struct zfcp_port *port, struct zfcp_unit *unit) 673 struct zfcp_port *port, struct zfcp_unit *unit)
828{ 674{
@@ -832,7 +678,7 @@ void zfcp_rec_dbf_event_trigger(u8 id2, void *ref, u8 want, u8 need,
832 spin_lock_irqsave(&adapter->rec_dbf_lock, flags); 678 spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
833 memset(r, 0, sizeof(*r)); 679 memset(r, 0, sizeof(*r));
834 r->id = ZFCP_REC_DBF_ID_TRIGGER; 680 r->id = ZFCP_REC_DBF_ID_TRIGGER;
835 r->id2 = id2; 681 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE);
836 r->u.trigger.ref = (unsigned long)ref; 682 r->u.trigger.ref = (unsigned long)ref;
837 r->u.trigger.want = want; 683 r->u.trigger.want = want;
838 r->u.trigger.need = need; 684 r->u.trigger.need = need;
@@ -855,7 +701,7 @@ void zfcp_rec_dbf_event_trigger(u8 id2, void *ref, u8 want, u8 need,
855 * @id2: identifier 701 * @id2: identifier
856 * @erp_action: error recovery action struct pointer 702 * @erp_action: error recovery action struct pointer
857 */ 703 */
858void zfcp_rec_dbf_event_action(u8 id2, struct zfcp_erp_action *erp_action) 704void zfcp_rec_dbf_event_action(char *id2, struct zfcp_erp_action *erp_action)
859{ 705{
860 struct zfcp_adapter *adapter = erp_action->adapter; 706 struct zfcp_adapter *adapter = erp_action->adapter;
861 struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; 707 struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf;
@@ -864,7 +710,7 @@ void zfcp_rec_dbf_event_action(u8 id2, struct zfcp_erp_action *erp_action)
864 spin_lock_irqsave(&adapter->rec_dbf_lock, flags); 710 spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
865 memset(r, 0, sizeof(*r)); 711 memset(r, 0, sizeof(*r));
866 r->id = ZFCP_REC_DBF_ID_ACTION; 712 r->id = ZFCP_REC_DBF_ID_ACTION;
867 r->id2 = id2; 713 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE);
868 r->u.action.action = (unsigned long)erp_action; 714 r->u.action.action = (unsigned long)erp_action;
869 r->u.action.status = erp_action->status; 715 r->u.action.status = erp_action->status;
870 r->u.action.step = erp_action->step; 716 r->u.action.step = erp_action->step;