]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/s390/scsi/zfcp_dbf.c
[SCSI] zfcp: zfcp_fsf cleanup.
[linux-2.6-omap-h63xx.git] / drivers / s390 / scsi / zfcp_dbf.c
index 37b85c67b11dcb2404d0f59eafa021d096f47588..36169c6944fd1d78b06161e66488b355d0d98ba3 100644 (file)
@@ -1,22 +1,9 @@
 /*
- * This file is part of the zfcp device driver for
- * FCP adapters for IBM System z9 and zSeries.
+ * zfcp device driver
  *
- * (C) Copyright IBM Corp. 2002, 2006
+ * Debug traces for zfcp.
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Copyright IBM Corporation 2002, 2008
  */
 
 #include <linux/ctype.h>
@@ -29,8 +16,6 @@ module_param(dbfsize, uint, 0400);
 MODULE_PARM_DESC(dbfsize,
                 "number of pages for each debug feature area (default 4)");
 
-#define ZFCP_LOG_AREA                  ZFCP_LOG_AREA_OTHER
-
 static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len,
                             int level, char *from, int from_len)
 {
@@ -186,8 +171,8 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
               fsf_status_qual, FSF_STATUS_QUALIFIER_SIZE);
        response->fsf_req_status = fsf_req->status;
        response->sbal_first = fsf_req->sbal_first;
-       response->sbal_curr = fsf_req->sbal_curr;
        response->sbal_last = fsf_req->sbal_last;
+       response->sbal_response = fsf_req->sbal_response;
        response->pool = fsf_req->pool != NULL;
        response->erp_action = (unsigned long)fsf_req->erp_action;
 
@@ -268,7 +253,7 @@ void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
        strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE);
        strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE);
 
