aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_aux.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_aux.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_aux.c')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c180
1 files changed, 1 insertions, 179 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 17f9989238f8..0b5087f7cabc 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -122,93 +122,6 @@ _zfcp_hex_dump(char *addr, int count)
122 122
123#define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER 123#define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER
124 124
125static inline int
126zfcp_fsf_req_is_scsi_cmnd(struct zfcp_fsf_req *fsf_req)
127{
128 return ((fsf_req->fsf_command == FSF_QTCB_FCP_CMND) &&
129 !(fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT));
130}
131
132void
133zfcp_cmd_dbf_event_fsf(const char *text, struct zfcp_fsf_req *fsf_req,
134 void *add_data, int add_length)
135{
136 struct zfcp_adapter *adapter = fsf_req->adapter;
137 struct scsi_cmnd *scsi_cmnd;
138 int level = 3;
139 int i;
140 unsigned long flags;
141
142 spin_lock_irqsave(&adapter->dbf_lock, flags);
143 if (zfcp_fsf_req_is_scsi_cmnd(fsf_req)) {
144 scsi_cmnd = (struct scsi_cmnd*) fsf_req->data;
145 debug_text_event(adapter->cmd_dbf, level, "fsferror");
146 debug_text_event(adapter->cmd_dbf, level, text);
147 debug_event(adapter->cmd_dbf, level, &fsf_req,
148 sizeof (unsigned long));
149 debug_event(adapter->cmd_dbf, level, &fsf_req->seq_no,
150 sizeof (u32));
151 debug_event(adapter->cmd_dbf, level, &scsi_cmnd,
152 sizeof (unsigned long));
153 debug_event(adapter->cmd_dbf, level, &scsi_cmnd->cmnd,
154 min(ZFCP_CMD_DBF_LENGTH, (int)scsi_cmnd->cmd_len));
155 for (i = 0; i < add_length; i += ZFCP_CMD_DBF_LENGTH)
156 debug_event(adapter->cmd_dbf,
157 level,
158 (char *) add_data + i,
159 min(ZFCP_CMD_DBF_LENGTH, add_length - i));
160 }
161 spin_unlock_irqrestore(&adapter->dbf_lock, flags);
162}
163
164/* XXX additionally log unit if available */
165/* ---> introduce new parameter for unit, see 2.4 code */
166void
167zfcp_cmd_dbf_event_scsi(const char *text, struct scsi_cmnd *scsi_cmnd)
168{
169 struct zfcp_adapter *adapter;
170 struct zfcp_fsf_req *fsf_req;
171 int level = ((host_byte(scsi_cmnd->result) != 0) ? 1 : 5);
172 unsigned long flags;
173
174 adapter = (struct zfcp_adapter *) scsi_cmnd->device->host->hostdata[0];
175 fsf_req = (struct zfcp_fsf_req *) scsi_cmnd->host_scribble;
176 spin_lock_irqsave(&adapter->dbf_lock, flags);
177 debug_text_event(adapter->cmd_dbf, level, "hostbyte");
178 debug_text_event(adapter->cmd_dbf, level, text);
179 debug_event(adapter->cmd_dbf, level, &scsi_cmnd->result, sizeof (u32));
180 debug_event(adapter->cmd_dbf, level, &scsi_cmnd,
181 sizeof (unsigned long));
182 debug_event(adapter->cmd_dbf, level, &scsi_cmnd->cmnd,
183 min(ZFCP_CMD_DBF_LENGTH, (int)scsi_cmnd->cmd_len));
184 if (likely(fsf_req)) {
185 debug_event(adapter->cmd_dbf, level, &fsf_req,
186 sizeof (unsigned long));
187 debug_event(adapter->cmd_dbf, level, &fsf_req->seq_no,
188 sizeof (u32));
189 } else {
190 debug_text_event(adapter->cmd_dbf, level, "");
191 debug_text_event(adapter->cmd_dbf, level, "");
192 }
193 spin_unlock_irqrestore(&adapter->dbf_lock, flags);
194}
195
196void
197zfcp_in_els_dbf_event(struct zfcp_adapter *adapter, const char *text,
198 struct fsf_status_read_buffer *status_buffer, int length)
199{
200 int level = 1;
201 int i;
202
203 debug_text_event(adapter->in_els_dbf, level, text);
204 debug_event(adapter->in_els_dbf, level, &status_buffer->d_id, 8);
205 for (i = 0; i < length; i += ZFCP_IN_ELS_DBF_LENGTH)
206 debug_event(adapter->in_els_dbf,
207 level,
208 (char *) status_buffer->payload + i,
209 min(ZFCP_IN_ELS_DBF_LENGTH, length - i));
210}
211
212/** 125/**
213 * zfcp_device_setup - setup function 126 * zfcp_device_setup - setup function
214 * @str: pointer to parameter string 127 * @str: pointer to parameter string
@@ -1015,81 +928,6 @@ zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter)
1015 mempool_destroy(adapter->pool.data_gid_pn); 928 mempool_destroy(adapter->pool.data_gid_pn);
1016} 929}
1017 930
1018/**
1019 * zfcp_adapter_debug_register - registers debug feature for an adapter
1020 * @adapter: pointer to adapter for which debug features should be registered
1021 * return: -ENOMEM on error, 0 otherwise
1022 */
1023int
1024zfcp_adapter_debug_register(struct zfcp_adapter *adapter)
1025{
1026 char dbf_name[20];
1027
1028 /* debug feature area which records SCSI command failures (hostbyte) */
1029 spin_lock_init(&adapter->dbf_lock);
1030
1031 sprintf(dbf_name, ZFCP_CMD_DBF_NAME "%s",
1032 zfcp_get_busid_by_adapter(adapter));
1033 adapter->cmd_dbf = debug_register(dbf_name, ZFCP_CMD_DBF_INDEX,
1034 ZFCP_CMD_DBF_AREAS,
1035 ZFCP_CMD_DBF_LENGTH);
1036 debug_register_view(adapter->cmd_dbf, &debug_hex_ascii_view);
1037 debug_set_level(adapter->cmd_dbf, ZFCP_CMD_DBF_LEVEL);
1038
1039 /* debug feature area which records SCSI command aborts */
1040 sprintf(dbf_name, ZFCP_ABORT_DBF_NAME "%s",
1041 zfcp_get_busid_by_adapter(adapter));
1042 adapter->abort_dbf = debug_register(dbf_name, ZFCP_ABORT_DBF_INDEX,
1043 ZFCP_ABORT_DBF_AREAS,
1044 ZFCP_ABORT_DBF_LENGTH);
1045 debug_register_view(adapter->abort_dbf, &debug_hex_ascii_view);
1046 debug_set_level(adapter->abort_dbf, ZFCP_ABORT_DBF_LEVEL);
1047
1048 /* debug feature area which records incoming ELS commands */
1049 sprintf(dbf_name, ZFCP_IN_ELS_DBF_NAME "%s",
1050 zfcp_get_busid_by_adapter(adapter));
1051 adapter->in_els_dbf = debug_register(dbf_name, ZFCP_IN_ELS_DBF_INDEX,
1052 ZFCP_IN_ELS_DBF_AREAS,
1053 ZFCP_IN_ELS_DBF_LENGTH);
1054 debug_register_view(adapter->in_els_dbf, &debug_hex_ascii_view);
1055 debug_set_level(adapter->in_els_dbf, ZFCP_IN_ELS_DBF_LEVEL);
1056
1057 /* debug feature area which records erp events */
1058 sprintf(dbf_name, ZFCP_ERP_DBF_NAME "%s",
1059 zfcp_get_busid_by_adapter(adapter));
1060 adapter->erp_dbf = debug_register(dbf_name, ZFCP_ERP_DBF_INDEX,
1061 ZFCP_ERP_DBF_AREAS,
1062 ZFCP_ERP_DBF_LENGTH);
1063 debug_register_view(adapter->erp_dbf, &debug_hex_ascii_view);
1064 debug_set_level(adapter->erp_dbf, ZFCP_ERP_DBF_LEVEL);
1065
1066 if (!(adapter->cmd_dbf && adapter->abort_dbf &&
1067 adapter->in_els_dbf && adapter->erp_dbf)) {
1068 zfcp_adapter_debug_unregister(adapter);
1069 return -ENOMEM;
1070 }
1071
1072 return 0;
1073
1074}
1075
1076/**
1077 * zfcp_adapter_debug_unregister - unregisters debug feature for an adapter
1078 * @adapter: pointer to adapter for which debug features should be unregistered
1079 */
1080void
1081zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter)
1082{
1083 debug_unregister(adapter->abort_dbf);
1084 debug_unregister(adapter->cmd_dbf);
1085 debug_unregister(adapter->erp_dbf);
1086 debug_unregister(adapter->in_els_dbf);
1087 adapter->abort_dbf = NULL;
1088 adapter->cmd_dbf = NULL;
1089 adapter->erp_dbf = NULL;
1090 adapter->in_els_dbf = NULL;
1091}
1092
1093void 931void
1094zfcp_dummy_release(struct device *dev) 932zfcp_dummy_release(struct device *dev)
1095{ 933{
@@ -1460,10 +1298,6 @@ zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter,
1460 /* see FC-FS */ 1298 /* see FC-FS */
1461 no_entries = (fcp_rscn_head->payload_len / 4); 1299 no_entries = (fcp_rscn_head->payload_len / 4);
1462 1300
1463 zfcp_in_els_dbf_event(adapter, "##rscn", status_buffer,
1464 fcp_rscn_head->payload_len);
1465
1466 debug_text_event(adapter->erp_dbf, 1, "unsol_els_rscn:");
1467 for (i = 1; i < no_entries; i++) { 1301 for (i = 1; i < no_entries; i++) {
1468 /* skip head and start with 1st element */ 1302 /* skip head and start with 1st element */
1469 fcp_rscn_element++; 1303 fcp_rscn_element++;
@@ -1495,8 +1329,6 @@ zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter,
1495 (ZFCP_STATUS_PORT_DID_DID, &port->status)) { 1329 (ZFCP_STATUS_PORT_DID_DID, &port->status)) {
1496 ZFCP_LOG_INFO("incoming RSCN, trying to open " 1330 ZFCP_LOG_INFO("incoming RSCN, trying to open "
1497 "port 0x%016Lx\n", port->wwpn); 1331 "port 0x%016Lx\n", port->wwpn);
1498 debug_text_event(adapter->erp_dbf, 1,
1499 "unsol_els_rscnu:");
1500 zfcp_erp_port_reopen(port, 1332 zfcp_erp_port_reopen(port,
1501 ZFCP_STATUS_COMMON_ERP_FAILED); 1333 ZFCP_STATUS_COMMON_ERP_FAILED);
1502 continue; 1334 continue;
@@ -1522,8 +1354,6 @@ zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter,
1522 */ 1354 */
1523 ZFCP_LOG_INFO("incoming RSCN, trying to open " 1355 ZFCP_LOG_INFO("incoming RSCN, trying to open "
1524 "port 0x%016Lx\n", port->wwpn); 1356 "port 0x%016Lx\n", port->wwpn);
1525 debug_text_event(adapter->erp_dbf, 1,
1526 "unsol_els_rscnk:");
1527 zfcp_test_link(port); 1357 zfcp_test_link(port);
1528 } 1358 }
1529 } 1359 }
@@ -1539,8 +1369,6 @@ zfcp_fsf_incoming_els_plogi(struct zfcp_adapter *adapter,
1539 struct zfcp_port *port; 1369 struct zfcp_port *port;
1540 unsigned long flags; 1370 unsigned long flags;
1541 1371
1542 zfcp_in_els_dbf_event(adapter, "##plogi", status_buffer, 28);
1543
1544 read_lock_irqsave(&zfcp_data.config_lock, flags); 1372 read_lock_irqsave(&zfcp_data.config_lock, flags);
1545 list_for_each_entry(port, &adapter->port_list_head, list) { 1373 list_for_each_entry(port, &adapter->port_list_head, list) {
1546 if (port->wwpn == (*(wwn_t *) & els_logi->nport_wwn)) 1374 if (port->wwpn == (*(wwn_t *) & els_logi->nport_wwn))
@@ -1554,8 +1382,6 @@ zfcp_fsf_incoming_els_plogi(struct zfcp_adapter *adapter,
1554 status_buffer->d_id, 1382 status_buffer->d_id,
1555 zfcp_get_busid_by_adapter(adapter)); 1383 zfcp_get_busid_by_adapter(adapter));
1556 } else { 1384 } else {
1557 debug_text_event(adapter->erp_dbf, 1, "unsol_els_plogi:");
1558 debug_event(adapter->erp_dbf, 1, &els_logi->nport_wwn, 8);
1559 zfcp_erp_port_forced_reopen(port, 0); 1385 zfcp_erp_port_forced_reopen(port, 0);
1560 } 1386 }
1561} 1387}
@@ -1568,8 +1394,6 @@ zfcp_fsf_incoming_els_logo(struct zfcp_adapter *adapter,
1568 struct zfcp_port *port; 1394 struct zfcp_port *port;
1569 unsigned long flags; 1395 unsigned long flags;
1570 1396
1571 zfcp_in_els_dbf_event(adapter, "##logo", status_buffer, 16);
1572
1573 read_lock_irqsave(&zfcp_data.config_lock, flags); 1397 read_lock_irqsave(&zfcp_data.config_lock, flags);
1574 list_for_each_entry(port, &adapter->port_list_head, list) { 1398 list_for_each_entry(port, &adapter->port_list_head, list) {
1575 if (port->wwpn == els_logo->nport_wwpn) 1399 if (port->wwpn == els_logo->nport_wwpn)
@@ -1583,8 +1407,6 @@ zfcp_fsf_incoming_els_logo(struct zfcp_adapter *adapter,
1583 status_buffer->d_id, 1407 status_buffer->d_id,
1584 zfcp_get_busid_by_adapter(adapter)); 1408 zfcp_get_busid_by_adapter(adapter));
1585 } else { 1409 } else {
1586 debug_text_event(adapter->erp_dbf, 1, "unsol_els_logo:");
1587 debug_event(adapter->erp_dbf, 1, &els_logo->nport_wwpn, 8);
1588 zfcp_erp_port_forced_reopen(port, 0); 1410 zfcp_erp_port_forced_reopen(port, 0);
1589 } 1411 }
1590} 1412}
@@ -1593,7 +1415,6 @@ static void
1593zfcp_fsf_incoming_els_unknown(struct zfcp_adapter *adapter, 1415zfcp_fsf_incoming_els_unknown(struct zfcp_adapter *adapter,
1594 struct fsf_status_read_buffer *status_buffer) 1416 struct fsf_status_read_buffer *status_buffer)
1595{ 1417{
1596 zfcp_in_els_dbf_event(adapter, "##undef", status_buffer, 24);
1597 ZFCP_LOG_NORMAL("warning: unknown incoming ELS 0x%08x " 1418 ZFCP_LOG_NORMAL("warning: unknown incoming ELS 0x%08x "
1598 "for adapter %s\n", *(u32 *) (status_buffer->payload), 1419 "for adapter %s\n", *(u32 *) (status_buffer->payload),
1599 zfcp_get_busid_by_adapter(adapter)); 1420 zfcp_get_busid_by_adapter(adapter));
@@ -1611,6 +1432,7 @@ zfcp_fsf_incoming_els(struct zfcp_fsf_req *fsf_req)
1611 els_type = *(u32 *) (status_buffer->payload); 1432 els_type = *(u32 *) (status_buffer->payload);
1612 adapter = fsf_req->adapter; 1433 adapter = fsf_req->adapter;
1613 1434
1435 zfcp_san_dbf_event_incoming_els(fsf_req);
1614 if (els_type == LS_PLOGI) 1436 if (els_type == LS_PLOGI)
1615 zfcp_fsf_incoming_els_plogi(adapter, status_buffer); 1437 zfcp_fsf_incoming_els_plogi(adapter, status_buffer);
1616 else if (els_type == LS_LOGO) 1438 else if (els_type == LS_LOGO)