aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_dbf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.c')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c90
1 files changed, 44 insertions, 46 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index c8bad675dbd1..36169c6944fd 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -1,22 +1,9 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * Debug traces for zfcp.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#include <linux/ctype.h> 9#include <linux/ctype.h>
@@ -29,8 +16,6 @@ module_param(dbfsize, uint, 0400);
29MODULE_PARM_DESC(dbfsize, 16MODULE_PARM_DESC(dbfsize,
30 "number of pages for each debug feature area (default 4)"); 17 "number of pages for each debug feature area (default 4)");
31 18
32#define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER
33
34static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len, 19static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len,
35 int level, char *from, int from_len) 20 int level, char *from, int from_len)
36{ 21{
@@ -186,8 +171,8 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
186 fsf_status_qual, FSF_STATUS_QUALIFIER_SIZE); 171 fsf_status_qual, FSF_STATUS_QUALIFIER_SIZE);
187 response->fsf_req_status = fsf_req->status; 172 response->fsf_req_status = fsf_req->status;
188 response->sbal_first = fsf_req->sbal_first; 173 response->sbal_first = fsf_req->sbal_first;
189 response->sbal_curr = fsf_req->sbal_curr;
190 response->sbal_last = fsf_req->sbal_last; 174 response->sbal_last = fsf_req->sbal_last;
175 response->sbal_response = fsf_req->sbal_response;
191 response->pool = fsf_req->pool != NULL; 176 response->pool = fsf_req->pool != NULL;
192 response->erp_action = (unsigned long)fsf_req->erp_action; 177 response->erp_action = (unsigned long)fsf_req->erp_action;
193 178
@@ -268,7 +253,7 @@ void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
268 strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE); 253 strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE);
269 strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE); 254 strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE);
270 255
271 rec->u.status.failed = adapter->status_read_failed; 256 rec->u.status.failed = atomic_read(&adapter->stat_miss);
272 if (status_buffer != NULL) { 257 if (status_buffer != NULL) {
273 rec->u.status.status_type = status_buffer->status_type; 258 rec->u.status.status_type = status_buffer->status_type;
274 rec->u.status.status_subtype = status_buffer->status_subtype; 259 rec->u.status.status_subtype = status_buffer->status_subtype;
@@ -355,8 +340,8 @@ static void zfcp_hba_dbf_view_response(char **p,
355 FSF_STATUS_QUALIFIER_SIZE, 0, FSF_STATUS_QUALIFIER_SIZE); 340 FSF_STATUS_QUALIFIER_SIZE, 0, FSF_STATUS_QUALIFIER_SIZE);
356 zfcp_dbf_out(p, "fsf_req_status", "0x%08x", r->fsf_req_status); 341 zfcp_dbf_out(p, "fsf_req_status", "0x%08x", r->fsf_req_status);
357 zfcp_dbf_out(p, "sbal_first", "0x%02x", r->sbal_first); 342 zfcp_dbf_out(p, "sbal_first", "0x%02x", r->sbal_first);
358 zfcp_dbf_out(p, "sbal_curr", "0x%02x", r->sbal_curr);
359 zfcp_dbf_out(p, "sbal_last", "0x%02x", r->sbal_last); 343 zfcp_dbf_out(p, "sbal_last", "0x%02x", r->sbal_last);
344 zfcp_dbf_out(p, "sbal_response", "0x%02x", r->sbal_response);
360 zfcp_dbf_out(p, "pool", "0x%02x", r->pool); 345 zfcp_dbf_out(p, "pool", "0x%02x", r->pool);
361 346
362 switch (r->fsf_command) { 347 switch (r->fsf_command) {
@@ -515,13 +500,13 @@ static const char *zfcp_rec_dbf_ids[] = {
515 [52] = "port boxed close unit", 500 [52] = "port boxed close unit",
516 [53] = "port boxed fcp", 501 [53] = "port boxed fcp",
517 [54] = "unit boxed fcp", 502 [54] = "unit boxed fcp",
518 [55] = "port access denied ct", 503 [55] = "port access denied",
519 [56] = "port access denied els", 504 [56] = "",
520 [57] = "port access denied open port", 505 [57] = "",
521 [58] = "port access denied close physical", 506 [58] = "",
522 [59] = "unit access denied open unit", 507 [59] = "unit access denied",
523 [60] = "shared unit access denied open unit", 508 [60] = "shared unit access denied open unit",
524 [61] = "unit access denied fcp", 509 [61] = "",
525 [62] = "request timeout", 510 [62] = "request timeout",
526 [63] = "adisc link test reject or timeout", 511 [63] = "adisc link test reject or timeout",
527 [64] = "adisc link test d_id changed", 512 [64] = "adisc link test d_id changed",
@@ -546,8 +531,8 @@ static const char *zfcp_rec_dbf_ids[] = {
546 [80] = "exclusive read-only unit access unsupported", 531 [80] = "exclusive read-only unit access unsupported",
547 [81] = "shared read-write unit access unsupported", 532 [81] = "shared read-write unit access unsupported",
548 [82] = "incoming rscn", 533 [82] = "incoming rscn",
549 [83] = "incoming plogi", 534 [83] = "incoming wwpn",
550 [84] = "incoming logo", 535 [84] = "",
551 [85] = "online", 536 [85] = "online",
552 [86] = "offline", 537 [86] = "offline",
553 [87] = "ccw device gone", 538 [87] = "ccw device gone",
@@ -586,8 +571,8 @@ static const char *zfcp_rec_dbf_ids[] = {
586 [120] = "unknown fsf command", 571 [120] = "unknown fsf command",
587 [121] = "no recommendation for status qualifier", 572 [121] = "no recommendation for status qualifier",
588 [122] = "status read physical port closed in error", 573 [122] = "status read physical port closed in error",
589 [123] = "fc service class not supported ct", 574 [123] = "fc service class not supported",
590 [124] = "fc service class not supported els", 575 [124] = "",
591 [125] = "need newer zfcp", 576 [125] = "need newer zfcp",
592 [126] = "need newer microcode", 577 [126] = "need newer microcode",
593 [127] = "arbitrated loop not supported", 578 [127] = "arbitrated loop not supported",
@@ -595,7 +580,7 @@ static const char *zfcp_rec_dbf_ids[] = {
595 [129] = "qtcb size mismatch", 580 [129] = "qtcb size mismatch",
596 [130] = "unknown fsf status ecd", 581 [130] = "unknown fsf status ecd",
597 [131] = "fcp request too big", 582 [131] = "fcp request too big",
598 [132] = "fc service class not supported fcp", 583 [132] = "",
599 [133] = "data direction not valid fcp", 584 [133] = "data direction not valid fcp",
600 [134] = "command length not valid fcp", 585 [134] = "command length not valid fcp",
601 [135] = "status read act update", 586 [135] = "status read act update",
@@ -603,13 +588,18 @@ static const char *zfcp_rec_dbf_ids[] = {
603 [137] = "hbaapi port open", 588 [137] = "hbaapi port open",
604 [138] = "hbaapi unit open", 589 [138] = "hbaapi unit open",
605 [139] = "hbaapi unit shutdown", 590 [139] = "hbaapi unit shutdown",
606 [140] = "qdio error", 591 [140] = "qdio error outbound",
607 [141] = "scsi host reset", 592 [141] = "scsi host reset",
608 [142] = "dismissing fsf request for recovery action", 593 [142] = "dismissing fsf request for recovery action",
609 [143] = "recovery action timed out", 594 [143] = "recovery action timed out",
610 [144] = "recovery action gone", 595 [144] = "recovery action gone",
611 [145] = "recovery action being processed", 596 [145] = "recovery action being processed",
612 [146] = "recovery action ready for next step", 597 [146] = "recovery action ready for next step",
598 [147] = "qdio error inbound",
599 [148] = "nameserver needed for port scan",
600 [149] = "port scan",
601 [150] = "ptp attach",
602 [151] = "port validation failed",
613}; 603};
614 604
615static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view, 605static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view,
@@ -670,24 +660,20 @@ static struct debug_view zfcp_rec_dbf_view = {
670 * zfcp_rec_dbf_event_thread - trace event related to recovery thread operation 660 * zfcp_rec_dbf_event_thread - trace event related to recovery thread operation
671 * @id2: identifier for event 661 * @id2: identifier for event
672 * @adapter: adapter 662 * @adapter: adapter
673 * @lock: non-zero value indicates that erp_lock has not yet been acquired 663 * This function assumes that the caller is holding erp_lock.
674 */ 664 */
675void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter, int lock) 665void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter)
676{ 666{
677 struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; 667 struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf;
678 unsigned long flags = 0; 668 unsigned long flags = 0;
679 struct list_head *entry; 669 struct list_head *entry;
680 unsigned ready = 0, running = 0, total; 670 unsigned ready = 0, running = 0, total;
681 671
682 if (lock)
683 read_lock_irqsave(&adapter->erp_lock, flags);
684 list_for_each(entry, &adapter->erp_ready_head) 672 list_for_each(entry, &adapter->erp_ready_head)
685 ready++; 673 ready++;
686 list_for_each(entry, &adapter->erp_running_head) 674 list_for_each(entry, &adapter->erp_running_head)
687 running++; 675 running++;
688 total = adapter->erp_total_count; 676 total = adapter->erp_total_count;
689 if (lock)
690 read_unlock_irqrestore(&adapter->erp_lock, flags);
691 677
692 spin_lock_irqsave(&adapter->rec_dbf_lock, flags); 678 spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
693 memset(r, 0, sizeof(*r)); 679 memset(r, 0, sizeof(*r));
@@ -696,10 +682,25 @@ void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter, int lock)
696 r->u.thread.total = total; 682 r->u.thread.total = total;
697 r->u.thread.ready = ready; 683 r->u.thread.ready = ready;
698 r->u.thread.running = running; 684 r->u.thread.running = running;
699 debug_event(adapter->rec_dbf, 5, r, sizeof(*r)); 685 debug_event(adapter->rec_dbf, 6, r, sizeof(*r));
700 spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); 686 spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
701} 687}
702 688
689/**
690 * zfcp_rec_dbf_event_thread - trace event related to recovery thread operation
691 * @id2: identifier for event
692 * @adapter: adapter
693 * This function assumes that the caller does not hold erp_lock.
694 */
695void zfcp_rec_dbf_event_thread_lock(u8 id2, struct zfcp_adapter *adapter)
696{
697 unsigned long flags;
698
699 read_lock_irqsave(&adapter->erp_lock, flags);
700 zfcp_rec_dbf_event_thread(id2, adapter);
701 read_unlock_irqrestore(&adapter->erp_lock, flags);
702}
703
703static void zfcp_rec_dbf_event_target(u8 id2, void *ref, 704static void zfcp_rec_dbf_event_target(u8 id2, void *ref,
704 struct zfcp_adapter *adapter, 705 struct zfcp_adapter *adapter,
705 atomic_t *status, atomic_t *erp_count, 706 atomic_t *status, atomic_t *erp_count,
@@ -823,7 +824,7 @@ void zfcp_rec_dbf_event_action(u8 id2, struct zfcp_erp_action *erp_action)
823 r->u.action.status = erp_action->status; 824 r->u.action.status = erp_action->status;
824 r->u.action.step = erp_action->step; 825 r->u.action.step = erp_action->step;
825 r->u.action.fsf_req = (unsigned long)erp_action->fsf_req; 826 r->u.action.fsf_req = (unsigned long)erp_action->fsf_req;
826 debug_event(adapter->rec_dbf, 4, r, sizeof(*r)); 827 debug_event(adapter->rec_dbf, 5, r, sizeof(*r));
827 spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); 828 spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
828} 829}
829 830
@@ -960,7 +961,7 @@ void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *fsf_req)
960 961
961 zfcp_san_dbf_event_els("iels", 1, fsf_req, buf->d_id, 962 zfcp_san_dbf_event_els("iels", 1, fsf_req, buf->d_id,
962 fc_host_port_id(adapter->scsi_host), 963 fc_host_port_id(adapter->scsi_host),
963 *(u8 *)buf->payload, (void *)buf->payload, 964 buf->payload.data[0], (void *)buf->payload.data,
964 length); 965 length);
965} 966}
966 967
@@ -1064,8 +1065,7 @@ static void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level,
1064 if (fsf_req != NULL) { 1065 if (fsf_req != NULL) {
1065 fcp_rsp = (struct fcp_rsp_iu *) 1066 fcp_rsp = (struct fcp_rsp_iu *)
1066 &(fsf_req->qtcb->bottom.io.fcp_rsp); 1067 &(fsf_req->qtcb->bottom.io.fcp_rsp);
1067 fcp_rsp_info = 1068 fcp_rsp_info = (unsigned char *) &fcp_rsp[1];
1068 zfcp_get_fcp_rsp_info_ptr(fcp_rsp);
1069 fcp_sns_info = 1069 fcp_sns_info =
1070 zfcp_get_fcp_sns_info_ptr(fcp_rsp); 1070 zfcp_get_fcp_sns_info_ptr(fcp_rsp);
1071 1071
@@ -1279,5 +1279,3 @@ void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter)
1279 adapter->hba_dbf = NULL; 1279 adapter->hba_dbf = NULL;
1280 adapter->rec_dbf = NULL; 1280 adapter->rec_dbf = NULL;
1281} 1281}
1282
1283#undef ZFCP_LOG_AREA