-       rec->u.status.failed = adapter->status_read_failed;
+       rec->u.status.failed = atomic_read(&adapter->stat_miss);
        if (status_buffer != NULL) {
                rec->u.status.status_type = status_buffer->status_type;
                rec->u.status.status_subtype = status_buffer->status_subtype;
@@ -355,8 +340,8 @@ static void zfcp_hba_dbf_view_response(char **p,
                      FSF_STATUS_QUALIFIER_SIZE, 0, FSF_STATUS_QUALIFIER_SIZE);
        zfcp_dbf_out(p, "fsf_req_status", "0x%08x", r->fsf_req_status);
        zfcp_dbf_out(p, "sbal_first", "0x%02x", r->sbal_first);
-       zfcp_dbf_out(p, "sbal_curr", "0x%02x", r->sbal_curr);
        zfcp_dbf_out(p, "sbal_last", "0x%02x", r->sbal_last);
+       zfcp_dbf_out(p, "sbal_response", "0x%02x", r->sbal_response);
        zfcp_dbf_out(p, "pool", "0x%02x", r->pool);
 
        switch (r->fsf_command) {
@@ -515,13 +500,13 @@ static const char *zfcp_rec_dbf_ids[] = {
        [52]    = "port boxed close unit",
        [53]    = "port boxed fcp",
        [54]    = "unit boxed fcp",
-       [55]    = "port access denied ct",
-       [56]    = "port access denied els",
-       [57]    = "port access denied open port",
-       [58]    = "port access denied close physical",
-       [59]    = "unit access denied open unit",
+       [55]    = "port access denied",
+       [56]    = "",
+       [57]    = "",
+       [58]    = "",
+       [59]    = "unit access denied",
        [60]    = "shared unit access denied open unit",
-       [61]    = "unit access denied fcp",
+       [61]    = "",
        [62]    = "request timeout",
        [63]    = "adisc link test reject or timeout",
        [64]    = "adisc link test d_id changed",
@@ -546,8 +531,8 @@ static const char *zfcp_rec_dbf_ids[] = {
        [80]    = "exclusive read-only unit access unsupported",
        [81]    = "shared read-write unit access unsupported",
        [82]    = "incoming rscn",
-       [83]    = "incoming plogi",
-       [84]    = "incoming logo",
+       [83]    = "incoming wwpn",
+       [84]    = "",
        [85]    = "online",
        [86]    = "offline",
        [87]    = "ccw device gone",
@@ -586,8 +571,8 @@ static const char *zfcp_rec_dbf_ids[] = {
        [120]   = "unknown fsf command",
        [121]   = "no recommendation for status qualifier",
        [122]   = "status read physical port closed in error",
-       [123]   = "fc service class not supported ct",
-       [124]   = "fc service class not supported els",
+       [123]   = "fc service class not supported",
+       [124]   = "",
        [125]   = "need newer zfcp",
        [126]   = "need newer microcode",
        [127]   = "arbitrated loop not supported",
@@ -595,7 +580,7 @@ static const char *zfcp_rec_dbf_ids[] = {
        [129]   = "qtcb size mismatch",
        [130]   = "unknown fsf status ecd",
        [131]   = "fcp request too big",
-       [132]   = "fc service class not supported fcp",
+       [132]   = "",
        [133]   = "data direction not valid fcp",
        [134]   = "command length not valid fcp",
        [135]   = "status read act update",
@@ -603,13 +588,18 @@ static const char *zfcp_rec_dbf_ids[] = {
        [137]   = "hbaapi port open",
        [138]   = "hbaapi unit open",
        [139]   = "hbaapi unit shutdown",
-       [140]   = "qdio error",
+       [140]   = "qdio error outbound",
        [141]   = "scsi host reset",
        [142]   = "dismissing fsf request for recovery action",
        [143]   = "recovery action timed out",
        [144]   = "recovery action gone",
        [145]   = "recovery action being processed",
        [146]   = "recovery action ready for next step",
+       [147]   = "qdio error inbound",
+       [148]   = "nameserver needed for port scan",
+       [149]   = "port scan",
+       [150]   = "ptp attach",
+       [151]   = "port validation failed",
 };
 
 static 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 = {
  * zfcp_rec_dbf_event_thread - trace event related to recovery thread operation
  * @id2: identifier for event
  * @adapter: adapter
- * @lock: non-zero value indicates that erp_lock has not yet been acquired
+ * This function assumes that the caller is holding erp_lock.
  */
-void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter, int lock)
+void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter)
 {
        struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf;
        unsigned long flags = 0;
        struct list_head *entry;
        unsigned ready = 0, running = 0, total;
 
-       if (lock)
-               read_lock_irqsave(&adapter->erp_lock, flags);
        list_for_each(entry, &adapter->erp_ready_head)
                ready++;
        list_for_each(entry, &adapter->erp_running_head)
                running++;
        total = adapter->erp_total_count;
-       if (lock)
-               read_unlock_irqrestore(&adapter->erp_lock, flags);
 
        spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
        memset(r, 0, sizeof(*r));
@@ -696,10 +682,25 @@ void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter, int lock)
        r->u.thread.total = total;
        r->u.thread.ready = ready;
        r->u.thread.running = running;
-       debug_event(adapter->rec_dbf, 5, r, sizeof(*r));
+       debug_event(adapter->rec_dbf, 6, r, sizeof(*r));
        spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
 }
 
+/**
+ * zfcp_rec_dbf_event_thread - trace event related to recovery thread operation
+ * @id2: identifier for event
+ * @adapter: adapter
+ * This function assumes that the caller does not hold erp_lock.
+ */
+void zfcp_rec_dbf_event_thread_lock(u8 id2, struct zfcp_adapter *adapter)
+{
+       unsigned long flags;
+
+       read_lock_irqsave(&adapter->erp_lock, flags);
+       zfcp_rec_dbf_event_thread(id2, adapter);
+       read_unlock_irqrestore(&adapter->erp_lock, flags);
+}
+
 static void zfcp_rec_dbf_event_target(u8 id2, void *ref,
                                      struct zfcp_adapter *adapter,
                                      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)
        r->u.action.status = erp_action->status;
        r->u.action.step = erp_action->step;
        r->u.action.fsf_req = (unsigned long)erp_action->fsf_req;
-       debug_event(adapter->rec_dbf, 4, r, sizeof(*r));
+       debug_event(adapter->rec_dbf, 5, r, sizeof(*r));
        spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
 }
 
@@ -960,7 +961,7 @@ void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *fsf_req)
 
        zfcp_san_dbf_event_els("iels", 1, fsf_req, buf->d_id,
                               fc_host_port_id(adapter->scsi_host),
-                              *(u8 *)buf->payload, (void *)buf->payload,
+                              buf->payload.data[0], (void *)buf->payload.data,
                               length);
 }
 
@@ -1055,7 +1056,7 @@ static void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level,
                                rec->scsi_result = scsi_cmnd->result;
                                rec->scsi_cmnd = (unsigned long)scsi_cmnd;
                                rec->scsi_serial = scsi_cmnd->serial_number;
-                               memcpy(rec->scsi_opcode, &scsi_cmnd->cmnd,
+                               memcpy(rec->scsi_opcode, scsi_cmnd->cmnd,
                                        min((int)scsi_cmnd->cmd_len,
                                                ZFCP_DBF_SCSI_OPCODE));
                                rec->scsi_retries = scsi_cmnd->retries;
@@ -1064,8 +1065,7 @@ static void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level,
                        if (fsf_req != NULL) {
                                fcp_rsp = (struct fcp_rsp_iu *)
                                    &(fsf_req->qtcb->bottom.io.fcp_rsp);
-                               fcp_rsp_info =
-                                   zfcp_get_fcp_rsp_info_ptr(fcp_rsp);
+                               fcp_rsp_info = (unsigned char *) &fcp_rsp[1];
                                fcp_sns_info =
                                    zfcp_get_fcp_sns_info_ptr(fcp_rsp);
 
@@ -1279,5 +1279,3 @@ void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter)
        adapter->hba_dbf = NULL;
        adapter->rec_dbf = NULL;
 }
-
-#undef ZFCP_LOG_AREA