aboutsummaryrefslogtreecommitdiff
path: root/drivers/s390
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-18 11:25:31 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-18 11:25:31 -0700
commit2cca775baecbfede2fec20c99add709232311fe7 (patch)
treeb0eefe80881d263ba7976174144ae4e9cf238425 /drivers/s390
parenteddeb0e2d863e3941d8768e70cb50c6120e61fa0 (diff)
parent94795b61e84994a3b058f92d041d1fb3d869c7d5 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (137 commits) [SCSI] iscsi: bidi support for iscsi_tcp [SCSI] iscsi: bidi support at the generic libiscsi level [SCSI] iscsi: extended cdb support [SCSI] zfcp: Fix error handling for blocked unit for send FCP command [SCSI] zfcp: Remove zfcp_erp_wait from slave destory handler to fix deadlock [SCSI] zfcp: fix 31 bit compile warnings [SCSI] bsg: no need to set BSG_F_BLOCK bit in bsg_complete_all_commands [SCSI] bsg: remove minor in struct bsg_device [SCSI] bsg: use better helper list functions [SCSI] bsg: replace kobject_get with blk_get_queue [SCSI] bsg: takes a ref to struct device in fops->open [SCSI] qla1280: remove version check [SCSI] libsas: fix endianness bug in sas_ata [SCSI] zfcp: fix compiler warning caused by poking inside new semaphore (linux-next) [SCSI] aacraid: Do not describe check_reset parameter with its value [SCSI] aacraid: Fix down_interruptible() to check the return value [SCSI] sun3_scsi_vme: add MODULE_LICENSE [SCSI] st: rename flush_write_buffer() [SCSI] tgt: use KMEM_CACHE macro [SCSI] initio: fix big endian problems for auto request sense ...
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c33
-rw-r--r--drivers/s390/scsi/zfcp_ccw.c24
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c1281
-rw-r--r--drivers/s390/scsi/zfcp_dbf.h228
-rw-r--r--drivers/s390/scsi/zfcp_def.h169
-rw-r--r--drivers/s390/scsi/zfcp_erp.c688
-rw-r--r--drivers/s390/scsi/zfcp_ext.h59
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c397
-rw-r--r--drivers/s390/scsi/zfcp_qdio.c7
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c69
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_adapter.c11
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_port.c9
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_unit.c5
13 files changed, 1448 insertions, 1532 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 874b55ed00a..8c7e2b778ef 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -1030,10 +1030,10 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device)
/* initialize debug locks */
- spin_lock_init(&adapter->erp_dbf_lock);
spin_lock_init(&adapter->hba_dbf_lock);
spin_lock_init(&adapter->san_dbf_lock);
spin_lock_init(&adapter->scsi_dbf_lock);
+ spin_lock_init(&adapter->rec_dbf_lock);
retval = zfcp_adapter_debug_register(adapter);
if (retval)
@@ -1325,10 +1325,10 @@ zfcp_nameserver_enqueue(struct zfcp_adapter *adapter)
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_FC
-static void
-zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter,
- struct fsf_status_read_buffer *status_buffer)
+static void zfcp_fsf_incoming_els_rscn(struct zfcp_fsf_req *fsf_req)
{
+ struct fsf_status_read_buffer *status_buffer = (void*)fsf_req->data;
+ struct zfcp_adapter *adapter = fsf_req->adapter;
struct fcp_rscn_head *fcp_rscn_head;
struct fcp_rscn_element *fcp_rscn_element;
struct zfcp_port *port;
@@ -1375,7 +1375,8 @@ zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter,
ZFCP_LOG_INFO("incoming RSCN, trying to open "
"port 0x%016Lx\n", port->wwpn);
zfcp_erp_port_reopen(port,
- ZFCP_STATUS_COMMON_ERP_FAILED);
+ ZFCP_STATUS_COMMON_ERP_FAILED,
+ 82, fsf_req);
continue;
}
@@ -1406,10 +1407,10 @@ zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter,
}
}
-static void
-zfcp_fsf_incoming_els_plogi(struct zfcp_adapter *adapter,
- struct fsf_status_read_buffer *status_buffer)
+static void zfcp_fsf_incoming_els_plogi(struct zfcp_fsf_req *fsf_req)
{
+ struct fsf_status_read_buffer *status_buffer = (void*)fsf_req->data;
+ struct zfcp_adapter *adapter = fsf_req->adapter;
struct fsf_plogi *els_plogi;
struct zfcp_port *port;
unsigned long flags;
@@ -1428,14 +1429,14 @@ zfcp_fsf_incoming_els_plogi(struct zfcp_adapter *adapter,
status_buffer->d_id,
zfcp_get_busid_by_adapter(adapter));
} else {
- zfcp_erp_port_forced_reopen(port, 0);
+ zfcp_erp_port_forced_reopen(port, 0, 83, fsf_req);
}
}
-static void
-zfcp_fsf_incoming_els_logo(struct zfcp_adapter *adapter,
- struct fsf_status_read_buffer *status_buffer)
+static void zfcp_fsf_incoming_els_logo(struct zfcp_fsf_req *fsf_req)
{
+ struct fsf_status_read_buffer *status_buffer = (void*)fsf_req->data;
+ struct zfcp_adapter *adapter = fsf_req->adapter;
struct fcp_logo *els_logo = (struct fcp_logo *) status_buffer->payload;
struct zfcp_port *port;
unsigned long flags;
@@ -1453,7 +1454,7 @@ zfcp_fsf_incoming_els_logo(struct zfcp_adapter *adapter,
status_buffer->d_id,
zfcp_get_busid_by_adapter(adapter));
} else {
- zfcp_erp_port_forced_reopen(port, 0);
+ zfcp_erp_port_forced_reopen(port, 0, 84, fsf_req);
}
}
@@ -1480,12 +1481,12 @@ zfcp_fsf_incoming_els(struct zfcp_fsf_req *fsf_req)
zfcp_san_dbf_event_incoming_els(fsf_req);
if (els_type == LS_PLOGI)
- zfcp_fsf_incoming_els_plogi(adapter, status_buffer);
+ zfcp_fsf_incoming_els_plogi(fsf_req);
else if (els_type == LS_LOGO)
- zfcp_fsf_incoming_els_logo(adapter, status_buffer);
+ zfcp_fsf_incoming_els_logo(fsf_req);
else if ((els_type & 0xffff0000) == LS_RSCN)
/* we are only concerned with the command, not the length */
- zfcp_fsf_incoming_els_rscn(adapter, status_buffer);
+ zfcp_fsf_incoming_els_rscn(fsf_req);
else
zfcp_fsf_incoming_els_unknown(adapter, status_buffer);
}
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
index edc5015e920..66d3b88844b 100644
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -170,9 +170,10 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device)
BUG_ON(!zfcp_reqlist_isempty(adapter));
adapter->req_no = 0;
- zfcp_erp_modify_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING,
- ZFCP_SET);
- zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
+ zfcp_erp_modify_adapter_status(adapter, 10, NULL,
+ ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
+ zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 85,
+ NULL);
zfcp_erp_wait(adapter);
goto out;
@@ -197,7 +198,7 @@ zfcp_ccw_set_offline(struct ccw_device *ccw_device)
down(&zfcp_data.config_sema);
adapter = dev_get_drvdata(&ccw_device->dev);
- zfcp_erp_adapter_shutdown(adapter, 0);
+ zfcp_erp_adapter_shutdown(adapter, 0, 86, NULL);
zfcp_erp_wait(adapter);
zfcp_erp_thread_kill(adapter);
up(&zfcp_data.config_sema);
@@ -223,24 +224,21 @@ zfcp_ccw_notify(struct ccw_device *ccw_device, int event)
case CIO_GONE:
ZFCP_LOG_NORMAL("adapter %s: device gone\n",
zfcp_get_busid_by_adapter(adapter));
- debug_text_event(adapter->erp_dbf,1,"dev_gone");
- zfcp_erp_adapter_shutdown(adapter, 0);
+ zfcp_erp_adapter_shutdown(adapter, 0, 87, NULL);
break;
case CIO_NO_PATH:
ZFCP_LOG_NORMAL("adapter %s: no path\n",
zfcp_get_busid_by_adapter(adapter));
- debug_text_event(adapter->erp_dbf,1,"no_path");
- zfcp_erp_adapter_shutdown(adapter, 0);
+ zfcp_erp_adapter_shutdown(adapter, 0, 88, NULL);
break;
case CIO_OPER:
ZFCP_LOG_NORMAL("adapter %s: operational again\n",
zfcp_get_busid_by_adapter(adapter));
- debug_text_event(adapter->erp_dbf,1,"dev_oper");
- zfcp_erp_modify_adapter_status(adapter,
+ zfcp_erp_modify_adapter_status(adapter, 11, NULL,
ZFCP_STATUS_COMMON_RUNNING,
ZFCP_SET);
- zfcp_erp_adapter_reopen(adapter,
- ZFCP_STATUS_COMMON_ERP_FAILED);
+ zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
+ 89, NULL);
break;
}
zfcp_erp_wait(adapter);
@@ -272,7 +270,7 @@ zfcp_ccw_shutdown(struct ccw_device *cdev)
down(&zfcp_data.config_sema);
adapter = dev_get_drvdata(&cdev->dev);
- zfcp_erp_adapter_shutdown(adapter, 0);
+ zfcp_erp_adapter_shutdown(adapter, 0, 90, NULL);
zfcp_erp_wait(adapter);
up(&zfcp_data.config_sema);
}
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 701046c9bb3..37b85c67b11 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -31,123 +31,128 @@ MODULE_PARM_DESC(dbfsize,
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER
-static int
-zfcp_dbf_stck(char *out_buf, const char *label, unsigned long long stck)
+static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len,
+ int level, char *from, int from_len)
+{
+ int offset;
+ struct zfcp_dbf_dump *dump = to;
+ int room = to_len - sizeof(*dump);
+
+ for (offset = 0; offset < from_len; offset += dump->size) {
+ memset(to, 0, to_len);
+ strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE);
+ dump->total_size = from_len;
+ dump->offset = offset;
+ dump->size = min(from_len - offset, room);
+ memcpy(dump->data, from + offset, dump->size);
+ debug_event(dbf, level, dump, dump->size);
+ }
+}
+
+/* FIXME: this duplicate this code in s390 debug feature */
+static void zfcp_dbf_timestamp(unsigned long long stck, struct timespec *time)
{
unsigned long long sec;
- struct timespec dbftime;
- int len = 0;
stck -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096);
sec = stck >> 12;
do_div(sec, 1000000);
- dbftime.tv_sec = sec;
+ time->tv_sec = sec;
stck -= (sec * 1000000) << 12;
- dbftime.tv_nsec = ((stck * 1000) >> 12);
- len += sprintf(out_buf + len, "%-24s%011lu:%06lu\n",
- label, dbftime.tv_sec, dbftime.tv_nsec);
-
- return len;
+ time->tv_nsec = ((stck * 1000) >> 12);
}
-static int zfcp_dbf_tag(char *out_buf, const char *label, const char *tag)
+static void zfcp_dbf_tag(char **p, const char *label, const char *tag)
{
- int len = 0, i;
+ int i;
- len += sprintf(out_buf + len, "%-24s", label);
+ *p += sprintf(*p, "%-24s", label);
for (i = 0; i < ZFCP_DBF_TAG_SIZE; i++)
- len += sprintf(out_buf + len, "%c", tag[i]);
- len += sprintf(out_buf + len, "\n");
+ *p += sprintf(*p, "%c", tag[i]);
+ *p += sprintf(*p, "\n");
+}
- return len;
+static void zfcp_dbf_outs(char **buf, const char *s1, const char *s2)
+{
+ *buf += sprintf(*buf, "%-24s%s\n", s1, s2);
}
-static int
-zfcp_dbf_view(char *out_buf, const char *label, const char *format, ...)
+static void zfcp_dbf_out(char **buf, const char *s, const char *format, ...)
{
va_list arg;
- int len = 0;
- len += sprintf(out_buf + len, "%-24s", label);
+ *buf += sprintf(*buf, "%-24s", s);
va_start(arg, format);
- len += vsprintf(out_buf + len, format, arg);
+ *buf += vsprintf(*buf, format, arg);
va_end(arg);
- len += sprintf(out_buf + len, "\n");
-
- return len;
+ *buf += sprintf(*buf, "\n");
}
-static int
-zfcp_dbf_view_dump(char *out_buf, const char *label,
- char *buffer, int buflen, int offset, int total_size)
+static void zfcp_dbf_outd(char **p, const char *label, char *buffer,
+ int buflen, int offset, int total_size)
{
- int len = 0;
-
- if (offset == 0)
- len += sprintf(out_buf + len, "%-24s ", label);
-
+ if (!offset)
+ *p += sprintf(*p, "%-24s ", label);
while (buflen--) {
if (offset > 0) {
if ((offset % 32) == 0)
- len += sprintf(out_buf + len, "\n%-24c ", ' ');
+ *p += sprintf(*p, "\n%-24c ", ' ');
else if ((offset % 4) == 0)
- len += sprintf(out_buf + len, " ");
+ *p += sprintf(*p, " ");
}
- len += sprintf(out_buf + len, "%02x", *buffer++);
+ *p += sprintf(*p, "%02x", *buffer++);
if (++offset == total_size) {
- len += sprintf(out_buf + len, "\n");
+ *p += sprintf(*p, "\n");
break;
}
}
-
- if (total_size == 0)
- len += sprintf(out_buf + len, "\n");
-
- return len;
+ if (!total_size)
+ *p += sprintf(*p, "\n");
}
-static int
-zfcp_dbf_view_header(debug_info_t * id, struct debug_view *view, int area,
- debug_entry_t * entry, char *out_buf)
+static int zfcp_dbf_view_header(debug_info_t *id, struct debug_view *view,
+ int area, debug_entry_t *entry, char *out_buf)
{
struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry);
- int len = 0;
+ struct timespec t;
+ char *p = out_buf;
if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) {
- len += zfcp_dbf_stck(out_buf + len, "timestamp",
- entry->id.stck);
- len += zfcp_dbf_view(out_buf + len, "cpu", "%02i",
- entry->id.fields.cpuid);
- } else {
- len += zfcp_dbf_view_dump(out_buf + len, NULL,
- dump->data,
- dump->size,
- dump->offset, dump->total_size);
+ zfcp_dbf_timestamp(entry->id.stck, &t);
+ zfcp_dbf_out(&p, "timestamp", "%011lu:%06lu",
+ t.tv_sec, t.tv_nsec);
+ zfcp_dbf_out(&p, "cpu", "%02i", entry->id.fields.cpuid);
+ } else {
+ zfcp_dbf_outd(&p, NULL, dump->data, dump->size, dump->offset,
+ dump->total_size);
if ((dump->offset + dump->size) == dump->total_size)
- len += sprintf(out_buf + len, "\n");
+ p += sprintf(p, "\n");
}
-
- return len;
+ return p - out_buf;
}
+/**
+ * zfcp_hba_dbf_event_fsf_response - trace event for request completion
+ * @fsf_req: request that has been completed
+ */
void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
{
struct zfcp_adapter *adapter = fsf_req->adapter;
struct fsf_qtcb *qtcb = fsf_req->qtcb;
union fsf_prot_status_qual *prot_status_qual =
- &qtcb->prefix.prot_status_qual;
+ &qtcb->prefix.prot_status_qual;
union fsf_status_qual *fsf_status_qual = &qtcb->header.fsf_status_qual;
struct scsi_cmnd *scsi_cmnd;
struct zfcp_port *port;
struct zfcp_unit *unit;
struct zfcp_send_els *send_els;
struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf;
- struct zfcp_hba_dbf_record_response *response = &rec->type.response;
+ struct zfcp_hba_dbf_record_response *response = &rec->u.response;
int level;
unsigned long flags;
spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
- memset(rec, 0, sizeof(struct zfcp_hba_dbf_record));
+ memset(rec, 0, sizeof(*rec));
strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE);
if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) &&
@@ -161,6 +166,9 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
(fsf_req->fsf_command == FSF_QTCB_OPEN_LUN)) {
strncpy(rec->tag2, "open", ZFCP_DBF_TAG_SIZE);
level = 4;
+ } else if (qtcb->header.log_length) {
+ strncpy(rec->tag2, "qtcb", ZFCP_DBF_TAG_SIZE);
+ level = 5;
} else {
strncpy(rec->tag2, "norm", ZFCP_DBF_TAG_SIZE);
level = 6;
@@ -188,11 +196,9 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
if (fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT)
break;
scsi_cmnd = (struct scsi_cmnd *)fsf_req->data;
- if (scsi_cmnd != NULL) {
- response->data.send_fcp.scsi_cmnd
- = (unsigned long)scsi_cmnd;
- response->data.send_fcp.scsi_serial
- = scsi_cmnd->serial_number;
+ if (scsi_cmnd) {
+ response->u.fcp.cmnd = (unsigned long)scsi_cmnd;
+ response->u.fcp.serial = scsi_cmnd->serial_number;
}
break;
@@ -200,25 +206,25 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
case FSF_QTCB_CLOSE_PORT:
case FSF_QTCB_CLOSE_PHYSICAL_PORT:
port = (struct zfcp_port *)fsf_req->data;
- response->data.port.wwpn = port->wwpn;
- response->data.port.d_id = port->d_id;
- response->data.port.port_handle = qtcb->header.port_handle;
+ response->u.port.wwpn = port->wwpn;
+ response->u.port.d_id = port->d_id;
+ response->u.port.port_handle = qtcb->header.port_handle;
break;
case FSF_QTCB_OPEN_LUN:
case FSF_QTCB_CLOSE_LUN:
unit = (struct zfcp_unit *)fsf_req->data;
port = unit->port;
- response->data.unit.wwpn = port->wwpn;
- response->data.unit.fcp_lun = unit->fcp_lun;
- response->data.unit.port_handle = qtcb->header.port_handle;
- response->data.unit.lun_handle = qtcb->header.lun_handle;
+ response->u.unit.wwpn = port->wwpn;
+ response->u.unit.fcp_lun = unit->fcp_lun;
+ response->u.unit.port_handle = qtcb->header.port_handle;
+ response->u.unit.lun_handle = qtcb->header.lun_handle;
break;
case FSF_QTCB_SEND_ELS:
send_els = (struct zfcp_send_els *)fsf_req->data;
- response->data.send_els.d_id = qtcb->bottom.support.d_id;
- response->data.send_els.ls_code = send_els->ls_code >> 24;
+ response->u.els.d_id = qtcb->bottom.support.d_id;
+ response->u.els.ls_code = send_els->ls_code >> 24;
break;
case FSF_QTCB_ABORT_FCP_CMND:
@@ -230,39 +236,54 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
break;
}
- debug_event(adapter->hba_dbf, level,
- rec, sizeof(struct zfcp_hba_dbf_record));
+ debug_event(adapter->hba_dbf, level, rec, sizeof(*rec));
+
+ /* have fcp channel microcode fixed to use as little as possible */
+ if (fsf_req->fsf_command != FSF_QTCB_FCP_CMND) {
+ /* adjust length skipping trailing zeros */
+ char *buf = (char *)qtcb + qtcb->header.log_start;
+ int len = qtcb->header.log_length;
+ for (; len && !buf[len - 1]; len--);
+ zfcp_dbf_hexdump(adapter->hba_dbf, rec, sizeof(*rec), level,
+ buf, len);
+ }
+
spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
}
-void
-zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
- struct fsf_status_read_buffer *status_buffer)
+/**
+ * zfcp_hba_dbf_event_fsf_unsol - trace event for an unsolicited status buffer
+ * @tag: tag indicating which kind of unsolicited status has been received
+ * @adapter: adapter that has issued the unsolicited status buffer
+ * @status_buffer: buffer containing payload of unsolicited status
+ */
+void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
+ struct fsf_status_read_buffer *status_buffer)
{
struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf;
unsigned long flags;
spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
- memset(rec, 0, sizeof(struct zfcp_hba_dbf_record));
+ memset(rec, 0, sizeof(*rec));
strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE);
strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE);
- rec->type.status.failed = adapter->status_read_failed;
+ rec->u.status.failed = adapter->status_read_failed;
if (status_buffer != NULL) {
- rec->type.status.status_type = status_buffer->status_type;
- rec->type.status.status_subtype = status_buffer->status_subtype;
- memcpy(&rec->type.status.queue_designator,
+ rec->u.status.status_type = status_buffer->status_type;
+ rec->u.status.status_subtype = status_buffer->status_subtype;
+ memcpy(&rec->u.status.queue_designator,
&status_buffer->queue_designator,
sizeof(struct fsf_queue_designator));
switch (status_buffer->status_type) {
case FSF_STATUS_READ_SENSE_DATA_AVAIL:
- rec->type.status.payload_size =
+ rec->u.status.payload_size =
ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL;
break;
case FSF_STATUS_READ_BIT_ERROR_THRESHOLD:
- rec->type.status.payload_size =
+ rec->u.status.payload_size =
ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD;
break;
@@ -270,119 +291,101 @@ zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
switch (status_buffer->status_subtype) {
case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK:
case FSF_STATUS_READ_SUB_FDISC_FAILED:
- rec->type.status.payload_size =
+ rec->u.status.payload_size =
sizeof(struct fsf_link_down_info);
}
break;
case FSF_STATUS_READ_FEATURE_UPDATE_ALERT:
- rec->type.status.payload_size =
+ rec->u.status.payload_size =
ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT;
break;
}
- memcpy(&rec->type.status.payload,
- &status_buffer->payload, rec->type.status.payload_size);
+ memcpy(&rec->u.status.payload,
+ &status_buffer->payload, rec->u.status.payload_size);
}
- debug_event(adapter->hba_dbf, 2,
- rec, sizeof(struct zfcp_hba_dbf_record));
+ debug_event(adapter->hba_dbf, 2, rec, sizeof(*rec));
spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
}
-void
-zfcp_hba_dbf_event_qdio(struct zfcp_adapter *adapter, unsigned int status,
- unsigned int qdio_error, unsigned int siga_error,
- int sbal_index, int sbal_count)
+/**
+ * zfcp_hba_dbf_event_qdio - trace event for QDIO related failure
+ * @adapter: adapter affected by this QDIO related event
+ * @status: as passed by qdio module
+ * @qdio_error: as passed by qdio module
+ * @siga_error: as passed by qdio module
+ * @sbal_index: first buffer with error condition, as passed by qdio module
+ * @sbal_count: number of buffers affected, as passed by qdio module
+ */
+void zfcp_hba_dbf_event_qdio(struct zfcp_adapter *adapter, unsigned int status,
+ unsigned int qdio_error, unsigned int siga_error,
+ int sbal_index, int sbal_count)
{
- struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf;
+ struct zfcp_hba_dbf_record *r = &adapter->hba_dbf_buf;
unsigned long flags;
spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
- memset(rec, 0, sizeof(struct zfcp_hba_dbf_record));
- strncpy(rec->tag, "qdio", ZFCP_DBF_TAG_SIZE);
- rec->type.qdio.status = status;
- rec->type.qdio.qdio_error = qdio_error;
- rec->type.qdio.siga_error = siga_error;
- rec->type.qdio.sbal_index = sbal_index;
- rec->type.qdio.sbal_count = sbal_count;
- debug_event(adapter->hba_dbf, 0,
- rec, sizeof(struct zfcp_hba_dbf_record));
+ memset(r, 0, sizeof(*r));
+ strncpy(r->tag, "qdio", ZFCP_DBF_TAG_SIZE);
+ r->u.qdio.status = status;
+ r->u.qdio.qdio_error = qdio_error;
+ r->u.qdio.siga_error = siga_error;
+ r->u.qdio.sbal_index = sbal_index;
+ r->u.qdio.sbal_count = sbal_count;
+ debug_event(adapter->hba_dbf, 0, r, sizeof(*r));
spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
}
-static int
-zfcp_hba_dbf_view_response(char *out_buf,
- struct zfcp_hba_dbf_record_response *rec)
-{
- int len = 0;
-
- len += zfcp_dbf_view(out_buf + len, "fsf_command", "0x%08x",
- rec->fsf_command);
- len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx",
- rec->fsf_reqid);
- len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x",
- rec->fsf_seqno);
- len += zfcp_dbf_stck(out_buf + len, "fsf_issued", rec->fsf_issued);
- len += zfcp_dbf_view(out_buf + len, "fsf_prot_status", "0x%08x",
- rec->fsf_prot_status);
- len += zfcp_dbf_view(out_buf + len, "fsf_status", "0x%08x",
- rec->fsf_status);
- len += zfcp_dbf_view_dump(out_buf + len, "fsf_prot_status_qual",
- rec->fsf_prot_status_qual,
- FSF_PROT_STATUS_QUAL_SIZE,
- 0, FSF_PROT_STATUS_QUAL_SIZE);
- len += zfcp_dbf_view_dump(out_buf + len, "fsf_status_qual",
- rec->fsf_status_qual,
- FSF_STATUS_QUALIFIER_SIZE,
- 0, FSF_STATUS_QUALIFIER_SIZE);
- len += zfcp_dbf_view(out_buf + len, "fsf_req_status", "0x%08x",
- rec->fsf_req_status);
- len += zfcp_dbf_view(out_buf + len, "sbal_first", "0x%02x",
- rec->sbal_first);
- len += zfcp_dbf_view(out_buf + len, "sbal_curr", "0x%02x",
- rec->sbal_curr);
- len += zfcp_dbf_view(out_buf + len, "sbal_last", "0x%02x",
- rec->sbal_last);
- len += zfcp_dbf_view(out_buf + len, "pool", "0x%02x", rec->pool);
-
- switch (rec->fsf_command) {
+static void zfcp_hba_dbf_view_response(char **p,
+ struct zfcp_hba_dbf_record_response *r)
+{
+ struct timespec t;
+
+ zfcp_dbf_out(p, "fsf_command", "0x%08x", r->fsf_command);
+ zfcp_dbf_out(p, "fsf_reqid", "0x%0Lx", r->fsf_reqid);
+ zfcp_dbf_out(p, "fsf_seqno", "0x%08x", r->fsf_seqno);
+ zfcp_dbf_timestamp(r->fsf_issued, &t);
+ zfcp_dbf_out(p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec);
+ zfcp_dbf_out(p, "fsf_prot_status", "0x%08x", r->fsf_prot_status);
+ zfcp_dbf_out(p, "fsf_status", "0x%08x", r->fsf_status);
+ zfcp_dbf_outd(p, "fsf_prot_status_qual", r->fsf_prot_status_qual,
+ FSF_PROT_STATUS_QUAL_SIZE, 0, FSF_PROT_STATUS_QUAL_SIZE);
+ zfcp_dbf_outd(p, "fsf_status_qual", r->fsf_status_qual,
+ 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, "pool", "0x%02x", r->pool);
+
+ switch (r->fsf_command) {
case FSF_QTCB_FCP_CMND:
- if (rec->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT)
+ if (r->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT)
break;
- len += zfcp_dbf_view(out_buf + len, "scsi_cmnd", "0x%0Lx",
- rec->data.send_fcp.scsi_cmnd);
- len += zfcp_dbf_view(out_buf + len, "scsi_serial", "0x%016Lx",
- rec->data.send_fcp.scsi_serial);
+ zfcp_dbf_out(p, "scsi_cmnd", "0x%0Lx", r->u.fcp.cmnd);
+ zfcp_dbf_out(p, "scsi_serial", "0x%016Lx", r->u.fcp.serial);
break;
case FSF_QTCB_OPEN_PORT_WITH_DID:
case FSF_QTCB_CLOSE_PORT:
case FSF_QTCB_CLOSE_PHYSICAL_PORT:
- len += zfcp_dbf_view(out_buf + len, "wwpn", "0x%016Lx",
- rec->data.port.wwpn);
- len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x",
- rec->data.port.d_id);
- len += zfcp_dbf_view(out_buf + len, "port_handle", "0x%08x",
- rec->data.port.port_handle);
+ zfcp_dbf_out(p, "wwpn", "0x%016Lx", r->u.port.wwpn);
+ zfcp_dbf_out(p, "d_id", "0x%06x", r->u.port.d_id);
+ zfcp_dbf_out(p, "port_handle", "0x%08x", r->u.port.port_handle);
break;
case FSF_QTCB_OPEN_LUN:
case FSF_QTCB_CLOSE_LUN:
- len += zfcp_dbf_view(out_buf + len, "wwpn", "0x%016Lx",
- rec->data.unit.wwpn);
- len += zfcp_dbf_view(out_buf + len, "fcp_lun", "0x%016Lx",
- rec->data.unit.fcp_lun);
- len += zfcp_dbf_view(out_buf + len, "port_handle", "0x%08x",
- rec->data.unit.port_handle);
- len += zfcp_dbf_view(out_buf + len, "lun_handle", "0x%08x",
- rec->data.unit.lun_handle);
+ zfcp_dbf_out(p, "wwpn", "0x%016Lx", r->u.unit.wwpn);
+ zfcp_dbf_out(p, "fcp_lun", "0x%016Lx", r->u.unit.fcp_lun);
+ zfcp_dbf_out(p, "port_handle", "0x%08x", r->u.unit.port_handle);
+ zfcp_dbf_out(p, "lun_handle", "0x%08x", r->u.unit.lun_handle);
break;
case FSF_QTCB_SEND_ELS:
- len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x",
- rec->data.send_els.d_id);
- len += zfcp_dbf_view(out_buf + len, "ls_code", "0x%02x",
- rec->data.send_els.ls_code);
+ zfcp_dbf_out(p, "d_id", "0x%06x", r->u.els.d_id);
+ zfcp_dbf_out(p, "ls_code", "0x%02x", r->u.els.ls_code);
break;
case FSF_QTCB_ABORT_FCP_CMND:
@@ -393,74 +396,52 @@ zfcp_hba_dbf_view_response(char *out_buf,
case FSF_QTCB_UPLOAD_CONTROL_FILE:
break;
}
-
- return len;
}
-static int
-zfcp_hba_dbf_view_status(char *out_buf, struct zfcp_hba_dbf_record_status *rec)
+static void zfcp_hba_dbf_view_status(char **p,
+ struct zfcp_hba_dbf_record_status *r)
{
- int len = 0;
-
- len += zfcp_dbf_view(out_buf + len, "failed", "0x%02x", rec->failed);
- len += zfcp_dbf_view(out_buf + len, "status_type", "0x%08x",
- rec->status_type);
- len += zfcp_dbf_view(out_buf + len, "status_subtype", "0x%08x",
- rec->status_subtype);
- len += zfcp_dbf_view_dump(out_buf + len, "queue_designator",
- (char *)&rec->queue_designator,
- sizeof(struct fsf_queue_designator),
- 0, sizeof(struct fsf_queue_designator));
- len += zfcp_dbf_view_dump(out_buf + len, "payload",
- (char *)&rec->payload,
- rec->payload_size, 0, rec->payload_size);
-
- return len;
+ zfcp_dbf_out(p, "failed", "0x%02x", r->failed);
+ zfcp_dbf_out(p, "status_type", "0x%08x", r->status_type);
+ zfcp_dbf_out(p, "status_subtype", "0x%08x", r->status_subtype);
+ zfcp_dbf_outd(p, "queue_designator", (char *)&r->queue_designator,
+ sizeof(struct fsf_queue_designator), 0,
+ sizeof(struct fsf_queue_designator));
+ zfcp_dbf_outd(p, "payload", (char *)&r->payload, r->payload_size, 0,
+ r->payload_size);
}
-static int
-zfcp_hba_dbf_view_qdio(char *out_buf, struct zfcp_hba_dbf_record_qdio *rec)
+static void zfcp_hba_dbf_view_qdio(char **p, struct zfcp_hba_dbf_record_qdio *r)
{
- int len = 0;
-
- len += zfcp_dbf_view(out_buf + len, "status", "0x%08x", rec->status);
- len += zfcp_dbf_view(out_buf + len, "qdio_error", "0x%08x",
- rec->qdio_error);
- len += zfcp_dbf_view(out_buf + len, "siga_error", "0x%08x",
- rec->siga_error);
- len += zfcp_dbf_view(out_buf + len, "sbal_index", "0x%02x",
- rec->sbal_index);
- len += zfcp_dbf_view(out_buf + len, "sbal_count", "0x%02x",
- rec->sbal_count);
-
- return len;
+ zfcp_dbf_out(p, "status", "0x%08x", r->status);
+ zfcp_dbf_out(p, "qdio_error", "0x%08x", r->qdio_error);
+ zfcp_dbf_out(p, "siga_error", "0x%08x", r->siga_error);
+ zfcp_dbf_out(p, "sbal_index", "0x%02x", r->sbal_index);
+ zfcp_dbf_out(p, "sbal_count", "0x%02x", r->sbal_count);
}
-static int
-zfcp_hba_dbf_view_format(debug_info_t * id, struct debug_view *view,
- char *out_buf, const char *in_buf)
+static int zfcp_hba_dbf_view_format(debug_info_t *id, struct debug_view *view,
+ char *out_buf, const char *in_buf)
{
- struct zfcp_hba_dbf_record *rec = (struct zfcp_hba_dbf_record *)in_buf;
- int len = 0;
+ struct zfcp_hba_dbf_record *r = (struct zfcp_hba_dbf_record *)in_buf;
+ char *p = out_buf;
- if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0)
+ if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0)
return 0;
- len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag);
- if (isalpha(rec->tag2[0]))
- len += zfcp_dbf_tag(out_buf + len, "tag2", rec->tag2);
- if (strncmp(rec->tag, "resp", ZFCP_DBF_TAG_SIZE) == 0)
- len += zfcp_hba_dbf_view_response(out_buf + len,
- &rec->type.response);
- else if (strncmp(rec->tag, "stat", ZFCP_DBF_TAG_SIZE) == 0)
- len += zfcp_hba_dbf_view_status(out_buf + len,
- &rec->type.status);
- else if (strncmp(rec->tag, "qdio", ZFCP_DBF_TAG_SIZE) == 0)
- len += zfcp_hba_dbf_view_qdio(out_buf + len, &rec->type.qdio);
+ zfcp_dbf_tag(&p, "tag", r->tag);
+ if (isalpha(r->tag2[0]))
+ zfcp_dbf_tag(&p, "tag2", r->tag2);
- len += sprintf(out_buf + len, "\n");
+ if (strncmp(r->tag, "resp", ZFCP_DBF_TAG_SIZE) == 0)
+ zfcp_hba_dbf_view_response(&p, &r->u.response);
+ else if (strncmp(r->tag, "stat", ZFCP_DBF_TAG_SIZE) == 0)
+ zfcp_hba_dbf_view_status(&p, &r->u.status);
+ else if (strncmp(r->tag, "qdio", ZFCP_DBF_TAG_SIZE) == 0)
+ zfcp_hba_dbf_view_qdio(&p, &r->u.qdio);
- return len;
+ p += sprintf(p, "\n");
+ return p - out_buf;
}
static struct debug_view zfcp_hba_dbf_view = {
@@ -472,219 +453,570 @@ static struct debug_view zfcp_hba_dbf_view = {
NULL
};
-static void
-_zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req,
- u32 s_id, u32 d_id, void *buffer, int buflen)
+static const char *zfcp_rec_dbf_tags[] = {
+ [ZFCP_REC_DBF_ID_THREAD] = "thread",
+ [ZFCP_REC_DBF_ID_TARGET] = "target",
+ [ZFCP_REC_DBF_ID_TRIGGER] = "trigger",
+ [ZFCP_REC_DBF_ID_ACTION] = "action",
+};
+
+static const char *zfcp_rec_dbf_ids[] = {
+ [1] = "new",
+ [2] = "ready",
+ [3] = "kill",
+ [4] = "down sleep",
+ [5] = "down wakeup",
+ [6] = "down sleep ecd",
+ [7] = "down wakeup ecd",
+ [8] = "down sleep epd",
+ [9] = "down wakeup epd",
+ [10] = "online",
+ [11] = "operational",
+ [12] = "scsi slave destroy",
+ [13] = "propagate failed adapter",
+ [14] = "propagate failed port",
+ [15] = "block adapter",
+ [16] = "unblock adapter",
+ [17] = "block port",
+ [18] = "unblock port",
+ [19] = "block unit",
+ [20] = "unblock unit",
+ [21] = "unit recovery failed",
+ [22] = "port recovery failed",
+ [23] = "adapter recovery failed",
+ [24] = "qdio queues down",
+ [25] = "p2p failed",
+ [26] = "nameserver lookup failed",
+ [27] = "nameserver port failed",
+ [28] = "link up",
+ [29] = "link down",
+ [30] = "link up status read",
+ [31] = "open port failed",
+ [32] = "open port failed",
+ [33] = "close port",
+ [34] = "open unit failed",
+ [35] = "exclusive open unit failed",
+ [36] = "shared open unit failed",
+ [37] = "link down",
+ [38] = "link down status read no link",
+ [39] = "link down status read fdisc login",
+ [40] = "link down status read firmware update",
+ [41] = "link down status read unknown reason",
+ [42] = "link down ecd incomplete",
+ [43] = "link down epd incomplete",
+ [44] = "sysfs adapter recovery",
+ [45] = "sysfs port recovery",
+ [46] = "sysfs unit recovery",
+ [47] = "port boxed abort",
+ [48] = "unit boxed abort",
+ [49] = "port boxed ct",
+ [50] = "port boxed close physical",
+ [51] = "port boxed open unit",
+ [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",
+ [60] = "shared unit access denied open unit",
+ [61] = "unit access denied fcp",
+ [62] = "request timeout",
+ [63] = "adisc link test reject or timeout",
+ [64] = "adisc link test d_id changed",
+ [65] = "adisc link test failed",
+ [66] = "recovery out of memory",
+ [67] = "adapter recovery repeated after state change",
+ [68] = "port recovery repeated after state change",
+ [69] = "unit recovery repeated after state change",
+ [70] = "port recovery follow-up after successful adapter recovery",
+ [71] = "adapter recovery escalation after failed adapter recovery",
+ [72] = "port recovery follow-up after successful physical port "
+ "recovery",
+ [73] = "adapter recovery escalation after failed physical port "
+ "recovery",
+ [74] = "unit recovery follow-up after successful port recovery",
+ [75] = "physical port recovery escalation after failed port "
+ "recovery",
+ [76] = "port recovery escalation after failed unit recovery",
+ [77] = "recovery opening nameserver port",
+ [78] = "duplicate request id",
+ [79] = "link down",