diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-18 14:25:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-18 14:25:31 -0400 |
commit | 2cca775baecbfede2fec20c99add709232311fe7 (patch) | |
tree | b0eefe80881d263ba7976174144ae4e9cf238425 /drivers/s390 | |
parent | eddeb0e2d863e3941d8768e70cb50c6120e61fa0 (diff) | |
parent | 94795b61e84994a3b058f92d041d1fb3d869c7d5 (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.c | 33 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_ccw.c | 24 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 1281 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.h | 228 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_def.h | 169 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_erp.c | 688 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_ext.h | 59 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fsf.c | 397 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_qdio.c | 7 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_scsi.c | 69 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_sysfs_adapter.c | 11 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_sysfs_port.c | 9 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_sysfs_unit.c | 5 |
13 files changed, 1448 insertions, 1532 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 874b55ed00a3..8c7e2b778ef1 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) | |||
1030 | 1030 | ||
1031 | /* initialize debug locks */ | 1031 | /* initialize debug locks */ |
1032 | 1032 | ||
1033 | spin_lock_init(&adapter->erp_dbf_lock); | ||
1034 | spin_lock_init(&adapter->hba_dbf_lock); | 1033 | spin_lock_init(&adapter->hba_dbf_lock); |
1035 | spin_lock_init(&adapter->san_dbf_lock); | 1034 | spin_lock_init(&adapter->san_dbf_lock); |
1036 | spin_lock_init(&adapter->scsi_dbf_lock); | 1035 | spin_lock_init(&adapter->scsi_dbf_lock); |
1036 | spin_lock_init(&adapter->rec_dbf_lock); | ||
1037 | 1037 | ||
1038 | retval = zfcp_adapter_debug_register(adapter); | 1038 | retval = zfcp_adapter_debug_register(adapter); |
1039 | if (retval) | 1039 | if (retval) |
@@ -1325,10 +1325,10 @@ zfcp_nameserver_enqueue(struct zfcp_adapter *adapter) | |||
1325 | 1325 | ||
1326 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_FC | 1326 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_FC |
1327 | 1327 | ||
1328 | static void | 1328 | static void zfcp_fsf_incoming_els_rscn(struct zfcp_fsf_req *fsf_req) |
1329 | zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter, | ||
1330 | struct fsf_status_read_buffer *status_buffer) | ||
1331 | { | 1329 | { |
1330 | struct fsf_status_read_buffer *status_buffer = (void*)fsf_req->data; | ||
1331 | struct zfcp_adapter *adapter = fsf_req->adapter; | ||
1332 | struct fcp_rscn_head *fcp_rscn_head; | 1332 | struct fcp_rscn_head *fcp_rscn_head; |
1333 | struct fcp_rscn_element *fcp_rscn_element; | 1333 | struct fcp_rscn_element *fcp_rscn_element; |
1334 | struct zfcp_port *port; | 1334 | struct zfcp_port *port; |
@@ -1375,7 +1375,8 @@ zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter, | |||
1375 | ZFCP_LOG_INFO("incoming RSCN, trying to open " | 1375 | ZFCP_LOG_INFO("incoming RSCN, trying to open " |
1376 | "port 0x%016Lx\n", port->wwpn); | 1376 | "port 0x%016Lx\n", port->wwpn); |
1377 | zfcp_erp_port_reopen(port, | 1377 | zfcp_erp_port_reopen(port, |
1378 | ZFCP_STATUS_COMMON_ERP_FAILED); | 1378 | ZFCP_STATUS_COMMON_ERP_FAILED, |
1379 | 82, fsf_req); | ||
1379 | continue; | 1380 | continue; |
1380 | } | 1381 | } |
1381 | 1382 | ||
@@ -1406,10 +1407,10 @@ zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter, | |||
1406 | } | 1407 | } |
1407 | } | 1408 | } |
1408 | 1409 | ||
1409 | static void | 1410 | static void zfcp_fsf_incoming_els_plogi(struct zfcp_fsf_req *fsf_req) |
1410 | zfcp_fsf_incoming_els_plogi(struct zfcp_adapter *adapter, | ||
1411 | struct fsf_status_read_buffer *status_buffer) | ||
1412 | { | 1411 | { |
1412 | struct fsf_status_read_buffer *status_buffer = (void*)fsf_req->data; | ||
1413 | struct zfcp_adapter *adapter = fsf_req->adapter; | ||
1413 | struct fsf_plogi *els_plogi; | 1414 | struct fsf_plogi *els_plogi; |
1414 | struct zfcp_port *port; | 1415 | struct zfcp_port *port; |
1415 | unsigned long flags; | 1416 | unsigned long flags; |
@@ -1428,14 +1429,14 @@ zfcp_fsf_incoming_els_plogi(struct zfcp_adapter *adapter, | |||
1428 | status_buffer->d_id, | 1429 | status_buffer->d_id, |
1429 | zfcp_get_busid_by_adapter(adapter)); | 1430 | zfcp_get_busid_by_adapter(adapter)); |
1430 | } else { | 1431 | } else { |
1431 | zfcp_erp_port_forced_reopen(port, 0); | 1432 | zfcp_erp_port_forced_reopen(port, 0, 83, fsf_req); |
1432 | } | 1433 | } |
1433 | } | 1434 | } |
1434 | 1435 | ||
1435 | static void | 1436 | static void zfcp_fsf_incoming_els_logo(struct zfcp_fsf_req *fsf_req) |
1436 | zfcp_fsf_incoming_els_logo(struct zfcp_adapter *adapter, | ||
1437 | struct fsf_status_read_buffer *status_buffer) | ||
1438 | { | 1437 | { |
1438 | struct fsf_status_read_buffer *status_buffer = (void*)fsf_req->data; | ||
1439 | struct zfcp_adapter *adapter = fsf_req->adapter; | ||
1439 | struct fcp_logo *els_logo = (struct fcp_logo *) status_buffer->payload; | 1440 | struct fcp_logo *els_logo = (struct fcp_logo *) status_buffer->payload; |
1440 | struct zfcp_port *port; | 1441 | struct zfcp_port *port; |
1441 | unsigned long flags; | 1442 | unsigned long flags; |
@@ -1453,7 +1454,7 @@ zfcp_fsf_incoming_els_logo(struct zfcp_adapter *adapter, | |||
1453 | status_buffer->d_id, | 1454 | status_buffer->d_id, |
1454 | zfcp_get_busid_by_adapter(adapter)); | 1455 | zfcp_get_busid_by_adapter(adapter)); |
1455 | } else { | 1456 | } else { |
1456 | zfcp_erp_port_forced_reopen(port, 0); | 1457 | zfcp_erp_port_forced_reopen(port, 0, 84, fsf_req); |
1457 | } | 1458 | } |
1458 | } | 1459 | } |
1459 | 1460 | ||
@@ -1480,12 +1481,12 @@ zfcp_fsf_incoming_els(struct zfcp_fsf_req *fsf_req) | |||
1480 | 1481 | ||
1481 | zfcp_san_dbf_event_incoming_els(fsf_req); | 1482 | zfcp_san_dbf_event_incoming_els(fsf_req); |
1482 | if (els_type == LS_PLOGI) | 1483 | if (els_type == LS_PLOGI) |
1483 | zfcp_fsf_incoming_els_plogi(adapter, status_buffer); | 1484 | zfcp_fsf_incoming_els_plogi(fsf_req); |
1484 | else if (els_type == LS_LOGO) | 1485 | else if (els_type == LS_LOGO) |
1485 | zfcp_fsf_incoming_els_logo(adapter, status_buffer); | 1486 | zfcp_fsf_incoming_els_logo(fsf_req); |
1486 | else if ((els_type & 0xffff0000) == LS_RSCN) | 1487 | else if ((els_type & 0xffff0000) == LS_RSCN) |
1487 | /* we are only concerned with the command, not the length */ | 1488 | /* we are only concerned with the command, not the length */ |
1488 | zfcp_fsf_incoming_els_rscn(adapter, status_buffer); | 1489 | zfcp_fsf_incoming_els_rscn(fsf_req); |
1489 | else | 1490 | else |
1490 | zfcp_fsf_incoming_els_unknown(adapter, status_buffer); | 1491 | zfcp_fsf_incoming_els_unknown(adapter, status_buffer); |
1491 | } | 1492 | } |
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c index edc5015e920d..66d3b88844b0 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) | |||
170 | BUG_ON(!zfcp_reqlist_isempty(adapter)); | 170 | BUG_ON(!zfcp_reqlist_isempty(adapter)); |
171 | adapter->req_no = 0; | 171 | adapter->req_no = 0; |
172 | 172 | ||
173 | zfcp_erp_modify_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING, | 173 | zfcp_erp_modify_adapter_status(adapter, 10, NULL, |
174 | ZFCP_SET); | 174 | ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); |
175 | zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED); | 175 | zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 85, |
176 | NULL); | ||
176 | zfcp_erp_wait(adapter); | 177 | zfcp_erp_wait(adapter); |
177 | goto out; | 178 | goto out; |
178 | 179 | ||
@@ -197,7 +198,7 @@ zfcp_ccw_set_offline(struct ccw_device *ccw_device) | |||
197 | 198 | ||
198 | down(&zfcp_data.config_sema); | 199 | down(&zfcp_data.config_sema); |
199 | adapter = dev_get_drvdata(&ccw_device->dev); | 200 | adapter = dev_get_drvdata(&ccw_device->dev); |
200 | zfcp_erp_adapter_shutdown(adapter, 0); | 201 | zfcp_erp_adapter_shutdown(adapter, 0, 86, NULL); |
201 | zfcp_erp_wait(adapter); | 202 | zfcp_erp_wait(adapter); |
202 | zfcp_erp_thread_kill(adapter); | 203 | zfcp_erp_thread_kill(adapter); |
203 | up(&zfcp_data.config_sema); | 204 | up(&zfcp_data.config_sema); |
@@ -223,24 +224,21 @@ zfcp_ccw_notify(struct ccw_device *ccw_device, int event) | |||
223 | case CIO_GONE: | 224 | case CIO_GONE: |
224 | ZFCP_LOG_NORMAL("adapter %s: device gone\n", | 225 | ZFCP_LOG_NORMAL("adapter %s: device gone\n", |
225 | zfcp_get_busid_by_adapter(adapter)); | 226 | zfcp_get_busid_by_adapter(adapter)); |
226 | debug_text_event(adapter->erp_dbf,1,"dev_gone"); | 227 | zfcp_erp_adapter_shutdown(adapter, 0, 87, NULL); |
227 | zfcp_erp_adapter_shutdown(adapter, 0); | ||
228 | break; | 228 | break; |
229 | case CIO_NO_PATH: | 229 | case CIO_NO_PATH: |
230 | ZFCP_LOG_NORMAL("adapter %s: no path\n", | 230 | ZFCP_LOG_NORMAL("adapter %s: no path\n", |
231 | zfcp_get_busid_by_adapter(adapter)); | 231 | zfcp_get_busid_by_adapter(adapter)); |
232 | debug_text_event(adapter->erp_dbf,1,"no_path"); | 232 | zfcp_erp_adapter_shutdown(adapter, 0, 88, NULL); |
233 | zfcp_erp_adapter_shutdown(adapter, 0); | ||
234 | break; | 233 | break; |
235 | case CIO_OPER: | 234 | case CIO_OPER: |
236 | ZFCP_LOG_NORMAL("adapter %s: operational again\n", | 235 | ZFCP_LOG_NORMAL("adapter %s: operational again\n", |
237 | zfcp_get_busid_by_adapter(adapter)); | 236 | zfcp_get_busid_by_adapter(adapter)); |
238 | debug_text_event(adapter->erp_dbf,1,"dev_oper"); | 237 | zfcp_erp_modify_adapter_status(adapter, 11, NULL, |
239 | zfcp_erp_modify_adapter_status(adapter, | ||
240 | ZFCP_STATUS_COMMON_RUNNING, | 238 | ZFCP_STATUS_COMMON_RUNNING, |
241 | ZFCP_SET); | 239 | ZFCP_SET); |
242 | zfcp_erp_adapter_reopen(adapter, | 240 | zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, |
243 | ZFCP_STATUS_COMMON_ERP_FAILED); | 241 | 89, NULL); |
244 | break; | 242 | break; |
245 | } | 243 | } |
246 | zfcp_erp_wait(adapter); | 244 | zfcp_erp_wait(adapter); |
@@ -272,7 +270,7 @@ zfcp_ccw_shutdown(struct ccw_device *cdev) | |||
272 | 270 | ||
273 | down(&zfcp_data.config_sema); | 271 | down(&zfcp_data.config_sema); |
274 | adapter = dev_get_drvdata(&cdev->dev); | 272 | adapter = dev_get_drvdata(&cdev->dev); |
275 | zfcp_erp_adapter_shutdown(adapter, 0); | 273 | zfcp_erp_adapter_shutdown(adapter, 0, 90, NULL); |
276 | zfcp_erp_wait(adapter); | 274 | zfcp_erp_wait(adapter); |
277 | up(&zfcp_data.config_sema); | 275 | up(&zfcp_data.config_sema); |
278 | } | 276 | } |
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index 701046c9bb33..37b85c67b11d 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c | |||
@@ -31,123 +31,128 @@ MODULE_PARM_DESC(dbfsize, | |||
31 | 31 | ||
32 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER | 32 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER |
33 | 33 | ||
34 | static int | 34 | static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len, |
35 | zfcp_dbf_stck(char *out_buf, const char *label, unsigned long long stck) | 35 | int level, char *from, int from_len) |
36 | { | ||
37 | int offset; | ||
38 | struct zfcp_dbf_dump *dump = to; | ||
39 | int room = to_len - sizeof(*dump); | ||
40 | |||
41 | for (offset = 0; offset < from_len; offset += dump->size) { | ||
42 | memset(to, 0, to_len); | ||
43 | strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE); | ||
44 | dump->total_size = from_len; | ||
45 | dump->offset = offset; | ||
46 | dump->size = min(from_len - offset, room); | ||
47 | memcpy(dump->data, from + offset, dump->size); | ||
48 | debug_event(dbf, level, dump, dump->size); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | /* FIXME: this duplicate this code in s390 debug feature */ | ||
53 | static void zfcp_dbf_timestamp(unsigned long long stck, struct timespec *time) | ||
36 | { | 54 | { |
37 | unsigned long long sec; | 55 | unsigned long long sec; |
38 | struct timespec dbftime; | ||
39 | int len = 0; | ||
40 | 56 | ||
41 | stck -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096); | 57 | stck -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096); |
42 | sec = stck >> 12; | 58 | sec = stck >> 12; |
43 | do_div(sec, 1000000); | 59 | do_div(sec, 1000000); |
44 | dbftime.tv_sec = sec; | 60 | time->tv_sec = sec; |
45 | stck -= (sec * 1000000) << 12; | 61 | stck -= (sec * 1000000) << 12; |
46 | dbftime.tv_nsec = ((stck * 1000) >> 12); | 62 | time->tv_nsec = ((stck * 1000) >> 12); |
47 | len += sprintf(out_buf + len, "%-24s%011lu:%06lu\n", | ||
48 | label, dbftime.tv_sec, dbftime.tv_nsec); | ||
49 | |||
50 | return len; | ||
51 | } | 63 | } |
52 | 64 | ||
53 | static int zfcp_dbf_tag(char *out_buf, const char *label, const char *tag) | 65 | static void zfcp_dbf_tag(char **p, const char *label, const char *tag) |
54 | { | 66 | { |
55 | int len = 0, i; | 67 | int i; |
56 | 68 | ||
57 | len += sprintf(out_buf + len, "%-24s", label); | 69 | *p += sprintf(*p, "%-24s", label); |
58 | for (i = 0; i < ZFCP_DBF_TAG_SIZE; i++) | 70 | for (i = 0; i < ZFCP_DBF_TAG_SIZE; i++) |
59 | len += sprintf(out_buf + len, "%c", tag[i]); | 71 | *p += sprintf(*p, "%c", tag[i]); |
60 | len += sprintf(out_buf + len, "\n"); | 72 | *p += sprintf(*p, "\n"); |
73 | } | ||
61 | 74 | ||
62 | return len; | 75 | static void zfcp_dbf_outs(char **buf, const char *s1, const char *s2) |
76 | { | ||
77 | *buf += sprintf(*buf, "%-24s%s\n", s1, s2); | ||
63 | } | 78 | } |
64 | 79 | ||
65 | static int | 80 | static void zfcp_dbf_out(char **buf, const char *s, const char *format, ...) |
66 | zfcp_dbf_view(char *out_buf, const char *label, const char *format, ...) | ||
67 | { | 81 | { |
68 | va_list arg; | 82 | va_list arg; |
69 | int len = 0; | ||
70 | 83 | ||
71 | len += sprintf(out_buf + len, "%-24s", label); | 84 | *buf += sprintf(*buf, "%-24s", s); |
72 | va_start(arg, format); | 85 | va_start(arg, format); |
73 | len += vsprintf(out_buf + len, format, arg); | 86 | *buf += vsprintf(*buf, format, arg); |
74 | va_end(arg); | 87 | va_end(arg); |
75 | len += sprintf(out_buf + len, "\n"); | 88 | *buf += sprintf(*buf, "\n"); |
76 | |||
77 | return len; | ||
78 | } | 89 | } |
79 | 90 | ||
80 | static int | 91 | static void zfcp_dbf_outd(char **p, const char *label, char *buffer, |
81 | zfcp_dbf_view_dump(char *out_buf, const char *label, | 92 | int buflen, int offset, int total_size) |
82 | char *buffer, int buflen, int offset, int total_size) | ||
83 | { | 93 | { |
84 | int len = 0; | 94 | if (!offset) |
85 | 95 | *p += sprintf(*p, "%-24s ", label); | |
86 | if (offset == 0) | ||
87 | len += sprintf(out_buf + len, "%-24s ", label); | ||
88 | |||
89 | while (buflen--) { | 96 | while (buflen--) { |
90 | if (offset > 0) { | 97 | if (offset > 0) { |
91 | if ((offset % 32) == 0) | 98 | if ((offset % 32) == 0) |
92 | len += sprintf(out_buf + len, "\n%-24c ", ' '); | 99 | *p += sprintf(*p, "\n%-24c ", ' '); |
93 | else if ((offset % 4) == 0) | 100 | else if ((offset % 4) == 0) |
94 | len += sprintf(out_buf + len, " "); | 101 | *p += sprintf(*p, " "); |
95 | } | 102 | } |
96 | len += sprintf(out_buf + len, "%02x", *buffer++); | 103 | *p += sprintf(*p, "%02x", *buffer++); |
97 | if (++offset == total_size) { | 104 | if (++offset == total_size) { |
98 | len += sprintf(out_buf + len, "\n"); | 105 | *p += sprintf(*p, "\n"); |
99 | break; | 106 | break; |
100 | } | 107 | } |
101 | } | 108 | } |
102 | 109 | if (!total_size) | |
103 | if (total_size == 0) | 110 | *p += sprintf(*p, "\n"); |
104 | len += sprintf(out_buf + len, "\n"); | ||
105 | |||
106 | return len; | ||
107 | } | 111 | } |
108 | 112 | ||
109 | static int | 113 | static int zfcp_dbf_view_header(debug_info_t *id, struct debug_view *view, |
110 | zfcp_dbf_view_header(debug_info_t * id, struct debug_view *view, int area, | 114 | int area, debug_entry_t *entry, char *out_buf) |
111 | debug_entry_t * entry, char *out_buf) | ||
112 | { | 115 | { |
113 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry); | 116 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry); |
114 | int len = 0; | 117 | struct timespec t; |
118 | char *p = out_buf; | ||
115 | 119 | ||
116 | if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) { | 120 | if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) { |
117 | len += zfcp_dbf_stck(out_buf + len, "timestamp", | 121 | zfcp_dbf_timestamp(entry->id.stck, &t); |
118 | entry->id.stck); | 122 | zfcp_dbf_out(&p, "timestamp", "%011lu:%06lu", |
119 | len += zfcp_dbf_view(out_buf + len, "cpu", "%02i", | 123 | t.tv_sec, t.tv_nsec); |
120 | entry->id.fields.cpuid); | 124 | zfcp_dbf_out(&p, "cpu", "%02i", entry->id.fields.cpuid); |
121 | } else { | 125 | } else { |
122 | len += zfcp_dbf_view_dump(out_buf + len, NULL, | 126 | zfcp_dbf_outd(&p, NULL, dump->data, dump->size, dump->offset, |
123 | dump->data, | 127 | dump->total_size); |
124 | dump->size, | ||
125 | dump->offset, dump->total_size); | ||
126 | if ((dump->offset + dump->size) == dump->total_size) | 128 | if ((dump->offset + dump->size) == dump->total_size) |
127 | len += sprintf(out_buf + len, "\n"); | 129 | p += sprintf(p, "\n"); |
128 | } | 130 | } |
129 | 131 | return p - out_buf; | |
130 | return len; | ||
131 | } | 132 | } |
132 | 133 | ||
134 | /** | ||
135 | * zfcp_hba_dbf_event_fsf_response - trace event for request completion | ||
136 | * @fsf_req: request that has been completed | ||
137 | */ | ||
133 | void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) | 138 | void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) |
134 | { | 139 | { |
135 | struct zfcp_adapter *adapter = fsf_req->adapter; | 140 | struct zfcp_adapter *adapter = fsf_req->adapter; |
136 | struct fsf_qtcb *qtcb = fsf_req->qtcb; | 141 | struct fsf_qtcb *qtcb = fsf_req->qtcb; |
137 | union fsf_prot_status_qual *prot_status_qual = | 142 | union fsf_prot_status_qual *prot_status_qual = |
138 | &qtcb->prefix.prot_status_qual; | 143 | &qtcb->prefix.prot_status_qual; |
139 | union fsf_status_qual *fsf_status_qual = &qtcb->header.fsf_status_qual; | 144 | union fsf_status_qual *fsf_status_qual = &qtcb->header.fsf_status_qual; |
140 | struct scsi_cmnd *scsi_cmnd; | 145 | struct scsi_cmnd *scsi_cmnd; |
141 | struct zfcp_port *port; | 146 | struct zfcp_port *port; |
142 | struct zfcp_unit *unit; | 147 | struct zfcp_unit *unit; |
143 | struct zfcp_send_els *send_els; | 148 | struct zfcp_send_els *send_els; |
144 | struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; | 149 | struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; |
145 | struct zfcp_hba_dbf_record_response *response = &rec->type.response; | 150 | struct zfcp_hba_dbf_record_response *response = &rec->u.response; |
146 | int level; | 151 | int level; |
147 | unsigned long flags; | 152 | unsigned long flags; |
148 | 153 | ||
149 | spin_lock_irqsave(&adapter->hba_dbf_lock, flags); | 154 | spin_lock_irqsave(&adapter->hba_dbf_lock, flags); |
150 | memset(rec, 0, sizeof(struct zfcp_hba_dbf_record)); | 155 | memset(rec, 0, sizeof(*rec)); |
151 | strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE); | 156 | strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE); |
152 | 157 | ||
153 | if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) && | 158 | 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) | |||
161 | (fsf_req->fsf_command == FSF_QTCB_OPEN_LUN)) { | 166 | (fsf_req->fsf_command == FSF_QTCB_OPEN_LUN)) { |
162 | strncpy(rec->tag2, "open", ZFCP_DBF_TAG_SIZE); | 167 | strncpy(rec->tag2, "open", ZFCP_DBF_TAG_SIZE); |
163 | level = 4; | 168 | level = 4; |
169 | } else if (qtcb->header.log_length) { | ||
170 | strncpy(rec->tag2, "qtcb", ZFCP_DBF_TAG_SIZE); | ||
171 | level = 5; | ||
164 | } else { | 172 | } else { |
165 | strncpy(rec->tag2, "norm", ZFCP_DBF_TAG_SIZE); | 173 | strncpy(rec->tag2, "norm", ZFCP_DBF_TAG_SIZE); |
166 | level = 6; | 174 | level = 6; |
@@ -188,11 +196,9 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) | |||
188 | if (fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) | 196 | if (fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) |
189 | break; | 197 | break; |
190 | scsi_cmnd = (struct scsi_cmnd *)fsf_req->data; | 198 | scsi_cmnd = (struct scsi_cmnd *)fsf_req->data; |
191 | if (scsi_cmnd != NULL) { | 199 | if (scsi_cmnd) { |
192 | response->data.send_fcp.scsi_cmnd | 200 | response->u.fcp.cmnd = (unsigned long)scsi_cmnd; |
193 | = (unsigned long)scsi_cmnd; | 201 | response->u.fcp.serial = scsi_cmnd->serial_number; |
194 | response->data.send_fcp.scsi_serial | ||
195 | = scsi_cmnd->serial_number; | ||
196 | } | 202 | } |
197 | break; | 203 | break; |
198 | 204 | ||
@@ -200,25 +206,25 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) | |||
200 | case FSF_QTCB_CLOSE_PORT: | 206 | case FSF_QTCB_CLOSE_PORT: |
201 | case FSF_QTCB_CLOSE_PHYSICAL_PORT: | 207 | case FSF_QTCB_CLOSE_PHYSICAL_PORT: |
202 | port = (struct zfcp_port *)fsf_req->data; | 208 | port = (struct zfcp_port *)fsf_req->data; |
203 | response->data.port.wwpn = port->wwpn; | 209 | response->u.port.wwpn = port->wwpn; |
204 | response->data.port.d_id = port->d_id; | 210 | response->u.port.d_id = port->d_id; |
205 | response->data.port.port_handle = qtcb->header.port_handle; | 211 | response->u.port.port_handle = qtcb->header.port_handle; |
206 | break; | 212 | break; |
207 | 213 | ||
208 | case FSF_QTCB_OPEN_LUN: | 214 | case FSF_QTCB_OPEN_LUN: |
209 | case FSF_QTCB_CLOSE_LUN: | 215 | case FSF_QTCB_CLOSE_LUN: |
210 | unit = (struct zfcp_unit *)fsf_req->data; | 216 | unit = (struct zfcp_unit *)fsf_req->data; |
211 | port = unit->port; | 217 | port = unit->port; |
212 | response->data.unit.wwpn = port->wwpn; | 218 | response->u.unit.wwpn = port->wwpn; |
213 | response->data.unit.fcp_lun = unit->fcp_lun; | 219 | response->u.unit.fcp_lun = unit->fcp_lun; |
214 | response->data.unit.port_handle = qtcb->header.port_handle; | 220 | response->u.unit.port_handle = qtcb->header.port_handle; |
215 | response->data.unit.lun_handle = qtcb->header.lun_handle; | 221 | response->u.unit.lun_handle = qtcb->header.lun_handle; |
216 | break; | 222 | break; |
217 | 223 | ||
218 | case FSF_QTCB_SEND_ELS: | 224 | case FSF_QTCB_SEND_ELS: |
219 | send_els = (struct zfcp_send_els *)fsf_req->data; | 225 | send_els = (struct zfcp_send_els *)fsf_req->data; |
220 | response->data.send_els.d_id = qtcb->bottom.support.d_id; | 226 | response->u.els.d_id = qtcb->bottom.support.d_id; |
221 | response->data.send_els.ls_code = send_els->ls_code >> 24; | 227 | response->u.els.ls_code = send_els->ls_code >> 24; |
222 | break; | 228 | break; |
223 | 229 | ||
224 | case FSF_QTCB_ABORT_FCP_CMND: | 230 | case FSF_QTCB_ABORT_FCP_CMND: |
@@ -230,39 +236,54 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) | |||
230 | break; | 236 | break; |
231 | } | 237 | } |
232 | 238 | ||
233 | debug_event(adapter->hba_dbf, level, | 239 | debug_event(adapter->hba_dbf, level, rec, sizeof(*rec)); |
234 | rec, sizeof(struct zfcp_hba_dbf_record)); | 240 | |
241 | /* have fcp channel microcode fixed to use as little as possible */ | ||
242 | if (fsf_req->fsf_command != FSF_QTCB_FCP_CMND) { | ||
243 | /* adjust length skipping trailing zeros */ | ||
244 | char *buf = (char *)qtcb + qtcb->header.log_start; | ||
245 | int len = qtcb->header.log_length; | ||
246 | for (; len && !buf[len - 1]; len--); | ||
247 | zfcp_dbf_hexdump(adapter->hba_dbf, rec, sizeof(*rec), level, | ||
248 | buf, len); | ||
249 | } | ||
250 | |||
235 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); | 251 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); |
236 | } | 252 | } |
237 | 253 | ||
238 | void | 254 | /** |
239 | zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter, | 255 | * zfcp_hba_dbf_event_fsf_unsol - trace event for an unsolicited status buffer |
240 | struct fsf_status_read_buffer *status_buffer) | 256 | * @tag: tag indicating which kind of unsolicited status has been received |
257 | * @adapter: adapter that has issued the unsolicited status buffer | ||
258 | * @status_buffer: buffer containing payload of unsolicited status | ||
259 | */ | ||
260 | void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter, | ||
261 | struct fsf_status_read_buffer *status_buffer) | ||
241 | { | 262 | { |
242 | struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; | 263 | struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; |
243 | unsigned long flags; | 264 | unsigned long flags; |
244 | 265 | ||
245 | spin_lock_irqsave(&adapter->hba_dbf_lock, flags); | 266 | spin_lock_irqsave(&adapter->hba_dbf_lock, flags); |
246 | memset(rec, 0, sizeof(struct zfcp_hba_dbf_record)); | 267 | memset(rec, 0, sizeof(*rec)); |
247 | strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE); | 268 | strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE); |
248 | strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE); | 269 | strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE); |
249 | 270 | ||
250 | rec->type.status.failed = adapter->status_read_failed; | 271 | rec->u.status.failed = adapter->status_read_failed; |
251 | if (status_buffer != NULL) { | 272 | if (status_buffer != NULL) { |
252 | rec->type.status.status_type = status_buffer->status_type; | 273 | rec->u.status.status_type = status_buffer->status_type; |
253 | rec->type.status.status_subtype = status_buffer->status_subtype; | 274 | rec->u.status.status_subtype = status_buffer->status_subtype; |
254 | memcpy(&rec->type.status.queue_designator, | 275 | memcpy(&rec->u.status.queue_designator, |
255 | &status_buffer->queue_designator, | 276 | &status_buffer->queue_designator, |
256 | sizeof(struct fsf_queue_designator)); | 277 | sizeof(struct fsf_queue_designator)); |
257 | 278 | ||
258 | switch (status_buffer->status_type) { | 279 | switch (status_buffer->status_type) { |
259 | case FSF_STATUS_READ_SENSE_DATA_AVAIL: | 280 | case FSF_STATUS_READ_SENSE_DATA_AVAIL: |
260 | rec->type.status.payload_size = | 281 | rec->u.status.payload_size = |
261 | ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL; | 282 | ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL; |
262 | break; | 283 | break; |
263 | 284 | ||
264 | case FSF_STATUS_READ_BIT_ERROR_THRESHOLD: | 285 | case FSF_STATUS_READ_BIT_ERROR_THRESHOLD: |
265 | rec->type.status.payload_size = | 286 | rec->u.status.payload_size = |
266 | ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD; | 287 | ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD; |
267 | break; | 288 | break; |
268 | 289 | ||
@@ -270,119 +291,101 @@ zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter, | |||
270 | switch (status_buffer->status_subtype) { | 291 | switch (status_buffer->status_subtype) { |
271 | case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: | 292 | case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: |
272 | case FSF_STATUS_READ_SUB_FDISC_FAILED: | 293 | case FSF_STATUS_READ_SUB_FDISC_FAILED: |
273 | rec->type.status.payload_size = | 294 | rec->u.status.payload_size = |
274 | sizeof(struct fsf_link_down_info); | 295 | sizeof(struct fsf_link_down_info); |
275 | } | 296 | } |
276 | break; | 297 | break; |
277 | 298 | ||
278 | case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: | 299 | case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: |
279 | rec->type.status.payload_size = | 300 | rec->u.status.payload_size = |
280 | ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT; | 301 | ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT; |
281 | break; | 302 | break; |
282 | } | 303 | } |
283 | memcpy(&rec->type.status.payload, | 304 | memcpy(&rec->u.status.payload, |
284 | &status_buffer->payload, rec->type.status.payload_size); | 305 | &status_buffer->payload, rec->u.status.payload_size); |
285 | } | 306 | } |
286 | 307 | ||
287 | debug_event(adapter->hba_dbf, 2, | 308 | debug_event(adapter->hba_dbf, 2, rec, sizeof(*rec)); |
288 | rec, sizeof(struct zfcp_hba_dbf_record)); | ||
289 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); | 309 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); |
290 | } | 310 | } |
291 | 311 | ||
292 | void | 312 | /** |
293 | zfcp_hba_dbf_event_qdio(struct zfcp_adapter *adapter, unsigned int status, | 313 | * zfcp_hba_dbf_event_qdio - trace event for QDIO related failure |
294 | unsigned int qdio_error, unsigned int siga_error, | 314 | * @adapter: adapter affected by this QDIO related event |
295 | int sbal_index, int sbal_count) | 315 | * @status: as passed by qdio module |
316 | * @qdio_error: as passed by qdio module | ||
317 | * @siga_error: as passed by qdio module | ||
318 | * @sbal_index: first buffer with error condition, as passed by qdio module | ||
319 | * @sbal_count: number of buffers affected, as passed by qdio module | ||
320 | */ | ||
321 | void zfcp_hba_dbf_event_qdio(struct zfcp_adapter *adapter, unsigned int status, | ||
322 | unsigned int qdio_error, unsigned int siga_error, | ||
323 | int sbal_index, int sbal_count) | ||
296 | { | 324 | { |
297 | struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; | 325 | struct zfcp_hba_dbf_record *r = &adapter->hba_dbf_buf; |
298 | unsigned long flags; | 326 | unsigned long flags; |
299 | 327 | ||
300 | spin_lock_irqsave(&adapter->hba_dbf_lock, flags); | 328 | spin_lock_irqsave(&adapter->hba_dbf_lock, flags); |
301 | memset(rec, 0, sizeof(struct zfcp_hba_dbf_record)); | 329 | memset(r, 0, sizeof(*r)); |
302 | strncpy(rec->tag, "qdio", ZFCP_DBF_TAG_SIZE); | 330 | strncpy(r->tag, "qdio", ZFCP_DBF_TAG_SIZE); |
303 | rec->type.qdio.status = status; | 331 | r->u.qdio.status = status; |
304 | rec->type.qdio.qdio_error = qdio_error; | 332 | r->u.qdio.qdio_error = qdio_error; |
305 | rec->type.qdio.siga_error = siga_error; | 333 | r->u.qdio.siga_error = siga_error; |
306 | rec->type.qdio.sbal_index = sbal_index; | 334 | r->u.qdio.sbal_index = sbal_index; |
307 | rec->type.qdio.sbal_count = sbal_count; | 335 | r->u.qdio.sbal_count = sbal_count; |
308 | debug_event(adapter->hba_dbf, 0, | 336 | debug_event(adapter->hba_dbf, 0, r, sizeof(*r)); |
309 | rec, sizeof(struct zfcp_hba_dbf_record)); | ||
310 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); | 337 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); |
311 | } | 338 | } |
312 | 339 | ||
313 | static int | 340 | static void zfcp_hba_dbf_view_response(char **p, |
314 | zfcp_hba_dbf_view_response(char *out_buf, | 341 | struct zfcp_hba_dbf_record_response *r) |
315 | struct zfcp_hba_dbf_record_response *rec) | 342 | { |
316 | { | 343 | struct timespec t; |
317 | int len = 0; | 344 | |
318 | 345 | zfcp_dbf_out(p, "fsf_command", "0x%08x", r->fsf_command); | |
319 | len += zfcp_dbf_view(out_buf + len, "fsf_command", "0x%08x", | 346 | zfcp_dbf_out(p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); |
320 | rec->fsf_command); | 347 | zfcp_dbf_out(p, "fsf_seqno", "0x%08x", r->fsf_seqno); |
321 | len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx", | 348 | zfcp_dbf_timestamp(r->fsf_issued, &t); |
322 | rec->fsf_reqid); | 349 | zfcp_dbf_out(p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec); |
323 | len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x", | 350 | zfcp_dbf_out(p, "fsf_prot_status", "0x%08x", r->fsf_prot_status); |
324 | rec->fsf_seqno); | 351 | zfcp_dbf_out(p, "fsf_status", "0x%08x", r->fsf_status); |
325 | len += zfcp_dbf_stck(out_buf + len, "fsf_issued", rec->fsf_issued); | 352 | zfcp_dbf_outd(p, "fsf_prot_status_qual", r->fsf_prot_status_qual, |
326 | len += zfcp_dbf_view(out_buf + len, "fsf_prot_status", "0x%08x", | 353 | FSF_PROT_STATUS_QUAL_SIZE, 0, FSF_PROT_STATUS_QUAL_SIZE); |
327 | rec->fsf_prot_status); | 354 | zfcp_dbf_outd(p, "fsf_status_qual", r->fsf_status_qual, |
328 | len += zfcp_dbf_view(out_buf + len, "fsf_status", "0x%08x", | 355 | FSF_STATUS_QUALIFIER_SIZE, 0, FSF_STATUS_QUALIFIER_SIZE); |
329 | rec->fsf_status); | 356 | zfcp_dbf_out(p, "fsf_req_status", "0x%08x", r->fsf_req_status); |
330 | len += zfcp_dbf_view_dump(out_buf + len, "fsf_prot_status_qual", | 357 | zfcp_dbf_out(p, "sbal_first", "0x%02x", r->sbal_first); |
331 | rec->fsf_prot_status_qual, | 358 | zfcp_dbf_out(p, "sbal_curr", "0x%02x", r->sbal_curr); |
332 | FSF_PROT_STATUS_QUAL_SIZE, | 359 | zfcp_dbf_out(p, "sbal_last", "0x%02x", r->sbal_last); |
333 | 0, FSF_PROT_STATUS_QUAL_SIZE); | 360 | zfcp_dbf_out(p, "pool", "0x%02x", r->pool); |
334 | len += zfcp_dbf_view_dump(out_buf + len, "fsf_status_qual", | 361 | |
335 | rec->fsf_status_qual, | 362 | switch (r->fsf_command) { |
336 | FSF_STATUS_QUALIFIER_SIZE, | ||
337 | 0, FSF_STATUS_QUALIFIER_SIZE); | ||
338 | len += zfcp_dbf_view(out_buf + len, "fsf_req_status", "0x%08x", | ||
339 | rec->fsf_req_status); | ||
340 | len += zfcp_dbf_view(out_buf + len, "sbal_first", "0x%02x", | ||
341 | rec->sbal_first); | ||
342 | len += zfcp_dbf_view(out_buf + len, "sbal_curr", "0x%02x", | ||
343 | rec->sbal_curr); | ||
344 | len += zfcp_dbf_view(out_buf + len, "sbal_last", "0x%02x", | ||
345 | rec->sbal_last); | ||
346 | len += zfcp_dbf_view(out_buf + len, "pool", "0x%02x", rec->pool); | ||
347 | |||
348 | switch (rec->fsf_command) { | ||
349 | case FSF_QTCB_FCP_CMND: | 363 | case FSF_QTCB_FCP_CMND: |
350 | if (rec->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) | 364 | if (r->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) |
351 | break; | 365 | break; |
352 | len += zfcp_dbf_view(out_buf + len, "scsi_cmnd", "0x%0Lx", | 366 | zfcp_dbf_out(p, "scsi_cmnd", "0x%0Lx", r->u.fcp.cmnd); |
353 | rec->data.send_fcp.scsi_cmnd); | 367 | zfcp_dbf_out(p, "scsi_serial", "0x%016Lx", r->u.fcp.serial); |
354 | len += zfcp_dbf_view(out_buf + len, "scsi_serial", "0x%016Lx", | ||
355 | rec->data.send_fcp.scsi_serial); | ||
356 | break; | 368 | break; |
357 | 369 | ||
358 | case FSF_QTCB_OPEN_PORT_WITH_DID: | 370 | case FSF_QTCB_OPEN_PORT_WITH_DID: |
359 | case FSF_QTCB_CLOSE_PORT: | 371 | case FSF_QTCB_CLOSE_PORT: |
360 | case FSF_QTCB_CLOSE_PHYSICAL_PORT: | 372 | case FSF_QTCB_CLOSE_PHYSICAL_PORT: |
361 | len += zfcp_dbf_view(out_buf + len, "wwpn", "0x%016Lx", | 373 | zfcp_dbf_out(p, "wwpn", "0x%016Lx", r->u.port.wwpn); |
362 | rec->data.port.wwpn); | 374 | zfcp_dbf_out(p, "d_id", "0x%06x", r->u.port.d_id); |
363 | len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x", | 375 | zfcp_dbf_out(p, "port_handle", "0x%08x", r->u.port.port_handle); |
364 | rec->data.port.d_id); | ||
365 | len += zfcp_dbf_view(out_buf + len, "port_handle", "0x%08x", | ||
366 | rec->data.port.port_handle); | ||
367 | break; | 376 | break; |
368 | 377 | ||
369 | case FSF_QTCB_OPEN_LUN: | 378 | case FSF_QTCB_OPEN_LUN: |
370 | case FSF_QTCB_CLOSE_LUN: | 379 | case FSF_QTCB_CLOSE_LUN: |
371 | len += zfcp_dbf_view(out_buf + len, "wwpn", "0x%016Lx", | 380 | zfcp_dbf_out(p, "wwpn", "0x%016Lx", r->u.unit.wwpn); |
372 | rec->data.unit.wwpn); | 381 | zfcp_dbf_out(p, "fcp_lun", "0x%016Lx", r->u.unit.fcp_lun); |
373 | len += zfcp_dbf_view(out_buf + len, "fcp_lun", "0x%016Lx", | 382 | zfcp_dbf_out(p, "port_handle", "0x%08x", r->u.unit.port_handle); |
374 | rec->data.unit.fcp_lun); | 383 | zfcp_dbf_out(p, "lun_handle", "0x%08x", r->u.unit.lun_handle); |
375 | len += zfcp_dbf_view(out_buf + len, "port_handle", "0x%08x", | ||
376 | rec->data.unit.port_handle); | ||
377 | len += zfcp_dbf_view(out_buf + len, "lun_handle", "0x%08x", | ||
378 | rec->data.unit.lun_handle); | ||
379 | break; | 384 | break; |
380 | 385 | ||
381 | case FSF_QTCB_SEND_ELS: | 386 | case FSF_QTCB_SEND_ELS: |
382 | len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x", | 387 | zfcp_dbf_out(p, "d_id", "0x%06x", r->u.els.d_id); |
383 | rec->data.send_els.d_id); | 388 | zfcp_dbf_out(p, "ls_code", "0x%02x", r->u.els.ls_code); |
384 | len += zfcp_dbf_view(out_buf + len, "ls_code", "0x%02x", | ||
385 | rec->data.send_els.ls_code); | ||
386 | break; | 389 | break; |
387 | 390 | ||
388 | case FSF_QTCB_ABORT_FCP_CMND: | 391 | case FSF_QTCB_ABORT_FCP_CMND: |
@@ -393,74 +396,52 @@ zfcp_hba_dbf_view_response(char *out_buf, | |||
393 | case FSF_QTCB_UPLOAD_CONTROL_FILE: | 396 | case FSF_QTCB_UPLOAD_CONTROL_FILE: |
394 | break; | 397 | break; |
395 | } | 398 | } |
396 | |||
397 | return len; | ||
398 | } | 399 | } |
399 | 400 | ||
400 | static int | 401 | static void zfcp_hba_dbf_view_status(char **p, |
401 | zfcp_hba_dbf_view_status(char *out_buf, struct zfcp_hba_dbf_record_status *rec) | 402 | struct zfcp_hba_dbf_record_status *r) |
402 | { | 403 | { |
403 | int len = 0; | 404 | zfcp_dbf_out(p, "failed", "0x%02x", r->failed); |
404 | 405 | zfcp_dbf_out(p, "status_type", "0x%08x", r->status_type); | |
405 | len += zfcp_dbf_view(out_buf + len, "failed", "0x%02x", rec->failed); | 406 | zfcp_dbf_out(p, "status_subtype", "0x%08x", r->status_subtype); |
406 | len += zfcp_dbf_view(out_buf + len, "status_type", "0x%08x", | 407 | zfcp_dbf_outd(p, "queue_designator", (char *)&r->queue_designator, |
407 | rec->status_type); | 408 | sizeof(struct fsf_queue_designator), 0, |
408 | len += zfcp_dbf_view(out_buf + len, "status_subtype", "0x%08x", | 409 | sizeof(struct fsf_queue_designator)); |
409 | rec->status_subtype); | 410 | zfcp_dbf_outd(p, "payload", (char *)&r->payload, r->payload_size, 0, |
410 | len += zfcp_dbf_view_dump(out_buf + len, "queue_designator", | 411 | r->payload_size); |
411 | (char *)&rec->queue_designator, | ||
412 | sizeof(struct fsf_queue_designator), | ||
413 | 0, sizeof(struct fsf_queue_designator)); | ||
414 | len += zfcp_dbf_view_dump(out_buf + len, "payload", | ||
415 | (char *)&rec->payload, | ||
416 | rec->payload_size, 0, rec->payload_size); | ||
417 | |||
418 | return len; | ||
419 | } | 412 | } |
420 | 413 | ||
421 | static int | 414 | static void zfcp_hba_dbf_view_qdio(char **p, struct zfcp_hba_dbf_record_qdio *r) |
422 | zfcp_hba_dbf_view_qdio(char *out_buf, struct zfcp_hba_dbf_record_qdio *rec) | ||
423 | { | 415 | { |
424 | int len = 0; | 416 | zfcp_dbf_out(p, "status", "0x%08x", r->status); |
425 | 417 | zfcp_dbf_out(p, "qdio_error", "0x%08x", r->qdio_error); | |
426 | len += zfcp_dbf_view(out_buf + len, "status", "0x%08x", rec->status); | 418 | zfcp_dbf_out(p, "siga_error", "0x%08x", r->siga_error); |
427 | len += zfcp_dbf_view(out_buf + len, "qdio_error", "0x%08x", | 419 | zfcp_dbf_out(p, "sbal_index", "0x%02x", r->sbal_index); |
428 | rec->qdio_error); | 420 | zfcp_dbf_out(p, "sbal_count", "0x%02x", r->sbal_count); |
429 | len += zfcp_dbf_view(out_buf + len, "siga_error", "0x%08x", | ||
430 | rec->siga_error); | ||
431 | len += zfcp_dbf_view(out_buf + len, "sbal_index", "0x%02x", | ||
432 | rec->sbal_index); | ||
433 | len += zfcp_dbf_view(out_buf + len, "sbal_count", "0x%02x", | ||
434 | rec->sbal_count); | ||
435 | |||
436 | return len; | ||
437 | } | 421 | } |
438 | 422 | ||
439 | static int | 423 | static int zfcp_hba_dbf_view_format(debug_info_t *id, struct debug_view *view, |
440 | zfcp_hba_dbf_view_format(debug_info_t * id, struct debug_view *view, | 424 | char *out_buf, const char *in_buf) |
441 | char *out_buf, const char *in_buf) | ||
442 | { | 425 | { |
443 | struct zfcp_hba_dbf_record *rec = (struct zfcp_hba_dbf_record *)in_buf; | 426 | struct zfcp_hba_dbf_record *r = (struct zfcp_hba_dbf_record *)in_buf; |
444 | int len = 0; | 427 | char *p = out_buf; |
445 | 428 | ||
446 | if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) | 429 | if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) |
447 | return 0; | 430 | return 0; |
448 | 431 | ||
449 | len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag); | 432 | zfcp_dbf_tag(&p, "tag", r->tag); |
450 | if (isalpha(rec->tag2[0])) | 433 | if (isalpha(r->tag2[0])) |
451 | len += zfcp_dbf_tag(out_buf + len, "tag2", rec->tag2); | 434 | zfcp_dbf_tag(&p, "tag2", r->tag2); |
452 | if (strncmp(rec->tag, "resp", ZFCP_DBF_TAG_SIZE) == 0) | ||
453 | len += zfcp_hba_dbf_view_response(out_buf + len, | ||
454 | &rec->type.response); | ||
455 | else if (strncmp(rec->tag, "stat", ZFCP_DBF_TAG_SIZE) == 0) | ||
456 | len += zfcp_hba_dbf_view_status(out_buf + len, | ||
457 | &rec->type.status); | ||
458 | else if (strncmp(rec->tag, "qdio", ZFCP_DBF_TAG_SIZE) == 0) | ||
459 | len += zfcp_hba_dbf_view_qdio(out_buf + len, &rec->type.qdio); | ||
460 | 435 | ||
461 | len += sprintf(out_buf + len, "\n"); | 436 | if (strncmp(r->tag, "resp", ZFCP_DBF_TAG_SIZE) == 0) |
437 | zfcp_hba_dbf_view_response(&p, &r->u.response); | ||
438 | else if (strncmp(r->tag, "stat", ZFCP_DBF_TAG_SIZE) == 0) | ||
439 | zfcp_hba_dbf_view_status(&p, &r->u.status); | ||
440 | else if (strncmp(r->tag, "qdio", ZFCP_DBF_TAG_SIZE) == 0) | ||
441 | zfcp_hba_dbf_view_qdio(&p, &r->u.qdio); | ||
462 | 442 | ||
463 | return len; | 443 | p += sprintf(p, "\n"); |
444 | return p - out_buf; | ||
464 | } | 445 | } |
465 | 446 | ||
466 | static struct debug_view zfcp_hba_dbf_view = { | 447 | static struct debug_view zfcp_hba_dbf_view = { |
@@ -472,219 +453,570 @@ static struct debug_view zfcp_hba_dbf_view = { | |||
472 | NULL | 453 | NULL |
473 | }; | 454 | }; |
474 | 455 | ||
475 | static void | 456 | static const char *zfcp_rec_dbf_tags[] = { |
476 | _zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req, | 457 | [ZFCP_REC_DBF_ID_THREAD] = "thread", |
477 | u32 s_id, u32 d_id, void *buffer, int buflen) | 458 | [ZFCP_REC_DBF_ID_TARGET] = "target", |
459 | [ZFCP_REC_DBF_ID_TRIGGER] = "trigger", | ||
460 | [ZFCP_REC_DBF_ID_ACTION] = "action", | ||
461 | }; | ||
462 | |||
463 | static const char *zfcp_rec_dbf_ids[] = { | ||
464 | [1] = "new", | ||
465 | [2] = "ready", | ||
466 | [3] = "kill", | ||
467 | [4] = "down sleep", | ||
468 | [5] = "down wakeup", | ||
469 | [6] = "down sleep ecd", | ||
470 | [7] = "down wakeup ecd", | ||
471 | [8] = "down sleep epd", | ||
472 | [9] = "down wakeup epd", | ||
473 | [10] = "online", | ||
474 | [11] = "operational", | ||
475 | [12] = "scsi slave destroy", | ||
476 | [13] = "propagate failed adapter", | ||
477 | [14] = "propagate failed port", | ||
478 | [15] = "block adapter", | ||
479 | [16] = "unblock adapter", | ||
480 | [17] = "block port", | ||
481 | [18] = "unblock port", | ||
482 | [19] = "block unit", | ||
483 | [20] = "unblock unit", | ||
484 | [21] = "unit recovery failed", | ||
485 | [22] = "port recovery failed", | ||
486 | [23] = "adapter recovery failed", | ||
487 | [24] = "qdio queues down", | ||
488 | [25] = "p2p failed", | ||
489 | [26] = "nameserver lookup failed", | ||
490 | [27] = "nameserver port failed", | ||
491 | [28] = "link up", | ||
492 | [29] = "link down", | ||
493 | [30] = "link up status read", | ||
494 | [31] = "open port failed", | ||
495 | [32] = "open port failed", | ||
496 | [33] = "close port", | ||
497 | [34] = "open unit failed", | ||
498 | [35] = "exclusive open unit failed", | ||
499 | [36] = "shared open unit failed", | ||
500 | [37] = "link down", | ||
501 | [38] = "link down status read no link", | ||
502 | [39] = "link down status read fdisc login", | ||
503 | [40] = "link down status read firmware update", | ||
504 | [41] = "link down status read unknown reason", | ||
505 | [42] = "link down ecd incomplete", | ||
506 | [43] = "link down epd incomplete", | ||
507 | [44] = "sysfs adapter recovery", | ||
508 | [45] = "sysfs port recovery", | ||
509 | [46] = "sysfs unit recovery", | ||
510 | [47] = "port boxed abort", | ||
511 | [48] = "unit boxed abort", | ||
512 | [49] = "port boxed ct", | ||
513 | [50] = "port boxed close physical", | ||
514 | [51] = "port boxed open unit", | ||
515 | [52] = "port boxed close unit", | ||
516 | [53] = "port boxed fcp", | ||
517 | [54] = "unit boxed fcp", | ||
518 | [55] = "port access denied ct", | ||
519 | [56] = "port access denied els", | ||
520 | [57] = "port access denied open port", | ||
521 | [58] = "port access denied close physical", | ||
522 | [59] = "unit access denied open unit", | ||
523 | [60] = "shared unit access denied open unit", | ||
524 | [61] = "unit access denied fcp", | ||
525 | [62] = "request timeout", | ||
526 | [63] = "adisc link test reject or timeout", | ||
527 | [64] = "adisc link test d_id changed", | ||
528 | [65] = "adisc link test failed", | ||
529 | [66] = "recovery out of memory", | ||
530 | [67] = "adapter recovery repeated after state change", | ||
531 | [68] = "port recovery repeated after state change", | ||
532 | [69] = "unit recovery repeated after state change", | ||
533 | [70] = "port recovery follow-up after successful adapter recovery", | ||
534 | [71] = "adapter recovery escalation after failed adapter recovery", | ||
535 | [72] = "port recovery follow-up after successful physical port " | ||
536 | "recovery", | ||
537 | [73] = "adapter recovery escalation after failed physical port " | ||
538 | "recovery", | ||
539 | [74] = "unit recovery follow-up after successful port recovery", | ||
540 | [75] = "physical port recovery escalation after failed port " | ||
541 | "recovery", | ||
542 | [76] = "port recovery escalation after failed unit recovery", | ||
543 | [77] = "recovery opening nameserver port", | ||
544 | [78] = "duplicate request id", | ||
545 | [79] = "link down", | ||
546 | [80] = "exclusive read-only unit access unsupported", | ||
547 | [81] = "shared read-write unit access unsupported", | ||
548 | [82] = "incoming rscn", | ||
549 | [83] = "incoming plogi", | ||
550 | [84] = "incoming logo", | ||
551 | [85] = "online", | ||
552 | [86] = "offline", | ||
553 | [87] = "ccw device gone", | ||
554 | [88] = "ccw device no path", | ||
555 | [89] = "ccw device operational", | ||
556 | [90] = "ccw device shutdown", | ||
557 | [91] = "sysfs port addition", | ||
558 | [92] = "sysfs port removal", | ||
559 | [93] = "sysfs adapter recovery", | ||
560 | [94] = "sysfs unit addition", | ||
561 | [95] = "sysfs unit removal", | ||
562 | [96] = "sysfs port recovery", | ||
563 | [97] = "sysfs unit recovery", | ||
564 | [98] = "sequence number mismatch", | ||
565 | [99] = "link up", | ||
566 | [100] = "error state", | ||
567 | [101] = "status read physical port closed", | ||
568 | [102] = "link up status read", | ||
569 | [103] = "too many failed status read buffers", | ||
570 | [104] = "port handle not valid abort", | ||
571 | [105] = "lun handle not valid abort", | ||
572 | [106] = "port handle not valid ct", | ||
573 | [107] = "port handle not valid close port", | ||
574 | [108] = "port handle not valid close physical port", | ||
575 | [109] = "port handle not valid open unit", | ||
576 | [110] = "port handle not valid close unit", | ||
577 | [111] = "lun handle not valid close unit", | ||
578 | [112] = "port handle not valid fcp", | ||
579 | [113] = "lun handle not valid fcp", | ||
580 | [114] = "handle mismatch fcp", | ||
581 | [115] = "lun not valid fcp", | ||
582 | [116] = "qdio send failed", | ||
583 | [117] = "version mismatch", | ||
584 | [118] = "incompatible qtcb type", | ||
585 | [119] = "unknown protocol status", | ||
586 | [120] = "unknown fsf command", | ||
587 | [121] = "no recommendation for status qualifier", | ||
588 | [122] = "status read physical port closed in error", | ||
589 | [123] = "fc service class not supported ct", | ||
590 | [124] = "fc service class not supported els", | ||
591 | [125] = "need newer zfcp", | ||
592 | [126] = "need newer microcode", | ||
593 | [127] = "arbitrated loop not supported", | ||
594 | [128] = "unknown topology", | ||
595 | [129] = "qtcb size mismatch", | ||
596 | [130] = "unknown fsf status ecd", | ||
597 | [131] = "fcp request too big", | ||
598 | [132] = "fc service class not supported fcp", | ||
599 | [133] = "data direction not valid fcp", | ||
600 | [134] = "command length not valid fcp", | ||
601 | [135] = "status read act update", | ||
602 | [136] = "status read cfdc update", | ||
603 | [137] = "hbaapi port open", | ||
604 | [138] = "hbaapi unit open", | ||
605 | [139] = "hbaapi unit shutdown", | ||
606 | [140] = "qdio error", | ||
607 | [141] = "scsi host reset", | ||
608 | [142] = "dismissing fsf request for recovery action", | ||
609 | [143] = "recovery action timed out", | ||
610 | [144] = "recovery action gone", | ||
611 | [145] = "recovery action being processed", | ||
612 | [146] = "recovery action ready for next step", | ||
613 | }; | ||
614 | |||
615 | static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view, | ||
616 | char *buf, const char *_rec) | ||
617 | { | ||
618 | struct zfcp_rec_dbf_record *r = (struct zfcp_rec_dbf_record *)_rec; | ||
619 | char *p = buf; | ||
620 | |||
621 | zfcp_dbf_outs(&p, "tag", zfcp_rec_dbf_tags[r->id]); | ||
622 | zfcp_dbf_outs(&p, "hint", zfcp_rec_dbf_ids[r->id2]); | ||
623 | zfcp_dbf_out(&p, "id", "%d", r->id2); | ||
624 | switch (r->id) { | ||
625 | case ZFCP_REC_DBF_ID_THREAD: | ||
626 | zfcp_dbf_out(&p, "total", "%d", r->u.thread.total); | ||
627 | zfcp_dbf_out(&p, "ready", "%d", r->u.thread.ready); | ||
628 | zfcp_dbf_out(&p, "running", "%d", r->u.thread.running); | ||
629 | break; | ||
630 | case ZFCP_REC_DBF_ID_TARGET: | ||
631 | zfcp_dbf_out(&p, "reference", "0x%016Lx", r->u.target.ref); | ||
632 | zfcp_dbf_out(&p, "status", "0x%08x", r->u.target.status); | ||
633 | zfcp_dbf_out(&p, "erp_count", "%d", r->u.target.erp_count); | ||
634 | zfcp_dbf_out(&p, "d_id", "0x%06x", r->u.target.d_id); | ||
635 | zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->u.target.wwpn); | ||
636 | zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->u.target.fcp_lun); | ||
637 | break; | ||
638 | case ZFCP_REC_DBF_ID_TRIGGER: | ||
639 | zfcp_dbf_out(&p, "reference", "0x%016Lx", r->u.trigger.ref); | ||
640 | zfcp_dbf_out(&p, "erp_action", "0x%016Lx", r->u.trigger.action); | ||
641 | zfcp_dbf_out(&p, "requested", "%d", r->u.trigger.want); | ||
642 | zfcp_dbf_out(&p, "executed", "%d", r->u.trigger.need); | ||
643 | zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->u.trigger.wwpn); | ||
644 | zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->u.trigger.fcp_lun); | ||
645 | zfcp_dbf_out(&p, "adapter_status", "0x%08x", r->u.trigger.as); | ||
646 | zfcp_dbf_out(&p, "port_status", "0x%08x", r->u.trigger.ps); | ||
647 | zfcp_dbf_out(&p, "unit_status", "0x%08x", r->u.trigger.us); | ||
648 | break; | ||
649 | case ZFCP_REC_DBF_ID_ACTION: | ||
650 | zfcp_dbf_out(&p, "erp_action", "0x%016Lx", r->u.action.action); | ||
651 | zfcp_dbf_out(&p, "fsf_req", "0x%016Lx", r->u.action.fsf_req); | ||
652 | zfcp_dbf_out(&p, "status", "0x%08Lx", r->u.action.status); | ||
653 | zfcp_dbf_out(&p, "step", "0x%08Lx", r->u.action.step); | ||
654 | break; | ||
655 | } | ||
656 | p += sprintf(p, "\n"); | ||
657 | return p - buf; | ||
658 | } | ||
659 | |||
660 | static struct debug_view zfcp_rec_dbf_view = { | ||
661 | "structured", | ||
662 | NULL, | ||
663 | &zfcp_dbf_view_header, | ||
664 | &zfcp_rec_dbf_view_format, | ||
665 | NULL, | ||
666 | NULL | ||
667 | }; | ||
668 | |||
669 | /** | ||
670 | * zfcp_rec_dbf_event_thread - trace event related to recovery thread operation | ||
671 | * @id2: identifier for event | ||
672 | * @adapter: adapter | ||
673 | * @lock: non-zero value indicates that erp_lock has not yet been acquired | ||
674 | */ | ||
675 | void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter, int lock) | ||
676 | { | ||
677 | struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | ||
678 | unsigned long flags = 0; | ||
679 | struct list_head *entry; | ||
680 | unsigned ready = 0, running = 0, total; | ||
681 | |||
682 | if (lock) | ||
683 | read_lock_irqsave(&adapter->erp_lock, flags); | ||
684 | list_for_each(entry, &adapter->erp_ready_head) | ||
685 | ready++; | ||
686 | list_for_each(entry, &adapter->erp_running_head) | ||
687 | running++; | ||
688 | total = adapter->erp_total_count; | ||
689 | if (lock) | ||
690 | read_unlock_irqrestore(&adapter->erp_lock, flags); | ||
691 | |||
692 | spin_lock_irqsave(&adapter->rec_dbf_lock, flags); | ||
693 | memset(r, 0, sizeof(*r)); | ||
694 | r->id = ZFCP_REC_DBF_ID_THREAD; | ||
695 | r->id2 = id2; | ||
696 | r->u.thread.total = total; | ||
697 | r->u.thread.ready = ready; | ||
698 | r->u.thread.running = running; | ||
699 | debug_event(adapter->rec_dbf, 5, r, sizeof(*r)); | ||
700 | spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); | ||
701 | } | ||
702 | |||
703 | static void zfcp_rec_dbf_event_target(u8 id2, void *ref, | ||
704 | struct zfcp_adapter *adapter, | ||
705 | atomic_t *status, atomic_t *erp_count, | ||
706 | u64 wwpn, u32 d_id, u64 fcp_lun) | ||
707 | { | ||
708 | struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | ||
709 | unsigned long flags; | ||
710 | |||
711 | spin_lock_irqsave(&adapter->rec_dbf_lock, flags); | ||
712 | memset(r, 0, sizeof(*r)); | ||
713 | r->id = ZFCP_REC_DBF_ID_TARGET; | ||
714 | r->id2 = id2; | ||
715 | r->u.target.ref = (unsigned long)ref; | ||
716 | r->u.target.status = atomic_read(status); | ||
717 | r->u.target.wwpn = wwpn; | ||
718 | r->u.target.d_id = d_id; | ||
719 | r->u.target.fcp_lun = fcp_lun; | ||
720 | r->u.target.erp_count = atomic_read(erp_count); | ||
721 | debug_event(adapter->rec_dbf, 3, r, sizeof(*r)); | ||
722 | spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); | ||
723 | } | ||
724 | |||
725 | /** | ||
726 | * zfcp_rec_dbf_event_adapter - trace event for adapter state change | ||
727 | * @id: identifier for trigger of state change | ||
728 | * @ref: additional reference (e.g. request) | ||
729 | * @adapter: adapter | ||
730 | */ | ||
731 | void zfcp_rec_dbf_event_adapter(u8 id, void *ref, struct zfcp_adapter *adapter) | ||
732 | { | ||
733 | zfcp_rec_dbf_event_target(id, ref, adapter, &adapter->status, | ||
734 | &adapter->erp_counter, 0, 0, 0); | ||
735 | } | ||
736 | |||
737 | /** | ||
738 | * zfcp_rec_dbf_event_port - trace event for port state change | ||
739 | * @id: identifier for trigger of state change | ||
740 | * @ref: additional reference (e.g. request) | ||
741 | * @port: port | ||
742 | */ | ||
743 | void zfcp_rec_dbf_event_port(u8 id, void *ref, struct zfcp_port *port) | ||
478 | { | 744 | { |
479 | struct zfcp_send_ct *send_ct = (struct zfcp_send_ct *)fsf_req->data; | ||
480 | struct zfcp_port *port = send_ct->port; | ||
481 | struct zfcp_adapter *adapter = port->adapter; | 745 | struct zfcp_adapter *adapter = port->adapter; |
482 | struct ct_hdr *header = (struct ct_hdr *)buffer; | 746 | |
483 | struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf; | 747 | zfcp_rec_dbf_event_target(id, ref, adapter, &port->status, |
484 | struct zfcp_san_dbf_record_ct *ct = &rec->type.ct; | 748 | &port->erp_counter, port->wwpn, port->d_id, |
749 | 0); | ||
750 | } | ||
751 | |||
752 | /** | ||
753 | * zfcp_rec_dbf_event_unit - trace event for unit state change | ||
754 | * @id: identifier for trigger of state change | ||
755 | * @ref: additional reference (e.g. request) | ||
756 | * @unit: unit | ||
757 | */ | ||
758 | void zfcp_rec_dbf_event_unit(u8 id, void *ref, struct zfcp_unit *unit) | ||
759 | { | ||
760 | struct zfcp_port *port = unit->port; | ||
761 | struct zfcp_adapter *adapter = port->adapter; | ||
762 | |||
763 | zfcp_rec_dbf_event_target(id, ref, adapter, &unit->status, | ||
764 | &unit->erp_counter, port->wwpn, port->d_id, | ||
765 | unit->fcp_lun); | ||
766 | } | ||
767 | |||
768 | /** | ||
769 | * zfcp_rec_dbf_event_trigger - trace event for triggered error recovery | ||
770 | * @id2: identifier for error recovery trigger | ||
771 | * @ref: additional reference (e.g. request) | ||
772 | * @want: originally requested error recovery action | ||
773 | * @need: error recovery action actually initiated | ||
774 | * @action: address of error recovery action struct | ||
775 | * @adapter: adapter | ||
776 | * @port: port | ||
777 | * @unit: unit | ||
778 | */ | ||
779 | void zfcp_rec_dbf_event_trigger(u8 id2, void *ref, u8 want, u8 need, | ||
780 | void *action, struct zfcp_adapter *adapter, | ||
781 | struct zfcp_port *port, struct zfcp_unit *unit) | ||
782 | { | ||
783 | struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | ||
485 | unsigned long flags; | 784 | unsigned long flags; |
486 | 785 | ||
487 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); | 786 | spin_lock_irqsave(&adapter->rec_dbf_lock, flags); |
488 | memset(rec, 0, sizeof(struct zfcp_san_dbf_record)); | 787 | memset(r, 0, sizeof(*r)); |
489 | strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); | 788 | r->id = ZFCP_REC_DBF_ID_TRIGGER; |
490 | rec->fsf_reqid = (unsigned long)fsf_req; | 789 | r->id2 = id2; |
491 | rec->fsf_seqno = fsf_req->seq_no; | 790 | r->u.trigger.ref = (unsigned long)ref; |
492 | rec->s_id = s_id; | 791 | r->u.trigger.want = want; |
493 | rec->d_id = d_id; | 792 | r->u.trigger.need = need; |
494 | if (strncmp(tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) { | 793 | r->u.trigger.action = (unsigned long)action; |
495 | ct->type.request.cmd_req_code = header->cmd_rsp_code; | 794 | r->u.trigger.as = atomic_read(&adapter->status); |
496 | ct->type.request.revision = header->revision; | 795 | if (port) { |
497 | ct->type.request.gs_type = header->gs_type; | 796 | r->u.trigger.ps = atomic_read(&port->status); |
498 | ct->type.request.gs_subtype = header->gs_subtype; | 797 | r->u.trigger.wwpn = port->wwpn; |
499 | ct->type.request.options = header->options; | ||
500 | ct->type.request.max_res_size = header->max_res_size; | ||
501 | } else if (strncmp(tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) { | ||
502 | ct->type.response.cmd_rsp_code = header->cmd_rsp_code; | ||
503 | ct->type.response.revision = header->revision; | ||
504 | ct->type.response.reason_code = header->reason_code; | ||
505 | ct->type.response.reason_code_expl = header->reason_code_expl; | ||
506 | ct->type.response.vendor_unique = header->vendor_unique; | ||
507 | } | 798 | } |
508 | ct->payload_size = | 799 | if (unit) { |
509 | min(buflen - (int)sizeof(struct ct_hdr), ZFCP_DBF_CT_PAYLOAD); | 800 | r->u.trigger.us = atomic_read(&unit->status); |
510 | memcpy(ct->payload, buffer + sizeof(struct ct_hdr), ct->payload_size); | 801 | r->u.trigger.fcp_lun = unit->fcp_lun; |
511 | debug_event(adapter->san_dbf, 3, | 802 | } |
512 | rec, sizeof(struct zfcp_san_dbf_record)); | 803 | debug_event(adapter->rec_dbf, action ? 1 : 4, r, sizeof(*r)); |
513 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | 804 | spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); |
514 | } | 805 | } |
515 | 806 | ||
807 | /** | ||
808 | * zfcp_rec_dbf_event_action - trace event showing progress of recovery action | ||
809 | * @id2: identifier | ||
810 | * @erp_action: error recovery action struct pointer | ||
811 | */ | ||
812 | void zfcp_rec_dbf_event_action(u8 id2, struct zfcp_erp_action *erp_action) | ||
813 | { | ||
814 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
815 | struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | ||
816 | unsigned long flags; | ||
817 | |||
818 | spin_lock_irqsave(&adapter->rec_dbf_lock, flags); | ||
819 | memset(r, 0, sizeof(*r)); | ||
820 | r->id = ZFCP_REC_DBF_ID_ACTION; | ||
821 | r->id2 = id2; | ||
822 | r->u.action.action = (unsigned long)erp_action; | ||
823 | r->u.action.status = erp_action->status; | ||
824 | r->u.action.step = erp_action->step; | ||
825 | r->u.action.fsf_req = (unsigned long)erp_action->fsf_req; | ||
826 | debug_event(adapter->rec_dbf, 4, r, sizeof(*r)); | ||
827 | spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); | ||
828 | } | ||
829 | |||
830 | /** | ||
831 | * zfcp_san_dbf_event_ct_request - trace event for issued CT request | ||
832 | * @fsf_req: request containing issued CT data | ||
833 | */ | ||
516 | void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req) | 834 | void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req) |
517 | { | 835 | { |
518 | struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; | 836 | struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; |
519 | struct zfcp_port *port = ct->port; | 837 | struct zfcp_port *port = ct->port; |
520 | struct zfcp_adapter *adapter = port->adapter; | 838 | struct zfcp_adapter *adapter = port->adapter; |
839 | struct ct_hdr *hdr = zfcp_sg_to_address(ct->req); | ||
840 | struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf; | ||
841 | struct zfcp_san_dbf_record_ct_request *oct = &r->u.ct_req; | ||
842 | unsigned long flags; | ||
521 | 843 | ||
522 | _zfcp_san_dbf_event_common_ct("octc", fsf_req, | 844 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); |
523 | fc_host_port_id(adapter->scsi_host), | 845 | memset(r, 0, sizeof(*r)); |
524 | port->d_id, zfcp_sg_to_address(ct->req), | 846 | strncpy(r->tag, "octc", ZFCP_DBF_TAG_SIZE); |
525 | ct->req->length); | 847 | r->fsf_reqid = (unsigned long)fsf_req; |
848 | r->fsf_seqno = fsf_req->seq_no; | ||
849 | r->s_id = fc_host_port_id(adapter->scsi_host); | ||
850 | r->d_id = port->d_id; | ||
851 | oct->cmd_req_code = hdr->cmd_rsp_code; | ||
852 | oct->revision = hdr->revision; | ||
853 | oct->gs_type = hdr->gs_type; | ||
854 | oct->gs_subtype = hdr->gs_subtype; | ||
855 | oct->options = hdr->options; | ||
856 | oct->max_res_size = hdr->max_res_size; | ||
857 | oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr), | ||
858 | ZFCP_DBF_CT_PAYLOAD); | ||
859 | memcpy(oct->payload, (void *)hdr + sizeof(struct ct_hdr), oct->len); | ||
860 | debug_event(adapter->san_dbf, 3, r, sizeof(*r)); | ||
861 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | ||
526 | } | 862 | } |
527 | 863 | ||
864 | /** | ||
865 | * zfcp_san_dbf_event_ct_response - trace event for completion of CT request | ||
866 | * @fsf_req: request containing CT response | ||
867 | */ | ||
528 | void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req) | 868 | void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req) |
529 | { | 869 | { |
530 | struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; | 870 | struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; |
531 | struct zfcp_port *port = ct->port; | 871 | struct zfcp_port *port = ct->port; |
532 | struct zfcp_adapter *adapter = port->adapter; | 872 | struct zfcp_adapter *adapter = port->adapter; |
873 | struct ct_hdr *hdr = zfcp_sg_to_address(ct->resp); | ||
874 | struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf; | ||
875 | struct zfcp_san_dbf_record_ct_response *rct = &r->u.ct_resp; | ||
876 | unsigned long flags; | ||
533 | 877 | ||
534 | _zfcp_san_dbf_event_common_ct("rctc", fsf_req, port->d_id, | 878 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); |
535 | fc_host_port_id(adapter->scsi_host), | 879 | memset(r, 0, sizeof(*r)); |
536 | zfcp_sg_to_address(ct->resp), | 880 | strncpy(r->tag, "rctc", ZFCP_DBF_TAG_SIZE); |
537 | ct->resp->length); | 881 | r->fsf_reqid = (unsigned long)fsf_req; |
882 | r->fsf_seqno = fsf_req->seq_no; | ||
883 | r->s_id = port->d_id; | ||
884 | r->d_id = fc_host_port_id(adapter->scsi_host); | ||
885 | rct->cmd_rsp_code = hdr->cmd_rsp_code; | ||
886 | rct->revision = hdr->revision; | ||
887 | rct->reason_code = hdr->reason_code; | ||
888 | rct->expl = hdr->reason_code_expl; | ||
889 | rct->vendor_unique = hdr->vendor_unique; | ||
890 | rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr), | ||
891 | ZFCP_DBF_CT_PAYLOAD); | ||
892 | memcpy(rct->payload, (void *)hdr + sizeof(struct ct_hdr), rct->len); | ||
893 | debug_event(adapter->san_dbf, 3, r, sizeof(*r)); | ||
894 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | ||
538 | } | 895 | } |
539 | 896 | ||
540 | static void | 897 | static void zfcp_san_dbf_event_els(const char *tag, int level, |
541 | _zfcp_san_dbf_event_common_els(const char *tag, int level, | 898 | struct zfcp_fsf_req *fsf_req, u32 s_id, |
542 | struct zfcp_fsf_req *fsf_req, u32 s_id, | 899 | u32 d_id, u8 ls_code, void *buffer, |
543 | u32 d_id, u8 ls_code, void *buffer, int buflen) | 900 | int buflen) |
544 | { | 901 | { |
545 | struct zfcp_adapter *adapter = fsf_req->adapter; | 902 | struct zfcp_adapter *adapter = fsf_req->adapter; |
546 | struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf; | 903 | struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf; |
547 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; | ||
548 | unsigned long flags; | 904 | unsigned long flags; |
549 | int offset = 0; | ||
550 | 905 | ||
551 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); | 906 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); |
552 | do { | 907 | memset(rec, 0, sizeof(*rec)); |
553 | memset(rec, 0, sizeof(struct zfcp_san_dbf_record)); | 908 | strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); |
554 | if (offset == 0) { | 909 | rec->fsf_reqid = (unsigned long)fsf_req; |
555 | strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); | 910 | rec->fsf_seqno = fsf_req->seq_no; |
556 | rec->fsf_reqid = (unsigned long)fsf_req; | 911 | rec->s_id = s_id; |
557 | rec->fsf_seqno = fsf_req->seq_no; | 912 | rec->d_id = d_id; |
558 | rec->s_id = s_id; | 913 | rec->u.els.ls_code = ls_code; |
559 | rec->d_id = d_id; | 914 | debug_event(adapter->san_dbf, level, rec, sizeof(*rec)); |
560 | rec->type.els.ls_code = ls_code; | 915 | zfcp_dbf_hexdump(adapter->san_dbf, rec, sizeof(*rec), level, |
561 | buflen = min(buflen, ZFCP_DBF_ELS_MAX_PAYLOAD); | 916 | buffer, min(buflen, ZFCP_DBF_ELS_MAX_PAYLOAD)); |
562 | rec->type.els.payload_size = buflen; | ||
563 | memcpy(rec->type.els.payload, | ||
564 | buffer, min(buflen, ZFCP_DBF_ELS_PAYLOAD)); | ||
565 | offset += min(buflen, ZFCP_DBF_ELS_PAYLOAD); | ||
566 | } else { | ||
567 | strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE); | ||
568 | dump->total_size = buflen; | ||
569 | dump->offset = offset; | ||
570 | dump->size = min(buflen - offset, | ||
571 | (int)sizeof(struct zfcp_san_dbf_record) | ||
572 | - (int)sizeof(struct zfcp_dbf_dump)); | ||
573 | memcpy(dump->data, buffer + offset, dump->size); | ||
574 | offset += dump->size; | ||
575 | } | ||
576 | debug_event(adapter->san_dbf, level, | ||
577 | rec, sizeof(struct zfcp_san_dbf_record)); | ||
578 | } while (offset < buflen); | ||
579 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | 917 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); |
580 | } | 918 | } |
581 | 919 | ||
920 | /** | ||
921 | * zfcp_san_dbf_event_els_request - trace event for issued ELS | ||
922 | * @fsf_req: request containing issued ELS | ||
923 | */ | ||
582 | void zfcp_san_dbf_event_els_request(struct zfcp_fsf_req *fsf_req) | 924 | void zfcp_san_dbf_event_els_request(struct zfcp_fsf_req *fsf_req) |
583 | { | 925 | { |
584 | struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data; | 926 | struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data; |
585 | 927 | ||
586 | _zfcp_san_dbf_event_common_els("oels", 2, fsf_req, | 928 | zfcp_san_dbf_event_els("oels", 2, fsf_req, |
587 | fc_host_port_id(els->adapter->scsi_host), | 929 | fc_host_port_id(els->adapter->scsi_host), |
588 | els->d_id, | 930 | els->d_id, *(u8 *) zfcp_sg_to_address(els->req), |
589 | *(u8 *) zfcp_sg_to_address(els->req), | 931 | zfcp_sg_to_address(els->req), els->req->length); |
590 | zfcp_sg_to_address(els->req), | ||
591 | els->req->length); | ||
592 | } | 932 | } |
593 | 933 | ||
934 | /** | ||
935 | * zfcp_san_dbf_event_els_response - trace event for completed ELS | ||
936 | * @fsf_req: request containing ELS response | ||
937 | */ | ||
594 | void zfcp_san_dbf_event_els_response(struct zfcp_fsf_req *fsf_req) | 938 | void zfcp_san_dbf_event_els_response(struct zfcp_fsf_req *fsf_req) |
595 | { | 939 | { |
596 | struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data; | 940 | struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data; |
597 | 941 | ||
598 | _zfcp_san_dbf_event_common_els("rels", 2, fsf_req, els->d_id, | 942 | zfcp_san_dbf_event_els("rels", 2, fsf_req, els->d_id, |
599 | fc_host_port_id(els->adapter->scsi_host), | 943 | fc_host_port_id(els->adapter->scsi_host), |
600 | *(u8 *) zfcp_sg_to_address(els->req), | 944 | *(u8 *)zfcp_sg_to_address(els->req), |
601 | zfcp_sg_to_address(els->resp), | 945 | zfcp_sg_to_address(els->resp), |
602 | els->resp->length); | 946 | els->resp->length); |
603 | } | 947 | } |
604 | 948 | ||
949 | /** | ||
950 | * zfcp_san_dbf_event_incoming_els - trace event for incomig ELS | ||
951 | * @fsf_req: request containing unsolicited status buffer with incoming ELS | ||
952 | */ | ||
605 | void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *fsf_req) | 953 | void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *fsf_req) |
606 | { | 954 | { |
607 | struct zfcp_adapter *adapter = fsf_req->adapter; | 955 | struct zfcp_adapter *adapter = fsf_req->adapter; |
608 | struct fsf_status_read_buffer *status_buffer = | 956 | struct fsf_status_read_buffer *buf = |
609 | (struct fsf_status_read_buffer *)fsf_req->data; | 957 | (struct fsf_status_read_buffer *)fsf_req->data; |
610 | int length = (int)status_buffer->length - | 958 | int length = (int)buf->length - |
611 | (int)((void *)&status_buffer->payload - (void *)status_buffer); | 959 | (int)((void *)&buf->payload - (void *)buf); |
612 | 960 | ||
613 | _zfcp_san_dbf_event_common_els("iels", 1, fsf_req, status_buffer->d_id, | 961 | zfcp_san_dbf_event_els("iels", 1, fsf_req, buf->d_id, |
614 | fc_host_port_id(adapter->scsi_host), | 962 | fc_host_port_id(adapter->scsi_host), |
615 | *(u8 *) status_buffer->payload, | 963 | *(u8 *)buf->payload, (void *)buf->payload, |
616 | (void *)status_buffer->payload, length); | 964 | length); |
617 | } | 965 | } |
618 | 966 | ||
619 | static int | 967 | static int zfcp_san_dbf_view_format(debug_info_t *id, struct debug_view *view, |
620 | zfcp_san_dbf_view_format(debug_info_t * id, struct debug_view *view, | 968 | char *out_buf, const char *in_buf) |
621 | char *out_buf, const char *in_buf) | ||
622 | { | 969 | { |
623 | struct zfcp_san_dbf_record *rec = (struct zfcp_san_dbf_record *)in_buf; | 970 | struct zfcp_san_dbf_record *r = (struct zfcp_san_dbf_record *)in_buf; |
624 | char *buffer = NULL; | 971 | char *buffer = NULL; |
625 | int buflen = 0, total = 0; | 972 | int buflen = 0, total = 0; |
626 | int len = 0; | 973 | char *p = out_buf; |
627 | 974 | ||
628 | if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) | 975 | if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) |
629 | return 0; | 976 | return 0; |
630 | 977 | ||
631 | len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag); | 978 | zfcp_dbf_tag(&p, "tag", r->tag); |
632 | len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx", | 979 | zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); |
633 | rec->fsf_reqid); | 980 | zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); |
634 | len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x", | 981 | zfcp_dbf_out(&p, "s_id", "0x%06x", r->s_id); |
635 | rec->fsf_seqno); | 982 | zfcp_dbf_out(&p, "d_id", "0x%06x", r->d_id); |
636 | len += zfcp_dbf_view(out_buf + len, "s_id", "0x%06x", rec->s_id); | 983 | |
637 | len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x", rec->d_id); | 984 | if (strncmp(r->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) { |
638 | 985 | struct zfcp_san_dbf_record_ct_request *ct = &r->u.ct_req; | |
639 | if (strncmp(rec->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) { | 986 | zfcp_dbf_out(&p, "cmd_req_code", "0x%04x", ct->cmd_req_code); |
640 | len += zfcp_dbf_view(out_buf + len, "cmd_req_code", "0x%04x", | 987 | zfcp_dbf_out(&p, "revision", "0x%02x", ct->revision); |
641 | rec->type.ct.type.request.cmd_req_code); | 988 | zfcp_dbf_out(&p, "gs_type", "0x%02x", ct->gs_type); |
642 | len += zfcp_dbf_view(out_buf + len, "revision", "0x%02x", | 989 | zfcp_dbf_out(&p, "gs_subtype", "0x%02x", ct->gs_subtype); |
643 | rec->type.ct.type.request.revision); | 990 | zfcp_dbf_out(&p, "options", "0x%02x", ct->options); |
644 | len += zfcp_dbf_view(out_buf + len, "gs_type", "0x%02x", | 991 | zfcp_dbf_out(&p, "max_res_size", "0x%04x", ct->max_res_size); |
645 | rec->type.ct.type.request.gs_type); | 992 | total = ct->len; |
646 | len += zfcp_dbf_view(out_buf + len, "gs_subtype", "0x%02x", | 993 | buffer = ct->payload; |
647 | rec->type.ct.type.request.gs_subtype); | ||
648 | len += zfcp_dbf_view(out_buf + len, "options", "0x%02x", | ||
649 | rec->type.ct.type.request.options); | ||
650 | len += zfcp_dbf_view(out_buf + len, "max_res_size", "0x%04x", | ||
651 | rec->type.ct.type.request.max_res_size); | ||
652 | total = rec->type.ct.payload_size; | ||
653 | buffer = rec->type.ct.payload; | ||
654 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); | 994 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); |
655 | } else if (strncmp(rec->tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) { | 995 | } else if (strncmp(r->tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) { |
656 | len += zfcp_dbf_view(out_buf + len, "cmd_rsp_code", "0x%04x", | 996 | struct zfcp_san_dbf_record_ct_response *ct = &r->u.ct_resp; |
657 | rec->type.ct.type.response.cmd_rsp_code); | 997 | zfcp_dbf_out(&p, "cmd_rsp_code", "0x%04x", ct->cmd_rsp_code); |
658 | len += zfcp_dbf_view(out_buf + len, "revision", "0x%02x", | 998 | zfcp_dbf_out(&p, "revision", "0x%02x", ct->revision); |
659 | rec->type.ct.type.response.revision); | 999 | zfcp_dbf_out(&p, "reason_code", "0x%02x", ct->reason_code); |
660 | len += zfcp_dbf_view(out_buf + len, "reason_code", "0x%02x", | 1000 | zfcp_dbf_out(&p, "reason_code_expl", "0x%02x", ct->expl); |
661 | rec->type.ct.type.response.reason_code); | 1001 | zfcp_dbf_out(&p, "vendor_unique", "0x%02x", ct->vendor_unique); |
662 | len += | 1002 | total = ct->len; |
663 | zfcp_dbf_view(out_buf + len, "reason_code_expl", "0x%02x", | 1003 | buffer = ct->payload; |
664 | rec->type.ct.type.response.reason_code_expl); | ||
665 | len += | ||
666 | zfcp_dbf_view(out_buf + len, "vendor_unique", "0x%02x", | ||
667 | rec->type.ct.type.response.vendor_unique); | ||
668 | total = rec->type.ct.payload_size; | ||
669 | buffer = rec->type.ct.payload; | ||
670 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); | 1004 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); |
671 | } else if (strncmp(rec->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 || | 1005 | } else if (strncmp(r->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 || |
672 | strncmp(rec->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 || | 1006 | strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 || |
673 | strncmp(rec->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) { | 1007 | strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) { |
674 | len += zfcp_dbf_view(out_buf + len, "ls_code", "0x%02x", | 1008 | struct zfcp_san_dbf_record_els *els = &r->u.els; |
675 | rec->type.els.ls_code); | 1009 | zfcp_dbf_out(&p, "ls_code", "0x%02x", els->ls_code); |
676 | total = rec->type.els.payload_size; | 1010 | total = els->len; |
677 | buffer = rec->type.els.payload; | 1011 | buffer = els->payload; |
678 | buflen = min(total, ZFCP_DBF_ELS_PAYLOAD); | 1012 | buflen = min(total, ZFCP_DBF_ELS_PAYLOAD); |
679 | } | 1013 | } |
680 | 1014 | ||
681 | len += zfcp_dbf_view_dump(out_buf + len, "payload", | 1015 | zfcp_dbf_outd(&p, "payload", buffer, buflen, 0, total); |
682 | buffer, buflen, 0, total); | ||
683 | |||
684 | if (buflen == total) | 1016 | if (buflen == total) |
685 | len += sprintf(out_buf + len, "\n"); | 1017 | p += sprintf(p, "\n"); |
686 | 1018 | ||
687 | return len; | 1019 | return p - out_buf; |
688 | } | 1020 | } |
689 | 1021 | ||
690 | static struct debug_view zfcp_san_dbf_view = { | 1022 | static struct debug_view zfcp_san_dbf_view = { |
@@ -696,12 +1028,11 @@ static struct debug_view zfcp_san_dbf_view = { | |||
696 | NULL | 1028 | NULL |
697 | }; | 1029 | }; |
698 | 1030 | ||
699 | static void | 1031 | static void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, |
700 | _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level, | 1032 | struct zfcp_adapter *adapter, |
701 | struct zfcp_adapter *adapter, | 1033 | struct scsi_cmnd *scsi_cmnd, |
702 | struct scsi_cmnd *scsi_cmnd, | 1034 | struct zfcp_fsf_req *fsf_req, |
703 | struct zfcp_fsf_req *fsf_req, | 1035 | unsigned long old_req_id) |
704 | unsigned long old_req_id) | ||
705 | { | 1036 | { |
706 | struct zfcp_scsi_dbf_record *rec = &adapter->scsi_dbf_buf; | 1037 | struct zfcp_scsi_dbf_record *rec = &adapter->scsi_dbf_buf; |
707 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; | 1038 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; |
@@ -712,7 +1043,7 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level, | |||
712 | 1043 | ||
713 | spin_lock_irqsave(&adapter->scsi_dbf_lock, flags); | 1044 | spin_lock_irqsave(&adapter->scsi_dbf_lock, flags); |
714 | do { | 1045 | do { |
715 | memset(rec, 0, sizeof(struct zfcp_scsi_dbf_record)); | 1046 | memset(rec, 0, sizeof(*rec)); |
716 | if (offset == 0) { | 1047 | if (offset == 0) { |
717 | strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); | 1048 | strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); |
718 | strncpy(rec->tag2, tag2, ZFCP_DBF_TAG_SIZE); | 1049 | strncpy(rec->tag2, tag2, ZFCP_DBF_TAG_SIZE); |
@@ -738,20 +1069,16 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level, | |||
738 | fcp_sns_info = | 1069 | fcp_sns_info = |
739 | zfcp_get_fcp_sns_info_ptr(fcp_rsp); | 1070 | zfcp_get_fcp_sns_info_ptr(fcp_rsp); |
740 | 1071 | ||
741 | rec->type.fcp.rsp_validity = | 1072 | rec->rsp_validity = fcp_rsp->validity.value; |
742 | fcp_rsp->validity.value; | 1073 | rec->rsp_scsi_status = fcp_rsp->scsi_status; |
743 | rec->type.fcp.rsp_scsi_status = | 1074 | rec->rsp_resid = fcp_rsp->fcp_resid; |
744 | fcp_rsp->scsi_status; | ||
745 | rec->type.fcp.rsp_resid = fcp_rsp->fcp_resid; | ||
746 | if (fcp_rsp->validity.bits.fcp_rsp_len_valid) | 1075 | if (fcp_rsp->validity.bits.fcp_rsp_len_valid) |
747 | rec->type.fcp.rsp_code = | 1076 | rec->rsp_code = *(fcp_rsp_info + 3); |
748 | *(fcp_rsp_info + 3); | ||
749 | if (fcp_rsp->validity.bits.fcp_sns_len_valid) { | 1077 | if (fcp_rsp->validity.bits.fcp_sns_len_valid) { |
750 | buflen = min((int)fcp_rsp->fcp_sns_len, | 1078 | buflen = min((int)fcp_rsp->fcp_sns_len, |
751 | ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO); | 1079 | ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO); |
752 | rec->type.fcp.sns_info_len = buflen; | 1080 | rec->sns_info_len = buflen; |
753 | memcpy(rec->type.fcp.sns_info, | 1081 | memcpy(rec->sns_info, fcp_sns_info, |
754 | fcp_sns_info, | ||
755 | min(buflen, | 1082 | min(buflen, |
756 | ZFCP_DBF_SCSI_FCP_SNS_INFO)); | 1083 | ZFCP_DBF_SCSI_FCP_SNS_INFO)); |
757 | offset += min(buflen, | 1084 | offset += min(buflen, |
@@ -762,7 +1089,7 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level, | |||
762 | rec->fsf_seqno = fsf_req->seq_no; | 1089 | rec->fsf_seqno = fsf_req->seq_no; |
763 | rec->fsf_issued = fsf_req->issued; | 1090 | rec->fsf_issued = fsf_req->issued; |
764 | } | 1091 | } |
765 | rec->type.old_fsf_reqid = old_req_id; | 1092 | rec->old_fsf_reqid = old_req_id; |
766 | } else { | 1093 | } else { |
767 | strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE); | 1094 | strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE); |
768 | dump->total_size = buflen; | 1095 | dump->total_size = buflen; |
@@ -774,108 +1101,101 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level, | |||
774 | memcpy(dump->data, fcp_sns_info + offset, dump->size); | 1101 | memcpy(dump->data, fcp_sns_info + offset, dump->size); |
775 | offset += dump->size; | 1102 | offset += dump->size; |
776 | } | 1103 | } |
777 | debug_event(adapter->scsi_dbf, level, | 1104 | debug_event(adapter->scsi_dbf, level, rec, sizeof(*rec)); |
778 | rec, sizeof(struct zfcp_scsi_dbf_record)); | ||
779 | } while (offset < buflen); | 1105 | } while (offset < buflen); |
780 | spin_unlock_irqrestore(&adapter->scsi_dbf_lock, flags); | 1106 | spin_unlock_irqrestore(&adapter->scsi_dbf_lock, flags); |
781 | } | 1107 | } |
782 | 1108 | ||
783 | void | 1109 | /** |
784 | zfcp_scsi_dbf_event_result(const char *tag, int level, | 1110 | * zfcp_scsi_dbf_event_result - trace event for SCSI command completion |
785 | struct zfcp_adapter *adapter, | 1111 | * @tag: tag indicating success or failure of SCSI command |
786 | struct scsi_cmnd *scsi_cmnd, | 1112 | * @level: trace level applicable for this event |
787 | struct zfcp_fsf_req *fsf_req) | 1113 | * @adapter: adapter that has been used to issue the SCSI command |
1114 | * @scsi_cmnd: SCSI command pointer | ||
1115 | * @fsf_req: request used to issue SCSI command (might be NULL) | ||
1116 | */ | ||
1117 | void zfcp_scsi_dbf_event_result(const char *tag, int level, | ||
1118 | struct zfcp_adapter *adapter, | ||
1119 | struct scsi_cmnd *scsi_cmnd, | ||
1120 | struct zfcp_fsf_req *fsf_req) | ||
788 | { | 1121 | { |
789 | _zfcp_scsi_dbf_event_common("rslt", tag, level, | 1122 | zfcp_scsi_dbf_event("rslt", tag, level, adapter, scsi_cmnd, fsf_req, 0); |
790 | adapter, scsi_cmnd, fsf_req, 0); | ||
791 | } | 1123 | } |
792 | 1124 | ||
793 | void | 1125 | /** |
794 | zfcp_scsi_dbf_event_abort(const char *tag, struct zfcp_adapter *adapter, | 1126 | * zfcp_scsi_dbf_event_abort - trace event for SCSI command abort |
795 | struct scsi_cmnd *scsi_cmnd, | 1127 | * @tag: tag indicating success or failure of abort operation |
796 | struct zfcp_fsf_req *new_fsf_req, | 1128 | * @adapter: adapter thas has been used to issue SCSI command to be aborted |
797 | unsigned long old_req_id) | 1129 | * @scsi_cmnd: SCSI command to be aborted |
1130 | * @new_fsf_req: request containing abort (might be NULL) | ||
1131 | * @old_req_id: identifier of request containg SCSI command to be aborted | ||
1132 | */ | ||
1133 | void zfcp_scsi_dbf_event_abort(const char *tag, struct zfcp_adapter *adapter, | ||
1134 | struct scsi_cmnd *scsi_cmnd, | ||
1135 | struct zfcp_fsf_req *new_fsf_req, | ||
1136 | unsigned long old_req_id) | ||
798 | { | 1137 | { |
799 | _zfcp_scsi_dbf_event_common("abrt", tag, 1, | 1138 | zfcp_scsi_dbf_event("abrt", tag, 1, adapter, scsi_cmnd, new_fsf_req, |
800 | adapter, scsi_cmnd, new_fsf_req, old_req_id); | 1139 | old_req_id); |
801 | } | 1140 | } |
802 | 1141 | ||
803 | void | 1142 | /** |
804 | zfcp_scsi_dbf_event_devreset(const char *tag, u8 flag, struct zfcp_unit *unit, | 1143 | * zfcp_scsi_dbf_event_devreset - trace event for Logical Unit or Target Reset |
805 | struct scsi_cmnd *scsi_cmnd) | 1144 | * @tag: tag indicating success or failure of reset operation |
1145 | * @flag: indicates type of reset (Target Reset, Logical Unit Reset) | ||
1146 | * @unit: unit that needs reset | ||
1147 | * @scsi_cmnd: SCSI command which caused this error recovery | ||
1148 | */ | ||
1149 | void zfcp_scsi_dbf_event_devreset(const char *tag, u8 flag, | ||
1150 | struct zfcp_unit *unit, | ||
1151 | struct scsi_cmnd *scsi_cmnd) | ||
806 | { | 1152 | { |
807 | struct zfcp_adapter *adapter = unit->port->adapter; | 1153 | zfcp_scsi_dbf_event(flag == FCP_TARGET_RESET ? "trst" : "lrst", tag, 1, |
808 | 1154 | unit->port->adapter, scsi_cmnd, NULL, 0); | |
809 | _zfcp_scsi_dbf_event_common(flag == FCP_TARGET_RESET ? "trst" : "lrst", | ||
810 | tag, 1, adapter, scsi_cmnd, NULL, 0); | ||
811 | } | 1155 | } |
812 | 1156 | ||
813 | static int | 1157 | static int zfcp_scsi_dbf_view_format(debug_info_t *id, struct debug_view *view, |
814 | zfcp_scsi_dbf_view_format(debug_info_t * id, struct debug_view *view, | 1158 | char *out_buf, const char *in_buf) |
815 | char *out_buf, const char *in_buf) | ||
816 | { | 1159 | { |
817 | struct zfcp_scsi_dbf_record *rec = | 1160 | struct zfcp_scsi_dbf_record *r = (struct zfcp_scsi_dbf_record *)in_buf; |
818 | (struct zfcp_scsi_dbf_record *)in_buf; | 1161 | struct timespec t; |
819 | int len = 0; | 1162 | char *p = out_buf; |
820 | 1163 | ||
821 | if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) | 1164 | if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) |
822 | return 0; | 1165 | return 0; |
823 | 1166 | ||
824 | len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag); | 1167 | zfcp_dbf_tag(&p, "tag", r->tag); |
825 | len += zfcp_dbf_tag(out_buf + len, "tag2", rec->tag2); | 1168 | zfcp_dbf_tag(&p, "tag2", r->tag2); |
826 | len += zfcp_dbf_view(out_buf + len, "scsi_id", "0x%08x", rec->scsi_id); | 1169 | zfcp_dbf_out(&p, "scsi_id", "0x%08x", r->scsi_id); |
827 | len += zfcp_dbf_view(out_buf + len, "scsi_lun", "0x%08x", | 1170 | zfcp_dbf_out(&p, "scsi_lun", "0x%08x", r->scsi_lun); |
828 | rec->scsi_lun); | 1171 | zfcp_dbf_out(&p, "scsi_result", "0x%08x", r->scsi_result); |
829 | len += zfcp_dbf_view(out_buf + len, "scsi_result", "0x%08x", | 1172 | zfcp_dbf_out(&p, "scsi_cmnd", "0x%0Lx", r->scsi_cmnd); |
830 | rec->scsi_result); | 1173 | zfcp_dbf_out(&p, "scsi_serial", "0x%016Lx", r->scsi_serial); |
831 | len += zfcp_dbf_view(out_buf + len, "scsi_cmnd", "0x%0Lx", | 1174 | zfcp_dbf_outd(&p, "scsi_opcode", r->scsi_opcode, ZFCP_DBF_SCSI_OPCODE, |
832 | rec->scsi_cmnd); | 1175 | 0, ZFCP_DBF_SCSI_OPCODE); |
833 | len += zfcp_dbf_view(out_buf + len, "scsi_serial", "0x%016Lx", | 1176 | zfcp_dbf_out(&p, "scsi_retries", "0x%02x", r->scsi_retries); |
834 | rec->scsi_serial); | 1177 | zfcp_dbf_out(&p, "scsi_allowed", "0x%02x", r->scsi_allowed); |
835 | len += zfcp_dbf_view_dump(out_buf + len, "scsi_opcode", | 1178 | if (strncmp(r->tag, "abrt", ZFCP_DBF_TAG_SIZE) == 0) |
836 | rec->scsi_opcode, | 1179 | zfcp_dbf_out(&p, "old_fsf_reqid", "0x%0Lx", r->old_fsf_reqid); |
837 | ZFCP_DBF_SCSI_OPCODE, | 1180 | zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); |
838 | 0, ZFCP_DBF_SCSI_OPCODE); | 1181 | zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); |
839 | len += zfcp_dbf_view(out_buf + len, "scsi_retries", "0x%02x", | 1182 | zfcp_dbf_timestamp(r->fsf_issued, &t); |
840 | rec->scsi_retries); | 1183 | zfcp_dbf_out(&p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec); |
841 | len += zfcp_dbf_view(out_buf + len, "scsi_allowed", "0x%02x", | 1184 | |
842 | rec->scsi_allowed); | 1185 | if (strncmp(r->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) { |
843 | if (strncmp(rec->tag, "abrt", ZFCP_DBF_TAG_SIZE) == 0) { | 1186 | zfcp_dbf_out(&p, "fcp_rsp_validity", "0x%02x", r->rsp_validity); |
844 | len += zfcp_dbf_view(out_buf + len, "old_fsf_reqid", "0x%0Lx", | 1187 | zfcp_dbf_out(&p, "fcp_rsp_scsi_status", "0x%02x", |
845 | rec->type.old_fsf_reqid); | 1188 | r->rsp_scsi_status); |
846 | } | 1189 | zfcp_dbf_out(&p, "fcp_rsp_resid", "0x%08x", r->rsp_resid); |
847 | len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx", | 1190 | zfcp_dbf_out(&p, "fcp_rsp_code", "0x%08x", r->rsp_code); |
848 | rec->fsf_reqid); | 1191 | zfcp_dbf_out(&p, "fcp_sns_info_len", "0x%08x", r->sns_info_len); |
849 | len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x", | 1192 | zfcp_dbf_outd(&p, "fcp_sns_info", r->sns_info, |
850 | rec->fsf_seqno); | 1193 | min((int)r->sns_info_len, |
851 | len += zfcp_dbf_stck(out_buf + len, "fsf_issued", rec->fsf_issued); | 1194 | ZFCP_DBF_SCSI_FCP_SNS_INFO), 0, |
852 | if (strncmp(rec->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) { | 1195 | r->sns_info_len); |
853 | len += | ||
854 | zfcp_dbf_view(out_buf + len, "fcp_rsp_validity", "0x%02x", | ||
855 | rec->type.fcp.rsp_validity); | ||
856 | len += | ||
857 | zfcp_dbf_view(out_buf + len, "fcp_rsp_scsi_status", | ||
858 | "0x%02x", rec->type.fcp.rsp_scsi_status); | ||
859 | len += | ||
860 | zfcp_dbf_view(out_buf + len, "fcp_rsp_resid", "0x%08x", | ||
861 | rec->type.fcp.rsp_resid); | ||
862 | len += | ||
863 | zfcp_dbf_view(out_buf + len, "fcp_rsp_code", "0x%08x", | ||
864 | rec->type.fcp.rsp_code); | ||
865 | len += | ||
866 | zfcp_dbf_view(out_buf + len, "fcp_sns_info_len", "0x%08x", | ||
867 | rec->type.fcp.sns_info_len); | ||
868 | len += | ||
869 | zfcp_dbf_view_dump(out_buf + len, "fcp_sns_info", | ||
870 | rec->type.fcp.sns_info, | ||
871 | min((int)rec->type.fcp.sns_info_len, | ||
872 | ZFCP_DBF_SCSI_FCP_SNS_INFO), 0, | ||
873 | rec->type.fcp.sns_info_len); | ||
874 | } | 1196 | } |
875 | 1197 | p += sprintf(p, "\n"); | |
876 | len += sprintf(out_buf + len, "\n"); | 1198 | return p - out_buf; |
877 | |||
878 | return len; | ||
879 | } | 1199 | } |
880 | 1200 | ||
881 | static struct debug_view zfcp_scsi_dbf_view = { | 1201 | static struct debug_view zfcp_scsi_dbf_view = { |
@@ -897,13 +1217,14 @@ int zfcp_adapter_debug_register(struct zfcp_adapter *adapter) | |||
897 | char dbf_name[DEBUG_MAX_NAME_LEN]; | 1217 | char dbf_name[DEBUG_MAX_NAME_LEN]; |
898 | 1218 | ||
899 | /* debug feature area which records recovery activity */ | 1219 | /* debug feature area which records recovery activity */ |
900 | sprintf(dbf_name, "zfcp_%s_erp", zfcp_get_busid_by_adapter(adapter)); | 1220 | sprintf(dbf_name, "zfcp_%s_rec", zfcp_get_busid_by_adapter(adapter)); |
901 | adapter->erp_dbf = debug_register(dbf_name, dbfsize, 2, | 1221 | adapter->rec_dbf = debug_register(dbf_name, dbfsize, 1, |
902 | sizeof(struct zfcp_erp_dbf_record)); | 1222 | sizeof(struct zfcp_rec_dbf_record)); |
903 | if (!adapter->erp_dbf) | 1223 | if (!adapter->rec_dbf) |
904 | goto failed; | 1224 | goto failed; |
905 | debug_register_view(adapter->erp_dbf, &debug_hex_ascii_view); | 1225 | debug_register_view(adapter->rec_dbf, &debug_hex_ascii_view); |
906 | debug_set_level(adapter->erp_dbf, 3); | 1226 | debug_register_view(adapter->rec_dbf, &zfcp_rec_dbf_view); |
1227 | debug_set_level(adapter->rec_dbf, 3); | ||
907 | 1228 | ||
908 | /* debug feature area which records HBA (FSF and QDIO) conditions */ | 1229 | /* debug feature area which records HBA (FSF and QDIO) conditions */ |
909 | sprintf(dbf_name, "zfcp_%s_hba", zfcp_get_busid_by_adapter(adapter)); | 1230 | sprintf(dbf_name, "zfcp_%s_hba", zfcp_get_busid_by_adapter(adapter)); |
@@ -952,11 +1273,11 @@ void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter) | |||
952 | debug_unregister(adapter->scsi_dbf); | 1273 | debug_unregister(adapter->scsi_dbf); |
953 | debug_unregister(adapter->san_dbf); | 1274 | debug_unregister(adapter->san_dbf); |
954 | debug_unregister(adapter->hba_dbf); | 1275 | debug_unregister(adapter->hba_dbf); |
955 | debug_unregister(adapter->erp_dbf); | 1276 | debug_unregister(adapter->rec_dbf); |
956 | adapter->scsi_dbf = NULL; | 1277 | adapter->scsi_dbf = NULL; |
957 | adapter->san_dbf = NULL; | 1278 | adapter->san_dbf = NULL; |
958 | adapter->hba_dbf = NULL; | 1279 | adapter->hba_dbf = NULL; |
959 | adapter->erp_dbf = NULL; | 1280 | adapter->rec_dbf = NULL; |
960 | } | 1281 | } |
961 | 1282 | ||
962 | #undef ZFCP_LOG_AREA | 1283 | #undef ZFCP_LOG_AREA |
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h new file mode 100644 index 000000000000..54c34e483457 --- /dev/null +++ b/drivers/s390/scsi/zfcp_dbf.h | |||
@@ -0,0 +1,228 @@ | |||
1 | /* | ||
2 | * This file is part of the zfcp device driver for | ||
3 | * FCP adapters for IBM System z9 and zSeries. | ||
4 | * | ||
5 | * Copyright IBM Corp. 2008, 2008 | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
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 | */ | ||
21 | |||
22 | #ifndef ZFCP_DBF_H | ||
23 | #define ZFCP_DBF_H | ||
24 | |||
25 | #include "zfcp_fsf.h" | ||
26 | |||
27 | #define ZFCP_DBF_TAG_SIZE 4 | ||
28 | |||
29 | struct zfcp_dbf_dump { | ||
30 | u8 tag[ZFCP_DBF_TAG_SIZE]; | ||
31 | u32 total_size; /* size of total dump data */ | ||
32 | u32 offset; /* how much data has being already dumped */ | ||
33 | u32 size; /* how much data comes with this record */ | ||
34 | u8 data[]; /* dump data */ | ||
35 | } __attribute__ ((packed)); | ||
36 | |||
37 | struct zfcp_rec_dbf_record_thread { | ||
38 | u32 total; | ||
39 | u32 ready; | ||
40 | u32 running; | ||
41 | } __attribute__ ((packed)); | ||
42 | |||
43 | struct zfcp_rec_dbf_record_target { | ||
44 | u64 ref; | ||
45 | u32 status; | ||
46 | u32 d_id; | ||
47 | u64 wwpn; | ||
48 | u64 fcp_lun; | ||
49 | u32 erp_count; | ||
50 | } __attribute__ ((packed)); | ||
51 | |||
52 | struct zfcp_rec_dbf_record_trigger { | ||
53 | u8 want; | ||
54 | u8 need; | ||
55 | u32 as; | ||
56 | u32 ps; | ||
57 | u32 us; | ||
58 | u64 ref; | ||
59 | u64 action; | ||
60 | u64 wwpn; | ||
61 | u64 fcp_lun; | ||
62 | } __attribute__ ((packed)); | ||
63 | |||
64 | struct zfcp_rec_dbf_record_action { | ||
65 | u32 status; | ||
66 | u32 step; | ||
67 | u64 action; | ||
68 | u64 fsf_req; | ||
69 | } __attribute__ ((packed)); | ||
70 | |||
71 | struct zfcp_rec_dbf_record { | ||
72 | u8 id; | ||
73 | u8 id2; | ||
74 | union { | ||
75 | struct zfcp_rec_dbf_record_action action; | ||
76 | struct zfcp_rec_dbf_record_thread thread; | ||
77 | struct zfcp_rec_dbf_record_target target; | ||
78 | struct zfcp_rec_dbf_record_trigger trigger; | ||
79 | } u; | ||
80 | } __attribute__ ((packed)); | ||
81 | |||
82 | enum { | ||
83 | ZFCP_REC_DBF_ID_ACTION, | ||
84 | ZFCP_REC_DBF_ID_THREAD, | ||
85 | ZFCP_REC_DBF_ID_TARGET, | ||
86 | ZFCP_REC_DBF_ID_TRIGGER, | ||
87 | }; | ||
88 | |||
89 | struct zfcp_hba_dbf_record_response { | ||
90 | u32 fsf_command; | ||
91 | u64 fsf_reqid; | ||
92 | u32 fsf_seqno; | ||
93 | u64 fsf_issued; | ||
94 | u32 fsf_prot_status; | ||
95 | u32 fsf_status; | ||
96 | u8 fsf_prot_status_qual[FSF_PROT_STATUS_QUAL_SIZE]; | ||
97 | u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE]; | ||
98 | u32 fsf_req_status; | ||
99 | u8 sbal_first; | ||
100 | u8 sbal_curr; | ||
101 | u8 sbal_last; | ||
102 | u8 pool; | ||
103 | u64 erp_action; | ||
104 | union { | ||
105 | struct { | ||
106 | u64 cmnd; | ||
107 | u64 serial; | ||
108 | } fcp; | ||
109 | struct { | ||
110 | u64 wwpn; | ||
111 | u32 d_id; | ||
112 | u32 port_handle; | ||
113 | } port; | ||
114 | struct { | ||
115 | u64 wwpn; | ||
116 | u64 fcp_lun; | ||
117 | u32 port_handle; | ||
118 | u32 lun_handle; | ||
119 | } unit; | ||
120 | struct { | ||
121 | u32 d_id; | ||
122 | u8 ls_code; | ||
123 | } els; | ||
124 | } u; | ||
125 | } __attribute__ ((packed)); | ||
126 | |||
127 | struct zfcp_hba_dbf_record_status { | ||
128 | u8 failed; | ||
129 | u32 status_type; | ||
130 | u32 status_subtype; | ||
131 | struct fsf_queue_designator | ||
132 | queue_designator; | ||
133 | u32 payload_size; | ||
134 | #define ZFCP_DBF_UNSOL_PAYLOAD 80 | ||
135 | #define ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL 32 | ||
136 | #define ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD 56 | ||
137 | #define ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT 2 * sizeof(u32) | ||
138 | u8 payload[ZFCP_DBF_UNSOL_PAYLOAD]; | ||
139 | } __attribute__ ((packed)); | ||
140 | |||
141 | struct zfcp_hba_dbf_record_qdio { | ||
142 | u32 status; | ||
143 | u32 qdio_error; | ||
144 | u32 siga_error; | ||
145 | u8 sbal_index; | ||
146 | u8 sbal_count; | ||
147 | } __attribute__ ((packed)); | ||
148 | |||
149 | struct zfcp_hba_dbf_record { | ||
150 | u8 tag[ZFCP_DBF_TAG_SIZE]; | ||
151 | u8 tag2[ZFCP_DBF_TAG_SIZE]; | ||
152 | union { | ||
153 | struct zfcp_hba_dbf_record_response response; | ||
154 | struct zfcp_hba_dbf_record_status status; | ||
155 | struct zfcp_hba_dbf_record_qdio qdio; | ||
156 | } u; | ||
157 | } __attribute__ ((packed)); | ||
158 | |||
159 | struct zfcp_san_dbf_record_ct_request { | ||
160 | u16 cmd_req_code; | ||
161 | u8 revision; | ||
162 | u8 gs_type; | ||
163 | u8 gs_subtype; | ||
164 | u8 options; | ||
165 | u16 max_res_size; | ||
166 | u32 len; | ||
167 | #define ZFCP_DBF_CT_PAYLOAD 24 | ||
168 | u8 payload[ZFCP_DBF_CT_PAYLOAD]; | ||
169 | } __attribute__ ((packed)); | ||
170 | |||
171 | struct zfcp_san_dbf_record_ct_response { | ||
172 | u16 cmd_rsp_code; | ||
173 | u8 revision; | ||
174 | u8 reason_code; | ||
175 | u8 expl; | ||
176 | u8 vendor_unique; | ||
177 | u32 len; | ||
178 | u8 payload[ZFCP_DBF_CT_PAYLOAD]; | ||
179 | } __attribute__ ((packed)); | ||
180 | |||
181 | struct zfcp_san_dbf_record_els { | ||
182 | u8 ls_code; | ||
183 | u32 len; | ||
184 | #define ZFCP_DBF_ELS_PAYLOAD 32 | ||
185 | #define ZFCP_DBF_ELS_MAX_PAYLOAD 1024 | ||
186 | u8 payload[ZFCP_DBF_ELS_PAYLOAD]; | ||
187 | } __attribute__ ((packed)); | ||
188 | |||
189 | struct zfcp_san_dbf_record { | ||
190 | u8 tag[ZFCP_DBF_TAG_SIZE]; | ||
191 | u64 fsf_reqid; | ||
192 | u32 fsf_seqno; | ||
193 | u32 s_id; | ||
194 | u32 d_id; | ||
195 | union { | ||
196 | struct zfcp_san_dbf_record_ct_request ct_req; | ||
197 | struct zfcp_san_dbf_record_ct_response ct_resp; | ||
198 | struct zfcp_san_dbf_record_els els; | ||
199 | } u; | ||
200 | } __attribute__ ((packed)); | ||
201 | |||
202 | struct zfcp_scsi_dbf_record { | ||
203 | u8 tag[ZFCP_DBF_TAG_SIZE]; | ||
204 | u8 tag2[ZFCP_DBF_TAG_SIZE]; | ||
205 | u32 scsi_id; | ||
206 | u32 scsi_lun; | ||
207 | u32 scsi_result; | ||
208 | u64 scsi_cmnd; | ||
209 | u64 scsi_serial; | ||
210 | #define ZFCP_DBF_SCSI_OPCODE 16 | ||
211 | u8 scsi_opcode[ZFCP_DBF_SCSI_OPCODE]; | ||
212 | u8 scsi_retries; | ||
213 | u8 scsi_allowed; | ||
214 | u64 fsf_reqid; | ||
215 | u32 fsf_seqno; | ||
216 | u64 fsf_issued; | ||
217 | u64 old_fsf_reqid; | ||
218 | u8 rsp_validity; | ||
219 | u8 rsp_scsi_status; | ||
220 | u32 rsp_resid; | ||
221 | u8 rsp_code; | ||
222 | #define ZFCP_DBF_SCSI_FCP_SNS_INFO 16 | ||
223 | #define ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO 256 | ||
224 | u32 sns_info_len; | ||
225 | u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO]; | ||
226 | } __attribute__ ((packed)); | ||
227 | |||
228 | #endif /* ZFCP_DBF_H */ | ||
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index 45a7cd98c140..bda8c77b22da 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <asm/qdio.h> | 47 | #include <asm/qdio.h> |
48 | #include <asm/debug.h> | 48 | #include <asm/debug.h> |
49 | #include <asm/ebcdic.h> | 49 | #include <asm/ebcdic.h> |
50 | #include "zfcp_dbf.h" | ||
50 | #include "zfcp_fsf.h" | 51 | #include "zfcp_fsf.h" |
51 | 52 | ||
52 | 53 | ||
@@ -262,167 +263,6 @@ struct fcp_logo { | |||
262 | } __attribute__((packed)); | 263 | } __attribute__((packed)); |
263 | 264 | ||
264 | /* | 265 | /* |
265 | * DBF stuff | ||
266 | */ | ||
267 | #define ZFCP_DBF_TAG_SIZE 4 | ||
268 | |||
269 | struct zfcp_dbf_dump { | ||
270 | u8 tag[ZFCP_DBF_TAG_SIZE]; | ||
271 | u32 total_size; /* size of total dump data */ | ||
272 | u32 offset; /* how much data has being already dumped */ | ||
273 | u32 size; /* how much data comes with this record */ | ||
274 | u8 data[]; /* dump data */ | ||
275 | } __attribute__ ((packed)); | ||
276 | |||
277 | /* FIXME: to be inflated when reworking the erp dbf */ | ||
278 | struct zfcp_erp_dbf_record { | ||
279 | u8 dummy[16]; | ||
280 | } __attribute__ ((packed)); | ||
281 | |||
282 | struct zfcp_hba_dbf_record_response { | ||
283 | u32 fsf_command; | ||
284 | u64 fsf_reqid; | ||
285 | u32 fsf_seqno; | ||
286 | u64 fsf_issued; | ||
287 | u32 fsf_prot_status; | ||
288 | u32 fsf_status; | ||
289 | u8 fsf_prot_status_qual[FSF_PROT_STATUS_QUAL_SIZE]; | ||
290 | u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE]; | ||
291 | u32 fsf_req_status; | ||
292 | u8 sbal_first; | ||
293 | u8 sbal_curr; | ||
294 | u8 sbal_last; | ||
295 | u8 pool; | ||
296 | u64 erp_action; | ||
297 | union { | ||
298 | struct { | ||
299 | u64 scsi_cmnd; | ||
300 | u64 scsi_serial; | ||
301 | } send_fcp; | ||
302 | struct { | ||
303 | u64 wwpn; | ||
304 | u32 d_id; | ||
305 | u32 port_handle; | ||
306 | } port; | ||
307 | struct { | ||
308 | u64 wwpn; | ||
309 | u64 fcp_lun; | ||
310 | u32 port_handle; | ||
311 | u32 lun_handle; | ||
312 | } unit; | ||
313 | struct { | ||
314 | u32 d_id; | ||
315 | u8 ls_code; | ||
316 | } send_els; | ||
317 | } data; | ||
318 | } __attribute__ ((packed)); | ||
319 | |||
320 | struct zfcp_hba_dbf_record_status { | ||
321 | u8 failed; | ||
322 | u32 status_type; | ||
323 | u32 status_subtype; | ||
324 | struct fsf_queue_designator | ||
325 | queue_designator; | ||
326 | u32 payload_size; | ||
327 | #define ZFCP_DBF_UNSOL_PAYLOAD 80 | ||
328 | #define ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL 32 | ||
329 | #define ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD 56 | ||
330 | #define ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT 2 * sizeof(u32) | ||
331 | u8 payload[ZFCP_DBF_UNSOL_PAYLOAD]; | ||
332 | } __attribute__ ((packed)); | ||
333 | |||
334 | struct zfcp_hba_dbf_record_qdio { | ||
335 | u32 status; | ||
336 | u32 qdio_error; | ||
337 | u32 siga_error; | ||
338 | u8 sbal_index; | ||
339 | u8 sbal_count; | ||
340 | } __attribute__ ((packed)); | ||
341 | |||
342 | struct zfcp_hba_dbf_record { | ||
343 | u8 tag[ZFCP_DBF_TAG_SIZE]; | ||
344 | u8 tag2[ZFCP_DBF_TAG_SIZE]; | ||
345 | union { | ||
346 | struct zfcp_hba_dbf_record_response response; | ||
347 | struct zfcp_hba_dbf_record_status status; | ||
348 | struct zfcp_hba_dbf_record_qdio qdio; | ||
349 | } type; | ||
350 | } __attribute__ ((packed)); | ||
351 | |||
352 | struct zfcp_san_dbf_record_ct { | ||
353 | union { | ||
354 | struct { | ||
355 | u16 cmd_req_code; | ||
356 | u8 revision; | ||
357 | u8 gs_type; | ||
358 | u8 gs_subtype; | ||
359 | u8 options; | ||
360 | u16 max_res_size; | ||
361 | } request; | ||
362 | struct { | ||
363 | u16 cmd_rsp_code; | ||
364 | u8 revision; | ||
365 | u8 reason_code; | ||
366 | u8 reason_code_expl; | ||
367 | u8 vendor_unique; | ||
368 | } response; | ||
369 | } type; | ||
370 | u32 payload_size; | ||
371 | #define ZFCP_DBF_CT_PAYLOAD 24 | ||
372 | u8 payload[ZFCP_DBF_CT_PAYLOAD]; | ||
373 | } __attribute__ ((packed)); | ||
374 | |||
375 | struct zfcp_san_dbf_record_els { | ||
376 | u8 ls_code; | ||
377 | u32 payload_size; | ||
378 | #define ZFCP_DBF_ELS_PAYLOAD 32 | ||
379 | #define ZFCP_DBF_ELS_MAX_PAYLOAD 1024 | ||
380 | u8 payload[ZFCP_DBF_ELS_PAYLOAD]; | ||
381 | } __attribute__ ((packed)); | ||
382 | |||
383 | struct zfcp_san_dbf_record { | ||
384 | u8 tag[ZFCP_DBF_TAG_SIZE]; | ||
385 | u64 fsf_reqid; | ||
386 | u32 fsf_seqno; | ||
387 | u32 s_id; | ||
388 | u32 d_id; | ||
389 | union { | ||
390 | struct zfcp_san_dbf_record_ct ct; | ||
391 | struct zfcp_san_dbf_record_els els; | ||
392 | } type; | ||
393 | } __attribute__ ((packed)); | ||
394 | |||
395 | struct zfcp_scsi_dbf_record { | ||
396 | u8 tag[ZFCP_DBF_TAG_SIZE]; | ||
397 | u8 tag2[ZFCP_DBF_TAG_SIZE]; | ||
398 | u32 scsi_id; | ||
399 | u32 scsi_lun; | ||
400 | u32 scsi_result; | ||
401 | u64 scsi_cmnd; | ||
402 | u64 scsi_serial; | ||
403 | #define ZFCP_DBF_SCSI_OPCODE 16 | ||
404 | u8 scsi_opcode[ZFCP_DBF_SCSI_OPCODE]; | ||
405 | u8 scsi_retries; | ||
406 | u8 scsi_allowed; | ||
407 | u64 fsf_reqid; | ||
408 | u32 fsf_seqno; | ||
409 | u64 fsf_issued; | ||
410 | union { | ||
411 | u64 old_fsf_reqid; | ||
412 | struct { | ||
413 | u8 rsp_validity; | ||
414 | u8 rsp_scsi_status; | ||
415 | u32 rsp_resid; | ||
416 | u8 rsp_code; | ||
417 | #define ZFCP_DBF_SCSI_FCP_SNS_INFO 16 | ||
418 | #define ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO 256 | ||
419 | u32 sns_info_len; | ||
420 | u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO]; | ||
421 | } fcp; | ||
422 | } type; | ||
423 | } __attribute__ ((packed)); | ||
424 | |||
425 | /* | ||
426 | * FC-FS stuff | 266 | * FC-FS stuff |
427 | */ | 267 | */ |
428 | #define R_A_TOV 10 /* seconds */ | 268 | #define R_A_TOV 10 /* seconds */ |
@@ -634,7 +474,6 @@ do { \ | |||
634 | ZFCP_STATUS_PORT_NO_SCSI_ID) | 474 | ZFCP_STATUS_PORT_NO_SCSI_ID) |
635 | 475 | ||
636 | /* logical unit status */ | 476 | /* logical unit status */ |
637 | #define ZFCP_STATUS_UNIT_NOTSUPPUNITRESET 0x00000001 | ||
638 | #define ZFCP_STATUS_UNIT_TEMPORARY 0x00000002 | 477 | #define ZFCP_STATUS_UNIT_TEMPORARY 0x00000002 |
639 | #define ZFCP_STATUS_UNIT_SHARED 0x00000004 | 478 | #define ZFCP_STATUS_UNIT_SHARED 0x00000004 |
640 | #define ZFCP_STATUS_UNIT_READONLY 0x00000008 | 479 | #define ZFCP_STATUS_UNIT_READONLY 0x00000008 |
@@ -917,15 +756,15 @@ struct zfcp_adapter { | |||
917 | u32 erp_low_mem_count; /* nr of erp actions waiting | 756 | u32 erp_low_mem_count; /* nr of erp actions waiting |
918 | for memory */ | 757 | for memory */ |
919 | struct zfcp_port *nameserver_port; /* adapter's nameserver */ | 758 | struct zfcp_port *nameserver_port; /* adapter's nameserver */ |
920 | debug_info_t *erp_dbf; | 759 | debug_info_t *rec_dbf; |
921 | debug_info_t *hba_dbf; | 760 | debug_info_t *hba_dbf; |
922 | debug_info_t *san_dbf; /* debug feature areas */ | 761 | debug_info_t *san_dbf; /* debug feature areas */ |
923 | debug_info_t *scsi_dbf; | 762 | debug_info_t *scsi_dbf; |
924 | spinlock_t erp_dbf_lock; | 763 | spinlock_t rec_dbf_lock; |
925 | spinlock_t hba_dbf_lock; | 764 | spinlock_t hba_dbf_lock; |
926 | spinlock_t san_dbf_lock; | 765 | spinlock_t san_dbf_lock; |
927 | spinlock_t scsi_dbf_lock; | 766 | spinlock_t scsi_dbf_lock; |
928 | struct zfcp_erp_dbf_record erp_dbf_buf; | 767 | struct zfcp_rec_dbf_record rec_dbf_buf; |
929 | struct zfcp_hba_dbf_record hba_dbf_buf; | 768 | struct zfcp_hba_dbf_record hba_dbf_buf; |
930 | struct zfcp_san_dbf_record san_dbf_buf; | 769 | struct zfcp_san_dbf_record san_dbf_buf; |
931 | struct zfcp_scsi_dbf_record scsi_dbf_buf; | 770 | struct zfcp_scsi_dbf_record scsi_dbf_buf; |
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 2dc8110ebf74..805484658dd9 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -26,13 +26,17 @@ | |||
26 | static int zfcp_erp_adisc(struct zfcp_port *); | 26 | static int zfcp_erp_adisc(struct zfcp_port *); |
27 | static void zfcp_erp_adisc_handler(unsigned long); | 27 | static void zfcp_erp_adisc_handler(unsigned long); |
28 | 28 | ||
29 | static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int); | 29 | static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int, u8, |
30 | static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *, int); | 30 | void *); |
31 | static int zfcp_erp_port_reopen_internal(struct zfcp_port *, int); | 31 | static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *, int, u8, |
32 | static int zfcp_erp_unit_reopen_internal(struct zfcp_unit *, int); | 32 | void *); |
33 | 33 | static int zfcp_erp_port_reopen_internal(struct zfcp_port *, int, u8, void *); | |
34 | static int zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *, int); | 34 | static int zfcp_erp_unit_reopen_internal(struct zfcp_unit *, int, u8, void *); |
35 | static int zfcp_erp_unit_reopen_all_internal(struct zfcp_port *, int); | 35 | |
36 | static int zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *, int, u8, | ||
37 | void *); | ||
38 | static int zfcp_erp_unit_reopen_all_internal(struct zfcp_port *, int, u8, | ||
39 | void *); | ||
36 | 40 | ||
37 | static void zfcp_erp_adapter_block(struct zfcp_adapter *, int); | 41 | static void zfcp_erp_adapter_block(struct zfcp_adapter *, int); |
38 | static void zfcp_erp_adapter_unblock(struct zfcp_adapter *); | 42 | static void zfcp_erp_adapter_unblock(struct zfcp_adapter *); |
@@ -97,7 +101,8 @@ static void zfcp_erp_action_dismiss_unit(struct zfcp_unit *); | |||
97 | static void zfcp_erp_action_dismiss(struct zfcp_erp_action *); | 101 | static void zfcp_erp_action_dismiss(struct zfcp_erp_action *); |
98 | 102 | ||
99 | static int zfcp_erp_action_enqueue(int, struct zfcp_adapter *, | 103 | static int zfcp_erp_action_enqueue(int, struct zfcp_adapter *, |
100 | struct zfcp_port *, struct zfcp_unit *); | 104 | struct zfcp_port *, struct zfcp_unit *, |
105 | u8 id, void *ref); | ||
101 | static int zfcp_erp_action_dequeue(struct zfcp_erp_action *); | 106 | static int zfcp_erp_action_dequeue(struct zfcp_erp_action *); |
102 | static void zfcp_erp_action_cleanup(int, struct zfcp_adapter *, | 107 | static void zfcp_erp_action_cleanup(int, struct zfcp_adapter *, |
103 | struct zfcp_port *, struct zfcp_unit *, | 108 | struct zfcp_port *, struct zfcp_unit *, |
@@ -128,11 +133,9 @@ static void zfcp_close_qdio(struct zfcp_adapter *adapter) | |||
128 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status); | 133 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status); |
129 | write_unlock_irq(&req_queue->queue_lock); | 134 | write_unlock_irq(&req_queue->queue_lock); |
130 | 135 | ||
131 | debug_text_event(adapter->erp_dbf, 3, "qdio_down2a"); | ||
132 | while (qdio_shutdown(adapter->ccw_device, | 136 | while (qdio_shutdown(adapter->ccw_device, |
133 | QDIO_FLAG_CLEANUP_USING_CLEAR) == -EINPROGRESS) | 137 | QDIO_FLAG_CLEANUP_USING_CLEAR) == -EINPROGRESS) |
134 | ssleep(1); | 138 | ssleep(1); |
135 | debug_text_event(adapter->erp_dbf, 3, "qdio_down2b"); | ||
136 | 139 | ||
137 | /* cleanup used outbound sbals */ | 140 | /* cleanup used outbound sbals */ |
138 | count = atomic_read(&req_queue->free_count); | 141 | count = atomic_read(&req_queue->free_count); |
@@ -163,7 +166,7 @@ static void zfcp_close_fsf(struct zfcp_adapter *adapter) | |||
163 | /* reset FSF request sequence number */ | 166 | /* reset FSF request sequence number */ |
164 | adapter->fsf_req_seq_no = 0; | 167 | adapter->fsf_req_seq_no = 0; |
165 | /* all ports and units are closed */ | 168 | /* all ports and units are closed */ |
166 | zfcp_erp_modify_adapter_status(adapter, | 169 | zfcp_erp_modify_adapter_status(adapter, 24, NULL, |
167 | ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR); | 170 | ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR); |
168 | } | 171 | } |
169 | 172 | ||
@@ -179,7 +182,8 @@ static void zfcp_close_fsf(struct zfcp_adapter *adapter) | |||
179 | static void zfcp_fsf_request_timeout_handler(unsigned long data) | 182 | static void zfcp_fsf_request_timeout_handler(unsigned long data) |
180 | { | 183 | { |
181 | struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; | 184 | struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; |
182 | zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED); | 185 | zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 62, |
186 | NULL); | ||
183 | } | 187 | } |
184 | 188 | ||
185 | void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout) | 189 | void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout) |
@@ -200,12 +204,11 @@ void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout) | |||
200 | * returns: 0 - initiated action successfully | 204 | * returns: 0 - initiated action successfully |
201 | * <0 - failed to initiate action | 205 | * <0 - failed to initiate action |
202 | */ | 206 | */ |
203 | static int | 207 | static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter, |
204 | zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter, int clear_mask) | 208 | int clear_mask, u8 id, void *ref) |
205 | { | 209 | { |
206 | int retval; | 210 | int retval; |
207 | 211 | ||
208 | debug_text_event(adapter->erp_dbf, 5, "a_ro"); | ||
209 | ZFCP_LOG_DEBUG("reopen adapter %s\n", | 212 | ZFCP_LOG_DEBUG("reopen adapter %s\n", |
210 | zfcp_get_busid_by_adapter(adapter)); | 213 | zfcp_get_busid_by_adapter(adapter)); |
211 | 214 | ||
@@ -214,14 +217,13 @@ zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter, int clear_mask) | |||
214 | if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &adapter->status)) { | 217 | if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &adapter->status)) { |
215 | ZFCP_LOG_DEBUG("skipped reopen of failed adapter %s\n", | 218 | ZFCP_LOG_DEBUG("skipped reopen of failed adapter %s\n", |
216 | zfcp_get_busid_by_adapter(adapter)); | 219 | zfcp_get_busid_by_adapter(adapter)); |
217 | debug_text_event(adapter->erp_dbf, 5, "a_ro_f"); | ||
218 | /* ensure propagation of failed status to new devices */ | 220 | /* ensure propagation of failed status to new devices */ |
219 | zfcp_erp_adapter_failed(adapter); | 221 | zfcp_erp_adapter_failed(adapter, 13, NULL); |
220 | retval = -EIO; | 222 | retval = -EIO; |
221 | goto out; | 223 | goto out; |
222 | } | 224 | } |
223 | retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, | 225 | retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, |
224 | adapter, NULL, NULL); | 226 | adapter, NULL, NULL, id, ref); |
225 | 227 | ||
226 | out: | 228 | out: |
227 | return retval; | 229 | return retval; |
@@ -236,56 +238,56 @@ zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter, int clear_mask) | |||
236 | * returns: 0 - initiated action successfully | 238 | * returns: 0 - initiated action successfully |
237 | * <0 - failed to initiate action | 239 | * <0 - failed to initiate action |
238 | */ | 240 | */ |
239 | int | 241 | int zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear_mask, |
240 | zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear_mask) | 242 | u8 id, void *ref) |
241 | { | 243 | { |
242 | int retval; | 244 | int retval; |
243 | unsigned long flags; | 245 | unsigned long flags; |
244 | 246 | ||
245 | read_lock_irqsave(&zfcp_data.config_lock, flags); | 247 | read_lock_irqsave(&zfcp_data.config_lock, flags); |
246 | write_lock(&adapter->erp_lock); | 248 | write_lock(&adapter->erp_lock); |
247 | retval = zfcp_erp_adapter_reopen_internal(adapter, clear_mask); | 249 | retval = zfcp_erp_adapter_reopen_internal(adapter, clear_mask, id, ref); |
248 | write_unlock(&adapter->erp_lock); | 250 | write_unlock(&adapter->erp_lock); |
249 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); | 251 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); |
250 | 252 | ||
251 | return retval; | 253 | return retval; |
252 | } | 254 | } |
253 | 255 | ||
254 | int | 256 | int zfcp_erp_adapter_shutdown(struct zfcp_adapter *adapter, int clear_mask, |
255 | zfcp_erp_adapter_shutdown(struct zfcp_adapter *adapter, int clear_mask) | 257 | u8 id, void *ref) |
256 | { | 258 | { |
257 | int retval; | 259 | int retval; |
258 | 260 | ||
259 | retval = zfcp_erp_adapter_reopen(adapter, | 261 | retval = zfcp_erp_adapter_reopen(adapter, |
260 | ZFCP_STATUS_COMMON_RUNNING | | 262 | ZFCP_STATUS_COMMON_RUNNING | |
261 | ZFCP_STATUS_COMMON_ERP_FAILED | | 263 | ZFCP_STATUS_COMMON_ERP_FAILED | |
262 | clear_mask); | 264 | clear_mask, id, ref); |
263 | 265 | ||
264 | return retval; | 266 | return retval; |
265 | } | 267 | } |
266 | 268 | ||
267 | int | 269 | int zfcp_erp_port_shutdown(struct zfcp_port *port, int clear_mask, u8 id, |
268 | zfcp_erp_port_shutdown(struct zfcp_port *port, int clear_mask) | 270 | void *ref) |
269 | { | 271 | { |
270 | int retval; | 272 | int retval; |
271 | 273 | ||
272 | retval = zfcp_erp_port_reopen(port, | 274 | retval = zfcp_erp_port_reopen(port, |
273 | ZFCP_STATUS_COMMON_RUNNING | | 275 | ZFCP_STATUS_COMMON_RUNNING | |
274 | ZFCP_STATUS_COMMON_ERP_FAILED | | 276 | ZFCP_STATUS_COMMON_ERP_FAILED | |
275 | clear_mask); | 277 | clear_mask, id, ref); |
276 | 278 | ||
277 | return retval; | 279 | return retval; |
278 | } | 280 | } |
279 | 281 | ||
280 | int | 282 | int zfcp_erp_unit_shutdown(struct zfcp_unit *unit, int clear_mask, u8 id, |
281 | zfcp_erp_unit_shutdown(struct zfcp_unit *unit, int clear_mask) | 283 | void *ref) |
282 | { | 284 | { |
283 | int retval; | 285 | int retval; |
284 | 286 | ||
285 | retval = zfcp_erp_unit_reopen(unit, | 287 | retval = zfcp_erp_unit_reopen(unit, |
286 | ZFCP_STATUS_COMMON_RUNNING | | 288 | ZFCP_STATUS_COMMON_RUNNING | |
287 | ZFCP_STATUS_COMMON_ERP_FAILED | | 289 | ZFCP_STATUS_COMMON_ERP_FAILED | |
288 | clear_mask); | 290 | clear_mask, id, ref); |
289 | 291 | ||
290 | return retval; | 292 | return retval; |
291 | } | 293 | } |
@@ -399,8 +401,7 @@ zfcp_erp_adisc_handler(unsigned long data) | |||
399 | "force physical port reopen " | 401 | "force physical port reopen " |
400 | "(adapter %s, port d_id=0x%06x)\n", | 402 | "(adapter %s, port d_id=0x%06x)\n", |
401 | zfcp_get_busid_by_adapter(adapter), d_id); | 403 | zfcp_get_busid_by_adapter(adapter), d_id); |
402 | debug_text_event(adapter->erp_dbf, 3, "forcreop"); | 404 | if (zfcp_erp_port_forced_reopen(port, 0, 63, NULL)) |
403 | if (zfcp_erp_port_forced_reopen(port, 0)) | ||
404 | ZFCP_LOG_NORMAL("failed reopen of port " | 405 | ZFCP_LOG_NORMAL("failed reopen of port " |
405 | "(adapter %s, wwpn=0x%016Lx)\n", | 406 | "(adapter %s, wwpn=0x%016Lx)\n", |
406 | zfcp_get_busid_by_port(port), | 407 | zfcp_get_busid_by_port(port), |
@@ -427,7 +428,7 @@ zfcp_erp_adisc_handler(unsigned long data) | |||
427 | "adisc_resp_wwpn=0x%016Lx)\n", | 428 | "adisc_resp_wwpn=0x%016Lx)\n", |
428 | zfcp_get_busid_by_port(port), | 429 | zfcp_get_busid_by_port(port), |
429 | port->wwpn, (wwn_t) adisc->wwpn); | 430 | port->wwpn, (wwn_t) adisc->wwpn); |
430 | if (zfcp_erp_port_reopen(port, 0)) | 431 | if (zfcp_erp_port_reopen(port, 0, 64, NULL)) |
431 | ZFCP_LOG_NORMAL("failed reopen of port " | 432 | ZFCP_LOG_NORMAL("failed reopen of port " |
432 | "(adapter %s, wwpn=0x%016Lx)\n", | 433 | "(adapter %s, wwpn=0x%016Lx)\n", |
433 | zfcp_get_busid_by_port(port), | 434 | zfcp_get_busid_by_port(port), |
@@ -461,7 +462,7 @@ zfcp_test_link(struct zfcp_port *port) | |||
461 | ZFCP_LOG_NORMAL("reopen needed for port 0x%016Lx " | 462 | ZFCP_LOG_NORMAL("reopen needed for port 0x%016Lx " |
462 | "on adapter %s\n ", port->wwpn, | 463 | "on adapter %s\n ", port->wwpn, |
463 | zfcp_get_busid_by_port(port)); | 464 | zfcp_get_busid_by_port(port)); |
464 | retval = zfcp_erp_port_forced_reopen(port, 0); | 465 | retval = zfcp_erp_port_forced_reopen(port, 0, 65, NULL); |
465 | if (retval != 0) { | 466 | if (retval != 0) { |
466 | ZFCP_LOG_NORMAL("reopen of remote port 0x%016Lx " | 467 | ZFCP_LOG_NORMAL("reopen of remote port 0x%016Lx " |
467 | "on adapter %s failed\n", port->wwpn, | 468 | "on adapter %s failed\n", port->wwpn, |
@@ -484,14 +485,11 @@ zfcp_test_link(struct zfcp_port *port) | |||
484 | * returns: 0 - initiated action successfully | 485 | * returns: 0 - initiated action successfully |
485 | * <0 - failed to initiate action | 486 | * <0 - failed to initiate action |
486 | */ | 487 | */ |
487 | static int | 488 | static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port, |
488 | zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port, int clear_mask) | 489 | int clear_mask, u8 id, |
490 | void *ref) | ||
489 | { | 491 | { |
490 | int retval; | 492 | int retval; |
491 | struct zfcp_adapter *adapter = port->adapter; | ||
492 | |||
493 | debug_text_event(adapter->erp_dbf, 5, "pf_ro"); | ||
494 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
495 | 493 | ||
496 | ZFCP_LOG_DEBUG("forced reopen of port 0x%016Lx on adapter %s\n", | 494 | ZFCP_LOG_DEBUG("forced reopen of port 0x%016Lx on adapter %s\n", |
497 | port->wwpn, zfcp_get_busid_by_port(port)); | 495 | port->wwpn, zfcp_get_busid_by_port(port)); |
@@ -502,14 +500,12 @@ zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port, int clear_mask) | |||
502 | ZFCP_LOG_DEBUG("skipped forced reopen of failed port 0x%016Lx " | 500 | ZFCP_LOG_DEBUG("skipped forced reopen of failed port 0x%016Lx " |
503 | "on adapter %s\n", port->wwpn, | 501 | "on adapter %s\n", port->wwpn, |
504 | zfcp_get_busid_by_port(port)); | 502 | zfcp_get_busid_by_port(port)); |
505 | debug_text_event(adapter->erp_dbf, 5, "pf_ro_f"); | ||
506 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
507 | retval = -EIO; | 503 | retval = -EIO; |
508 | goto out; | 504 | goto out; |
509 | } | 505 | } |
510 | 506 | ||
511 | retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT_FORCED, | 507 | retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT_FORCED, |
512 | port->adapter, port, NULL); | 508 | port->adapter, port, NULL, id, ref); |
513 | 509 | ||
514 | out: | 510 | out: |
515 | return retval; | 511 | return retval; |
@@ -524,8 +520,8 @@ zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port, int clear_mask) | |||
524 | * returns: 0 - initiated action successfully | 520 | * returns: 0 - initiated action successfully |
525 | * <0 - failed to initiate action | 521 | * <0 - failed to initiate action |
526 | */ | 522 | */ |
527 | int | 523 | int zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear_mask, u8 id, |
528 | zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear_mask) | 524 | void *ref) |
529 | { | 525 | { |
530 | int retval; | 526 | int retval; |
531 | unsigned long flags; | 527 | unsigned long flags; |
@@ -534,7 +530,8 @@ zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear_mask) | |||
534 | adapter = port->adapter; | 530 | adapter = port->adapter; |
535 | read_lock_irqsave(&zfcp_data.config_lock, flags); | 531 | read_lock_irqsave(&zfcp_data.config_lock, flags); |
536 | write_lock(&adapter->erp_lock); | 532 | write_lock(&adapter->erp_lock); |
537 | retval = zfcp_erp_port_forced_reopen_internal(port, clear_mask); | 533 | retval = zfcp_erp_port_forced_reopen_internal(port, clear_mask, id, |
534 | ref); | ||
538 | write_unlock(&adapter->erp_lock); | 535 | write_unlock(&adapter->erp_lock); |
539 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); | 536 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); |
540 | 537 | ||
@@ -551,14 +548,10 @@ zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear_mask) | |||
551 | * returns: 0 - initiated action successfully | 548 | * returns: 0 - initiated action successfully |
552 | * <0 - failed to initiate action | 549 | * <0 - failed to initiate action |
553 | */ | 550 | */ |
554 | static int | 551 | static int zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask, |
555 | zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask) | 552 | u8 id, void *ref) |
556 | { | 553 | { |
557 | int retval; | 554 | int retval; |
558 | struct zfcp_adapter *adapter = port->adapter; | ||
559 | |||
560 | debug_text_event(adapter->erp_dbf, 5, "p_ro"); | ||
561 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
562 | 555 | ||
563 | ZFCP_LOG_DEBUG("reopen of port 0x%016Lx on adapter %s\n", | 556 | ZFCP_LOG_DEBUG("reopen of port 0x%016Lx on adapter %s\n", |
564 | port->wwpn, zfcp_get_busid_by_port(port)); | 557 | port->wwpn, zfcp_get_busid_by_port(port)); |
@@ -569,16 +562,14 @@ zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask) | |||
569 | ZFCP_LOG_DEBUG("skipped reopen of failed port 0x%016Lx " | 562 | ZFCP_LOG_DEBUG("skipped reopen of failed port 0x%016Lx " |
570 | "on adapter %s\n", port->wwpn, | 563 | "on adapter %s\n", port->wwpn, |
571 | zfcp_get_busid_by_port(port)); | 564 | zfcp_get_busid_by_port(port)); |
572 | debug_text_event(adapter->erp_dbf, 5, "p_ro_f"); | ||
573 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
574 | /* ensure propagation of failed status to new devices */ | 565 | /* ensure propagation of failed status to new devices */ |
575 | zfcp_erp_port_failed(port); | 566 | zfcp_erp_port_failed(port, 14, NULL); |
576 | retval = -EIO; | 567 | retval = -EIO; |
577 | goto out; | 568 | goto out; |
578 | } | 569 | } |
579 | 570 | ||
580 | retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT, | 571 | retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT, |
581 | port->adapter, port, NULL); | 572 | port->adapter, port, NULL, id, ref); |
582 | 573 | ||
583 | out: | 574 | out: |
584 | return retval; | 575 | return retval; |
@@ -594,8 +585,8 @@ zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask) | |||
594 | * correct locking. An error recovery task is initiated to do the reopen. | 585 | * correct locking. An error recovery task is initiated to do the reopen. |
595 | * To wait for the completion of the reopen zfcp_erp_wait should be used. | 586 | * To wait for the completion of the reopen zfcp_erp_wait should be used. |
596 | */ | 587 | */ |
597 | int | 588 | int zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask, u8 id, |
598 | zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask) | 589 | void *ref) |
599 | { | 590 | { |
600 | int retval; | 591 | int retval; |
601 | unsigned long flags; | 592 | unsigned long flags; |
@@ -603,7 +594,7 @@ zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask) | |||
603 | 594 | ||
604 | read_lock_irqsave(&zfcp_data.config_lock, flags); | 595 | read_lock_irqsave(&zfcp_data.config_lock, flags); |
605 | write_lock(&adapter->erp_lock); | 596 | write_lock(&adapter->erp_lock); |
606 | retval = zfcp_erp_port_reopen_internal(port, clear_mask); | 597 | retval = zfcp_erp_port_reopen_internal(port, clear_mask, id, ref); |
607 | write_unlock(&adapter->erp_lock); | 598 | write_unlock(&adapter->erp_lock); |
608 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); | 599 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); |
609 | 600 | ||
@@ -620,14 +611,12 @@ zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask) | |||
620 | * returns: 0 - initiated action successfully | 611 | * returns: 0 - initiated action successfully |
621 | * <0 - failed to initiate action | 612 | * <0 - failed to initiate action |
622 | */ | 613 | */ |
623 | static int | 614 | static int zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask, |
624 | zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask) | 615 | u8 id, void *ref) |
625 | { | 616 | { |
626 | int retval; | 617 | int retval; |
627 | struct zfcp_adapter *adapter = unit->port->adapter; | 618 | struct zfcp_adapter *adapter = unit->port->adapter; |
628 | 619 | ||
629 | debug_text_event(adapter->erp_dbf, 5, "u_ro"); | ||
630 | debug_event(adapter->erp_dbf, 5, &unit->fcp_lun, sizeof (fcp_lun_t)); | ||
631 | ZFCP_LOG_DEBUG("reopen of unit 0x%016Lx on port 0x%016Lx " | 620 | ZFCP_LOG_DEBUG("reopen of unit 0x%016Lx on port 0x%016Lx " |
632 | "on adapter %s\n", unit->fcp_lun, | 621 | "on adapter %s\n", unit->fcp_lun, |
633 | unit->port->wwpn, zfcp_get_busid_by_unit(unit)); | 622 | unit->port->wwpn, zfcp_get_busid_by_unit(unit)); |
@@ -639,15 +628,12 @@ zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask) | |||
639 | "on port 0x%016Lx on adapter %s\n", | 628 | "on port 0x%016Lx on adapter %s\n", |
640 | unit->fcp_lun, unit->port->wwpn, | 629 | unit->fcp_lun, unit->port->wwpn, |
641 | zfcp_get_busid_by_unit(unit)); | 630 | zfcp_get_busid_by_unit(unit)); |
642 | debug_text_event(adapter->erp_dbf, 5, "u_ro_f"); | ||
643 | debug_event(adapter->erp_dbf, 5, &unit->fcp_lun, | ||
644 | sizeof (fcp_lun_t)); | ||
645 | retval = -EIO; | 631 | retval = -EIO; |
646 | goto out; | 632 | goto out; |
647 | } | 633 | } |
648 | 634 | ||
649 | retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_UNIT, | 635 | retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_UNIT, |
650 | unit->port->adapter, unit->port, unit); | 636 | adapter, unit->port, unit, id, ref); |
651 | out: | 637 | out: |
652 | return retval; | 638 | return retval; |
653 | } | 639 | } |
@@ -662,8 +648,8 @@ zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask) | |||
662 | * locking. An error recovery task is initiated to do the reopen. | 648 | * locking. An error recovery task is initiated to do the reopen. |
663 | * To wait for the completion of the reopen zfcp_erp_wait should be used. | 649 | * To wait for the completion of the reopen zfcp_erp_wait should be used. |
664 | */ | 650 | */ |
665 | int | 651 | int zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear_mask, u8 id, |
666 | zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear_mask) | 652 | void *ref) |
667 | { | 653 | { |
668 | int retval; | 654 | int retval; |
669 | unsigned long flags; | 655 | unsigned long flags; |
@@ -675,7 +661,7 @@ zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear_mask) | |||
675 | 661 | ||
676 | read_lock_irqsave(&zfcp_data.config_lock, flags); | 662 | read_lock_irqsave(&zfcp_data.config_lock, flags); |
677 | write_lock(&adapter->erp_lock); | 663 | write_lock(&adapter->erp_lock); |
678 | retval = zfcp_erp_unit_reopen_internal(unit, clear_mask); | 664 | retval = zfcp_erp_unit_reopen_internal(unit, clear_mask, id, ref); |
679 | write_unlock(&adapter->erp_lock); | 665 | write_unlock(&adapter->erp_lock); |
680 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); | 666 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); |
681 | 667 | ||
@@ -687,19 +673,43 @@ zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear_mask) | |||
687 | */ | 673 | */ |
688 | static void zfcp_erp_adapter_block(struct zfcp_adapter *adapter, int clear_mask) | 674 | static void zfcp_erp_adapter_block(struct zfcp_adapter *adapter, int clear_mask) |
689 | { | 675 | { |
690 | debug_text_event(adapter->erp_dbf, 6, "a_bl"); | 676 | zfcp_erp_modify_adapter_status(adapter, 15, NULL, |
691 | zfcp_erp_modify_adapter_status(adapter, | ||
692 | ZFCP_STATUS_COMMON_UNBLOCKED | | 677 | ZFCP_STATUS_COMMON_UNBLOCKED | |
693 | clear_mask, ZFCP_CLEAR); | 678 | clear_mask, ZFCP_CLEAR); |
694 | } | 679 | } |
695 | 680 | ||
681 | /* FIXME: isn't really atomic */ | ||
682 | /* | ||
683 | * returns the mask which has not been set so far, i.e. | ||
684 | * 0 if no bit has been changed, !0 if some bit has been changed | ||
685 | */ | ||
686 | static int atomic_test_and_set_mask(unsigned long mask, atomic_t *v) | ||
687 | { | ||
688 | int changed_bits = (atomic_read(v) /*XOR*/^ mask) & mask; | ||
689 | atomic_set_mask(mask, v); | ||
690 | return changed_bits; | ||
691 | } | ||
692 | |||
693 | /* FIXME: isn't really atomic */ | ||
694 | /* | ||
695 | * returns the mask which has not been cleared so far, i.e. | ||
696 | * 0 if no bit has been changed, !0 if some bit has been changed | ||
697 | */ | ||
698 | static int atomic_test_and_clear_mask(unsigned long mask, atomic_t *v) | ||
699 | { | ||
700 | int changed_bits = atomic_read(v) & mask; | ||
701 | atomic_clear_mask(mask, v); | ||
702 | return changed_bits; | ||
703 | } | ||
704 | |||
696 | /** | 705 | /** |
697 | * zfcp_erp_adapter_unblock - mark adapter as unblocked, allow scsi requests | 706 | * zfcp_erp_adapter_unblock - mark adapter as unblocked, allow scsi requests |
698 | */ | 707 | */ |
699 | static void zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter) | 708 | static void zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter) |
700 | { | 709 | { |
701 | debug_text_event(adapter->erp_dbf, 6, "a_ubl"); | 710 | if (atomic_test_and_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, |
702 | atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status); | 711 | &adapter->status)) |
712 | zfcp_rec_dbf_event_adapter(16, NULL, adapter); | ||
703 | } | 713 | } |
704 | 714 | ||
705 | /* | 715 | /* |
@@ -714,11 +724,7 @@ static void zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter) | |||
714 | static void | 724 | static void |
715 | zfcp_erp_port_block(struct zfcp_port *port, int clear_mask) | 725 | zfcp_erp_port_block(struct zfcp_port *port, int clear_mask) |
716 | { | 726 | { |
717 | struct zfcp_adapter *adapter = port->adapter; | 727 | zfcp_erp_modify_port_status(port, 17, NULL, |
718 | |||
719 | debug_text_event(adapter->erp_dbf, 6, "p_bl"); | ||
720 | debug_event(adapter->erp_dbf, 6, &port->wwpn, sizeof (wwn_t)); | ||
721 | zfcp_erp_modify_port_status(port, | ||
722 | ZFCP_STATUS_COMMON_UNBLOCKED | clear_mask, | 728 | ZFCP_STATUS_COMMON_UNBLOCKED | clear_mask, |
723 | ZFCP_CLEAR); | 729 | ZFCP_CLEAR); |
724 | } | 730 | } |
@@ -733,11 +739,9 @@ zfcp_erp_port_block(struct zfcp_port *port, int clear_mask) | |||
733 | static void | 739 | static void |
734 | zfcp_erp_port_unblock(struct zfcp_port *port) | 740 | zfcp_erp_port_unblock(struct zfcp_port *port) |
735 | { | 741 | { |
736 | struct zfcp_adapter *adapter = port->adapter; | 742 | if (atomic_test_and_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, |
737 | 743 | &port->status)) | |
738 | debug_text_event(adapter->erp_dbf, 6, "p_ubl"); | 744 | zfcp_rec_dbf_event_port(18, NULL, port); |
739 | debug_event(adapter->erp_dbf, 6, &port->wwpn, sizeof (wwn_t)); | ||
740 | atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &port->status); | ||
741 | } | 745 | } |
742 | 746 | ||
743 | /* | 747 | /* |
@@ -752,11 +756,7 @@ zfcp_erp_port_unblock(struct zfcp_port *port) | |||
752 | static void | 756 | static void |
753 | zfcp_erp_unit_block(struct zfcp_unit *unit, int clear_mask) | 757 | zfcp_erp_unit_block(struct zfcp_unit *unit, int clear_mask) |
754 | { | 758 | { |
755 | struct zfcp_adapter *adapter = unit->port->adapter; | 759 | zfcp_erp_modify_unit_status(unit, 19, NULL, |
756 | |||
757 | debug_text_event(adapter->erp_dbf, 6, "u_bl"); | ||
758 | debug_event(adapter->erp_dbf, 6, &unit->fcp_lun, sizeof (fcp_lun_t)); | ||
759 | zfcp_erp_modify_unit_status(unit, | ||
760 | ZFCP_STATUS_COMMON_UNBLOCKED | clear_mask, | 760 | ZFCP_STATUS_COMMON_UNBLOCKED | clear_mask, |
761 | ZFCP_CLEAR); | 761 | ZFCP_CLEAR); |
762 | } | 762 | } |
@@ -771,11 +771,9 @@ zfcp_erp_unit_block(struct zfcp_unit *unit, int clear_mask) | |||
771 | static void | 771 | static void |
772 | zfcp_erp_unit_unblock(struct zfcp_unit *unit) | 772 | zfcp_erp_unit_unblock(struct zfcp_unit *unit) |
773 | { | 773 | { |
774 | struct zfcp_adapter *adapter = unit->port->adapter; | 774 | if (atomic_test_and_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, |
775 | 775 | &unit->status)) | |
776 | debug_text_event(adapter->erp_dbf, 6, "u_ubl"); | 776 | zfcp_rec_dbf_event_unit(20, NULL, unit); |
777 | debug_event(adapter->erp_dbf, 6, &unit->fcp_lun, sizeof (fcp_lun_t)); | ||
778 | atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &unit->status); | ||
779 | } | 777 | } |
780 | 778 | ||
781 | static void | 779 | static void |
@@ -783,11 +781,9 @@ zfcp_erp_action_ready(struct zfcp_erp_action *erp_action) | |||
783 | { | 781 | { |
784 | struct zfcp_adapter *adapter = erp_action->adapter; | 782 | struct zfcp_adapter *adapter = erp_action->adapter; |
785 | 783 | ||
786 | debug_text_event(adapter->erp_dbf, 4, "a_ar"); | ||
787 | debug_event(adapter->erp_dbf, 4, &erp_action->action, sizeof (int)); | ||
788 | |||
789 | zfcp_erp_action_to_ready(erp_action); | 784 | zfcp_erp_action_to_ready(erp_action); |
790 | up(&adapter->erp_ready_sem); | 785 | up(&adapter->erp_ready_sem); |
786 | zfcp_rec_dbf_event_thread(2, adapter, 0); | ||
791 | } | 787 | } |
792 | 788 | ||
793 | /* | 789 | /* |
@@ -849,18 +845,15 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action) | |||
849 | if (zfcp_reqlist_find_safe(adapter, erp_action->fsf_req) && | 845 | if (zfcp_reqlist_find_safe(adapter, erp_action->fsf_req) && |
850 | erp_action->fsf_req->erp_action == erp_action) { | 846 | erp_action->fsf_req->erp_action == erp_action) { |
851 | /* fsf_req still exists */ | 847 | /* fsf_req still exists */ |
852 | debug_text_event(adapter->erp_dbf, 3, "a_ca_req"); | ||
853 | debug_event(adapter->erp_dbf, 3, &erp_action->fsf_req, | ||
854 | sizeof (unsigned long)); | ||
855 | /* dismiss fsf_req of timed out/dismissed erp_action */ | 848 | /* dismiss fsf_req of timed out/dismissed erp_action */ |
856 | if (erp_action->status & (ZFCP_STATUS_ERP_DISMISSED | | 849 | if (erp_action->status & (ZFCP_STATUS_ERP_DISMISSED | |
857 | ZFCP_STATUS_ERP_TIMEDOUT)) { | 850 | ZFCP_STATUS_ERP_TIMEDOUT)) { |
858 | debug_text_event(adapter->erp_dbf, 3, | ||
859 | "a_ca_disreq"); | ||
860 | erp_action->fsf_req->status |= | 851 | erp_action->fsf_req->status |= |
861 | ZFCP_STATUS_FSFREQ_DISMISSED; | 852 | ZFCP_STATUS_FSFREQ_DISMISSED; |
853 | zfcp_rec_dbf_event_action(142, erp_action); | ||
862 | } | 854 | } |
863 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { | 855 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { |
856 | zfcp_rec_dbf_event_action(143, erp_action); | ||
864 | ZFCP_LOG_NORMAL("error: erp step timed out " | 857 | ZFCP_LOG_NORMAL("error: erp step timed out " |
865 | "(action=%d, fsf_req=%p)\n ", | 858 | "(action=%d, fsf_req=%p)\n ", |
866 | erp_action->action, | 859 | erp_action->action, |
@@ -879,7 +872,6 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action) | |||
879 | erp_action->fsf_req = NULL; | 872 | erp_action->fsf_req = NULL; |
880 | } | 873 | } |
881 | } else { | 874 | } else { |
882 | debug_text_event(adapter->erp_dbf, 3, "a_ca_gonereq"); | ||
883 | /* | 875 | /* |
884 | * even if this fsf_req has gone, forget about | 876 | * even if this fsf_req has gone, forget about |
885 | * association between erp_action and fsf_req | 877 | * association between erp_action and fsf_req |
@@ -887,8 +879,7 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action) | |||
887 | erp_action->fsf_req = NULL; | 879 | erp_action->fsf_req = NULL; |
888 | } | 880 | } |
889 | spin_unlock(&adapter->req_list_lock); | 881 | spin_unlock(&adapter->req_list_lock); |
890 | } else | 882 | } |
891 | debug_text_event(adapter->erp_dbf, 3, "a_ca_noreq"); | ||
892 | } | 883 | } |
893 | 884 | ||
894 | /** | 885 | /** |
@@ -900,19 +891,11 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action) | |||
900 | static void zfcp_erp_async_handler_nolock(struct zfcp_erp_action *erp_action, | 891 | static void zfcp_erp_async_handler_nolock(struct zfcp_erp_action *erp_action, |
901 | unsigned long set_mask) | 892 | unsigned long set_mask) |
902 | { | 893 | { |
903 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
904 | |||
905 | if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING) { | 894 | if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING) { |
906 | debug_text_event(adapter->erp_dbf, 2, "a_asyh_ex"); | ||
907 | debug_event(adapter->erp_dbf, 2, &erp_action->action, | ||
908 | sizeof (int)); | ||
909 | erp_action->status |= set_mask; | 895 | erp_action->status |= set_mask; |
910 | zfcp_erp_action_ready(erp_action); | 896 | zfcp_erp_action_ready(erp_action); |
911 | } else { | 897 | } else { |
912 | /* action is ready or gone - nothing to do */ | 898 | /* action is ready or gone - nothing to do */ |
913 | debug_text_event(adapter->erp_dbf, 3, "a_asyh_gone"); | ||
914 | debug_event(adapter->erp_dbf, 3, &erp_action->action, | ||
915 | sizeof (int)); | ||
916 | } | 899 | } |
917 | } | 900 | } |
918 | 901 | ||
@@ -939,10 +922,6 @@ static void | |||
939 | zfcp_erp_memwait_handler(unsigned long data) | 922 | zfcp_erp_memwait_handler(unsigned long data) |
940 | { | 923 | { |
941 | struct zfcp_erp_action *erp_action = (struct zfcp_erp_action *) data; | 924 | struct zfcp_erp_action *erp_action = (struct zfcp_erp_action *) data; |
942 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
943 | |||
944 | debug_text_event(adapter->erp_dbf, 2, "a_mwh"); | ||
945 | debug_event(adapter->erp_dbf, 2, &erp_action->action, sizeof (int)); | ||
946 | 925 | ||
947 | zfcp_erp_async_handler(erp_action, 0); | 926 | zfcp_erp_async_handler(erp_action, 0); |
948 | } | 927 | } |
@@ -955,10 +934,6 @@ zfcp_erp_memwait_handler(unsigned long data) | |||
955 | static void zfcp_erp_timeout_handler(unsigned long data) | 934 | static void zfcp_erp_timeout_handler(unsigned long data) |
956 | { | 935 | { |
957 | struct zfcp_erp_action *erp_action = (struct zfcp_erp_action *) data; | 936 | struct zfcp_erp_action *erp_action = (struct zfcp_erp_action *) data; |
958 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
959 | |||
960 | debug_text_event(adapter->erp_dbf, 2, "a_th"); | ||
961 | debug_event(adapter->erp_dbf, 2, &erp_action->action, sizeof (int)); | ||
962 | 937 | ||
963 | zfcp_erp_async_handler(erp_action, ZFCP_STATUS_ERP_TIMEDOUT); | 938 | zfcp_erp_async_handler(erp_action, ZFCP_STATUS_ERP_TIMEDOUT); |
964 | } | 939 | } |
@@ -973,11 +948,6 @@ static void zfcp_erp_timeout_handler(unsigned long data) | |||
973 | */ | 948 | */ |
974 | static void zfcp_erp_action_dismiss(struct zfcp_erp_action *erp_action) | 949 | static void zfcp_erp_action_dismiss(struct zfcp_erp_action *erp_action) |
975 | { | 950 | { |
976 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
977 | |||
978 | debug_text_event(adapter->erp_dbf, 2, "a_adis"); | ||
979 | debug_event(adapter->erp_dbf, 2, &erp_action->action, sizeof (int)); | ||
980 | |||
981 | erp_action->status |= ZFCP_STATUS_ERP_DISMISSED; | 951 | erp_action->status |= ZFCP_STATUS_ERP_DISMISSED; |
982 | if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING) | 952 | if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING) |
983 | zfcp_erp_action_ready(erp_action); | 953 | zfcp_erp_action_ready(erp_action); |
@@ -995,12 +965,10 @@ zfcp_erp_thread_setup(struct zfcp_adapter *adapter) | |||
995 | ZFCP_LOG_NORMAL("error: creation of erp thread failed for " | 965 | ZFCP_LOG_NORMAL("error: creation of erp thread failed for " |
996 | "adapter %s\n", | 966 | "adapter %s\n", |
997 | zfcp_get_busid_by_adapter(adapter)); | 967 | zfcp_get_busid_by_adapter(adapter)); |
998 | debug_text_event(adapter->erp_dbf, 5, "a_thset_fail"); | ||
999 | } else { | 968 | } else { |
1000 | wait_event(adapter->erp_thread_wqh, | 969 | wait_event(adapter->erp_thread_wqh, |
1001 | atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, | 970 | atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, |
1002 | &adapter->status)); | 971 | &adapter->status)); |
1003 | debug_text_event(adapter->erp_dbf, 5, "a_thset_ok"); | ||
1004 | } | 972 | } |
1005 | 973 | ||
1006 | return (retval < 0); | 974 | return (retval < 0); |
@@ -1027,6 +995,7 @@ zfcp_erp_thread_kill(struct zfcp_adapter *adapter) | |||
1027 | 995 | ||
1028 | atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL, &adapter->status); | 996 | atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL, &adapter->status); |
1029 | up(&adapter->erp_ready_sem); | 997 | up(&adapter->erp_ready_sem); |
998 | zfcp_rec_dbf_event_thread(2, adapter, 1); | ||
1030 | 999 | ||
1031 | wait_event(adapter->erp_thread_wqh, | 1000 | wait_event(adapter->erp_thread_wqh, |
1032 | !atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, | 1001 | !atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, |
@@ -1035,8 +1004,6 @@ zfcp_erp_thread_kill(struct zfcp_adapter *adapter) | |||
1035 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL, | 1004 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL, |
1036 | &adapter->status); | 1005 | &adapter->status); |
1037 | 1006 | ||
1038 | debug_text_event(adapter->erp_dbf, 5, "a_thki_ok"); | ||
1039 | |||
1040 | return retval; | 1007 | return retval; |
1041 | } | 1008 | } |
1042 | 1009 | ||
@@ -1059,7 +1026,6 @@ zfcp_erp_thread(void *data) | |||
1059 | /* Block all signals */ | 1026 | /* Block all signals */ |
1060 | siginitsetinv(¤t->blocked, 0); | 1027 | siginitsetinv(¤t->blocked, 0); |
1061 | atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); | 1028 | atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); |
1062 | debug_text_event(adapter->erp_dbf, 5, "a_th_run"); | ||
1063 | wake_up(&adapter->erp_thread_wqh); | 1029 | wake_up(&adapter->erp_thread_wqh); |
1064 | 1030 | ||
1065 | while (!atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL, | 1031 | while (!atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL, |
@@ -1084,12 +1050,12 @@ zfcp_erp_thread(void *data) | |||
1084 | * no action in 'ready' queue to be processed and | 1050 | * no action in 'ready' queue to be processed and |
1085 | * thread is not to be killed | 1051 | * thread is not to be killed |
1086 | */ | 1052 | */ |
1053 | zfcp_rec_dbf_event_thread(4, adapter, 1); | ||
1087 | down_interruptible(&adapter->erp_ready_sem); | 1054 | down_interruptible(&adapter->erp_ready_sem); |
1088 | debug_text_event(adapter->erp_dbf, 5, "a_th_woken"); | 1055 | zfcp_rec_dbf_event_thread(5, adapter, 1); |
1089 | } | 1056 | } |
1090 | 1057 | ||
1091 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); | 1058 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); |
1092 | debug_text_event(adapter->erp_dbf, 5, "a_th_stop"); | ||
1093 | wake_up(&adapter->erp_thread_wqh); | 1059 | wake_up(&adapter->erp_thread_wqh); |
1094 | 1060 | ||
1095 | return 0; | 1061 | return 0; |
@@ -1125,7 +1091,6 @@ zfcp_erp_strategy(struct zfcp_erp_action *erp_action) | |||
1125 | /* dequeue dismissed action and leave, if required */ | 1091 | /* dequeue dismissed action and leave, if required */ |
1126 | retval = zfcp_erp_strategy_check_action(erp_action, retval); | 1092 | retval = zfcp_erp_strategy_check_action(erp_action, retval); |
1127 | if (retval == ZFCP_ERP_DISMISSED) { | 1093 | if (retval == ZFCP_ERP_DISMISSED) { |
1128 | debug_text_event(adapter->erp_dbf, 4, "a_st_dis1"); | ||
1129 | goto unlock; | 1094 | goto unlock; |
1130 | } | 1095 | } |
1131 | 1096 | ||
@@ -1176,20 +1141,17 @@ zfcp_erp_strategy(struct zfcp_erp_action *erp_action) | |||
1176 | element was timed out. | 1141 | element was timed out. |
1177 | */ | 1142 | */ |
1178 | if (adapter->erp_total_count == adapter->erp_low_mem_count) { | 1143 | if (adapter->erp_total_count == adapter->erp_low_mem_count) { |
1179 | debug_text_event(adapter->erp_dbf, 3, "a_st_lowmem"); | ||
1180 | ZFCP_LOG_NORMAL("error: no mempool elements available, " | 1144 | ZFCP_LOG_NORMAL("error: no mempool elements available, " |
1181 | "restarting I/O on adapter %s " | 1145 | "restarting I/O on adapter %s " |
1182 | "to free mempool\n", | 1146 | "to free mempool\n", |
1183 | zfcp_get_busid_by_adapter(adapter)); | 1147 | zfcp_get_busid_by_adapter(adapter)); |
1184 | zfcp_erp_adapter_reopen_internal(adapter, 0); | 1148 | zfcp_erp_adapter_reopen_internal(adapter, 0, 66, NULL); |
1185 | } else { | 1149 | } else { |
1186 | debug_text_event(adapter->erp_dbf, 2, "a_st_memw"); | ||
1187 | retval = zfcp_erp_strategy_memwait(erp_action); | 1150 | retval = zfcp_erp_strategy_memwait(erp_action); |
1188 | } | 1151 | } |
1189 | goto unlock; | 1152 | goto unlock; |
1190 | case ZFCP_ERP_CONTINUES: | 1153 | case ZFCP_ERP_CONTINUES: |
1191 | /* leave since this action runs asynchronously */ | 1154 | /* leave since this action runs asynchronously */ |
1192 | debug_text_event(adapter->erp_dbf, 6, "a_st_cont"); | ||
1193 | if (erp_action->status & ZFCP_STATUS_ERP_LOWMEM) { | 1155 | if (erp_action->status & ZFCP_STATUS_ERP_LOWMEM) { |
1194 | --adapter->erp_low_mem_count; | 1156 | --adapter->erp_low_mem_count; |
1195 | erp_action->status &= ~ZFCP_STATUS_ERP_LOWMEM; | 1157 | erp_action->status &= ~ZFCP_STATUS_ERP_LOWMEM; |
@@ -1218,7 +1180,6 @@ zfcp_erp_strategy(struct zfcp_erp_action *erp_action) | |||
1218 | * action is repeated in order to process state change | 1180 | * action is repeated in order to process state change |
1219 | */ | 1181 | */ |
1220 | if (retval == ZFCP_ERP_EXIT) { | 1182 | if (retval == ZFCP_ERP_EXIT) { |
1221 | debug_text_event(adapter->erp_dbf, 2, "a_st_exit"); | ||
1222 | goto unlock; | 1183 | goto unlock; |
1223 | } | 1184 | } |
1224 | 1185 | ||
@@ -1244,8 +1205,6 @@ zfcp_erp_strategy(struct zfcp_erp_action *erp_action) | |||
1244 | if (retval != ZFCP_ERP_DISMISSED) | 1205 | if (retval != ZFCP_ERP_DISMISSED) |
1245 | zfcp_erp_strategy_check_queues(adapter); | 1206 | zfcp_erp_strategy_check_queues(adapter); |
1246 | 1207 | ||
1247 | debug_text_event(adapter->erp_dbf, 6, "a_st_done"); | ||
1248 | |||
1249 | return retval; | 1208 | return retval; |
1250 | } | 1209 | } |
1251 | 1210 | ||
@@ -1260,17 +1219,12 @@ zfcp_erp_strategy(struct zfcp_erp_action *erp_action) | |||
1260 | static int | 1219 | static int |
1261 | zfcp_erp_strategy_check_action(struct zfcp_erp_action *erp_action, int retval) | 1220 | zfcp_erp_strategy_check_action(struct zfcp_erp_action *erp_action, int retval) |
1262 | { | 1221 | { |
1263 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
1264 | |||
1265 | zfcp_erp_strategy_check_fsfreq(erp_action); | 1222 | zfcp_erp_strategy_check_fsfreq(erp_action); |
1266 | 1223 | ||
1267 | debug_event(adapter->erp_dbf, 5, &erp_action->action, sizeof (int)); | ||
1268 | if (erp_action->status & ZFCP_STATUS_ERP_DISMISSED) { | 1224 | if (erp_action->status & ZFCP_STATUS_ERP_DISMISSED) { |
1269 | debug_text_event(adapter->erp_dbf, 3, "a_stcd_dis"); | ||
1270 | zfcp_erp_action_dequeue(erp_action); | 1225 | zfcp_erp_action_dequeue(erp_action); |
1271 | retval = ZFCP_ERP_DISMISSED; | 1226 | retval = ZFCP_ERP_DISMISSED; |
1272 | } else | 1227 | } |
1273 | debug_text_event(adapter->erp_dbf, 5, "a_stcd_nodis"); | ||
1274 | 1228 | ||
1275 | return retval; | 1229 | return retval; |
1276 | } | 1230 | } |
@@ -1279,7 +1233,6 @@ static int | |||
1279 | zfcp_erp_strategy_do_action(struct zfcp_erp_action *erp_action) | 1233 | zfcp_erp_strategy_do_action(struct zfcp_erp_action *erp_action) |
1280 | { | 1234 | { |
1281 | int retval = ZFCP_ERP_FAILED; | 1235 | int retval = ZFCP_ERP_FAILED; |
1282 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
1283 | 1236 | ||
1284 | /* | 1237 | /* |
1285 | * try to execute/continue action as far as possible, | 1238 | * try to execute/continue action as far as possible, |
@@ -1309,9 +1262,6 @@ zfcp_erp_strategy_do_action(struct zfcp_erp_action *erp_action) | |||
1309 | break; | 1262 | break; |
1310 | 1263 | ||
1311 | default: | 1264 | default: |
1312 | debug_text_exception(adapter->erp_dbf, 1, "a_stda_bug"); | ||
1313 | debug_event(adapter->erp_dbf, 1, &erp_action->action, | ||
1314 | sizeof (int)); | ||
1315 | ZFCP_LOG_NORMAL("bug: unknown erp action requested on " | 1265 | ZFCP_LOG_NORMAL("bug: unknown erp action requested on " |
1316 | "adapter %s (action=%d)\n", | 1266 | "adapter %s (action=%d)\n", |
1317 | zfcp_get_busid_by_adapter(erp_action->adapter), | 1267 | zfcp_get_busid_by_adapter(erp_action->adapter), |
@@ -1333,10 +1283,7 @@ static int | |||
1333 | zfcp_erp_strategy_memwait(struct zfcp_erp_action *erp_action) | 1283 | zfcp_erp_strategy_memwait(struct zfcp_erp_action *erp_action) |
1334 | { | 1284 | { |
1335 | int retval = ZFCP_ERP_CONTINUES; | 1285 | int retval = ZFCP_ERP_CONTINUES; |
1336 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
1337 | 1286 | ||
1338 | debug_text_event(adapter->erp_dbf, 6, "a_mwinit"); | ||
1339 | debug_event(adapter->erp_dbf, 6, &erp_action->action, sizeof (int)); | ||
1340 | init_timer(&erp_action->timer); | 1287 | init_timer(&erp_action->timer); |
1341 | erp_action->timer.function = zfcp_erp_memwait_handler; | 1288 | erp_action->timer.function = zfcp_erp_memwait_handler; |
1342 | erp_action->timer.data = (unsigned long) erp_action; | 1289 | erp_action->timer.data = (unsigned long) erp_action; |
@@ -1353,13 +1300,12 @@ zfcp_erp_strategy_memwait(struct zfcp_erp_action *erp_action) | |||
1353 | * | 1300 | * |
1354 | */ | 1301 | */ |
1355 | void | 1302 | void |
1356 | zfcp_erp_adapter_failed(struct zfcp_adapter *adapter) | 1303 | zfcp_erp_adapter_failed(struct zfcp_adapter *adapter, u8 id, void *ref) |
1357 | { | 1304 | { |
1358 | zfcp_erp_modify_adapter_status(adapter, | 1305 | zfcp_erp_modify_adapter_status(adapter, id, ref, |
1359 | ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); | 1306 | ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); |
1360 | ZFCP_LOG_NORMAL("adapter erp failed on adapter %s\n", | 1307 | ZFCP_LOG_NORMAL("adapter erp failed on adapter %s\n", |
1361 | zfcp_get_busid_by_adapter(adapter)); | 1308 | zfcp_get_busid_by_adapter(adapter)); |
1362 | debug_text_event(adapter->erp_dbf, 2, "a_afail"); | ||
1363 | } | 1309 | } |
1364 | 1310 | ||
1365 | /* | 1311 | /* |
@@ -1369,9 +1315,9 @@ zfcp_erp_adapter_failed(struct zfcp_adapter *adapter) | |||
1369 | * | 1315 | * |
1370 | */ | 1316 | */ |
1371 | void | 1317 | void |
1372 | zfcp_erp_port_failed(struct zfcp_port *port) | 1318 | zfcp_erp_port_failed(struct zfcp_port *port, u8 id, void *ref) |
1373 | { | 1319 | { |
1374 | zfcp_erp_modify_port_status(port, | 1320 | zfcp_erp_modify_port_status(port, id, ref, |
1375 | ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); | 1321 | ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); |
1376 | 1322 | ||
1377 | if (atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) | 1323 | if (atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) |
@@ -1381,9 +1327,6 @@ zfcp_erp_port_failed(struct zfcp_port *port) | |||
1381 | else | 1327 | else |
1382 | ZFCP_LOG_NORMAL("port erp failed (adapter %s, wwpn=0x%016Lx)\n", | 1328 | ZFCP_LOG_NORMAL("port erp failed (adapter %s, wwpn=0x%016Lx)\n", |
1383 | zfcp_get_busid_by_port(port), port->wwpn); | 1329 | zfcp_get_busid_by_port(port), port->wwpn); |
1384 | |||
1385 | debug_text_event(port->adapter->erp_dbf, 2, "p_pfail"); | ||
1386 | debug_event(port->adapter->erp_dbf, 2, &port->wwpn, sizeof (wwn_t)); | ||
1387 | } | 1330 | } |
1388 | 1331 | ||
1389 | /* | 1332 | /* |
@@ -1393,17 +1336,14 @@ zfcp_erp_port_failed(struct zfcp_port *port) | |||
1393 | * | 1336 | * |
1394 | */ | 1337 | */ |
1395 | void | 1338 | void |
1396 | zfcp_erp_unit_failed(struct zfcp_unit *unit) | 1339 | zfcp_erp_unit_failed(struct zfcp_unit *unit, u8 id, void *ref) |
1397 | { | 1340 | { |
1398 | zfcp_erp_modify_unit_status(unit, | 1341 | zfcp_erp_modify_unit_status(unit, id, ref, |
1399 | ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); | 1342 | ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); |
1400 | 1343 | ||
1401 | ZFCP_LOG_NORMAL("unit erp failed on unit 0x%016Lx on port 0x%016Lx " | 1344 | ZFCP_LOG_NORMAL("unit erp failed on unit 0x%016Lx on port 0x%016Lx " |
1402 | " on adapter %s\n", unit->fcp_lun, | 1345 | " on adapter %s\n", unit->fcp_lun, |
1403 | unit->port->wwpn, zfcp_get_busid_by_unit(unit)); | 1346 | unit->port->wwpn, zfcp_get_busid_by_unit(unit)); |
1404 | debug_text_event(unit->port->adapter->erp_dbf, 2, "u_ufail"); | ||
1405 | debug_event(unit->port->adapter->erp_dbf, 2, | ||
1406 | &unit->fcp_lun, sizeof (fcp_lun_t)); | ||
1407 | } | 1347 | } |
1408 | 1348 | ||
1409 | /* | 1349 | /* |
@@ -1427,10 +1367,6 @@ zfcp_erp_strategy_check_target(struct zfcp_erp_action *erp_action, int result) | |||
1427 | struct zfcp_port *port = erp_action->port; | 1367 | struct zfcp_port *port = erp_action->port; |
1428 | struct zfcp_unit *unit = erp_action->unit; | 1368 | struct zfcp_unit *unit = erp_action->unit; |
1429 | 1369 | ||
1430 | debug_text_event(adapter->erp_dbf, 5, "a_stct_norm"); | ||
1431 | debug_event(adapter->erp_dbf, 5, &erp_action->action, sizeof (int)); | ||
1432 | debug_event(adapter->erp_dbf, 5, &result, sizeof (int)); | ||
1433 | |||
1434 | switch (erp_action->action) { | 1370 | switch (erp_action->action) { |
1435 | 1371 | ||
1436 | case ZFCP_ERP_ACTION_REOPEN_UNIT: | 1372 | case ZFCP_ERP_ACTION_REOPEN_UNIT: |
@@ -1457,15 +1393,14 @@ zfcp_erp_strategy_statechange(int action, | |||
1457 | struct zfcp_port *port, | 1393 | struct zfcp_port *port, |
1458 | struct zfcp_unit *unit, int retval) | 1394 | struct zfcp_unit *unit, int retval) |
1459 | { | 1395 | { |
1460 | debug_text_event(adapter->erp_dbf, 3, "a_stsc"); | ||
1461 | debug_event(adapter->erp_dbf, 3, &action, sizeof (int)); | ||
1462 | |||
1463 | switch (action) { | 1396 | switch (action) { |
1464 | 1397 | ||
1465 | case ZFCP_ERP_ACTION_REOPEN_ADAPTER: | 1398 | case ZFCP_ERP_ACTION_REOPEN_ADAPTER: |
1466 | if (zfcp_erp_strategy_statechange_detected(&adapter->status, | 1399 | if (zfcp_erp_strategy_statechange_detected(&adapter->status, |
1467 | status)) { | 1400 | status)) { |
1468 | zfcp_erp_adapter_reopen_internal(adapter, ZFCP_STATUS_COMMON_ERP_FAILED); | 1401 | zfcp_erp_adapter_reopen_internal(adapter, |
1402 | ZFCP_STATUS_COMMON_ERP_FAILED, | ||
1403 | 67, NULL); | ||
1469 | retval = ZFCP_ERP_EXIT; | 1404 | retval = ZFCP_ERP_EXIT; |
1470 | } | 1405 | } |
1471 | break; | 1406 | break; |
@@ -1474,7 +1409,9 @@ zfcp_erp_strategy_statechange(int action, | |||
1474 | case ZFCP_ERP_ACTION_REOPEN_PORT: | 1409 | case ZFCP_ERP_ACTION_REOPEN_PORT: |
1475 | if (zfcp_erp_strategy_statechange_detected(&port->status, | 1410 | if (zfcp_erp_strategy_statechange_detected(&port->status, |
1476 | status)) { | 1411 | status)) { |
1477 | zfcp_erp_port_reopen_internal(port, ZFCP_STATUS_COMMON_ERP_FAILED); | 1412 | zfcp_erp_port_reopen_internal(port, |
1413 | ZFCP_STATUS_COMMON_ERP_FAILED, | ||
1414 | 68, NULL); | ||
1478 | retval = ZFCP_ERP_EXIT; | 1415 | retval = ZFCP_ERP_EXIT; |
1479 | } | 1416 | } |
1480 | break; | 1417 | break; |
@@ -1482,7 +1419,9 @@ zfcp_erp_strategy_statechange(int action, | |||
1482 | case ZFCP_ERP_ACTION_REOPEN_UNIT: | 1419 | case ZFCP_ERP_ACTION_REOPEN_UNIT: |
1483 | if (zfcp_erp_strategy_statechange_detected(&unit->status, | 1420 | if (zfcp_erp_strategy_statechange_detected(&unit->status, |
1484 | status)) { | 1421 | status)) { |
1485 | zfcp_erp_unit_reopen_internal(unit, ZFCP_STATUS_COMMON_ERP_FAILED); | 1422 | zfcp_erp_unit_reopen_internal(unit, |
1423 | ZFCP_STATUS_COMMON_ERP_FAILED, | ||
1424 | 69, NULL); | ||
1486 | retval = ZFCP_ERP_EXIT; | 1425 | retval = ZFCP_ERP_EXIT; |
1487 | } | 1426 | } |
1488 | break; | 1427 | break; |
@@ -1506,10 +1445,6 @@ zfcp_erp_strategy_statechange_detected(atomic_t * target_status, u32 erp_status) | |||
1506 | static int | 1445 | static int |
1507 | zfcp_erp_strategy_check_unit(struct zfcp_unit *unit, int result) | 1446 | zfcp_erp_strategy_check_unit(struct zfcp_unit *unit, int result) |
1508 | { | 1447 | { |
1509 | debug_text_event(unit->port->adapter->erp_dbf, 5, "u_stct"); | ||
1510 | debug_event(unit->port->adapter->erp_dbf, 5, &unit->fcp_lun, | ||
1511 | sizeof (fcp_lun_t)); | ||
1512 | |||
1513 | switch (result) { | 1448 | switch (result) { |
1514 | case ZFCP_ERP_SUCCEEDED : | 1449 | case ZFCP_ERP_SUCCEEDED : |
1515 | atomic_set(&unit->erp_counter, 0); | 1450 | atomic_set(&unit->erp_counter, 0); |
@@ -1518,7 +1453,7 @@ zfcp_erp_strategy_check_unit(struct zfcp_unit *unit, int result) | |||
1518 | case ZFCP_ERP_FAILED : | 1453 | case ZFCP_ERP_FAILED : |
1519 | atomic_inc(&unit->erp_counter); | 1454 | atomic_inc(&unit->erp_counter); |
1520 | if (atomic_read(&unit->erp_counter) > ZFCP_MAX_ERPS) | 1455 | if (atomic_read(&unit->erp_counter) > ZFCP_MAX_ERPS) |
1521 | zfcp_erp_unit_failed(unit); | 1456 | zfcp_erp_unit_failed(unit, 21, NULL); |
1522 | break; | 1457 | break; |
1523 | case ZFCP_ERP_EXIT : | 1458 | case ZFCP_ERP_EXIT : |
1524 | /* nothing */ | 1459 | /* nothing */ |
@@ -1536,9 +1471,6 @@ zfcp_erp_strategy_check_unit(struct zfcp_unit *unit, int result) | |||
1536 | static int | 1471 | static int |
1537 | zfcp_erp_strategy_check_port(struct zfcp_port *port, int result) | 1472 | zfcp_erp_strategy_check_port(struct zfcp_port *port, int result) |
1538 | { | 1473 | { |
1539 | debug_text_event(port->adapter->erp_dbf, 5, "p_stct"); | ||
1540 | debug_event(port->adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
1541 | |||
1542 | switch (result) { | 1474 | switch (result) { |
1543 | case ZFCP_ERP_SUCCEEDED : | 1475 | case ZFCP_ERP_SUCCEEDED : |
1544 | atomic_set(&port->erp_counter, 0); | 1476 | atomic_set(&port->erp_counter, 0); |
@@ -1547,7 +1479,7 @@ zfcp_erp_strategy_check_port(struct zfcp_port *port, int result) | |||
1547 | case ZFCP_ERP_FAILED : | 1479 | case ZFCP_ERP_FAILED : |
1548 | atomic_inc(&port->erp_counter); | 1480 | atomic_inc(&port->erp_counter); |
1549 | if (atomic_read(&port->erp_counter) > ZFCP_MAX_ERPS) | 1481 | if (atomic_read(&port->erp_counter) > ZFCP_MAX_ERPS) |
1550 | zfcp_erp_port_failed(port); | 1482 | zfcp_erp_port_failed(port, 22, NULL); |
1551 | break; | 1483 | break; |
1552 | case ZFCP_ERP_EXIT : | 1484 | case ZFCP_ERP_EXIT : |
1553 | /* nothing */ | 1485 | /* nothing */ |
@@ -1565,8 +1497,6 @@ zfcp_erp_strategy_check_port(struct zfcp_port *port, int result) | |||
1565 | static int | 1497 | static int |
1566 | zfcp_erp_strategy_check_adapter(struct zfcp_adapter *adapter, int result) | 1498 | zfcp_erp_strategy_check_adapter(struct zfcp_adapter *adapter, int result) |
1567 | { | 1499 | { |
1568 | debug_text_event(adapter->erp_dbf, 5, "a_stct"); | ||
1569 | |||
1570 | switch (result) { | 1500 | switch (result) { |
1571 | case ZFCP_ERP_SUCCEEDED : | 1501 | case ZFCP_ERP_SUCCEEDED : |
1572 | atomic_set(&adapter->erp_counter, 0); | 1502 | atomic_set(&adapter->erp_counter, 0); |
@@ -1575,7 +1505,7 @@ zfcp_erp_strategy_check_adapter(struct zfcp_adapter *adapter, int result) | |||
1575 | case ZFCP_ERP_FAILED : | 1505 | case ZFCP_ERP_FAILED : |
1576 | atomic_inc(&adapter->erp_counter); | 1506 | atomic_inc(&adapter->erp_counter); |
1577 | if (atomic_read(&adapter->erp_counter) > ZFCP_MAX_ERPS) | 1507 | if (atomic_read(&adapter->erp_counter) > ZFCP_MAX_ERPS) |
1578 | zfcp_erp_adapter_failed(adapter); | 1508 | zfcp_erp_adapter_failed(adapter, 23, NULL); |
1579 | break; | 1509 | break; |
1580 | case ZFCP_ERP_EXIT : | 1510 | case ZFCP_ERP_EXIT : |
1581 | /* nothing */ | 1511 | /* nothing */ |
@@ -1658,37 +1588,34 @@ zfcp_erp_strategy_followup_actions(int action, | |||
1658 | struct zfcp_port *port, | 1588 | struct zfcp_port *port, |
1659 | struct zfcp_unit *unit, int status) | 1589 | struct zfcp_unit *unit, int status) |
1660 | { | 1590 | { |
1661 | debug_text_event(adapter->erp_dbf, 5, "a_stfol"); | ||
1662 | debug_event(adapter->erp_dbf, 5, &action, sizeof (int)); | ||
1663 | |||
1664 | /* initiate follow-up actions depending on success of finished action */ | 1591 | /* initiate follow-up actions depending on success of finished action */ |
1665 | switch (action) { | 1592 | switch (action) { |
1666 | 1593 | ||
1667 | case ZFCP_ERP_ACTION_REOPEN_ADAPTER: | 1594 | case ZFCP_ERP_ACTION_REOPEN_ADAPTER: |
1668 | if (status == ZFCP_ERP_SUCCEEDED) | 1595 | if (status == ZFCP_ERP_SUCCEEDED) |
1669 | zfcp_erp_port_reopen_all_internal(adapter, 0); | 1596 | zfcp_erp_port_reopen_all_internal(adapter, 0, 70, NULL); |
1670 | else | 1597 | else |
1671 | zfcp_erp_adapter_reopen_internal(adapter, 0); | 1598 | zfcp_erp_adapter_reopen_internal(adapter, 0, 71, NULL); |
1672 | break; | 1599 | break; |
1673 | 1600 | ||
1674 | case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: | 1601 | case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: |
1675 | if (status == ZFCP_ERP_SUCCEEDED) | 1602 | if (status == ZFCP_ERP_SUCCEEDED) |
1676 | zfcp_erp_port_reopen_internal(port, 0); | 1603 | zfcp_erp_port_reopen_internal(port, 0, 72, NULL); |
1677 | else | 1604 | else |
1678 | zfcp_erp_adapter_reopen_internal(adapter, 0); | 1605 | zfcp_erp_adapter_reopen_internal(adapter, 0, 73, NULL); |
1679 | break; | 1606 | break; |
1680 | 1607 | ||
1681 | case ZFCP_ERP_ACTION_REOPEN_PORT: | 1608 | case ZFCP_ERP_ACTION_REOPEN_PORT: |
1682 | if (status == ZFCP_ERP_SUCCEEDED) | 1609 | if (status == ZFCP_ERP_SUCCEEDED) |
1683 | zfcp_erp_unit_reopen_all_internal(port, 0); | 1610 | zfcp_erp_unit_reopen_all_internal(port, 0, 74, NULL); |
1684 | else | 1611 | else |
1685 | zfcp_erp_port_forced_reopen_internal(port, 0); | 1612 | zfcp_erp_port_forced_reopen_internal(port, 0, 75, NULL); |
1686 | break; | 1613 | break; |
1687 | 1614 | ||
1688 | case ZFCP_ERP_ACTION_REOPEN_UNIT: | 1615 | case ZFCP_ERP_ACTION_REOPEN_UNIT: |
1689 | /* Nothing to do if status == ZFCP_ERP_SUCCEEDED */ | 1616 | /* Nothing to do if status == ZFCP_ERP_SUCCEEDED */ |
1690 | if (status != ZFCP_ERP_SUCCEEDED) | 1617 | if (status != ZFCP_ERP_SUCCEEDED) |
1691 | zfcp_erp_port_reopen_internal(unit->port, 0); | 1618 | zfcp_erp_port_reopen_internal(unit->port, 0, 76, NULL); |
1692 | break; | 1619 | break; |
1693 | } | 1620 | } |
1694 | 1621 | ||
@@ -1704,12 +1631,10 @@ zfcp_erp_strategy_check_queues(struct zfcp_adapter *adapter) | |||
1704 | read_lock(&adapter->erp_lock); | 1631 | read_lock(&adapter->erp_lock); |
1705 | if (list_empty(&adapter->erp_ready_head) && | 1632 | if (list_empty(&adapter->erp_ready_head) && |
1706 | list_empty(&adapter->erp_running_head)) { | 1633 | list_empty(&adapter->erp_running_head)) { |
1707 | debug_text_event(adapter->erp_dbf, 4, "a_cq_wake"); | ||
1708 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, | 1634 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, |
1709 | &adapter->status); | 1635 | &adapter->status); |
1710 | wake_up(&adapter->erp_done_wqh); | 1636 | wake_up(&adapter->erp_done_wqh); |
1711 | } else | 1637 | } |
1712 | debug_text_event(adapter->erp_dbf, 5, "a_cq_notempty"); | ||
1713 | read_unlock(&adapter->erp_lock); | 1638 | read_unlock(&adapter->erp_lock); |
1714 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); | 1639 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); |
1715 | 1640 | ||
@@ -1733,29 +1658,27 @@ zfcp_erp_wait(struct zfcp_adapter *adapter) | |||
1733 | return retval; | 1658 | return retval; |
1734 | } | 1659 | } |
1735 | 1660 | ||
1736 | void | 1661 | void zfcp_erp_modify_adapter_status(struct zfcp_adapter *adapter, u8 id, |
1737 | zfcp_erp_modify_adapter_status(struct zfcp_adapter *adapter, | 1662 | void *ref, u32 mask, int set_or_clear) |
1738 | u32 mask, int set_or_clear) | ||
1739 | { | 1663 | { |
1740 | struct zfcp_port *port; | 1664 | struct zfcp_port *port; |
1741 | u32 common_mask = mask & ZFCP_COMMON_FLAGS; | 1665 | u32 changed, common_mask = mask & ZFCP_COMMON_FLAGS; |
1742 | 1666 | ||
1743 | if (set_or_clear == ZFCP_SET) { | 1667 | if (set_or_clear == ZFCP_SET) { |
1744 | atomic_set_mask(mask, &adapter->status); | 1668 | changed = atomic_test_and_set_mask(mask, &adapter->status); |
1745 | debug_text_event(adapter->erp_dbf, 3, "a_mod_as_s"); | ||
1746 | } else { | 1669 | } else { |
1747 | atomic_clear_mask(mask, &adapter->status); | 1670 | changed = atomic_test_and_clear_mask(mask, &adapter->status); |
1748 | if (mask & ZFCP_STATUS_COMMON_ERP_FAILED) | 1671 | if (mask & ZFCP_STATUS_COMMON_ERP_FAILED) |
1749 | atomic_set(&adapter->erp_counter, 0); | 1672 | atomic_set(&adapter->erp_counter, 0); |
1750 | debug_text_event(adapter->erp_dbf, 3, "a_mod_as_c"); | ||
1751 | } | 1673 | } |
1752 | debug_event(adapter->erp_dbf, 3, &mask, sizeof (u32)); | 1674 | if (changed) |
1675 | zfcp_rec_dbf_event_adapter(id, ref, adapter); | ||
1753 | 1676 | ||
1754 | /* Deal with all underlying devices, only pass common_mask */ | 1677 | /* Deal with all underlying devices, only pass common_mask */ |
1755 | if (common_mask) | 1678 | if (common_mask) |
1756 | list_for_each_entry(port, &adapter->port_list_head, list) | 1679 | list_for_each_entry(port, &adapter->port_list_head, list) |
1757 | zfcp_erp_modify_port_status(port, common_mask, | 1680 | zfcp_erp_modify_port_status(port, id, ref, common_mask, |
1758 | set_or_clear); | 1681 | set_or_clear); |
1759 | } | 1682 | } |
1760 | 1683 | ||
1761 | /* | 1684 | /* |
@@ -1764,29 +1687,27 @@ zfcp_erp_modify_adapter_status(struct zfcp_adapter *adapter, | |||
1764 | * purpose: sets the port and all underlying devices to ERP_FAILED | 1687 | * purpose: sets the port and all underlying devices to ERP_FAILED |
1765 | * | 1688 | * |
1766 | */ | 1689 | */ |
1767 | void | 1690 | void zfcp_erp_modify_port_status(struct zfcp_port *port, u8 id, void *ref, |
1768 | zfcp_erp_modify_port_status(struct zfcp_port *port, u32 mask, int set_or_clear) | 1691 | u32 mask, int set_or_clear) |
1769 | { | 1692 | { |
1770 | struct zfcp_unit *unit; | 1693 | struct zfcp_unit *unit; |
1771 | u32 common_mask = mask & ZFCP_COMMON_FLAGS; | 1694 | u32 changed, common_mask = mask & ZFCP_COMMON_FLAGS; |
1772 | 1695 | ||
1773 | if (set_or_clear == ZFCP_SET) { | 1696 | if (set_or_clear == ZFCP_SET) { |
1774 | atomic_set_mask(mask, &port->status); | 1697 | changed = atomic_test_and_set_mask(mask, &port->status); |
1775 | debug_text_event(port->adapter->erp_dbf, 3, "p_mod_ps_s"); | ||
1776 | } else { | 1698 | } else { |
1777 | atomic_clear_mask(mask, &port->status); | 1699 | changed = atomic_test_and_clear_mask(mask, &port->status); |
1778 | if (mask & ZFCP_STATUS_COMMON_ERP_FAILED) | 1700 | if (mask & ZFCP_STATUS_COMMON_ERP_FAILED) |
1779 | atomic_set(&port->erp_counter, 0); | 1701 | atomic_set(&port->erp_counter, 0); |
1780 | debug_text_event(port->adapter->erp_dbf, 3, "p_mod_ps_c"); | ||
1781 | } | 1702 | } |
1782 | debug_event(port->adapter->erp_dbf, 3, &port->wwpn, sizeof (wwn_t)); | 1703 | if (changed) |
1783 | debug_event(port->adapter->erp_dbf, 3, &mask, sizeof (u32)); | 1704 | zfcp_rec_dbf_event_port(id, ref, port); |
1784 | 1705 | ||
1785 | /* Modify status of all underlying devices, only pass common mask */ | 1706 | /* Modify status of all underlying devices, only pass common mask */ |
1786 | if (common_mask) | 1707 | if (common_mask) |
1787 | list_for_each_entry(unit, &port->unit_list_head, list) | 1708 | list_for_each_entry(unit, &port->unit_list_head, list) |
1788 | zfcp_erp_modify_unit_status(unit, common_mask, | 1709 | zfcp_erp_modify_unit_status(unit, id, ref, common_mask, |
1789 | set_or_clear); | 1710 | set_or_clear); |
1790 | } | 1711 | } |
1791 | 1712 | ||
1792 | /* | 1713 | /* |
@@ -1795,22 +1716,21 @@ zfcp_erp_modify_port_status(struct zfcp_port *port, u32 mask, int set_or_clear) | |||
1795 | * purpose: sets the unit to ERP_FAILED | 1716 | * purpose: sets the unit to ERP_FAILED |
1796 | * | 1717 | * |
1797 | */ | 1718 | */ |
1798 | void | 1719 | void zfcp_erp_modify_unit_status(struct zfcp_unit *unit, u8 id, void *ref, |
1799 | zfcp_erp_modify_unit_status(struct zfcp_unit *unit, u32 mask, int set_or_clear) | 1720 | u32 mask, int set_or_clear) |
1800 | { | 1721 | { |
1722 | u32 changed; | ||
1723 | |||
1801 | if (set_or_clear == ZFCP_SET) { | 1724 | if (set_or_clear == ZFCP_SET) { |
1802 | atomic_set_mask(mask, &unit->status); | 1725 | changed = atomic_test_and_set_mask(mask, &unit->status); |
1803 | debug_text_event(unit->port->adapter->erp_dbf, 3, "u_mod_us_s"); | ||
1804 | } else { | 1726 | } else { |
1805 | atomic_clear_mask(mask, &unit->status); | 1727 | changed = atomic_test_and_clear_mask(mask, &unit->status); |
1806 | if (mask & ZFCP_STATUS_COMMON_ERP_FAILED) { | 1728 | if (mask & ZFCP_STATUS_COMMON_ERP_FAILED) { |
1807 | atomic_set(&unit->erp_counter, 0); | 1729 | atomic_set(&unit->erp_counter, 0); |
1808 | } | 1730 | } |
1809 | debug_text_event(unit->port->adapter->erp_dbf, 3, "u_mod_us_c"); | ||
1810 | } | 1731 | } |
1811 | debug_event(unit->port->adapter->erp_dbf, 3, &unit->fcp_lun, | 1732 | if (changed) |
1812 | sizeof (fcp_lun_t)); | 1733 | zfcp_rec_dbf_event_unit(id, ref, unit); |
1813 | debug_event(unit->port->adapter->erp_dbf, 3, &mask, sizeof (u32)); | ||
1814 | } | 1734 | } |
1815 | 1735 | ||
1816 | /* | 1736 | /* |
@@ -1822,30 +1742,32 @@ zfcp_erp_modify_unit_status(struct zfcp_unit *unit, u32 mask, int set_or_clear) | |||
1822 | * returns: 0 - initiated action successfully | 1742 | * returns: 0 - initiated action successfully |
1823 | * <0 - failed to initiate action | 1743 | * <0 - failed to initiate action |
1824 | */ | 1744 | */ |
1825 | int | 1745 | int zfcp_erp_port_reopen_all(struct zfcp_adapter *adapter, int clear_mask, |
1826 | zfcp_erp_port_reopen_all(struct zfcp_adapter *adapter, int clear_mask) | 1746 | u8 id, void *ref) |
1827 | { | 1747 | { |
1828 | int retval; | 1748 | int retval; |
1829 | unsigned long flags; | 1749 | unsigned long flags; |
1830 | 1750 | ||
1831 | read_lock_irqsave(&zfcp_data.config_lock, flags); | 1751 | read_lock_irqsave(&zfcp_data.config_lock, flags); |
1832 | write_lock(&adapter->erp_lock); | 1752 | write_lock(&adapter->erp_lock); |
1833 | retval = zfcp_erp_port_reopen_all_internal(adapter, clear_mask); | 1753 | retval = zfcp_erp_port_reopen_all_internal(adapter, clear_mask, id, |
1754 | ref); | ||
1834 | write_unlock(&adapter->erp_lock); | 1755 | write_unlock(&adapter->erp_lock); |
1835 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); | 1756 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); |
1836 | 1757 | ||
1837 | return retval; | 1758 | return retval; |
1838 | } | 1759 | } |
1839 | 1760 | ||
1840 | static int | 1761 | static int zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *adapter, |
1841 | zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *adapter, int clear_mask) | 1762 | int clear_mask, u8 id, void *ref) |
1842 | { | 1763 | { |
1843 | int retval = 0; | 1764 | int retval = 0; |
1844 | struct zfcp_port *port; | 1765 | struct zfcp_port *port; |
1845 | 1766 | ||
1846 | list_for_each_entry(port, &adapter->port_list_head, list) | 1767 | list_for_each_entry(port, &adapter->port_list_head, list) |
1847 | if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) | 1768 | if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) |
1848 | zfcp_erp_port_reopen_internal(port, clear_mask); | 1769 | zfcp_erp_port_reopen_internal(port, clear_mask, id, |
1770 | ref); | ||
1849 | 1771 | ||
1850 | return retval; | 1772 | return retval; |
1851 | } | 1773 | } |
@@ -1857,14 +1779,14 @@ zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *adapter, int clear_mask) | |||
1857 | * | 1779 | * |
1858 | * returns: FIXME | 1780 | * returns: FIXME |
1859 | */ | 1781 | */ |
1860 | static int | 1782 | static int zfcp_erp_unit_reopen_all_internal(struct zfcp_port *port, |
1861 | zfcp_erp_unit_reopen_all_internal(struct zfcp_port *port, int clear_mask) | 1783 | int clear_mask, u8 id, void *ref) |
1862 | { | 1784 | { |
1863 | int retval = 0; | 1785 | int retval = 0; |
1864 | struct zfcp_unit *unit; | 1786 | struct zfcp_unit *unit; |
1865 | 1787 | ||
1866 | list_for_each_entry(unit, &port->unit_list_head, list) | 1788 | list_for_each_entry(unit, &port->unit_list_head, list) |
1867 | zfcp_erp_unit_reopen_internal(unit, clear_mask); | 1789 | zfcp_erp_unit_reopen_internal(unit, clear_mask, id, ref); |
1868 | 1790 | ||
1869 | return retval; | 1791 | return retval; |
1870 | } | 1792 | } |
@@ -1892,10 +1814,6 @@ zfcp_erp_adapter_strategy(struct zfcp_erp_action *erp_action) | |||
1892 | else | 1814 | else |
1893 | retval = zfcp_erp_adapter_strategy_open(erp_action); | 1815 | retval = zfcp_erp_adapter_strategy_open(erp_action); |
1894 | 1816 | ||
1895 | debug_text_event(adapter->erp_dbf, 3, "a_ast/ret"); | ||
1896 | debug_event(adapter->erp_dbf, 3, &erp_action->action, sizeof (int)); | ||
1897 | debug_event(adapter->erp_dbf, 3, &retval, sizeof (int)); | ||
1898 | |||
1899 | if (retval == ZFCP_ERP_FAILED) { | 1817 | if (retval == ZFCP_ERP_FAILED) { |
1900 | ZFCP_LOG_INFO("Waiting to allow the adapter %s " | 1818 | ZFCP_LOG_INFO("Waiting to allow the adapter %s " |
1901 | "to recover itself\n", | 1819 | "to recover itself\n", |
@@ -2021,7 +1939,6 @@ zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *erp_action) | |||
2021 | zfcp_get_busid_by_adapter(adapter)); | 1939 | zfcp_get_busid_by_adapter(adapter)); |
2022 | goto failed_qdio_establish; | 1940 | goto failed_qdio_establish; |
2023 | } | 1941 | } |
2024 | debug_text_event(adapter->erp_dbf, 3, "qdio_est"); | ||
2025 | 1942 | ||
2026 | if (qdio_activate(adapter->ccw_device, 0) != 0) { | 1943 | if (qdio_activate(adapter->ccw_device, 0) != 0) { |
2027 | ZFCP_LOG_INFO("error: activation of QDIO queues failed " | 1944 | ZFCP_LOG_INFO("error: activation of QDIO queues failed " |
@@ -2029,7 +1946,6 @@ zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *erp_action) | |||
2029 | zfcp_get_busid_by_adapter(adapter)); | 1946 | zfcp_get_busid_by_adapter(adapter)); |
2030 | goto failed_qdio_activate; | 1947 | goto failed_qdio_activate; |
2031 | } | 1948 | } |
2032 | debug_text_event(adapter->erp_dbf, 3, "qdio_act"); | ||
2033 | 1949 | ||
2034 | /* | 1950 | /* |
2035 | * put buffers into response queue, | 1951 | * put buffers into response queue, |
@@ -2077,11 +1993,9 @@ zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *erp_action) | |||
2077 | /* NOP */ | 1993 | /* NOP */ |
2078 | 1994 | ||
2079 | failed_qdio_activate: | 1995 | failed_qdio_activate: |
2080 | debug_text_event(adapter->erp_dbf, 3, "qdio_down1a"); | ||
2081 | while (qdio_shutdown(adapter->ccw_device, | 1996 | while (qdio_shutdown(adapter->ccw_device, |
2082 | QDIO_FLAG_CLEANUP_USING_CLEAR) == -EINPROGRESS) | 1997 | QDIO_FLAG_CLEANUP_USING_CLEAR) == -EINPROGRESS) |
2083 | ssleep(1); | 1998 | ssleep(1); |
2084 | debug_text_event(adapter->erp_dbf, 3, "qdio_down1b"); | ||
2085 | 1999 | ||
2086 | failed_qdio_establish: | 2000 | failed_qdio_establish: |
2087 | failed_sanity: | 2001 | failed_sanity: |
@@ -2127,14 +2041,12 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action) | |||
2127 | write_unlock_irq(&adapter->erp_lock); | 2041 | write_unlock_irq(&adapter->erp_lock); |
2128 | if (zfcp_fsf_exchange_config_data(erp_action)) { | 2042 | if (zfcp_fsf_exchange_config_data(erp_action)) { |
2129 | retval = ZFCP_ERP_FAILED; | 2043 | retval = ZFCP_ERP_FAILED; |
2130 | debug_text_event(adapter->erp_dbf, 5, "a_fstx_xf"); | ||
2131 | ZFCP_LOG_INFO("error: initiation of exchange of " | 2044 | ZFCP_LOG_INFO("error: initiation of exchange of " |
2132 | "configuration data failed for " | 2045 | "configuration data failed for " |
2133 | "adapter %s\n", | 2046 | "adapter %s\n", |
2134 | zfcp_get_busid_by_adapter(adapter)); | 2047 | zfcp_get_busid_by_adapter(adapter)); |
2135 | break; | 2048 | break; |
2136 | } | 2049 | } |
2137 | debug_text_event(adapter->erp_dbf, 6, "a_fstx_xok"); | ||
2138 | ZFCP_LOG_DEBUG("Xchange underway\n"); | 2050 | ZFCP_LOG_DEBUG("Xchange underway\n"); |
2139 | 2051 | ||
2140 | /* | 2052 | /* |
@@ -2150,7 +2062,9 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action) | |||
2150 | * _must_ be the one belonging to the 'exchange config | 2062 | * _must_ be the one belonging to the 'exchange config |
2151 | * data' request. | 2063 | * data' request. |
2152 | */ | 2064 | */ |
2065 | zfcp_rec_dbf_event_thread(6, adapter, 1); | ||
2153 | down(&adapter->erp_ready_sem); | 2066 | down(&adapter->erp_ready_sem); |
2067 | zfcp_rec_dbf_event_thread(7, adapter, 1); | ||
2154 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { | 2068 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { |
2155 | ZFCP_LOG_INFO("error: exchange of configuration data " | 2069 | ZFCP_LOG_INFO("error: exchange of configuration data " |
2156 | "for adapter %s timed out\n", | 2070 | "for adapter %s timed out\n", |
@@ -2198,16 +2112,15 @@ zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action) | |||
2198 | 2112 | ||
2199 | ret = zfcp_fsf_exchange_port_data(erp_action); | 2113 | ret = zfcp_fsf_exchange_port_data(erp_action); |
2200 | if (ret == -EOPNOTSUPP) { | 2114 | if (ret == -EOPNOTSUPP) { |
2201 | debug_text_event(adapter->erp_dbf, 3, "a_xport_notsupp"); | ||
2202 | return ZFCP_ERP_SUCCEEDED; | 2115 | return ZFCP_ERP_SUCCEEDED; |
2203 | } else if (ret) { | 2116 | } else if (ret) { |
2204 | debug_text_event(adapter->erp_dbf, 3, "a_xport_failed"); | ||
2205 | return ZFCP_ERP_FAILED; | 2117 | return ZFCP_ERP_FAILED; |
2206 | } | 2118 | } |
2207 | debug_text_event(adapter->erp_dbf, 6, "a_xport_ok"); | ||
2208 | 2119 | ||
2209 | ret = ZFCP_ERP_SUCCEEDED; | 2120 | ret = ZFCP_ERP_SUCCEEDED; |
2121 | zfcp_rec_dbf_event_thread(8, adapter, 1); | ||
2210 | down(&adapter->erp_ready_sem); | 2122 | down(&adapter->erp_ready_sem); |
2123 | zfcp_rec_dbf_event_thread(9, adapter, 1); | ||
2211 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { | 2124 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { |
2212 | ZFCP_LOG_INFO("error: exchange port data timed out (adapter " | 2125 | ZFCP_LOG_INFO("error: exchange port data timed out (adapter " |
2213 | "%s)\n", zfcp_get_busid_by_adapter(adapter)); | 2126 | "%s)\n", zfcp_get_busid_by_adapter(adapter)); |
@@ -2261,7 +2174,6 @@ zfcp_erp_port_forced_strategy(struct zfcp_erp_action *erp_action) | |||
2261 | { | 2174 | { |
2262 | int retval = ZFCP_ERP_FAILED; | 2175 | int retval = ZFCP_ERP_FAILED; |
2263 | struct zfcp_port *port = erp_action->port; | 2176 | struct zfcp_port *port = erp_action->port; |
2264 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
2265 | 2177 | ||
2266 | switch (erp_action->step) { | 2178 | switch (erp_action->step) { |
2267 | 2179 | ||
@@ -2298,11 +2210,6 @@ zfcp_erp_port_forced_strategy(struct zfcp_erp_action *erp_action) | |||
2298 | break; | 2210 | break; |
2299 | } | 2211 | } |
2300 | 2212 | ||
2301 | debug_text_event(adapter->erp_dbf, 3, "p_pfst/ret"); | ||
2302 | debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof (wwn_t)); | ||
2303 | debug_event(adapter->erp_dbf, 3, &erp_action->action, sizeof (int)); | ||
2304 | debug_event(adapter->erp_dbf, 3, &retval, sizeof (int)); | ||
2305 | |||
2306 | return retval; | 2213 | return retval; |
2307 | } | 2214 | } |
2308 | 2215 | ||
@@ -2320,7 +2227,6 @@ zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action) | |||
2320 | { | 2227 | { |
2321 | int retval = ZFCP_ERP_FAILED; | 2228 | int retval = ZFCP_ERP_FAILED; |
2322 | struct zfcp_port *port = erp_action->port; | 2229 | struct zfcp_port *port = erp_action->port; |
2323 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
2324 | 2230 | ||
2325 | switch (erp_action->step) { | 2231 | switch (erp_action->step) { |
2326 | 2232 | ||
@@ -2353,11 +2259,6 @@ zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action) | |||
2353 | retval = zfcp_erp_port_strategy_open(erp_action); | 2259 | retval = zfcp_erp_port_strategy_open(erp_action); |
2354 | 2260 | ||
2355 | out: | 2261 | out: |
2356 | debug_text_event(adapter->erp_dbf, 3, "p_pst/ret"); | ||
2357 | debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof (wwn_t)); | ||
2358 | debug_event(adapter->erp_dbf, 3, &erp_action->action, sizeof (int)); | ||
2359 | debug_event(adapter->erp_dbf, 3, &retval, sizeof (int)); | ||
2360 | |||
2361 | return retval; | 2262 | return retval; |
2362 | } | 2263 | } |
2363 | 2264 | ||
@@ -2395,7 +2296,7 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action) | |||
2395 | port->wwpn, | 2296 | port->wwpn, |
2396 | zfcp_get_busid_by_adapter(adapter), | 2297 | zfcp_get_busid_by_adapter(adapter), |
2397 | adapter->peer_wwpn); | 2298 | adapter->peer_wwpn); |
2398 | zfcp_erp_port_failed(port); | 2299 | zfcp_erp_port_failed(port, 25, NULL); |
2399 | retval = ZFCP_ERP_FAILED; | 2300 | retval = ZFCP_ERP_FAILED; |
2400 | break; | 2301 | break; |
2401 | } | 2302 | } |
@@ -2421,8 +2322,8 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action) | |||
2421 | /* nameserver port may live again */ | 2322 | /* nameserver port may live again */ |
2422 | atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, | 2323 | atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, |
2423 | &adapter->nameserver_port->status); | 2324 | &adapter->nameserver_port->status); |
2424 | if (zfcp_erp_port_reopen(adapter->nameserver_port, 0) | 2325 | if (zfcp_erp_port_reopen(adapter->nameserver_port, 0, |
2425 | >= 0) { | 2326 | 77, erp_action) >= 0) { |
2426 | erp_action->step = | 2327 | erp_action->step = |
2427 | ZFCP_ERP_STEP_NAMESERVER_OPEN; | 2328 | ZFCP_ERP_STEP_NAMESERVER_OPEN; |
2428 | retval = ZFCP_ERP_CONTINUES; | 2329 | retval = ZFCP_ERP_CONTINUES; |
@@ -2453,7 +2354,7 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action) | |||
2453 | "for port 0x%016Lx " | 2354 | "for port 0x%016Lx " |
2454 | "(misconfigured WWPN?)\n", | 2355 | "(misconfigured WWPN?)\n", |
2455 | port->wwpn); | 2356 | port->wwpn); |
2456 | zfcp_erp_port_failed(port); | 2357 | zfcp_erp_port_failed(port, 26, NULL); |
2457 | retval = ZFCP_ERP_EXIT; | 2358 | retval = ZFCP_ERP_EXIT; |
2458 | } else { | 2359 | } else { |
2459 | ZFCP_LOG_DEBUG("nameserver look-up failed for " | 2360 | ZFCP_LOG_DEBUG("nameserver look-up failed for " |
@@ -2549,17 +2450,12 @@ zfcp_erp_port_strategy_open_nameserver_wakeup(struct zfcp_erp_action | |||
2549 | read_lock_irqsave(&adapter->erp_lock, flags); | 2450 | read_lock_irqsave(&adapter->erp_lock, flags); |
2550 | list_for_each_entry_safe(erp_action, tmp, &adapter->erp_running_head, | 2451 | list_for_each_entry_safe(erp_action, tmp, &adapter->erp_running_head, |
2551 | list) { | 2452 | list) { |
2552 | debug_text_event(adapter->erp_dbf, 4, "p_pstnsw_n"); | ||
2553 | debug_event(adapter->erp_dbf, 4, &erp_action->port->wwpn, | ||
2554 | sizeof (wwn_t)); | ||
2555 | if (erp_action->step == ZFCP_ERP_STEP_NAMESERVER_OPEN) { | 2453 | if (erp_action->step == ZFCP_ERP_STEP_NAMESERVER_OPEN) { |
2556 | debug_text_event(adapter->erp_dbf, 3, "p_pstnsw_w"); | ||
2557 | debug_event(adapter->erp_dbf, 3, | ||
2558 | &erp_action->port->wwpn, sizeof (wwn_t)); | ||
2559 | if (atomic_test_mask( | 2454 | if (atomic_test_mask( |
2560 | ZFCP_STATUS_COMMON_ERP_FAILED, | 2455 | ZFCP_STATUS_COMMON_ERP_FAILED, |
2561 | &adapter->nameserver_port->status)) | 2456 | &adapter->nameserver_port->status)) |
2562 | zfcp_erp_port_failed(erp_action->port); | 2457 | zfcp_erp_port_failed(erp_action->port, 27, |
2458 | NULL); | ||
2563 | zfcp_erp_action_ready(erp_action); | 2459 | zfcp_erp_action_ready(erp_action); |
2564 | } | 2460 | } |
2565 | } | 2461 | } |
@@ -2580,26 +2476,18 @@ static int | |||
2580 | zfcp_erp_port_forced_strategy_close(struct zfcp_erp_action *erp_action) | 2476 | zfcp_erp_port_forced_strategy_close(struct zfcp_erp_action *erp_action) |
2581 | { | 2477 | { |
2582 | int retval; | 2478 | int retval; |
2583 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
2584 | struct zfcp_port *port = erp_action->port; | ||
2585 | 2479 | ||
2586 | retval = zfcp_fsf_close_physical_port(erp_action); | 2480 | retval = zfcp_fsf_close_physical_port(erp_action); |
2587 | if (retval == -ENOMEM) { | 2481 | if (retval == -ENOMEM) { |
2588 | debug_text_event(adapter->erp_dbf, 5, "o_pfstc_nomem"); | ||
2589 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
2590 | retval = ZFCP_ERP_NOMEM; | 2482 | retval = ZFCP_ERP_NOMEM; |
2591 | goto out; | 2483 | goto out; |
2592 | } | 2484 | } |
2593 | erp_action->step = ZFCP_ERP_STEP_PHYS_PORT_CLOSING; | 2485 | erp_action->step = ZFCP_ERP_STEP_PHYS_PORT_CLOSING; |
2594 | if (retval != 0) { | 2486 | if (retval != 0) { |
2595 | debug_text_event(adapter->erp_dbf, 5, "o_pfstc_cpf"); | ||
2596 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
2597 | /* could not send 'open', fail */ | 2487 | /* could not send 'open', fail */ |
2598 | retval = ZFCP_ERP_FAILED; | 2488 | retval = ZFCP_ERP_FAILED; |
2599 | goto out; | 2489 | goto out; |
2600 | } | 2490 | } |
2601 | debug_text_event(adapter->erp_dbf, 6, "o_pfstc_cpok"); | ||
2602 | debug_event(adapter->erp_dbf, 6, &port->wwpn, sizeof (wwn_t)); | ||
2603 | retval = ZFCP_ERP_CONTINUES; | 2491 | retval = ZFCP_ERP_CONTINUES; |
2604 | out: | 2492 | out: |
2605 | return retval; | 2493 | return retval; |
@@ -2609,10 +2497,6 @@ static int | |||
2609 | zfcp_erp_port_strategy_clearstati(struct zfcp_port *port) | 2497 | zfcp_erp_port_strategy_clearstati(struct zfcp_port *port) |
2610 | { | 2498 | { |
2611 | int retval = 0; | 2499 | int retval = 0; |
2612 | struct zfcp_adapter *adapter = port->adapter; | ||
2613 | |||
2614 | debug_text_event(adapter->erp_dbf, 5, "p_pstclst"); | ||
2615 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
2616 | 2500 | ||
2617 | atomic_clear_mask(ZFCP_STATUS_COMMON_OPENING | | 2501 | atomic_clear_mask(ZFCP_STATUS_COMMON_OPENING | |
2618 | ZFCP_STATUS_COMMON_CLOSING | | 2502 | ZFCP_STATUS_COMMON_CLOSING | |
@@ -2636,26 +2520,18 @@ static int | |||
2636 | zfcp_erp_port_strategy_close(struct zfcp_erp_action *erp_action) | 2520 | zfcp_erp_port_strategy_close(struct zfcp_erp_action *erp_action) |
2637 | { | 2521 | { |
2638 | int retval; | 2522 | int retval; |
2639 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
2640 | struct zfcp_port *port = erp_action->port; | ||
2641 | 2523 | ||
2642 | retval = zfcp_fsf_close_port(erp_action); | 2524 | retval = zfcp_fsf_close_port(erp_action); |
2643 | if (retval == -ENOMEM) { | 2525 | if (retval == -ENOMEM) { |
2644 | debug_text_event(adapter->erp_dbf, 5, "p_pstc_nomem"); | ||
2645 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
2646 | retval = ZFCP_ERP_NOMEM; | 2526 | retval = ZFCP_ERP_NOMEM; |
2647 | goto out; | 2527 | goto out; |
2648 | } | 2528 | } |
2649 | erp_action->step = ZFCP_ERP_STEP_PORT_CLOSING; | 2529 | erp_action->step = ZFCP_ERP_STEP_PORT_CLOSING; |
2650 | if (retval != 0) { | 2530 | if (retval != 0) { |
2651 | debug_text_event(adapter->erp_dbf, 5, "p_pstc_cpf"); | ||
2652 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
2653 | /* could not send 'close', fail */ | 2531 | /* could not send 'close', fail */ |
2654 | retval = ZFCP_ERP_FAILED; | 2532 | retval = ZFCP_ERP_FAILED; |
2655 | goto out; | 2533 | goto out; |
2656 | } | 2534 | } |
2657 | debug_text_event(adapter->erp_dbf, 6, "p_pstc_cpok"); | ||
2658 | debug_event(adapter->erp_dbf, 6, &port->wwpn, sizeof (wwn_t)); | ||
2659 | retval = ZFCP_ERP_CONTINUES; | 2535 | retval = ZFCP_ERP_CONTINUES; |
2660 | out: | 2536 | out: |
2661 | return retval; | 2537 | return retval; |
@@ -2673,26 +2549,18 @@ static int | |||
2673 | zfcp_erp_port_strategy_open_port(struct zfcp_erp_action *erp_action) | 2549 | zfcp_erp_port_strategy_open_port(struct zfcp_erp_action *erp_action) |
2674 | { | 2550 | { |
2675 | int retval; | 2551 | int retval; |
2676 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
2677 | struct zfcp_port *port = erp_action->port; | ||
2678 | 2552 | ||
2679 | retval = zfcp_fsf_open_port(erp_action); | 2553 | retval = zfcp_fsf_open_port(erp_action); |
2680 | if (retval == -ENOMEM) { | 2554 | if (retval == -ENOMEM) { |
2681 | debug_text_event(adapter->erp_dbf, 5, "p_psto_nomem"); | ||
2682 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
2683 | retval = ZFCP_ERP_NOMEM; | 2555 | retval = ZFCP_ERP_NOMEM; |
2684 | goto out; | 2556 | goto out; |
2685 | } | 2557 | } |
2686 | erp_action->step = ZFCP_ERP_STEP_PORT_OPENING; | 2558 | erp_action->step = ZFCP_ERP_STEP_PORT_OPENING; |
2687 | if (retval != 0) { | 2559 | if (retval != 0) { |
2688 | debug_text_event(adapter->erp_dbf, 5, "p_psto_opf"); | ||
2689 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
2690 | /* could not send 'open', fail */ | 2560 | /* could not send 'open', fail */ |
2691 | retval = ZFCP_ERP_FAILED; | 2561 | retval = ZFCP_ERP_FAILED; |
2692 | goto out; | 2562 | goto out; |
2693 | } | 2563 | } |
2694 | debug_text_event(adapter->erp_dbf, 6, "p_psto_opok"); | ||
2695 | debug_event(adapter->erp_dbf, 6, &port->wwpn, sizeof (wwn_t)); | ||
2696 | retval = ZFCP_ERP_CONTINUES; | 2564 | retval = ZFCP_ERP_CONTINUES; |
2697 | out: | 2565 | out: |
2698 | return retval; | 2566 | return retval; |
@@ -2710,26 +2578,18 @@ static int | |||
2710 | zfcp_erp_port_strategy_open_common_lookup(struct zfcp_erp_action *erp_action) | 2578 | zfcp_erp_port_strategy_open_common_lookup(struct zfcp_erp_action *erp_action) |
2711 | { | 2579 | { |
2712 | int retval; | 2580 | int retval; |
2713 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
2714 | struct zfcp_port *port = erp_action->port; | ||
2715 | 2581 | ||
2716 | retval = zfcp_ns_gid_pn_request(erp_action); | 2582 | retval = zfcp_ns_gid_pn_request(erp_action); |
2717 | if (retval == -ENOMEM) { | 2583 | if (retval == -ENOMEM) { |
2718 | debug_text_event(adapter->erp_dbf, 5, "p_pstn_nomem"); | ||
2719 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
2720 | retval = ZFCP_ERP_NOMEM; | 2584 | retval = ZFCP_ERP_NOMEM; |
2721 | goto out; | 2585 | goto out; |
2722 | } | 2586 | } |
2723 | erp_action->step = ZFCP_ERP_STEP_NAMESERVER_LOOKUP; | 2587 | erp_action->step = ZFCP_ERP_STEP_NAMESERVER_LOOKUP; |
2724 | if (retval != 0) { | 2588 | if (retval != 0) { |
2725 | debug_text_event(adapter->erp_dbf, 5, "p_pstn_ref"); | ||
2726 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
2727 | /* could not send nameserver request, fail */ | 2589 | /* could not send nameserver request, fail */ |
2728 | retval = ZFCP_ERP_FAILED; | 2590 | retval = ZFCP_ERP_FAILED; |
2729 | goto out; | 2591 | goto out; |
2730 | } | 2592 | } |
2731 | debug_text_event(adapter->erp_dbf, 6, "p_pstn_reok"); | ||
2732 | debug_event(adapter->erp_dbf, 6, &port->wwpn, sizeof (wwn_t)); | ||
2733 | retval = ZFCP_ERP_CONTINUES; | 2593 | retval = ZFCP_ERP_CONTINUES; |
2734 | out: | 2594 | out: |
2735 | return retval; | 2595 | return retval; |
@@ -2750,7 +2610,6 @@ zfcp_erp_unit_strategy(struct zfcp_erp_action *erp_action) | |||
2750 | { | 2610 | { |
2751 | int retval = ZFCP_ERP_FAILED; | 2611 | int retval = ZFCP_ERP_FAILED; |
2752 | struct zfcp_unit *unit = erp_action->unit; | 2612 | struct zfcp_unit *unit = erp_action->unit; |
2753 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
2754 | 2613 | ||
2755 | switch (erp_action->step) { | 2614 | switch (erp_action->step) { |
2756 | 2615 | ||
@@ -2797,10 +2656,6 @@ zfcp_erp_unit_strategy(struct zfcp_erp_action *erp_action) | |||
2797 | break; | 2656 | break; |
2798 | } | 2657 | } |
2799 | 2658 | ||
2800 | debug_text_event(adapter->erp_dbf, 3, "u_ust/ret"); | ||
2801 | debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof (fcp_lun_t)); | ||
2802 | debug_event(adapter->erp_dbf, 3, &erp_action->action, sizeof (int)); | ||
2803 | debug_event(adapter->erp_dbf, 3, &retval, sizeof (int)); | ||
2804 | return retval; | 2659 | return retval; |
2805 | } | 2660 | } |
2806 | 2661 | ||
@@ -2808,10 +2663,6 @@ static int | |||
2808 | zfcp_erp_unit_strategy_clearstati(struct zfcp_unit *unit) | 2663 | zfcp_erp_unit_strategy_clearstati(struct zfcp_unit *unit) |
2809 | { | 2664 | { |
2810 | int retval = 0; | 2665 | int retval = 0; |
2811 | struct zfcp_adapter *adapter = unit->port->adapter; | ||
2812 | |||
2813 | debug_text_event(adapter->erp_dbf, 5, "u_ustclst"); | ||
2814 | debug_event(adapter->erp_dbf, 5, &unit->fcp_lun, sizeof (fcp_lun_t)); | ||
2815 | 2666 | ||
2816 | atomic_clear_mask(ZFCP_STATUS_COMMON_OPENING | | 2667 | atomic_clear_mask(ZFCP_STATUS_COMMON_OPENING | |
2817 | ZFCP_STATUS_COMMON_CLOSING | | 2668 | ZFCP_STATUS_COMMON_CLOSING | |
@@ -2835,28 +2686,18 @@ static int | |||
2835 | zfcp_erp_unit_strategy_close(struct zfcp_erp_action *erp_action) | 2686 | zfcp_erp_unit_strategy_close(struct zfcp_erp_action *erp_action) |
2836 | { | 2687 | { |
2837 | int retval; | 2688 | int retval; |
2838 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
2839 | struct zfcp_unit *unit = erp_action->unit; | ||
2840 | 2689 | ||
2841 | retval = zfcp_fsf_close_unit(erp_action); | 2690 | retval = zfcp_fsf_close_unit(erp_action); |
2842 | if (retval == -ENOMEM) { | 2691 | if (retval == -ENOMEM) { |
2843 | debug_text_event(adapter->erp_dbf, 5, "u_ustc_nomem"); | ||
2844 | debug_event(adapter->erp_dbf, 5, &unit->fcp_lun, | ||
2845 | sizeof (fcp_lun_t)); | ||
2846 | retval = ZFCP_ERP_NOMEM; | 2692 | retval = ZFCP_ERP_NOMEM; |
2847 | goto out; | 2693 | goto out; |
2848 | } | 2694 | } |
2849 | erp_action->step = ZFCP_ERP_STEP_UNIT_CLOSING; | 2695 | erp_action->step = ZFCP_ERP_STEP_UNIT_CLOSING; |
2850 | if (retval != 0) { | 2696 | if (retval != 0) { |
2851 | debug_text_event(adapter->erp_dbf, 5, "u_ustc_cuf"); | ||
2852 | debug_event(adapter->erp_dbf, 5, &unit->fcp_lun, | ||
2853 | sizeof (fcp_lun_t)); | ||
2854 | /* could not send 'close', fail */ | 2697 | /* could not send 'close', fail */ |
2855 | retval = ZFCP_ERP_FAILED; | 2698 | retval = ZFCP_ERP_FAILED; |
2856 | goto out; | 2699 | goto out; |
2857 | } | 2700 | } |
2858 | debug_text_event(adapter->erp_dbf, 6, "u_ustc_cuok"); | ||
2859 | debug_event(adapter->erp_dbf, 6, &unit->fcp_lun, sizeof (fcp_lun_t)); | ||
2860 | retval = ZFCP_ERP_CONTINUES; | 2701 | retval = ZFCP_ERP_CONTINUES; |
2861 | 2702 | ||
2862 | out: | 2703 | out: |
@@ -2875,28 +2716,18 @@ static int | |||
2875 | zfcp_erp_unit_strategy_open(struct zfcp_erp_action *erp_action) | 2716 | zfcp_erp_unit_strategy_open(struct zfcp_erp_action *erp_action) |
2876 | { | 2717 | { |
2877 | int retval; | 2718 | int retval; |
2878 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
2879 | struct zfcp_unit *unit = erp_action->unit; | ||
2880 | 2719 | ||
2881 | retval = zfcp_fsf_open_unit(erp_action); | 2720 | retval = zfcp_fsf_open_unit(erp_action); |
2882 | if (retval == -ENOMEM) { | 2721 | if (retval == -ENOMEM) { |
2883 | debug_text_event(adapter->erp_dbf, 5, "u_usto_nomem"); | ||
2884 | debug_event(adapter->erp_dbf, 5, &unit->fcp_lun, | ||
2885 | sizeof (fcp_lun_t)); | ||
2886 | retval = ZFCP_ERP_NOMEM; | 2722 | retval = ZFCP_ERP_NOMEM; |
2887 | goto out; | 2723 | goto out; |
2888 | } | 2724 | } |
2889 | erp_action->step = ZFCP_ERP_STEP_UNIT_OPENING; | 2725 | erp_action->step = ZFCP_ERP_STEP_UNIT_OPENING; |
2890 | if (retval != 0) { | 2726 | if (retval != 0) { |
2891 | debug_text_event(adapter->erp_dbf, 5, "u_usto_ouf"); | ||
2892 | debug_event(adapter->erp_dbf, 5, &unit->fcp_lun, | ||
2893 | sizeof (fcp_lun_t)); | ||
2894 | /* could not send 'open', fail */ | 2727 | /* could not send 'open', fail */ |
2895 | retval = ZFCP_ERP_FAILED; | 2728 | retval = ZFCP_ERP_FAILED; |
2896 | goto out; | 2729 | goto out; |
2897 | } | 2730 | } |
2898 | debug_text_event(adapter->erp_dbf, 6, "u_usto_ouok"); | ||
2899 | debug_event(adapter->erp_dbf, 6, &unit->fcp_lun, sizeof (fcp_lun_t)); | ||
2900 | retval = ZFCP_ERP_CONTINUES; | 2731 | retval = ZFCP_ERP_CONTINUES; |
2901 | out: | 2732 | out: |
2902 | return retval; | 2733 | return retval; |
@@ -2918,14 +2749,12 @@ void zfcp_erp_start_timer(struct zfcp_fsf_req *fsf_req) | |||
2918 | * | 2749 | * |
2919 | * returns: | 2750 | * returns: |
2920 | */ | 2751 | */ |
2921 | static int | 2752 | static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter, |
2922 | zfcp_erp_action_enqueue(int action, | 2753 | struct zfcp_port *port, |
2923 | struct zfcp_adapter *adapter, | 2754 | struct zfcp_unit *unit, u8 id, void *ref) |
2924 | struct zfcp_port *port, struct zfcp_unit *unit) | ||
2925 | { | 2755 | { |
2926 | int retval = 1; | 2756 | int retval = 1, need = want; |
2927 | struct zfcp_erp_action *erp_action = NULL; | 2757 | struct zfcp_erp_action *erp_action = NULL; |
2928 | int stronger_action = 0; | ||
2929 | u32 status = 0; | 2758 | u32 status = 0; |
2930 | 2759 | ||
2931 | /* | 2760 | /* |
@@ -2944,17 +2773,11 @@ zfcp_erp_action_enqueue(int action, | |||
2944 | &adapter->status)) | 2773 | &adapter->status)) |
2945 | return -EIO; | 2774 | return -EIO; |
2946 | 2775 | ||
2947 | debug_event(adapter->erp_dbf, 4, &action, sizeof (int)); | ||
2948 | /* check whether we really need this */ | 2776 | /* check whether we really need this */ |
2949 | switch (action) { | 2777 | switch (want) { |
2950 | case ZFCP_ERP_ACTION_REOPEN_UNIT: | 2778 | case ZFCP_ERP_ACTION_REOPEN_UNIT: |
2951 | if (atomic_test_mask | 2779 | if (atomic_test_mask |
2952 | (ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status)) { | 2780 | (ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status)) { |
2953 | debug_text_event(adapter->erp_dbf, 4, "u_actenq_drp"); | ||
2954 | debug_event(adapter->erp_dbf, 4, &port->wwpn, | ||
2955 | sizeof (wwn_t)); | ||
2956 | debug_event(adapter->erp_dbf, 4, &unit->fcp_lun, | ||
2957 | sizeof (fcp_lun_t)); | ||
2958 | goto out; | 2781 | goto out; |
2959 | } | 2782 | } |
2960 | if (!atomic_test_mask | 2783 | if (!atomic_test_mask |
@@ -2964,18 +2787,13 @@ zfcp_erp_action_enqueue(int action, | |||
2964 | goto out; | 2787 | goto out; |
2965 | } | 2788 | } |
2966 | if (!atomic_test_mask | 2789 | if (!atomic_test_mask |
2967 | (ZFCP_STATUS_COMMON_UNBLOCKED, &port->status)) { | 2790 | (ZFCP_STATUS_COMMON_UNBLOCKED, &port->status)) |
2968 | stronger_action = ZFCP_ERP_ACTION_REOPEN_PORT; | 2791 | need = ZFCP_ERP_ACTION_REOPEN_PORT; |
2969 | unit = NULL; | ||
2970 | } | ||
2971 | /* fall through !!! */ | 2792 | /* fall through !!! */ |
2972 | 2793 | ||
2973 | case ZFCP_ERP_ACTION_REOPEN_PORT: | 2794 | case ZFCP_ERP_ACTION_REOPEN_PORT: |
2974 | if (atomic_test_mask | 2795 | if (atomic_test_mask |
2975 | (ZFCP_STATUS_COMMON_ERP_INUSE, &port->status)) { | 2796 | (ZFCP_STATUS_COMMON_ERP_INUSE, &port->status)) { |
2976 | debug_text_event(adapter->erp_dbf, 4, "p_actenq_drp"); | ||
2977 | debug_event(adapter->erp_dbf, 4, &port->wwpn, | ||
2978 | sizeof (wwn_t)); | ||
2979 | goto out; | 2797 | goto out; |
2980 | } | 2798 | } |
2981 | /* fall through !!! */ | 2799 | /* fall through !!! */ |
@@ -2987,15 +2805,9 @@ zfcp_erp_action_enqueue(int action, | |||
2987 | ZFCP_ERP_ACTION_REOPEN_PORT_FORCED) { | 2805 | ZFCP_ERP_ACTION_REOPEN_PORT_FORCED) { |
2988 | ZFCP_LOG_INFO("dropped erp action %i (port " | 2806 | ZFCP_LOG_INFO("dropped erp action %i (port " |
2989 | "0x%016Lx, action in use: %i)\n", | 2807 | "0x%016Lx, action in use: %i)\n", |
2990 | action, port->wwpn, | 2808 | want, port->wwpn, |
2991 | port->erp_action.action); | 2809 | port->erp_action.action); |
2992 | debug_text_event(adapter->erp_dbf, 4, | 2810 | } |
2993 | "pf_actenq_drp"); | ||
2994 | } else | ||
2995 | debug_text_event(adapter->erp_dbf, 4, | ||
2996 | "pf_actenq_drpcp"); | ||
2997 | debug_event(adapter->erp_dbf, 4, &port->wwpn, | ||
2998 | sizeof (wwn_t)); | ||
2999 | goto out; | 2811 | goto out; |
3000 | } | 2812 | } |
3001 | if (!atomic_test_mask | 2813 | if (!atomic_test_mask |
@@ -3005,46 +2817,36 @@ zfcp_erp_action_enqueue(int action, | |||
3005 | goto out; | 2817 | goto out; |
3006 | } | 2818 | } |
3007 | if (!atomic_test_mask | 2819 | if (!atomic_test_mask |
3008 | (ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status)) { | 2820 | (ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status)) |
3009 | stronger_action = ZFCP_ERP_ACTION_REOPEN_ADAPTER; | 2821 | need = ZFCP_ERP_ACTION_REOPEN_ADAPTER; |
3010 | port = NULL; | ||
3011 | } | ||
3012 | /* fall through !!! */ | 2822 | /* fall through !!! */ |
3013 | 2823 | ||
3014 | case ZFCP_ERP_ACTION_REOPEN_ADAPTER: | 2824 | case ZFCP_ERP_ACTION_REOPEN_ADAPTER: |
3015 | if (atomic_test_mask | 2825 | if (atomic_test_mask |
3016 | (ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status)) { | 2826 | (ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status)) { |
3017 | debug_text_event(adapter->erp_dbf, 4, "a_actenq_drp"); | ||
3018 | goto out; | 2827 | goto out; |
3019 | } | 2828 | } |
3020 | break; | 2829 | break; |
3021 | 2830 | ||
3022 | default: | 2831 | default: |
3023 | debug_text_exception(adapter->erp_dbf, 1, "a_actenq_bug"); | ||
3024 | debug_event(adapter->erp_dbf, 1, &action, sizeof (int)); | ||
3025 | ZFCP_LOG_NORMAL("bug: unknown erp action requested " | 2832 | ZFCP_LOG_NORMAL("bug: unknown erp action requested " |
3026 | "on adapter %s (action=%d)\n", | 2833 | "on adapter %s (action=%d)\n", |
3027 | zfcp_get_busid_by_adapter(adapter), action); | 2834 | zfcp_get_busid_by_adapter(adapter), want); |
3028 | goto out; | 2835 | goto out; |
3029 | } | 2836 | } |
3030 | 2837 | ||
3031 | /* check whether we need something stronger first */ | 2838 | /* check whether we need something stronger first */ |
3032 | if (stronger_action) { | 2839 | if (need) { |
3033 | debug_text_event(adapter->erp_dbf, 4, "a_actenq_str"); | ||
3034 | debug_event(adapter->erp_dbf, 4, &stronger_action, | ||
3035 | sizeof (int)); | ||
3036 | ZFCP_LOG_DEBUG("stronger erp action %d needed before " | 2840 | ZFCP_LOG_DEBUG("stronger erp action %d needed before " |
3037 | "erp action %d on adapter %s\n", | 2841 | "erp action %d on adapter %s\n", |
3038 | stronger_action, action, | 2842 | need, want, zfcp_get_busid_by_adapter(adapter)); |
3039 | zfcp_get_busid_by_adapter(adapter)); | ||
3040 | action = stronger_action; | ||
3041 | } | 2843 | } |
3042 | 2844 | ||
3043 | /* mark adapter to have some error recovery pending */ | 2845 | /* mark adapter to have some error recovery pending */ |
3044 | atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status); | 2846 | atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status); |
3045 | 2847 | ||
3046 | /* setup error recovery action */ | 2848 | /* setup error recovery action */ |
3047 | switch (action) { | 2849 | switch (need) { |
3048 | 2850 | ||
3049 | case ZFCP_ERP_ACTION_REOPEN_UNIT: | 2851 | case ZFCP_ERP_ACTION_REOPEN_UNIT: |
3050 | zfcp_unit_get(unit); | 2852 | zfcp_unit_get(unit); |
@@ -3077,13 +2879,11 @@ zfcp_erp_action_enqueue(int action, | |||
3077 | break; | 2879 | break; |
3078 | } | 2880 | } |
3079 | 2881 | ||
3080 | debug_text_event(adapter->erp_dbf, 4, "a_actenq"); | ||
3081 | |||
3082 | memset(erp_action, 0, sizeof (struct zfcp_erp_action)); | 2882 | memset(erp_action, 0, sizeof (struct zfcp_erp_action)); |
3083 | erp_action->adapter = adapter; | 2883 | erp_action->adapter = adapter; |
3084 | erp_action->port = port; | 2884 | erp_action->port = port; |
3085 | erp_action->unit = unit; | 2885 | erp_action->unit = unit; |
3086 | erp_action->action = action; | 2886 | erp_action->action = need; |
3087 | erp_action->status = status; | 2887 | erp_action->status = status; |
3088 | 2888 | ||
3089 | ++adapter->erp_total_count; | 2889 | ++adapter->erp_total_count; |
@@ -3091,8 +2891,11 @@ zfcp_erp_action_enqueue(int action, | |||
3091 | /* finally put it into 'ready' queue and kick erp thread */ | 2891 | /* finally put it into 'ready' queue and kick erp thread */ |
3092 | list_add_tail(&erp_action->list, &adapter->erp_ready_head); | 2892 | list_add_tail(&erp_action->list, &adapter->erp_ready_head); |
3093 | up(&adapter->erp_ready_sem); | 2893 | up(&adapter->erp_ready_sem); |
2894 | zfcp_rec_dbf_event_thread(1, adapter, 0); | ||
3094 | retval = 0; | 2895 | retval = 0; |
3095 | out: | 2896 | out: |
2897 | zfcp_rec_dbf_event_trigger(id, ref, want, need, erp_action, | ||
2898 | adapter, port, unit); | ||
3096 | return retval; | 2899 | return retval; |
3097 | } | 2900 | } |
3098 | 2901 | ||
@@ -3108,9 +2911,9 @@ zfcp_erp_action_dequeue(struct zfcp_erp_action *erp_action) | |||
3108 | erp_action->status &= ~ZFCP_STATUS_ERP_LOWMEM; | 2911 | erp_action->status &= ~ZFCP_STATUS_ERP_LOWMEM; |
3109 | } | 2912 | } |
3110 | 2913 | ||
3111 | debug_text_event(adapter->erp_dbf, 4, "a_actdeq"); | ||
3112 | debug_event(adapter->erp_dbf, 4, &erp_action->action, sizeof (int)); | ||
3113 | list_del(&erp_action->list); | 2914 | list_del(&erp_action->list); |
2915 | zfcp_rec_dbf_event_action(144, erp_action); | ||
2916 | |||
3114 | switch (erp_action->action) { | 2917 | switch (erp_action->action) { |
3115 | case ZFCP_ERP_ACTION_REOPEN_UNIT: | 2918 | case ZFCP_ERP_ACTION_REOPEN_UNIT: |
3116 | atomic_clear_mask(ZFCP_STATUS_COMMON_ERP_INUSE, | 2919 | atomic_clear_mask(ZFCP_STATUS_COMMON_ERP_INUSE, |
@@ -3215,7 +3018,6 @@ static void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter) | |||
3215 | { | 3018 | { |
3216 | struct zfcp_port *port; | 3019 | struct zfcp_port *port; |
3217 | 3020 | ||
3218 | debug_text_event(adapter->erp_dbf, 5, "a_actab"); | ||
3219 | if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status)) | 3021 | if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status)) |
3220 | zfcp_erp_action_dismiss(&adapter->erp_action); | 3022 | zfcp_erp_action_dismiss(&adapter->erp_action); |
3221 | else | 3023 | else |
@@ -3226,10 +3028,7 @@ static void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter) | |||
3226 | static void zfcp_erp_action_dismiss_port(struct zfcp_port *port) | 3028 | static void zfcp_erp_action_dismiss_port(struct zfcp_port *port) |
3227 | { | 3029 | { |
3228 | struct zfcp_unit *unit; | 3030 | struct zfcp_unit *unit; |
3229 | struct zfcp_adapter *adapter = port->adapter; | ||
3230 | 3031 | ||
3231 | debug_text_event(adapter->erp_dbf, 5, "p_actab"); | ||
3232 | debug_event(adapter->erp_dbf, 5, &port->wwpn, sizeof (wwn_t)); | ||
3233 | if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status)) | 3032 | if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status)) |
3234 | zfcp_erp_action_dismiss(&port->erp_action); | 3033 | zfcp_erp_action_dismiss(&port->erp_action); |
3235 | else | 3034 | else |
@@ -3239,92 +3038,60 @@ static void zfcp_erp_action_dismiss_port(struct zfcp_port *port) | |||
3239 | 3038 | ||
3240 | static void zfcp_erp_action_dismiss_unit(struct zfcp_unit *unit) | 3039 | static void zfcp_erp_action_dismiss_unit(struct zfcp_unit *unit) |
3241 | { | 3040 | { |
3242 | struct zfcp_adapter *adapter = unit->port->adapter; | ||
3243 | |||
3244 | debug_text_event(adapter->erp_dbf, 5, "u_actab"); | ||
3245 | debug_event(adapter->erp_dbf, 5, &unit->fcp_lun, sizeof (fcp_lun_t)); | ||
3246 | if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status)) | 3041 | if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status)) |
3247 | zfcp_erp_action_dismiss(&unit->erp_action); | 3042 | zfcp_erp_action_dismiss(&unit->erp_action); |
3248 | } | 3043 | } |
3249 | 3044 | ||
3250 | static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action) | 3045 | static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action) |
3251 | { | 3046 | { |
3252 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
3253 | |||
3254 | debug_text_event(adapter->erp_dbf, 6, "a_toru"); | ||
3255 | debug_event(adapter->erp_dbf, 6, &erp_action->action, sizeof (int)); | ||
3256 | list_move(&erp_action->list, &erp_action->adapter->erp_running_head); | 3047 | list_move(&erp_action->list, &erp_action->adapter->erp_running_head); |
3048 | zfcp_rec_dbf_event_action(145, erp_action); | ||
3257 | } | 3049 | } |
3258 | 3050 | ||
3259 | static void zfcp_erp_action_to_ready(struct zfcp_erp_action *erp_action) | 3051 | static void zfcp_erp_action_to_ready(struct zfcp_erp_action *erp_action) |
3260 | { | 3052 | { |
3261 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
3262 | |||
3263 | debug_text_event(adapter->erp_dbf, 6, "a_tore"); | ||
3264 | debug_event(adapter->erp_dbf, 6, &erp_action->action, sizeof (int)); | ||
3265 | list_move(&erp_action->list, &erp_action->adapter->erp_ready_head); | 3053 | list_move(&erp_action->list, &erp_action->adapter->erp_ready_head); |
3054 | zfcp_rec_dbf_event_action(146, erp_action); | ||
3266 | } | 3055 | } |
3267 | 3056 | ||
3268 | void | 3057 | void zfcp_erp_port_boxed(struct zfcp_port *port, u8 id, void *ref) |
3269 | zfcp_erp_port_boxed(struct zfcp_port *port) | ||
3270 | { | 3058 | { |
3271 | struct zfcp_adapter *adapter = port->adapter; | ||
3272 | unsigned long flags; | 3059 | unsigned long flags; |
3273 | 3060 | ||
3274 | debug_text_event(adapter->erp_dbf, 3, "p_access_boxed"); | ||
3275 | debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t)); | ||
3276 | read_lock_irqsave(&zfcp_data.config_lock, flags); | 3061 | read_lock_irqsave(&zfcp_data.config_lock, flags); |
3277 | zfcp_erp_modify_port_status(port, | 3062 | zfcp_erp_modify_port_status(port, id, ref, |
3278 | ZFCP_STATUS_COMMON_ACCESS_BOXED, | 3063 | ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET); |
3279 | ZFCP_SET); | ||
3280 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); | 3064 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); |
3281 | zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED); | 3065 | zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref); |
3282 | } | 3066 | } |
3283 | 3067 | ||
3284 | void | 3068 | void zfcp_erp_unit_boxed(struct zfcp_unit *unit, u8 id, void *ref) |
3285 | zfcp_erp_unit_boxed(struct zfcp_unit *unit) | ||
3286 | { | 3069 | { |
3287 | struct zfcp_adapter *adapter = unit->port->adapter; | 3070 | zfcp_erp_modify_unit_status(unit, id, ref, |
3288 | 3071 | ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET); | |
3289 | debug_text_event(adapter->erp_dbf, 3, "u_access_boxed"); | 3072 | zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref); |
3290 | debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t)); | ||
3291 | zfcp_erp_modify_unit_status(unit, | ||
3292 | ZFCP_STATUS_COMMON_ACCESS_BOXED, | ||
3293 | ZFCP_SET); | ||
3294 | zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED); | ||
3295 | } | 3073 | } |
3296 | 3074 | ||
3297 | void | 3075 | void zfcp_erp_port_access_denied(struct zfcp_port *port, u8 id, void *ref) |
3298 | zfcp_erp_port_access_denied(struct zfcp_port *port) | ||
3299 | { | 3076 | { |
3300 | struct zfcp_adapter *adapter = port->adapter; | ||
3301 | unsigned long flags; | 3077 | unsigned long flags; |
3302 | 3078 | ||
3303 | debug_text_event(adapter->erp_dbf, 3, "p_access_denied"); | ||
3304 | debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t)); | ||
3305 | read_lock_irqsave(&zfcp_data.config_lock, flags); | 3079 | read_lock_irqsave(&zfcp_data.config_lock, flags); |
3306 | zfcp_erp_modify_port_status(port, | 3080 | zfcp_erp_modify_port_status(port, id, ref, |
3307 | ZFCP_STATUS_COMMON_ERP_FAILED | | 3081 | ZFCP_STATUS_COMMON_ERP_FAILED | |
3308 | ZFCP_STATUS_COMMON_ACCESS_DENIED, | 3082 | ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); |
3309 | ZFCP_SET); | ||
3310 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); | 3083 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); |
3311 | } | 3084 | } |
3312 | 3085 | ||
3313 | void | 3086 | void zfcp_erp_unit_access_denied(struct zfcp_unit *unit, u8 id, void *ref) |
3314 | zfcp_erp_unit_access_denied(struct zfcp_unit *unit) | ||
3315 | { | 3087 | { |
3316 | struct zfcp_adapter *adapter = unit->port->adapter; | 3088 | zfcp_erp_modify_unit_status(unit, id, ref, |
3317 | 3089 | ZFCP_STATUS_COMMON_ERP_FAILED | | |
3318 | debug_text_event(adapter->erp_dbf, 3, "u_access_denied"); | 3090 | ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); |
3319 | debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t)); | ||
3320 | zfcp_erp_modify_unit_status(unit, | ||
3321 | ZFCP_STATUS_COMMON_ERP_FAILED | | ||
3322 | ZFCP_STATUS_COMMON_ACCESS_DENIED, | ||
3323 | ZFCP_SET); | ||
3324 | } | 3091 | } |
3325 | 3092 | ||
3326 | void | 3093 | void zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter, u8 id, |
3327 | zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter) | 3094 | void *ref) |
3328 | { | 3095 | { |
3329 | struct zfcp_port *port; | 3096 | struct zfcp_port *port; |
3330 | unsigned long flags; | 3097 | unsigned long flags; |
@@ -3332,54 +3099,43 @@ zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter) | |||
3332 | if (adapter->connection_features & FSF_FEATURE_NPIV_MODE) | 3099 | if (adapter->connection_features & FSF_FEATURE_NPIV_MODE) |
3333 | return; | 3100 | return; |
3334 | 3101 | ||
3335 | debug_text_event(adapter->erp_dbf, 3, "a_access_recover"); | ||
3336 | debug_event(adapter->erp_dbf, 3, zfcp_get_busid_by_adapter(adapter), 8); | ||
3337 | |||
3338 | read_lock_irqsave(&zfcp_data.config_lock, flags); | 3102 | read_lock_irqsave(&zfcp_data.config_lock, flags); |
3339 | if (adapter->nameserver_port) | 3103 | if (adapter->nameserver_port) |
3340 | zfcp_erp_port_access_changed(adapter->nameserver_port); | 3104 | zfcp_erp_port_access_changed(adapter->nameserver_port, id, ref); |
3341 | list_for_each_entry(port, &adapter->port_list_head, list) | 3105 | list_for_each_entry(port, &adapter->port_list_head, list) |
3342 | if (port != adapter->nameserver_port) | 3106 | if (port != adapter->nameserver_port) |
3343 | zfcp_erp_port_access_changed(port); | 3107 | zfcp_erp_port_access_changed(port, id, ref); |
3344 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); | 3108 | read_unlock_irqrestore(&zfcp_data.config_lock, flags); |
3345 | } | 3109 | } |
3346 | 3110 | ||
3347 | void | 3111 | void zfcp_erp_port_access_changed(struct zfcp_port *port, u8 id, void *ref) |
3348 | zfcp_erp_port_access_changed(struct zfcp_port *port) | ||
3349 | { | 3112 | { |
3350 | struct zfcp_adapter *adapter = port->adapter; | 3113 | struct zfcp_adapter *adapter = port->adapter; |
3351 | struct zfcp_unit *unit; | 3114 | struct zfcp_unit *unit; |
3352 | 3115 | ||
3353 | debug_text_event(adapter->erp_dbf, 3, "p_access_recover"); | ||
3354 | debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t)); | ||
3355 | |||
3356 | if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, | 3116 | if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, |
3357 | &port->status) && | 3117 | &port->status) && |
3358 | !atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED, | 3118 | !atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED, |
3359 | &port->status)) { | 3119 | &port->status)) { |
3360 | if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) | 3120 | if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) |
3361 | list_for_each_entry(unit, &port->unit_list_head, list) | 3121 | list_for_each_entry(unit, &port->unit_list_head, list) |
3362 | zfcp_erp_unit_access_changed(unit); | 3122 | zfcp_erp_unit_access_changed(unit, id, ref); |
3363 | return; | 3123 | return; |
3364 | } | 3124 | } |
3365 | 3125 | ||
3366 | ZFCP_LOG_NORMAL("reopen of port 0x%016Lx on adapter %s " | 3126 | ZFCP_LOG_NORMAL("reopen of port 0x%016Lx on adapter %s " |
3367 | "(due to ACT update)\n", | 3127 | "(due to ACT update)\n", |
3368 | port->wwpn, zfcp_get_busid_by_adapter(adapter)); | 3128 | port->wwpn, zfcp_get_busid_by_adapter(adapter)); |
3369 | if (zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED) != 0) | 3129 | if (zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref)) |
3370 | ZFCP_LOG_NORMAL("failed reopen of port" | 3130 | ZFCP_LOG_NORMAL("failed reopen of port" |
3371 | "(adapter %s, wwpn=0x%016Lx)\n", | 3131 | "(adapter %s, wwpn=0x%016Lx)\n", |
3372 | zfcp_get_busid_by_adapter(adapter), port->wwpn); | 3132 | zfcp_get_busid_by_adapter(adapter), port->wwpn); |
3373 | } | 3133 | } |
3374 | 3134 | ||
3375 | void | 3135 | void zfcp_erp_unit_access_changed(struct zfcp_unit *unit, u8 id, void *ref) |
3376 | zfcp_erp_unit_access_changed(struct zfcp_unit *unit) | ||
3377 | { | 3136 | { |
3378 | struct zfcp_adapter *adapter = unit->port->adapter; | 3137 | struct zfcp_adapter *adapter = unit->port->adapter; |
3379 | 3138 | ||
3380 | debug_text_event(adapter->erp_dbf, 3, "u_access_recover"); | ||
3381 | debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t)); | ||
3382 | |||
3383 | if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, | 3139 | if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, |
3384 | &unit->status) && | 3140 | &unit->status) && |
3385 | !atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED, | 3141 | !atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED, |
@@ -3390,7 +3146,7 @@ zfcp_erp_unit_access_changed(struct zfcp_unit *unit) | |||
3390 | " on adapter %s (due to ACT update)\n", | 3146 | " on adapter %s (due to ACT update)\n", |
3391 | unit->fcp_lun, unit->port->wwpn, | 3147 | unit->fcp_lun, unit->port->wwpn, |
3392 | zfcp_get_busid_by_adapter(adapter)); | 3148 | zfcp_get_busid_by_adapter(adapter)); |
3393 | if (zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED) != 0) | 3149 | if (zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref)) |
3394 | ZFCP_LOG_NORMAL("failed reopen of unit (adapter %s, " | 3150 | ZFCP_LOG_NORMAL("failed reopen of unit (adapter %s, " |
3395 | "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n", | 3151 | "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n", |
3396 | zfcp_get_busid_by_adapter(adapter), | 3152 | zfcp_get_busid_by_adapter(adapter), |
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index 06b1079b7f3d..6abf178fda5d 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h | |||
@@ -131,22 +131,25 @@ extern int zfcp_scsi_command_sync(struct zfcp_unit *, struct scsi_cmnd *, int); | |||
131 | extern struct fc_function_template zfcp_transport_functions; | 131 | extern struct fc_function_template zfcp_transport_functions; |
132 | 132 | ||
133 | /******************************** ERP ****************************************/ | 133 | /******************************** ERP ****************************************/ |
134 | extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, u32, int); | 134 | extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, u8, void *, |
135 | extern int zfcp_erp_adapter_reopen(struct zfcp_adapter *, int); | 135 | u32, int); |
136 | extern int zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int); | 136 | extern int zfcp_erp_adapter_reopen(struct zfcp_adapter *, int, u8, void *); |
137 | extern void zfcp_erp_adapter_failed(struct zfcp_adapter *); | 137 | extern int zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int, u8, void *); |
138 | 138 | extern void zfcp_erp_adapter_failed(struct zfcp_adapter *, u8, void *); | |
139 | extern void zfcp_erp_modify_port_status(struct zfcp_port *, u32, int); | 139 | |
140 | extern int zfcp_erp_port_reopen(struct zfcp_port *, int); | 140 | extern void zfcp_erp_modify_port_status(struct zfcp_port *, u8, void *, u32, |
141 | extern int zfcp_erp_port_shutdown(struct zfcp_port *, int); | 141 | int); |
142 | extern int zfcp_erp_port_forced_reopen(struct zfcp_port *, int); | 142 | extern int zfcp_erp_port_reopen(struct zfcp_port *, int, u8, void *); |
143 | extern void zfcp_erp_port_failed(struct zfcp_port *); | 143 | extern int zfcp_erp_port_shutdown(struct zfcp_port *, int, u8, void *); |
144 | extern int zfcp_erp_port_reopen_all(struct zfcp_adapter *, int); | 144 | extern int zfcp_erp_port_forced_reopen(struct zfcp_port *, int, u8, void *); |
145 | 145 | extern void zfcp_erp_port_failed(struct zfcp_port *, u8, void *); | |
146 | extern void zfcp_erp_modify_unit_status(struct zfcp_unit *, u32, int); | 146 | extern int zfcp_erp_port_reopen_all(struct zfcp_adapter *, int, u8, void *); |
147 | extern int zfcp_erp_unit_reopen(struct zfcp_unit *, int); | 147 | |
148 | extern int zfcp_erp_unit_shutdown(struct zfcp_unit *, int); | 148 | extern void zfcp_erp_modify_unit_status(struct zfcp_unit *, u8, void *, u32, |
149 | extern void zfcp_erp_unit_failed(struct zfcp_unit *); | 149 | int); |
150 | extern int zfcp_erp_unit_reopen(struct zfcp_unit *, int, u8, void *); | ||
151 | extern int zfcp_erp_unit_shutdown(struct zfcp_unit *, int, u8, void *); | ||
152 | extern void zfcp_erp_unit_failed(struct zfcp_unit *, u8, void *); | ||
150 | 153 | ||
151 | extern int zfcp_erp_thread_setup(struct zfcp_adapter *); | 154 | extern int zfcp_erp_thread_setup(struct zfcp_adapter *); |
152 | extern int zfcp_erp_thread_kill(struct zfcp_adapter *); | 155 | extern int zfcp_erp_thread_kill(struct zfcp_adapter *); |
@@ -155,15 +158,25 @@ extern void zfcp_erp_async_handler(struct zfcp_erp_action *, unsigned long); | |||
155 | 158 | ||
156 | extern int zfcp_test_link(struct zfcp_port *); | 159 | extern int zfcp_test_link(struct zfcp_port *); |
157 | 160 | ||
158 | extern void zfcp_erp_port_boxed(struct zfcp_port *); | 161 | extern void zfcp_erp_port_boxed(struct zfcp_port *, u8 id, void *ref); |
159 | extern void zfcp_erp_unit_boxed(struct zfcp_unit *); | 162 | extern void zfcp_erp_unit_boxed(struct zfcp_unit *, u8 id, void *ref); |
160 | extern void zfcp_erp_port_access_denied(struct zfcp_port *); | 163 | extern void zfcp_erp_port_access_denied(struct zfcp_port *, u8 id, void *ref); |
161 | extern void zfcp_erp_unit_access_denied(struct zfcp_unit *); | 164 | extern void zfcp_erp_unit_access_denied(struct zfcp_unit *, u8 id, void *ref); |
162 | extern void zfcp_erp_adapter_access_changed(struct zfcp_adapter *); | 165 | extern void zfcp_erp_adapter_access_changed(struct zfcp_adapter *, u8, void *); |
163 | extern void zfcp_erp_port_access_changed(struct zfcp_port *); | 166 | extern void zfcp_erp_port_access_changed(struct zfcp_port *, u8, void *); |
164 | extern void zfcp_erp_unit_access_changed(struct zfcp_unit *); | 167 | extern void zfcp_erp_unit_access_changed(struct zfcp_unit *, u8, void *); |
165 | 168 | ||
166 | /******************************** AUX ****************************************/ | 169 | /******************************** AUX ****************************************/ |
170 | extern void zfcp_rec_dbf_event_thread(u8 id, struct zfcp_adapter *adapter, | ||
171 | int lock); | ||
172 | extern void zfcp_rec_dbf_event_adapter(u8 id, void *ref, struct zfcp_adapter *); | ||
173 | extern void zfcp_rec_dbf_event_port(u8 id, void *ref, struct zfcp_port *port); | ||
174 | extern void zfcp_rec_dbf_event_unit(u8 id, void *ref, struct zfcp_unit *unit); | ||
175 | extern void zfcp_rec_dbf_event_trigger(u8 id, void *ref, u8 want, u8 need, | ||
176 | void *action, struct zfcp_adapter *, | ||
177 | struct zfcp_port *, struct zfcp_unit *); | ||
178 | extern void zfcp_rec_dbf_event_action(u8 id, struct zfcp_erp_action *); | ||
179 | |||
167 | extern void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *); | 180 | extern void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *); |
168 | extern void zfcp_hba_dbf_event_fsf_unsol(const char *, struct zfcp_adapter *, | 181 | extern void zfcp_hba_dbf_event_fsf_unsol(const char *, struct zfcp_adapter *, |
169 | struct fsf_status_read_buffer *); | 182 | struct fsf_status_read_buffer *); |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 0dff05840ee2..7c3f02816e95 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -46,7 +46,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *); | |||
46 | static int zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *); | 46 | static int zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *); |
47 | static int zfcp_fsf_fsfstatus_eval(struct zfcp_fsf_req *); | 47 | static int zfcp_fsf_fsfstatus_eval(struct zfcp_fsf_req *); |
48 | static int zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *); | 48 | static int zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *); |
49 | static void zfcp_fsf_link_down_info_eval(struct zfcp_adapter *, | 49 | static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *, u8, |
50 | struct fsf_link_down_info *); | 50 | struct fsf_link_down_info *); |
51 | static int zfcp_fsf_req_dispatch(struct zfcp_fsf_req *); | 51 | static int zfcp_fsf_req_dispatch(struct zfcp_fsf_req *); |
52 | 52 | ||
@@ -284,37 +284,6 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req) | |||
284 | goto skip_protstatus; | 284 | goto skip_protstatus; |
285 | } | 285 | } |
286 | 286 | ||
287 | /* log additional information provided by FSF (if any) */ | ||
288 | if (likely(qtcb->header.log_length)) { | ||
289 | /* do not trust them ;-) */ | ||
290 | if (unlikely(qtcb->header.log_start > | ||
291 | sizeof(struct fsf_qtcb))) { | ||
292 | ZFCP_LOG_NORMAL | ||
293 | ("bug: ULP (FSF logging) log data starts " | ||
294 | "beyond end of packet header. Ignored. " | ||
295 | "(start=%i, size=%li)\n", | ||
296 | qtcb->header.log_start, | ||
297 | sizeof(struct fsf_qtcb)); | ||
298 | goto forget_log; | ||
299 | } | ||
300 | if (unlikely((size_t) (qtcb->header.log_start + | ||
301 | qtcb->header.log_length) > | ||
302 | sizeof(struct fsf_qtcb))) { | ||
303 | ZFCP_LOG_NORMAL("bug: ULP (FSF logging) log data ends " | ||
304 | "beyond end of packet header. Ignored. " | ||
305 | "(start=%i, length=%i, size=%li)\n", | ||
306 | qtcb->header.log_start, | ||
307 | qtcb->header.log_length, | ||
308 | sizeof(struct fsf_qtcb)); | ||
309 | goto forget_log; | ||
310 | } | ||
311 | ZFCP_LOG_TRACE("ULP log data: \n"); | ||
312 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE, | ||
313 | (char *) qtcb + qtcb->header.log_start, | ||
314 | qtcb->header.log_length); | ||
315 | } | ||
316 | forget_log: | ||
317 | |||
318 | /* evaluate FSF Protocol Status */ | 287 | /* evaluate FSF Protocol Status */ |
319 | switch (qtcb->prefix.prot_status) { | 288 | switch (qtcb->prefix.prot_status) { |
320 | 289 | ||
@@ -329,7 +298,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req) | |||
329 | zfcp_get_busid_by_adapter(adapter), | 298 | zfcp_get_busid_by_adapter(adapter), |
330 | prot_status_qual->version_error.fsf_version, | 299 | prot_status_qual->version_error.fsf_version, |
331 | ZFCP_QTCB_VERSION); | 300 | ZFCP_QTCB_VERSION); |
332 | zfcp_erp_adapter_shutdown(adapter, 0); | 301 | zfcp_erp_adapter_shutdown(adapter, 0, 117, fsf_req); |
333 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 302 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
334 | break; | 303 | break; |
335 | 304 | ||
@@ -340,7 +309,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req) | |||
340 | qtcb->prefix.req_seq_no, | 309 | qtcb->prefix.req_seq_no, |
341 | zfcp_get_busid_by_adapter(adapter), | 310 | zfcp_get_busid_by_adapter(adapter), |
342 | prot_status_qual->sequence_error.exp_req_seq_no); | 311 | prot_status_qual->sequence_error.exp_req_seq_no); |
343 | zfcp_erp_adapter_reopen(adapter, 0); | 312 | zfcp_erp_adapter_reopen(adapter, 0, 98, fsf_req); |
344 | fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY; | 313 | fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY; |
345 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 314 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
346 | break; | 315 | break; |
@@ -351,7 +320,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req) | |||
351 | "that used on adapter %s. " | 320 | "that used on adapter %s. " |
352 | "Stopping all operations on this adapter.\n", | 321 | "Stopping all operations on this adapter.\n", |
353 | zfcp_get_busid_by_adapter(adapter)); | 322 | zfcp_get_busid_by_adapter(adapter)); |
354 | zfcp_erp_adapter_shutdown(adapter, 0); | 323 | zfcp_erp_adapter_shutdown(adapter, 0, 118, fsf_req); |
355 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 324 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
356 | break; | 325 | break; |
357 | 326 | ||
@@ -368,14 +337,15 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req) | |||
368 | *(unsigned long long*) | 337 | *(unsigned long long*) |
369 | (&qtcb->bottom.support.req_handle), | 338 | (&qtcb->bottom.support.req_handle), |
370 | zfcp_get_busid_by_adapter(adapter)); | 339 | zfcp_get_busid_by_adapter(adapter)); |
371 | zfcp_erp_adapter_shutdown(adapter, 0); | 340 | zfcp_erp_adapter_shutdown(adapter, 0, 78, fsf_req); |
372 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 341 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
373 | break; | 342 | break; |
374 | 343 | ||
375 | case FSF_PROT_LINK_DOWN: | 344 | case FSF_PROT_LINK_DOWN: |
376 | zfcp_fsf_link_down_info_eval(adapter, | 345 | zfcp_fsf_link_down_info_eval(fsf_req, 37, |
377 | &prot_status_qual->link_down_info); | 346 | &prot_status_qual->link_down_info); |
378 | zfcp_erp_adapter_reopen(adapter, 0); | 347 | /* FIXME: reopening adapter now? better wait for link up */ |
348 | zfcp_erp_adapter_reopen(adapter, 0, 79, fsf_req); | ||
379 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 349 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
380 | break; | 350 | break; |
381 | 351 | ||
@@ -385,12 +355,13 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req) | |||
385 | "Re-starting operations on this adapter.\n", | 355 | "Re-starting operations on this adapter.\n", |
386 | zfcp_get_busid_by_adapter(adapter)); | 356 | zfcp_get_busid_by_adapter(adapter)); |
387 | /* All ports should be marked as ready to run again */ | 357 | /* All ports should be marked as ready to run again */ |
388 | zfcp_erp_modify_adapter_status(adapter, | 358 | zfcp_erp_modify_adapter_status(adapter, 28, NULL, |
389 | ZFCP_STATUS_COMMON_RUNNING, | 359 | ZFCP_STATUS_COMMON_RUNNING, |
390 | ZFCP_SET); | 360 | ZFCP_SET); |
391 | zfcp_erp_adapter_reopen(adapter, | 361 | zfcp_erp_adapter_reopen(adapter, |
392 | ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED | 362 | ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED |
393 | | ZFCP_STATUS_COMMON_ERP_FAILED); | 363 | | ZFCP_STATUS_COMMON_ERP_FAILED, |
364 | 99, fsf_req); | ||
394 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 365 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
395 | break; | 366 | break; |
396 | 367 | ||
@@ -400,7 +371,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req) | |||
400 | "Restarting all operations on this " | 371 | "Restarting all operations on this " |
401 | "adapter.\n", | 372 | "adapter.\n", |
402 | zfcp_get_busid_by_adapter(adapter)); | 373 | zfcp_get_busid_by_adapter(adapter)); |
403 | zfcp_erp_adapter_reopen(adapter, 0); | 374 | zfcp_erp_adapter_reopen(adapter, 0, 100, fsf_req); |
404 | fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY; | 375 | fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY; |
405 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 376 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
406 | break; | 377 | break; |
@@ -413,7 +384,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req) | |||
413 | "(debug info 0x%x).\n", | 384 | "(debug info 0x%x).\n", |
414 | zfcp_get_busid_by_adapter(adapter), | 385 | zfcp_get_busid_by_adapter(adapter), |
415 | qtcb->prefix.prot_status); | 386 | qtcb->prefix.prot_status); |
416 | zfcp_erp_adapter_shutdown(adapter, 0); | 387 | zfcp_erp_adapter_shutdown(adapter, 0, 119, fsf_req); |
417 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 388 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
418 | } | 389 | } |
419 | 390 | ||
@@ -452,7 +423,7 @@ zfcp_fsf_fsfstatus_eval(struct zfcp_fsf_req *fsf_req) | |||
452 | "(debug info 0x%x).\n", | 423 | "(debug info 0x%x).\n", |
453 | zfcp_get_busid_by_adapter(fsf_req->adapter), | 424 | zfcp_get_busid_by_adapter(fsf_req->adapter), |
454 | fsf_req->qtcb->header.fsf_command); | 425 | fsf_req->qtcb->header.fsf_command); |
455 | zfcp_erp_adapter_shutdown(fsf_req->adapter, 0); | 426 | zfcp_erp_adapter_shutdown(fsf_req->adapter, 0, 120, fsf_req); |
456 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 427 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
457 | break; | 428 | break; |
458 | 429 | ||
@@ -506,7 +477,7 @@ zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *fsf_req) | |||
506 | "problem on the adapter %s " | 477 | "problem on the adapter %s " |
507 | "Stopping all operations on this adapter. ", | 478 | "Stopping all operations on this adapter. ", |
508 | zfcp_get_busid_by_adapter(fsf_req->adapter)); | 479 | zfcp_get_busid_by_adapter(fsf_req->adapter)); |
509 | zfcp_erp_adapter_shutdown(fsf_req->adapter, 0); | 480 | zfcp_erp_adapter_shutdown(fsf_req->adapter, 0, 121, fsf_req); |
510 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 481 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
511 | break; | 482 | break; |
512 | case FSF_SQ_ULP_PROGRAMMING_ERROR: | 483 | case FSF_SQ_ULP_PROGRAMMING_ERROR: |
@@ -537,9 +508,11 @@ zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *fsf_req) | |||
537 | * zfcp_fsf_link_down_info_eval - evaluate link down information block | 508 | * zfcp_fsf_link_down_info_eval - evaluate link down information block |
538 | */ | 509 | */ |
539 | static void | 510 | static void |
540 | zfcp_fsf_link_down_info_eval(struct zfcp_adapter *adapter, | 511 | zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *fsf_req, u8 id, |
541 | struct fsf_link_down_info *link_down) | 512 | struct fsf_link_down_info *link_down) |
542 | { | 513 | { |
514 | struct zfcp_adapter *adapter = fsf_req->adapter; | ||
515 | |||
543 | if (atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, | 516 | if (atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, |
544 | &adapter->status)) | 517 | &adapter->status)) |
545 | return; | 518 | return; |
@@ -630,7 +603,7 @@ zfcp_fsf_link_down_info_eval(struct zfcp_adapter *adapter, | |||
630 | link_down->vendor_specific_code); | 603 | link_down->vendor_specific_code); |
631 | 604 | ||
632 | out: | 605 | out: |
633 | zfcp_erp_adapter_failed(adapter); | 606 | zfcp_erp_adapter_failed(adapter, id, fsf_req); |
634 | } | 607 | } |
635 | 608 | ||
636 | /* | 609 | /* |
@@ -824,19 +797,14 @@ zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *fsf_req) | |||
824 | switch (status_buffer->status_subtype) { | 797 | switch (status_buffer->status_subtype) { |
825 | 798 | ||
826 | case FSF_STATUS_READ_SUB_CLOSE_PHYS_PORT: | 799 | case FSF_STATUS_READ_SUB_CLOSE_PHYS_PORT: |
827 | debug_text_event(adapter->erp_dbf, 3, "unsol_pc_phys:"); | 800 | zfcp_erp_port_reopen(port, 0, 101, fsf_req); |
828 | zfcp_erp_port_reopen(port, 0); | ||
829 | break; | 801 | break; |
830 | 802 | ||
831 | case FSF_STATUS_READ_SUB_ERROR_PORT: | 803 | case FSF_STATUS_READ_SUB_ERROR_PORT: |
832 | debug_text_event(adapter->erp_dbf, 1, "unsol_pc_err:"); | 804 | zfcp_erp_port_shutdown(port, 0, 122, fsf_req); |
833 | zfcp_erp_port_shutdown(port, 0); | ||
834 | break; | 805 | break; |
835 | 806 | ||
836 | default: | 807 | default: |
837 | debug_text_event(adapter->erp_dbf, 0, "unsol_unk_sub:"); | ||
838 | debug_exception(adapter->erp_dbf, 0, | ||
839 | &status_buffer->status_subtype, sizeof (u32)); | ||
840 | ZFCP_LOG_NORMAL("bug: Undefined status subtype received " | 808 | ZFCP_LOG_NORMAL("bug: Undefined status subtype received " |
841 | "for a reopen indication on port with " | 809 | "for a reopen indication on port with " |
842 | "d_id 0x%06x on the adapter %s. " | 810 | "d_id 0x%06x on the adapter %s. " |
@@ -928,7 +896,7 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req) | |||
928 | case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: | 896 | case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: |
929 | ZFCP_LOG_INFO("Physical link to adapter %s is down\n", | 897 | ZFCP_LOG_INFO("Physical link to adapter %s is down\n", |
930 | zfcp_get_busid_by_adapter(adapter)); | 898 | zfcp_get_busid_by_adapter(adapter)); |
931 | zfcp_fsf_link_down_info_eval(adapter, | 899 | zfcp_fsf_link_down_info_eval(fsf_req, 38, |
932 | (struct fsf_link_down_info *) | 900 | (struct fsf_link_down_info *) |
933 | &status_buffer->payload); | 901 | &status_buffer->payload); |
934 | break; | 902 | break; |
@@ -936,7 +904,7 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req) | |||
936 | ZFCP_LOG_INFO("Local link to adapter %s is down " | 904 | ZFCP_LOG_INFO("Local link to adapter %s is down " |
937 | "due to failed FDISC login\n", | 905 | "due to failed FDISC login\n", |
938 | zfcp_get_busid_by_adapter(adapter)); | 906 | zfcp_get_busid_by_adapter(adapter)); |
939 | zfcp_fsf_link_down_info_eval(adapter, | 907 | zfcp_fsf_link_down_info_eval(fsf_req, 39, |
940 | (struct fsf_link_down_info *) | 908 | (struct fsf_link_down_info *) |
941 | &status_buffer->payload); | 909 | &status_buffer->payload); |
942 | break; | 910 | break; |
@@ -944,13 +912,13 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req) | |||
944 | ZFCP_LOG_INFO("Local link to adapter %s is down " | 912 | ZFCP_LOG_INFO("Local link to adapter %s is down " |
945 | "due to firmware update on adapter\n", | 913 | "due to firmware update on adapter\n", |
946 | zfcp_get_busid_by_adapter(adapter)); | 914 | zfcp_get_busid_by_adapter(adapter)); |
947 | zfcp_fsf_link_down_info_eval(adapter, NULL); | 915 | zfcp_fsf_link_down_info_eval(fsf_req, 40, NULL); |
948 | break; | 916 | break; |
949 | default: | 917 | default: |
950 | ZFCP_LOG_INFO("Local link to adapter %s is down " | 918 | ZFCP_LOG_INFO("Local link to adapter %s is down " |
951 | "due to unknown reason\n", | 919 | "due to unknown reason\n", |
952 | zfcp_get_busid_by_adapter(adapter)); | 920 | zfcp_get_busid_by_adapter(adapter)); |
953 | zfcp_fsf_link_down_info_eval(adapter, NULL); | 921 | zfcp_fsf_link_down_info_eval(fsf_req, 41, NULL); |
954 | }; | 922 | }; |
955 | break; | 923 | break; |
956 | 924 | ||
@@ -959,12 +927,13 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req) | |||
959 | "Restarting operations on this adapter\n", | 927 | "Restarting operations on this adapter\n", |
960 | zfcp_get_busid_by_adapter(adapter)); | 928 | zfcp_get_busid_by_adapter(adapter)); |
961 | /* All ports should be marked as ready to run again */ | 929 | /* All ports should be marked as ready to run again */ |
962 | zfcp_erp_modify_adapter_status(adapter, | 930 | zfcp_erp_modify_adapter_status(adapter, 30, NULL, |
963 | ZFCP_STATUS_COMMON_RUNNING, | 931 | ZFCP_STATUS_COMMON_RUNNING, |
964 | ZFCP_SET); | 932 | ZFCP_SET); |
965 | zfcp_erp_adapter_reopen(adapter, | 933 | zfcp_erp_adapter_reopen(adapter, |
966 | ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED | 934 | ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED |
967 | | ZFCP_STATUS_COMMON_ERP_FAILED); | 935 | | ZFCP_STATUS_COMMON_ERP_FAILED, |
936 | 102, fsf_req); | ||
968 | break; | 937 | break; |
969 | 938 | ||
970 | case FSF_STATUS_READ_NOTIFICATION_LOST: | 939 | case FSF_STATUS_READ_NOTIFICATION_LOST: |
@@ -998,13 +967,13 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req) | |||
998 | 967 | ||
999 | if (status_buffer->status_subtype & | 968 | if (status_buffer->status_subtype & |
1000 | FSF_STATUS_READ_SUB_ACT_UPDATED) | 969 | FSF_STATUS_READ_SUB_ACT_UPDATED) |
1001 | zfcp_erp_adapter_access_changed(adapter); | 970 | zfcp_erp_adapter_access_changed(adapter, 135, fsf_req); |
1002 | break; | 971 | break; |
1003 | 972 | ||
1004 | case FSF_STATUS_READ_CFDC_UPDATED: | 973 | case FSF_STATUS_READ_CFDC_UPDATED: |
1005 | ZFCP_LOG_NORMAL("CFDC has been updated on the adapter %s\n", | 974 | ZFCP_LOG_NORMAL("CFDC has been updated on the adapter %s\n", |
1006 | zfcp_get_busid_by_adapter(adapter)); | 975 | zfcp_get_busid_by_adapter(adapter)); |
1007 | zfcp_erp_adapter_access_changed(adapter); | 976 | zfcp_erp_adapter_access_changed(adapter, 136, fsf_req); |
1008 | break; | 977 | break; |
1009 | 978 | ||
1010 | case FSF_STATUS_READ_CFDC_HARDENED: | 979 | case FSF_STATUS_READ_CFDC_HARDENED: |
@@ -1025,7 +994,6 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req) | |||
1025 | break; | 994 | break; |
1026 | 995 | ||
1027 | case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: | 996 | case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: |
1028 | debug_text_event(adapter->erp_dbf, 2, "unsol_features:"); | ||
1029 | ZFCP_LOG_INFO("List of supported features on adapter %s has " | 997 | ZFCP_LOG_INFO("List of supported features on adapter %s has " |
1030 | "been changed from 0x%08X to 0x%08X\n", | 998 | "been changed from 0x%08X to 0x%08X\n", |
1031 | zfcp_get_busid_by_adapter(adapter), | 999 | zfcp_get_busid_by_adapter(adapter), |
@@ -1073,7 +1041,7 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req) | |||
1073 | ZFCP_LOG_INFO("restart adapter %s due to status read " | 1041 | ZFCP_LOG_INFO("restart adapter %s due to status read " |
1074 | "buffer shortage\n", | 1042 | "buffer shortage\n", |
1075 | zfcp_get_busid_by_adapter(adapter)); | 1043 | zfcp_get_busid_by_adapter(adapter)); |
1076 | zfcp_erp_adapter_reopen(adapter, 0); | 1044 | zfcp_erp_adapter_reopen(adapter, 0, 103, fsf_req); |
1077 | } | 1045 | } |
1078 | } | 1046 | } |
1079 | out: | 1047 | out: |
@@ -1174,8 +1142,6 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req) | |||
1174 | 1142 | ||
1175 | case FSF_PORT_HANDLE_NOT_VALID: | 1143 | case FSF_PORT_HANDLE_NOT_VALID: |
1176 | if (fsf_stat_qual->word[0] != fsf_stat_qual->word[1]) { | 1144 | if (fsf_stat_qual->word[0] != fsf_stat_qual->word[1]) { |
1177 | debug_text_event(new_fsf_req->adapter->erp_dbf, 3, | ||
1178 | "fsf_s_phand_nv0"); | ||
1179 | /* | 1145 | /* |
1180 | * In this case a command that was sent prior to a port | 1146 | * In this case a command that was sent prior to a port |
1181 | * reopen was aborted (handles are different). This is | 1147 | * reopen was aborted (handles are different). This is |
@@ -1194,17 +1160,14 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req) | |||
1194 | fsf_status_qual, | 1160 | fsf_status_qual, |
1195 | sizeof (union fsf_status_qual)); | 1161 | sizeof (union fsf_status_qual)); |
1196 | /* Let's hope this sorts out the mess */ | 1162 | /* Let's hope this sorts out the mess */ |
1197 | debug_text_event(new_fsf_req->adapter->erp_dbf, 1, | 1163 | zfcp_erp_adapter_reopen(unit->port->adapter, 0, 104, |
1198 | "fsf_s_phand_nv1"); | 1164 | new_fsf_req); |
1199 | zfcp_erp_adapter_reopen(unit->port->adapter, 0); | ||
1200 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1165 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1201 | } | 1166 | } |
1202 | break; | 1167 | break; |
1203 | 1168 | ||
1204 | case FSF_LUN_HANDLE_NOT_VALID: | 1169 | case FSF_LUN_HANDLE_NOT_VALID: |
1205 | if (fsf_stat_qual->word[0] != fsf_stat_qual->word[1]) { | 1170 | if (fsf_stat_qual->word[0] != fsf_stat_qual->word[1]) { |
1206 | debug_text_event(new_fsf_req->adapter->erp_dbf, 3, | ||
1207 | "fsf_s_lhand_nv0"); | ||
1208 | /* | 1171 | /* |
1209 | * In this case a command that was sent prior to a unit | 1172 | * In this case a command that was sent prior to a unit |
1210 | * reopen was aborted (handles are different). | 1173 | * reopen was aborted (handles are different). |
@@ -1226,17 +1189,13 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req) | |||
1226 | fsf_status_qual, | 1189 | fsf_status_qual, |
1227 | sizeof (union fsf_status_qual)); | 1190 | sizeof (union fsf_status_qual)); |
1228 | /* Let's hope this sorts out the mess */ | 1191 | /* Let's hope this sorts out the mess */ |
1229 | debug_text_event(new_fsf_req->adapter->erp_dbf, 1, | 1192 | zfcp_erp_port_reopen(unit->port, 0, 105, new_fsf_req); |
1230 | "fsf_s_lhand_nv1"); | ||
1231 | zfcp_erp_port_reopen(unit->port, 0); | ||
1232 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1193 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1233 | } | 1194 | } |
1234 | break; | 1195 | break; |
1235 | 1196 | ||
1236 | case FSF_FCP_COMMAND_DOES_NOT_EXIST: | 1197 | case FSF_FCP_COMMAND_DOES_NOT_EXIST: |
1237 | retval = 0; | 1198 | retval = 0; |
1238 | debug_text_event(new_fsf_req->adapter->erp_dbf, 3, | ||
1239 | "fsf_s_no_exist"); | ||
1240 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED; | 1199 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED; |
1241 | break; | 1200 | break; |
1242 | 1201 | ||
@@ -1244,9 +1203,7 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req) | |||
1244 | ZFCP_LOG_INFO("Remote port 0x%016Lx on adapter %s needs to " | 1203 | ZFCP_LOG_INFO("Remote port 0x%016Lx on adapter %s needs to " |
1245 | "be reopened\n", unit->port->wwpn, | 1204 | "be reopened\n", unit->port->wwpn, |
1246 | zfcp_get_busid_by_unit(unit)); | 1205 | zfcp_get_busid_by_unit(unit)); |
1247 | debug_text_event(new_fsf_req->adapter->erp_dbf, 2, | 1206 | zfcp_erp_port_boxed(unit->port, 47, new_fsf_req); |
1248 | "fsf_s_pboxed"); | ||
1249 | zfcp_erp_port_boxed(unit->port); | ||
1250 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 1207 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
1251 | | ZFCP_STATUS_FSFREQ_RETRY; | 1208 | | ZFCP_STATUS_FSFREQ_RETRY; |
1252 | break; | 1209 | break; |
@@ -1257,8 +1214,7 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req) | |||
1257 | "to be reopened\n", | 1214 | "to be reopened\n", |
1258 | unit->fcp_lun, unit->port->wwpn, | 1215 | unit->fcp_lun, unit->port->wwpn, |
1259 | zfcp_get_busid_by_unit(unit)); | 1216 | zfcp_get_busid_by_unit(unit)); |
1260 | debug_text_event(new_fsf_req->adapter->erp_dbf, 1, "fsf_s_lboxed"); | 1217 | zfcp_erp_unit_boxed(unit, 48, new_fsf_req); |
1261 | zfcp_erp_unit_boxed(unit); | ||
1262 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 1218 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
1263 | | ZFCP_STATUS_FSFREQ_RETRY; | 1219 | | ZFCP_STATUS_FSFREQ_RETRY; |
1264 | break; | 1220 | break; |
@@ -1266,26 +1222,17 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req) | |||
1266 | case FSF_ADAPTER_STATUS_AVAILABLE: | 1222 | case FSF_ADAPTER_STATUS_AVAILABLE: |
1267 | switch (new_fsf_req->qtcb->header.fsf_status_qual.word[0]) { | 1223 | switch (new_fsf_req->qtcb->header.fsf_status_qual.word[0]) { |
1268 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: | 1224 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: |
1269 | debug_text_event(new_fsf_req->adapter->erp_dbf, 1, | ||
1270 | "fsf_sq_ltest"); | ||
1271 | zfcp_test_link(unit->port); | 1225 | zfcp_test_link(unit->port); |
1272 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1226 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1273 | break; | 1227 | break; |
1274 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: | 1228 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: |
1275 | /* SCSI stack will escalate */ | 1229 | /* SCSI stack will escalate */ |
1276 | debug_text_event(new_fsf_req->adapter->erp_dbf, 1, | ||
1277 | "fsf_sq_ulp"); | ||
1278 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1230 | new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1279 | break; | 1231 | break; |
1280 | default: | 1232 | default: |
1281 | ZFCP_LOG_NORMAL | 1233 | ZFCP_LOG_NORMAL |
1282 | ("bug: Wrong status qualifier 0x%x arrived.\n", | 1234 | ("bug: Wrong status qualifier 0x%x arrived.\n", |
1283 | new_fsf_req->qtcb->header.fsf_status_qual.word[0]); | 1235 | new_fsf_req->qtcb->header.fsf_status_qual.word[0]); |
1284 | debug_text_event(new_fsf_req->adapter->erp_dbf, 0, | ||
1285 | "fsf_sq_inval:"); | ||
1286 | debug_exception(new_fsf_req->adapter->erp_dbf, 0, | ||
1287 | &new_fsf_req->qtcb->header. | ||
1288 | fsf_status_qual.word[0], sizeof (u32)); | ||
1289 | break; | 1236 | break; |
1290 | } | 1237 | } |
1291 | break; | 1238 | break; |
@@ -1299,11 +1246,6 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req) | |||
1299 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " | 1246 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " |
1300 | "(debug info 0x%x)\n", | 1247 | "(debug info 0x%x)\n", |
1301 | new_fsf_req->qtcb->header.fsf_status); | 1248 | new_fsf_req->qtcb->header.fsf_status); |
1302 | debug_text_event(new_fsf_req->adapter->erp_dbf, 0, | ||
1303 | "fsf_s_inval:"); | ||
1304 | debug_exception(new_fsf_req->adapter->erp_dbf, 0, | ||
1305 | &new_fsf_req->qtcb->header.fsf_status, | ||
1306 | sizeof (u32)); | ||
1307 | break; | 1249 | break; |
1308 | } | 1250 | } |
1309 | skip_fsfstatus: | 1251 | skip_fsfstatus: |
@@ -1506,8 +1448,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req) | |||
1506 | zfcp_get_busid_by_port(port), | 1448 | zfcp_get_busid_by_port(port), |
1507 | ZFCP_FC_SERVICE_CLASS_DEFAULT); | 1449 | ZFCP_FC_SERVICE_CLASS_DEFAULT); |
1508 | /* stop operation for this adapter */ | 1450 | /* stop operation for this adapter */ |
1509 | debug_text_exception(adapter->erp_dbf, 0, "fsf_s_class_nsup"); | 1451 | zfcp_erp_adapter_shutdown(adapter, 0, 123, fsf_req); |
1510 | zfcp_erp_adapter_shutdown(adapter, 0); | ||
1511 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1452 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1512 | break; | 1453 | break; |
1513 | 1454 | ||
@@ -1515,13 +1456,11 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req) | |||
1515 | switch (header->fsf_status_qual.word[0]){ | 1456 | switch (header->fsf_status_qual.word[0]){ |
1516 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: | 1457 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: |
1517 | /* reopening link to port */ | 1458 | /* reopening link to port */ |
1518 | debug_text_event(adapter->erp_dbf, 1, "fsf_sq_ltest"); | ||
1519 | zfcp_test_link(port); | 1459 | zfcp_test_link(port); |
1520 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1460 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1521 | break; | 1461 | break; |
1522 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: | 1462 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: |
1523 | /* ERP strategy will escalate */ | 1463 | /* ERP strategy will escalate */ |
1524 | debug_text_event(adapter->erp_dbf, 1, "fsf_sq_ulp"); | ||
1525 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1464 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1526 | break; | 1465 | break; |
1527 | default: | 1466 | default: |
@@ -1549,8 +1488,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req) | |||
1549 | break; | 1488 | break; |
1550 | } | 1489 | } |
1551 | } | 1490 | } |
1552 | debug_text_event(adapter->erp_dbf, 1, "fsf_s_access"); | 1491 | zfcp_erp_port_access_denied(port, 55, fsf_req); |
1553 | zfcp_erp_port_access_denied(port); | ||
1554 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1492 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1555 | break; | 1493 | break; |
1556 | 1494 | ||
@@ -1562,7 +1500,6 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req) | |||
1562 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO, | 1500 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO, |
1563 | (char *) &header->fsf_status_qual, | 1501 | (char *) &header->fsf_status_qual, |
1564 | sizeof (union fsf_status_qual)); | 1502 | sizeof (union fsf_status_qual)); |
1565 | debug_text_event(adapter->erp_dbf, 1, "fsf_s_gcom_rej"); | ||
1566 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1503 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1567 | break; | 1504 | break; |
1568 | 1505 | ||
@@ -1575,8 +1512,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req) | |||
1575 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO, | 1512 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO, |
1576 | (char *) &header->fsf_status_qual, | 1513 | (char *) &header->fsf_status_qual, |
1577 | sizeof (union fsf_status_qual)); | 1514 | sizeof (union fsf_status_qual)); |
1578 | debug_text_event(adapter->erp_dbf, 1, "fsf_s_phandle_nv"); | 1515 | zfcp_erp_adapter_reopen(adapter, 0, 106, fsf_req); |
1579 | zfcp_erp_adapter_reopen(adapter, 0); | ||
1580 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1516 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1581 | break; | 1517 | break; |
1582 | 1518 | ||
@@ -1584,8 +1520,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req) | |||
1584 | ZFCP_LOG_INFO("port needs to be reopened " | 1520 | ZFCP_LOG_INFO("port needs to be reopened " |
1585 | "(adapter %s, port d_id=0x%06x)\n", | 1521 | "(adapter %s, port d_id=0x%06x)\n", |
1586 | zfcp_get_busid_by_port(port), port->d_id); | 1522 | zfcp_get_busid_by_port(port), port->d_id); |
1587 | debug_text_event(adapter->erp_dbf, 2, "fsf_s_pboxed"); | 1523 | zfcp_erp_port_boxed(port, 49, fsf_req); |
1588 | zfcp_erp_port_boxed(port); | ||
1589 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 1524 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
1590 | | ZFCP_STATUS_FSFREQ_RETRY; | 1525 | | ZFCP_STATUS_FSFREQ_RETRY; |
1591 | break; | 1526 | break; |
@@ -1624,9 +1559,6 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req) | |||
1624 | default: | 1559 | default: |
1625 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " | 1560 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " |
1626 | "(debug info 0x%x)\n", header->fsf_status); | 1561 | "(debug info 0x%x)\n", header->fsf_status); |
1627 | debug_text_event(adapter->erp_dbf, 0, "fsf_sq_inval:"); | ||
1628 | debug_exception(adapter->erp_dbf, 0, | ||
1629 | &header->fsf_status_qual.word[0], sizeof (u32)); | ||
1630 | break; | 1562 | break; |
1631 | } | 1563 | } |
1632 | 1564 | ||
@@ -1810,21 +1742,18 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req) | |||
1810 | zfcp_get_busid_by_adapter(adapter), | 1742 | zfcp_get_busid_by_adapter(adapter), |
1811 | ZFCP_FC_SERVICE_CLASS_DEFAULT); | 1743 | ZFCP_FC_SERVICE_CLASS_DEFAULT); |
1812 | /* stop operation for this adapter */ | 1744 | /* stop operation for this adapter */ |
1813 | debug_text_exception(adapter->erp_dbf, 0, "fsf_s_class_nsup"); | 1745 | zfcp_erp_adapter_shutdown(adapter, 0, 124, fsf_req); |
1814 | zfcp_erp_adapter_shutdown(adapter, 0); | ||
1815 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1746 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1816 | break; | 1747 | break; |
1817 | 1748 | ||
1818 | case FSF_ADAPTER_STATUS_AVAILABLE: | 1749 | case FSF_ADAPTER_STATUS_AVAILABLE: |
1819 | switch (header->fsf_status_qual.word[0]){ | 1750 | switch (header->fsf_status_qual.word[0]){ |
1820 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: | 1751 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: |
1821 | debug_text_event(adapter->erp_dbf, 1, "fsf_sq_ltest"); | ||
1822 | if (port && (send_els->ls_code != ZFCP_LS_ADISC)) | 1752 | if (port && (send_els->ls_code != ZFCP_LS_ADISC)) |
1823 | zfcp_test_link(port); | 1753 | zfcp_test_link(port); |
1824 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1754 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1825 | break; | 1755 | break; |
1826 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: | 1756 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: |
1827 | debug_text_event(adapter->erp_dbf, 1, "fsf_sq_ulp"); | ||
1828 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1757 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1829 | retval = | 1758 | retval = |
1830 | zfcp_handle_els_rjt(header->fsf_status_qual.word[1], | 1759 | zfcp_handle_els_rjt(header->fsf_status_qual.word[1], |
@@ -1832,7 +1761,6 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req) | |||
1832 | &header->fsf_status_qual.word[2]); | 1761 | &header->fsf_status_qual.word[2]); |
1833 | break; | 1762 | break; |
1834 | case FSF_SQ_RETRY_IF_POSSIBLE: | 1763 | case FSF_SQ_RETRY_IF_POSSIBLE: |
1835 | debug_text_event(adapter->erp_dbf, 1, "fsf_sq_retry"); | ||
1836 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1764 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1837 | break; | 1765 | break; |
1838 | default: | 1766 | default: |
@@ -1909,9 +1837,8 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req) | |||
1909 | break; | 1837 | break; |
1910 | } | 1838 | } |
1911 | } | 1839 | } |
1912 | debug_text_event(adapter->erp_dbf, 1, "fsf_s_access"); | ||
1913 | if (port != NULL) | 1840 | if (port != NULL) |
1914 | zfcp_erp_port_access_denied(port); | 1841 | zfcp_erp_port_access_denied(port, 56, fsf_req); |
1915 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1842 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1916 | break; | 1843 | break; |
1917 | 1844 | ||
@@ -1921,9 +1848,6 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req) | |||
1921 | "(adapter: %s, fsf_status=0x%08x)\n", | 1848 | "(adapter: %s, fsf_status=0x%08x)\n", |
1922 | zfcp_get_busid_by_adapter(adapter), | 1849 | zfcp_get_busid_by_adapter(adapter), |
1923 | header->fsf_status); | 1850 | header->fsf_status); |
1924 | debug_text_event(adapter->erp_dbf, 0, "fsf_sq_inval"); | ||
1925 | debug_exception(adapter->erp_dbf, 0, | ||
1926 | &header->fsf_status_qual.word[0], sizeof(u32)); | ||
1927 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 1851 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
1928 | break; | 1852 | break; |
1929 | } | 1853 | } |
@@ -2132,8 +2056,7 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok) | |||
2132 | "versions in comparison to this device " | 2056 | "versions in comparison to this device " |
2133 | "driver (try updated device driver)\n", | 2057 | "driver (try updated device driver)\n", |
2134 | zfcp_get_busid_by_adapter(adapter)); | 2058 | zfcp_get_busid_by_adapter(adapter)); |
2135 | debug_text_event(adapter->erp_dbf, 0, "low_qtcb_ver"); | 2059 | zfcp_erp_adapter_shutdown(adapter, 0, 125, fsf_req); |
2136 | zfcp_erp_adapter_shutdown(adapter, 0); | ||
2137 | return -EIO; | 2060 | return -EIO; |
2138 | } | 2061 | } |
2139 | if (ZFCP_QTCB_VERSION > bottom->high_qtcb_version) { | 2062 | if (ZFCP_QTCB_VERSION > bottom->high_qtcb_version) { |
@@ -2142,8 +2065,7 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok) | |||
2142 | "versions than this device driver uses" | 2065 | "versions than this device driver uses" |
2143 | "(consider a microcode upgrade)\n", | 2066 | "(consider a microcode upgrade)\n", |
2144 | zfcp_get_busid_by_adapter(adapter)); | 2067 | zfcp_get_busid_by_adapter(adapter)); |
2145 | debug_text_event(adapter->erp_dbf, 0, "high_qtcb_ver"); | 2068 | zfcp_erp_adapter_shutdown(adapter, 0, 126, fsf_req); |
2146 | zfcp_erp_adapter_shutdown(adapter, 0); | ||
2147 | return -EIO; | 2069 | return -EIO; |
2148 | } | 2070 | } |
2149 | return 0; | 2071 | return 0; |
@@ -2183,17 +2105,13 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req) | |||
2183 | adapter->peer_wwnn, | 2105 | adapter->peer_wwnn, |
2184 | adapter->peer_wwpn, | 2106 | adapter->peer_wwpn, |
2185 | adapter->peer_d_id); | 2107 | adapter->peer_d_id); |
2186 | debug_text_event(fsf_req->adapter->erp_dbf, 0, | ||
2187 | "top-p-to-p"); | ||
2188 | break; | 2108 | break; |
2189 | case FC_PORTTYPE_NLPORT: | 2109 | case FC_PORTTYPE_NLPORT: |
2190 | ZFCP_LOG_NORMAL("error: Arbitrated loop fibrechannel " | 2110 | ZFCP_LOG_NORMAL("error: Arbitrated loop fibrechannel " |
2191 | "topology detected at adapter %s " | 2111 | "topology detected at adapter %s " |
2192 | "unsupported, shutting down adapter\n", | 2112 | "unsupported, shutting down adapter\n", |
2193 | zfcp_get_busid_by_adapter(adapter)); | 2113 | zfcp_get_busid_by_adapter(adapter)); |
2194 | debug_text_event(fsf_req->adapter->erp_dbf, 0, | 2114 | zfcp_erp_adapter_shutdown(adapter, 0, 127, fsf_req); |
2195 | "top-al"); | ||
2196 | zfcp_erp_adapter_shutdown(adapter, 0); | ||
2197 | return -EIO; | 2115 | return -EIO; |
2198 | case FC_PORTTYPE_NPORT: | 2116 | case FC_PORTTYPE_NPORT: |
2199 | ZFCP_LOG_NORMAL("Switched fabric fibrechannel " | 2117 | ZFCP_LOG_NORMAL("Switched fabric fibrechannel " |
@@ -2208,9 +2126,7 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req) | |||
2208 | "of a type known to the zfcp " | 2126 | "of a type known to the zfcp " |
2209 | "driver, shutting down adapter\n", | 2127 | "driver, shutting down adapter\n", |
2210 | zfcp_get_busid_by_adapter(adapter)); | 2128 | zfcp_get_busid_by_adapter(adapter)); |
2211 | debug_text_exception(fsf_req->adapter->erp_dbf, 0, | 2129 | zfcp_erp_adapter_shutdown(adapter, 0, 128, fsf_req); |
2212 | "unknown-topo"); | ||
2213 | zfcp_erp_adapter_shutdown(adapter, 0); | ||
2214 | return -EIO; | 2130 | return -EIO; |
2215 | } | 2131 | } |
2216 | bottom = &qtcb->bottom.config; | 2132 | bottom = &qtcb->bottom.config; |
@@ -2222,33 +2138,24 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req) | |||
2222 | bottom->max_qtcb_size, | 2138 | bottom->max_qtcb_size, |
2223 | zfcp_get_busid_by_adapter(adapter), | 2139 | zfcp_get_busid_by_adapter(adapter), |
2224 | sizeof(struct fsf_qtcb)); | 2140 | sizeof(struct fsf_qtcb)); |
2225 | debug_text_event(fsf_req->adapter->erp_dbf, 0, | 2141 | zfcp_erp_adapter_shutdown(adapter, 0, 129, fsf_req); |
2226 | "qtcb-size"); | ||
2227 | debug_event(fsf_req->adapter->erp_dbf, 0, | ||
2228 | &bottom->max_qtcb_size, sizeof (u32)); | ||
2229 | zfcp_erp_adapter_shutdown(adapter, 0); | ||
2230 | return -EIO; | 2142 | return -EIO; |
2231 | } | 2143 | } |
2232 | atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, | 2144 | atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, |
2233 | &adapter->status); | 2145 | &adapter->status); |
2234 | break; | 2146 | break; |
2235 | case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE: | 2147 | case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE: |
2236 | debug_text_event(adapter->erp_dbf, 0, "xchg-inco"); | ||
2237 | |||
2238 | if (zfcp_fsf_exchange_config_evaluate(fsf_req, 0)) | 2148 | if (zfcp_fsf_exchange_config_evaluate(fsf_req, 0)) |
2239 | return -EIO; | 2149 | return -EIO; |
2240 | 2150 | ||
2241 | atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, | 2151 | atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, |
2242 | &adapter->status); | 2152 | &adapter->status); |
2243 | 2153 | ||
2244 | zfcp_fsf_link_down_info_eval(adapter, | 2154 | zfcp_fsf_link_down_info_eval(fsf_req, 42, |
2245 | &qtcb->header.fsf_status_qual.link_down_info); | 2155 | &qtcb->header.fsf_status_qual.link_down_info); |
2246 | break; | 2156 | break; |
2247 | default: | 2157 | default: |
2248 | debug_text_event(fsf_req->adapter->erp_dbf, 0, "fsf-stat-ng"); | 2158 | zfcp_erp_adapter_shutdown(adapter, 0, 130, fsf_req); |
2249 | debug_event(fsf_req->adapter->erp_dbf, 0, | ||
2250 | &fsf_req->qtcb->header.fsf_status, sizeof(u32)); | ||
2251 | zfcp_erp_adapter_shutdown(adapter, 0); | ||
2252 | return -EIO; | 2159 | return -EIO; |
2253 | } | 2160 | } |
2254 | return 0; | 2161 | return 0; |
@@ -2424,13 +2331,9 @@ zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *fsf_req) | |||
2424 | case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE: | 2331 | case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE: |
2425 | zfcp_fsf_exchange_port_evaluate(fsf_req, 0); | 2332 | zfcp_fsf_exchange_port_evaluate(fsf_req, 0); |
2426 | atomic_set_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status); | 2333 | atomic_set_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status); |
2427 | zfcp_fsf_link_down_info_eval(adapter, | 2334 | zfcp_fsf_link_down_info_eval(fsf_req, 43, |
2428 | &qtcb->header.fsf_status_qual.link_down_info); | 2335 | &qtcb->header.fsf_status_qual.link_down_info); |
2429 | break; | 2336 | break; |
2430 | default: | ||
2431 | debug_text_event(adapter->erp_dbf, 0, "xchg-port-ng"); | ||
2432 | debug_event(adapter->erp_dbf, 0, | ||
2433 | &fsf_req->qtcb->header.fsf_status, sizeof(u32)); | ||
2434 | } | 2337 | } |
2435 | } | 2338 | } |
2436 | 2339 | ||
@@ -2528,8 +2431,6 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req) | |||
2528 | ZFCP_LOG_NORMAL("bug: remote port 0x%016Lx on adapter %s " | 2431 | ZFCP_LOG_NORMAL("bug: remote port 0x%016Lx on adapter %s " |
2529 | "is already open.\n", | 2432 | "is already open.\n", |
2530 | port->wwpn, zfcp_get_busid_by_port(port)); | 2433 | port->wwpn, zfcp_get_busid_by_port(port)); |
2531 | debug_text_exception(fsf_req->adapter->erp_dbf, 0, | ||
2532 | "fsf_s_popen"); | ||
2533 | /* | 2434 | /* |
2534 | * This is a bug, however operation should continue normally | 2435 | * This is a bug, however operation should continue normally |
2535 | * if it is simply ignored | 2436 | * if it is simply ignored |
@@ -2553,8 +2454,7 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req) | |||
2553 | break; | 2454 | break; |
2554 | } | 2455 | } |
2555 | } | 2456 | } |
2556 | debug_text_event(fsf_req->adapter->erp_dbf, 1, "fsf_s_access"); | 2457 | zfcp_erp_port_access_denied(port, 57, fsf_req); |
2557 | zfcp_erp_port_access_denied(port); | ||
2558 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 2458 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
2559 | break; | 2459 | break; |
2560 | 2460 | ||
@@ -2563,24 +2463,18 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req) | |||
2563 | "The remote port 0x%016Lx on adapter %s " | 2463 | "The remote port 0x%016Lx on adapter %s " |
2564 | "could not be opened. Disabling it.\n", | 2464 | "could not be opened. Disabling it.\n", |
2565 | port->wwpn, zfcp_get_busid_by_port(port)); | 2465 | port->wwpn, zfcp_get_busid_by_port(port)); |
2566 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | 2466 | zfcp_erp_port_failed(port, 31, fsf_req); |
2567 | "fsf_s_max_ports"); | ||
2568 | zfcp_erp_port_failed(port); | ||
2569 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 2467 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
2570 | break; | 2468 | break; |
2571 | 2469 | ||
2572 | case FSF_ADAPTER_STATUS_AVAILABLE: | 2470 | case FSF_ADAPTER_STATUS_AVAILABLE: |
2573 | switch (header->fsf_status_qual.word[0]) { | 2471 | switch (header->fsf_status_qual.word[0]) { |
2574 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: | 2472 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: |
2575 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | ||
2576 | "fsf_sq_ltest"); | ||
2577 | /* ERP strategy will escalate */ | 2473 | /* ERP strategy will escalate */ |
2578 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 2474 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
2579 | break; | 2475 | break; |
2580 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: | 2476 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: |
2581 | /* ERP strategy will escalate */ | 2477 | /* ERP strategy will escalate */ |
2582 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | ||
2583 | "fsf_sq_ulp"); | ||
2584 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 2478 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
2585 | break; | 2479 | break; |
2586 | case FSF_SQ_NO_RETRY_POSSIBLE: | 2480 | case FSF_SQ_NO_RETRY_POSSIBLE: |
@@ -2589,21 +2483,13 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req) | |||
2589 | "Disabling it.\n", | 2483 | "Disabling it.\n", |
2590 | port->wwpn, | 2484 | port->wwpn, |
2591 | zfcp_get_busid_by_port(port)); | 2485 | zfcp_get_busid_by_port(port)); |
2592 | debug_text_exception(fsf_req->adapter->erp_dbf, 0, | 2486 | zfcp_erp_port_failed(port, 32, fsf_req); |
2593 | "fsf_sq_no_retry"); | ||
2594 | zfcp_erp_port_failed(port); | ||
2595 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 2487 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
2596 | break; | 2488 | break; |
2597 | default: | 2489 | default: |
2598 | ZFCP_LOG_NORMAL | 2490 | ZFCP_LOG_NORMAL |
2599 | ("bug: Wrong status qualifier 0x%x arrived.\n", | 2491 | ("bug: Wrong status qualifier 0x%x arrived.\n", |
2600 | header->fsf_status_qual.word[0]); | 2492 | header->fsf_status_qual.word[0]); |
2601 | debug_text_event(fsf_req->adapter->erp_dbf, 0, | ||
2602 | "fsf_sq_inval:"); | ||
2603 | debug_exception( | ||
2604 | fsf_req->adapter->erp_dbf, 0, | ||
2605 | &header->fsf_status_qual.word[0], | ||
2606 | sizeof (u32)); | ||
2607 | break; | 2493 | break; |
2608 | } | 2494 | } |
2609 | break; | 2495 | break; |
@@ -2646,17 +2532,12 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req) | |||
2646 | "warning: insufficient length of " | 2532 | "warning: insufficient length of " |
2647 | "PLOGI payload (%i)\n", | 2533 | "PLOGI payload (%i)\n", |
2648 | fsf_req->qtcb->bottom.support.els1_length); | 2534 | fsf_req->qtcb->bottom.support.els1_length); |
2649 | debug_text_event(fsf_req->adapter->erp_dbf, 0, | ||
2650 | "fsf_s_short_plogi:"); | ||
2651 | /* skip sanity check and assume wwpn is ok */ | 2535 | /* skip sanity check and assume wwpn is ok */ |
2652 | } else { | 2536 | } else { |
2653 | if (plogi->serv_param.wwpn != port->wwpn) { | 2537 | if (plogi->serv_param.wwpn != port->wwpn) { |
2654 | ZFCP_LOG_INFO("warning: d_id of port " | 2538 | ZFCP_LOG_INFO("warning: d_id of port " |
2655 | "0x%016Lx changed during " | 2539 | "0x%016Lx changed during " |
2656 | "open\n", port->wwpn); | 2540 | "open\n", port->wwpn); |
2657 | debug_text_event( | ||
2658 | fsf_req->adapter->erp_dbf, 0, | ||
2659 | "fsf_s_did_change:"); | ||
2660 | atomic_clear_mask( | 2541 | atomic_clear_mask( |
2661 | ZFCP_STATUS_PORT_DID_DID, | 2542 | ZFCP_STATUS_PORT_DID_DID, |
2662 | &port->status); | 2543 | &port->status); |
@@ -2681,9 +2562,6 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req) | |||
2681 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " | 2562 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " |
2682 | "(debug info 0x%x)\n", | 2563 | "(debug info 0x%x)\n", |
2683 | header->fsf_status); | 2564 | header->fsf_status); |
2684 | debug_text_event(fsf_req->adapter->erp_dbf, 0, "fsf_s_inval:"); | ||
2685 | debug_exception(fsf_req->adapter->erp_dbf, 0, | ||
2686 | &header->fsf_status, sizeof (u32)); | ||
2687 | break; | 2565 | break; |
2688 | } | 2566 | } |
2689 | 2567 | ||
@@ -2787,9 +2665,7 @@ zfcp_fsf_close_port_handler(struct zfcp_fsf_req *fsf_req) | |||
2787 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, | 2665 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, |
2788 | (char *) &fsf_req->qtcb->header.fsf_status_qual, | 2666 | (char *) &fsf_req->qtcb->header.fsf_status_qual, |
2789 | sizeof (union fsf_status_qual)); | 2667 | sizeof (union fsf_status_qual)); |
2790 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | 2668 | zfcp_erp_adapter_reopen(port->adapter, 0, 107, fsf_req); |
2791 | "fsf_s_phand_nv"); | ||
2792 | zfcp_erp_adapter_reopen(port->adapter, 0); | ||
2793 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 2669 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
2794 | break; | 2670 | break; |
2795 | 2671 | ||
@@ -2804,7 +2680,7 @@ zfcp_fsf_close_port_handler(struct zfcp_fsf_req *fsf_req) | |||
2804 | ZFCP_LOG_TRACE("remote port 0x016%Lx on adapter %s closed, " | 2680 | ZFCP_LOG_TRACE("remote port 0x016%Lx on adapter %s closed, " |
2805 | "port handle 0x%x\n", port->wwpn, | 2681 | "port handle 0x%x\n", port->wwpn, |
2806 | zfcp_get_busid_by_port(port), port->handle); | 2682 | zfcp_get_busid_by_port(port), port->handle); |
2807 | zfcp_erp_modify_port_status(port, | 2683 | zfcp_erp_modify_port_status(port, 33, fsf_req, |
2808 | ZFCP_STATUS_COMMON_OPEN, | 2684 | ZFCP_STATUS_COMMON_OPEN, |
2809 | ZFCP_CLEAR); | 2685 | ZFCP_CLEAR); |
2810 | retval = 0; | 2686 | retval = 0; |
@@ -2814,10 +2690,6 @@ zfcp_fsf_close_port_handler(struct zfcp_fsf_req *fsf_req) | |||
2814 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " | 2690 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " |
2815 | "(debug info 0x%x)\n", | 2691 | "(debug info 0x%x)\n", |
2816 | fsf_req->qtcb->header.fsf_status); | 2692 | fsf_req->qtcb->header.fsf_status); |
2817 | debug_text_event(fsf_req->adapter->erp_dbf, 0, "fsf_s_inval:"); | ||
2818 | debug_exception(fsf_req->adapter->erp_dbf, 0, | ||
2819 | &fsf_req->qtcb->header.fsf_status, | ||
2820 | sizeof (u32)); | ||
2821 | break; | 2693 | break; |
2822 | } | 2694 | } |
2823 | 2695 | ||
@@ -2930,9 +2802,7 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req) | |||
2930 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, | 2802 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, |
2931 | (char *) &header->fsf_status_qual, | 2803 | (char *) &header->fsf_status_qual, |
2932 | sizeof (union fsf_status_qual)); | 2804 | sizeof (union fsf_status_qual)); |
2933 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | 2805 | zfcp_erp_adapter_reopen(port->adapter, 0, 108, fsf_req); |
2934 | "fsf_s_phand_nv"); | ||
2935 | zfcp_erp_adapter_reopen(port->adapter, 0); | ||
2936 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 2806 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
2937 | break; | 2807 | break; |
2938 | 2808 | ||
@@ -2953,8 +2823,7 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req) | |||
2953 | break; | 2823 | break; |
2954 | } | 2824 | } |
2955 | } | 2825 | } |
2956 | debug_text_event(fsf_req->adapter->erp_dbf, 1, "fsf_s_access"); | 2826 | zfcp_erp_port_access_denied(port, 58, fsf_req); |
2957 | zfcp_erp_port_access_denied(port); | ||
2958 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 2827 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
2959 | break; | 2828 | break; |
2960 | 2829 | ||
@@ -2964,35 +2833,32 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req) | |||
2964 | "to close it physically.\n", | 2833 | "to close it physically.\n", |
2965 | port->wwpn, | 2834 | port->wwpn, |
2966 | zfcp_get_busid_by_port(port)); | 2835 | zfcp_get_busid_by_port(port)); |
2967 | debug_text_event(fsf_req->adapter->erp_dbf, 1, "fsf_s_pboxed"); | 2836 | zfcp_erp_port_boxed(port, 50, fsf_req); |
2968 | zfcp_erp_port_boxed(port); | ||
2969 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | | 2837 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | |
2970 | ZFCP_STATUS_FSFREQ_RETRY; | 2838 | ZFCP_STATUS_FSFREQ_RETRY; |
2839 | |||
2840 | /* can't use generic zfcp_erp_modify_port_status because | ||
2841 | * ZFCP_STATUS_COMMON_OPEN must not be reset for the port */ | ||
2842 | atomic_clear_mask(ZFCP_STATUS_PORT_PHYS_OPEN, &port->status); | ||
2843 | list_for_each_entry(unit, &port->unit_list_head, list) | ||
2844 | atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, | ||
2845 | &unit->status); | ||
2971 | break; | 2846 | break; |
2972 | 2847 | ||
2973 | case FSF_ADAPTER_STATUS_AVAILABLE: | 2848 | case FSF_ADAPTER_STATUS_AVAILABLE: |
2974 | switch (header->fsf_status_qual.word[0]) { | 2849 | switch (header->fsf_status_qual.word[0]) { |
2975 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: | 2850 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: |
2976 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | ||
2977 | "fsf_sq_ltest"); | ||
2978 | /* This will now be escalated by ERP */ | 2851 | /* This will now be escalated by ERP */ |
2979 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 2852 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
2980 | break; | 2853 | break; |
2981 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: | 2854 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: |
2982 | /* ERP strategy will escalate */ | 2855 | /* ERP strategy will escalate */ |
2983 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | ||
2984 | "fsf_sq_ulp"); | ||
2985 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 2856 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
2986 | break; | 2857 | break; |
2987 | default: | 2858 | default: |
2988 | ZFCP_LOG_NORMAL | 2859 | ZFCP_LOG_NORMAL |
2989 | ("bug: Wrong status qualifier 0x%x arrived.\n", | 2860 | ("bug: Wrong status qualifier 0x%x arrived.\n", |
2990 | header->fsf_status_qual.word[0]); | 2861 | header->fsf_status_qual.word[0]); |
2991 | debug_text_event(fsf_req->adapter->erp_dbf, 0, | ||
2992 | "fsf_sq_inval:"); | ||
2993 | debug_exception( | ||
2994 | fsf_req->adapter->erp_dbf, 0, | ||
2995 | &header->fsf_status_qual.word[0], sizeof (u32)); | ||
2996 | break; | 2862 | break; |
2997 | } | 2863 | } |
2998 | break; | 2864 | break; |
@@ -3015,9 +2881,6 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req) | |||
3015 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " | 2881 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " |
3016 | "(debug info 0x%x)\n", | 2882 | "(debug info 0x%x)\n", |
3017 | header->fsf_status); | 2883 | header->fsf_status); |
3018 | debug_text_event(fsf_req->adapter->erp_dbf, 0, "fsf_s_inval:"); | ||
3019 | debug_exception(fsf_req->adapter->erp_dbf, 0, | ||
3020 | &header->fsf_status, sizeof (u32)); | ||
3021 | break; | 2884 | break; |
3022 | } | 2885 | } |
3023 | 2886 | ||
@@ -3149,8 +3012,7 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3149 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, | 3012 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, |
3150 | (char *) &header->fsf_status_qual, | 3013 | (char *) &header->fsf_status_qual, |
3151 | sizeof (union fsf_status_qual)); | 3014 | sizeof (union fsf_status_qual)); |
3152 | debug_text_event(adapter->erp_dbf, 1, "fsf_s_ph_nv"); | 3015 | zfcp_erp_adapter_reopen(unit->port->adapter, 0, 109, fsf_req); |
3153 | zfcp_erp_adapter_reopen(unit->port->adapter, 0); | ||
3154 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3016 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3155 | break; | 3017 | break; |
3156 | 3018 | ||
@@ -3159,8 +3021,6 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3159 | "remote port 0x%016Lx on adapter %s twice.\n", | 3021 | "remote port 0x%016Lx on adapter %s twice.\n", |
3160 | unit->fcp_lun, | 3022 | unit->fcp_lun, |
3161 | unit->port->wwpn, zfcp_get_busid_by_unit(unit)); | 3023 | unit->port->wwpn, zfcp_get_busid_by_unit(unit)); |
3162 | debug_text_exception(adapter->erp_dbf, 0, | ||
3163 | "fsf_s_uopen"); | ||
3164 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3024 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3165 | break; | 3025 | break; |
3166 | 3026 | ||
@@ -3182,8 +3042,7 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3182 | break; | 3042 | break; |
3183 | } | 3043 | } |
3184 | } | 3044 | } |
3185 | debug_text_event(adapter->erp_dbf, 1, "fsf_s_access"); | 3045 | zfcp_erp_unit_access_denied(unit, 59, fsf_req); |
3186 | zfcp_erp_unit_access_denied(unit); | ||
3187 | atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status); | 3046 | atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status); |
3188 | atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status); | 3047 | atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status); |
3189 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3048 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
@@ -3193,8 +3052,7 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3193 | ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter %s " | 3052 | ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter %s " |
3194 | "needs to be reopened\n", | 3053 | "needs to be reopened\n", |
3195 | unit->port->wwpn, zfcp_get_busid_by_unit(unit)); | 3054 | unit->port->wwpn, zfcp_get_busid_by_unit(unit)); |
3196 | debug_text_event(adapter->erp_dbf, 2, "fsf_s_pboxed"); | 3055 | zfcp_erp_port_boxed(unit->port, 51, fsf_req); |
3197 | zfcp_erp_port_boxed(unit->port); | ||
3198 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | | 3056 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | |
3199 | ZFCP_STATUS_FSFREQ_RETRY; | 3057 | ZFCP_STATUS_FSFREQ_RETRY; |
3200 | break; | 3058 | break; |
@@ -3234,9 +3092,7 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3234 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, | 3092 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, |
3235 | (char *) &header->fsf_status_qual, | 3093 | (char *) &header->fsf_status_qual, |
3236 | sizeof (union fsf_status_qual)); | 3094 | sizeof (union fsf_status_qual)); |
3237 | debug_text_event(adapter->erp_dbf, 2, | 3095 | zfcp_erp_unit_access_denied(unit, 60, fsf_req); |
3238 | "fsf_s_l_sh_vio"); | ||
3239 | zfcp_erp_unit_access_denied(unit); | ||
3240 | atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status); | 3096 | atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status); |
3241 | atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status); | 3097 | atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status); |
3242 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3098 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
@@ -3250,9 +3106,7 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3250 | unit->fcp_lun, | 3106 | unit->fcp_lun, |
3251 | unit->port->wwpn, | 3107 | unit->port->wwpn, |
3252 | zfcp_get_busid_by_unit(unit)); | 3108 | zfcp_get_busid_by_unit(unit)); |
3253 | debug_text_event(adapter->erp_dbf, 1, | 3109 | zfcp_erp_unit_failed(unit, 34, fsf_req); |
3254 | "fsf_s_max_units"); | ||
3255 | zfcp_erp_unit_failed(unit); | ||
3256 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3110 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3257 | break; | 3111 | break; |
3258 | 3112 | ||
@@ -3260,26 +3114,17 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3260 | switch (header->fsf_status_qual.word[0]) { | 3114 | switch (header->fsf_status_qual.word[0]) { |
3261 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: | 3115 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: |
3262 | /* Re-establish link to port */ | 3116 | /* Re-establish link to port */ |
3263 | debug_text_event(adapter->erp_dbf, 1, | ||
3264 | "fsf_sq_ltest"); | ||
3265 | zfcp_test_link(unit->port); | 3117 | zfcp_test_link(unit->port); |
3266 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3118 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3267 | break; | 3119 | break; |
3268 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: | 3120 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: |
3269 | /* ERP strategy will escalate */ | 3121 | /* ERP strategy will escalate */ |
3270 | debug_text_event(adapter->erp_dbf, 1, | ||
3271 | "fsf_sq_ulp"); | ||
3272 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3122 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3273 | break; | 3123 | break; |
3274 | default: | 3124 | default: |
3275 | ZFCP_LOG_NORMAL | 3125 | ZFCP_LOG_NORMAL |
3276 | ("bug: Wrong status qualifier 0x%x arrived.\n", | 3126 | ("bug: Wrong status qualifier 0x%x arrived.\n", |
3277 | header->fsf_status_qual.word[0]); | 3127 | header->fsf_status_qual.word[0]); |
3278 | debug_text_event(adapter->erp_dbf, 0, | ||
3279 | "fsf_sq_inval:"); | ||
3280 | debug_exception(adapter->erp_dbf, 0, | ||
3281 | &header->fsf_status_qual.word[0], | ||
3282 | sizeof (u32)); | ||
3283 | } | 3128 | } |
3284 | break; | 3129 | break; |
3285 | 3130 | ||
@@ -3331,15 +3176,15 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3331 | if (exclusive && !readwrite) { | 3176 | if (exclusive && !readwrite) { |
3332 | ZFCP_LOG_NORMAL("exclusive access of read-only " | 3177 | ZFCP_LOG_NORMAL("exclusive access of read-only " |
3333 | "unit not supported\n"); | 3178 | "unit not supported\n"); |
3334 | zfcp_erp_unit_failed(unit); | 3179 | zfcp_erp_unit_failed(unit, 35, fsf_req); |
3335 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3180 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3336 | zfcp_erp_unit_shutdown(unit, 0); | 3181 | zfcp_erp_unit_shutdown(unit, 0, 80, fsf_req); |
3337 | } else if (!exclusive && readwrite) { | 3182 | } else if (!exclusive && readwrite) { |
3338 | ZFCP_LOG_NORMAL("shared access of read-write " | 3183 | ZFCP_LOG_NORMAL("shared access of read-write " |
3339 | "unit not supported\n"); | 3184 | "unit not supported\n"); |
3340 | zfcp_erp_unit_failed(unit); | 3185 | zfcp_erp_unit_failed(unit, 36, fsf_req); |
3341 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3186 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3342 | zfcp_erp_unit_shutdown(unit, 0); | 3187 | zfcp_erp_unit_shutdown(unit, 0, 81, fsf_req); |
3343 | } | 3188 | } |
3344 | } | 3189 | } |
3345 | 3190 | ||
@@ -3350,9 +3195,6 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3350 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " | 3195 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " |
3351 | "(debug info 0x%x)\n", | 3196 | "(debug info 0x%x)\n", |
3352 | header->fsf_status); | 3197 | header->fsf_status); |
3353 | debug_text_event(adapter->erp_dbf, 0, "fsf_s_inval:"); | ||
3354 | debug_exception(adapter->erp_dbf, 0, | ||
3355 | &header->fsf_status, sizeof (u32)); | ||
3356 | break; | 3198 | break; |
3357 | } | 3199 | } |
3358 | 3200 | ||
@@ -3465,9 +3307,7 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3465 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, | 3307 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, |
3466 | (char *) &fsf_req->qtcb->header.fsf_status_qual, | 3308 | (char *) &fsf_req->qtcb->header.fsf_status_qual, |
3467 | sizeof (union fsf_status_qual)); | 3309 | sizeof (union fsf_status_qual)); |
3468 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | 3310 | zfcp_erp_adapter_reopen(unit->port->adapter, 0, 110, fsf_req); |
3469 | "fsf_s_phand_nv"); | ||
3470 | zfcp_erp_adapter_reopen(unit->port->adapter, 0); | ||
3471 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3311 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3472 | break; | 3312 | break; |
3473 | 3313 | ||
@@ -3483,9 +3323,7 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3483 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, | 3323 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, |
3484 | (char *) &fsf_req->qtcb->header.fsf_status_qual, | 3324 | (char *) &fsf_req->qtcb->header.fsf_status_qual, |
3485 | sizeof (union fsf_status_qual)); | 3325 | sizeof (union fsf_status_qual)); |
3486 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | 3326 | zfcp_erp_port_reopen(unit->port, 0, 111, fsf_req); |
3487 | "fsf_s_lhand_nv"); | ||
3488 | zfcp_erp_port_reopen(unit->port, 0); | ||
3489 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3327 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3490 | break; | 3328 | break; |
3491 | 3329 | ||
@@ -3494,8 +3332,7 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3494 | "needs to be reopened\n", | 3332 | "needs to be reopened\n", |
3495 | unit->port->wwpn, | 3333 | unit->port->wwpn, |
3496 | zfcp_get_busid_by_unit(unit)); | 3334 | zfcp_get_busid_by_unit(unit)); |
3497 | debug_text_event(fsf_req->adapter->erp_dbf, 2, "fsf_s_pboxed"); | 3335 | zfcp_erp_port_boxed(unit->port, 52, fsf_req); |
3498 | zfcp_erp_port_boxed(unit->port); | ||
3499 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | | 3336 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | |
3500 | ZFCP_STATUS_FSFREQ_RETRY; | 3337 | ZFCP_STATUS_FSFREQ_RETRY; |
3501 | break; | 3338 | break; |
@@ -3504,27 +3341,17 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3504 | switch (fsf_req->qtcb->header.fsf_status_qual.word[0]) { | 3341 | switch (fsf_req->qtcb->header.fsf_status_qual.word[0]) { |
3505 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: | 3342 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: |
3506 | /* re-establish link to port */ | 3343 | /* re-establish link to port */ |
3507 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | ||
3508 | "fsf_sq_ltest"); | ||
3509 | zfcp_test_link(unit->port); | 3344 | zfcp_test_link(unit->port); |
3510 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3345 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3511 | break; | 3346 | break; |
3512 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: | 3347 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: |
3513 | /* ERP strategy will escalate */ | 3348 | /* ERP strategy will escalate */ |
3514 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | ||
3515 | "fsf_sq_ulp"); | ||
3516 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3349 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3517 | break; | 3350 | break; |
3518 | default: | 3351 | default: |
3519 | ZFCP_LOG_NORMAL | 3352 | ZFCP_LOG_NORMAL |
3520 | ("bug: Wrong status qualifier 0x%x arrived.\n", | 3353 | ("bug: Wrong status qualifier 0x%x arrived.\n", |
3521 | fsf_req->qtcb->header.fsf_status_qual.word[0]); | 3354 | fsf_req->qtcb->header.fsf_status_qual.word[0]); |
3522 | debug_text_event(fsf_req->adapter->erp_dbf, 0, | ||
3523 | "fsf_sq_inval:"); | ||
3524 | debug_exception( | ||
3525 | fsf_req->adapter->erp_dbf, 0, | ||
3526 | &fsf_req->qtcb->header.fsf_status_qual.word[0], | ||
3527 | sizeof (u32)); | ||
3528 | break; | 3355 | break; |
3529 | } | 3356 | } |
3530 | break; | 3357 | break; |
@@ -3545,10 +3372,6 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req) | |||
3545 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " | 3372 | ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented " |
3546 | "(debug info 0x%x)\n", | 3373 | "(debug info 0x%x)\n", |
3547 | fsf_req->qtcb->header.fsf_status); | 3374 | fsf_req->qtcb->header.fsf_status); |
3548 | debug_text_event(fsf_req->adapter->erp_dbf, 0, "fsf_s_inval:"); | ||
3549 | debug_exception(fsf_req->adapter->erp_dbf, 0, | ||
3550 | &fsf_req->qtcb->header.fsf_status, | ||
3551 | sizeof (u32)); | ||
3552 | break; | 3375 | break; |
3553 | } | 3376 | } |
3554 | 3377 | ||
@@ -3703,7 +3526,7 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter, | |||
3703 | zfcp_get_busid_by_unit(unit), | 3526 | zfcp_get_busid_by_unit(unit), |
3704 | unit->port->wwpn, | 3527 | unit->port->wwpn, |
3705 | unit->fcp_lun); | 3528 | unit->fcp_lun); |
3706 | zfcp_erp_unit_shutdown(unit, 0); | 3529 | zfcp_erp_unit_shutdown(unit, 0, 131, fsf_req); |
3707 | retval = -EINVAL; | 3530 | retval = -EINVAL; |
3708 | } | 3531 | } |
3709 | goto no_fit; | 3532 | goto no_fit; |
@@ -3739,8 +3562,8 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter, | |||
3739 | send_failed: | 3562 | send_failed: |
3740 | no_fit: | 3563 | no_fit: |
3741 | failed_scsi_cmnd: | 3564 | failed_scsi_cmnd: |
3742 | unit_blocked: | ||
3743 | zfcp_unit_put(unit); | 3565 | zfcp_unit_put(unit); |
3566 | unit_blocked: | ||
3744 | zfcp_fsf_req_free(fsf_req); | 3567 | zfcp_fsf_req_free(fsf_req); |
3745 | fsf_req = NULL; | 3568 | fsf_req = NULL; |
3746 | scsi_cmnd->host_scribble = NULL; | 3569 | scsi_cmnd->host_scribble = NULL; |
@@ -3861,9 +3684,7 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req) | |||
3861 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, | 3684 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, |
3862 | (char *) &header->fsf_status_qual, | 3685 | (char *) &header->fsf_status_qual, |
3863 | sizeof (union fsf_status_qual)); | 3686 | sizeof (union fsf_status_qual)); |
3864 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | 3687 | zfcp_erp_adapter_reopen(unit->port->adapter, 0, 112, fsf_req); |
3865 | "fsf_s_phand_nv"); | ||
3866 | zfcp_erp_adapter_reopen(unit->port->adapter, 0); | ||
3867 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3688 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3868 | break; | 3689 | break; |
3869 | 3690 | ||
@@ -3879,9 +3700,7 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req) | |||
3879 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL, | 3700 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL, |
3880 | (char *) &header->fsf_status_qual, | 3701 | (char *) &header->fsf_status_qual, |
3881 | sizeof (union fsf_status_qual)); | 3702 | sizeof (union fsf_status_qual)); |
3882 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | 3703 | zfcp_erp_port_reopen(unit->port, 0, 113, fsf_req); |
3883 | "fsf_s_uhand_nv"); | ||
3884 | zfcp_erp_port_reopen(unit->port, 0); | ||
3885 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3704 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3886 | break; | 3705 | break; |
3887 | 3706 | ||
@@ -3897,9 +3716,7 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req) | |||
3897 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL, | 3716 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL, |
3898 | (char *) &header->fsf_status_qual, | 3717 | (char *) &header->fsf_status_qual, |
3899 | sizeof (union fsf_status_qual)); | 3718 | sizeof (union fsf_status_qual)); |
3900 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | 3719 | zfcp_erp_adapter_reopen(unit->port->adapter, 0, 114, fsf_req); |
3901 | "fsf_s_hand_mis"); | ||
3902 | zfcp_erp_adapter_reopen(unit->port->adapter, 0); | ||
3903 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3720 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3904 | break; | 3721 | break; |
3905 | 3722 | ||
@@ -3909,9 +3726,7 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req) | |||
3909 | zfcp_get_busid_by_unit(unit), | 3726 | zfcp_get_busid_by_unit(unit), |
3910 | ZFCP_FC_SERVICE_CLASS_DEFAULT); | 3727 | ZFCP_FC_SERVICE_CLASS_DEFAULT); |
3911 | /* stop operation for this adapter */ | 3728 | /* stop operation for this adapter */ |
3912 | debug_text_exception(fsf_req->adapter->erp_dbf, 0, | 3729 | zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 132, fsf_req); |
3913 | "fsf_s_class_nsup"); | ||
3914 | zfcp_erp_adapter_shutdown(unit->port->adapter, 0); | ||
3915 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3730 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3916 | break; | 3731 | break; |
3917 | 3732 | ||
@@ -3927,9 +3742,7 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req) | |||
3927 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, | 3742 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG, |
3928 | (char *) &header->fsf_status_qual, | 3743 | (char *) &header->fsf_status_qual, |
3929 | sizeof (union fsf_status_qual)); | 3744 | sizeof (union fsf_status_qual)); |
3930 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | 3745 | zfcp_erp_port_reopen(unit->port, 0, 115, fsf_req); |
3931 | "fsf_s_fcp_lun_nv"); | ||
3932 | zfcp_erp_port_reopen(unit->port, 0); | ||
3933 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3746 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3934 | break; | 3747 | break; |
3935 | 3748 | ||
@@ -3951,8 +3764,7 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req) | |||
3951 | break; | 3764 | break; |
3952 | } | 3765 | } |
3953 | } | 3766 | } |
3954 | debug_text_event(fsf_req->adapter->erp_dbf, 1, "fsf_s_access"); | 3767 | zfcp_erp_unit_access_denied(unit, 61, fsf_req); |
3955 | zfcp_erp_unit_access_denied(unit); | ||
3956 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3768 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3957 | break; | 3769 | break; |
3958 | 3770 | ||
@@ -3965,9 +3777,7 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req) | |||
3965 | zfcp_get_busid_by_unit(unit), | 3777 | zfcp_get_busid_by_unit(unit), |
3966 | fsf_req->qtcb->bottom.io.data_direction); | 3778 | fsf_req->qtcb->bottom.io.data_direction); |
3967 | /* stop operation for this adapter */ | 3779 | /* stop operation for this adapter */ |
3968 | debug_text_event(fsf_req->adapter->erp_dbf, 0, | 3780 | zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 133, fsf_req); |
3969 | "fsf_s_dir_ind_nv"); | ||
3970 | zfcp_erp_adapter_shutdown(unit->port->adapter, 0); | ||
3971 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3781 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3972 | break; | 3782 | break; |
3973 | 3783 | ||
@@ -3980,9 +3790,7 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req) | |||
3980 | zfcp_get_busid_by_unit(unit), | 3790 | zfcp_get_busid_by_unit(unit), |
3981 | fsf_req->qtcb->bottom.io.fcp_cmnd_length); | 3791 | fsf_req->qtcb->bottom.io.fcp_cmnd_length); |
3982 | /* stop operation for this adapter */ | 3792 | /* stop operation for this adapter */ |
3983 | debug_text_event(fsf_req->adapter->erp_dbf, 0, | 3793 | zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 134, fsf_req); |
3984 | "fsf_s_cmd_len_nv"); | ||
3985 | zfcp_erp_adapter_shutdown(unit->port->adapter, 0); | ||
3986 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3794 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
3987 | break; | 3795 | break; |
3988 | 3796 | ||
@@ -3990,8 +3798,7 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req) | |||
3990 | ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter %s " | 3798 | ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter %s " |
3991 | "needs to be reopened\n", | 3799 | "needs to be reopened\n", |
3992 | unit->port->wwpn, zfcp_get_busid_by_unit(unit)); | 3800 | unit->port->wwpn, zfcp_get_busid_by_unit(unit)); |
3993 | debug_text_event(fsf_req->adapter->erp_dbf, 2, "fsf_s_pboxed"); | 3801 | zfcp_erp_port_boxed(unit->port, 53, fsf_req); |
3994 | zfcp_erp_port_boxed(unit->port); | ||
3995 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | | 3802 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | |
3996 | ZFCP_STATUS_FSFREQ_RETRY; | 3803 | ZFCP_STATUS_FSFREQ_RETRY; |
3997 | break; | 3804 | break; |
@@ -4001,8 +3808,7 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req) | |||
4001 | "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n", | 3808 | "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n", |
4002 | zfcp_get_busid_by_unit(unit), | 3809 | zfcp_get_busid_by_unit(unit), |
4003 | unit->port->wwpn, unit->fcp_lun); | 3810 | unit->port->wwpn, unit->fcp_lun); |
4004 | debug_text_event(fsf_req->adapter->erp_dbf, 1, "fsf_s_lboxed"); | 3811 | zfcp_erp_unit_boxed(unit, 54, fsf_req); |
4005 | zfcp_erp_unit_boxed(unit); | ||
4006 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 3812 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
4007 | | ZFCP_STATUS_FSFREQ_RETRY; | 3813 | | ZFCP_STATUS_FSFREQ_RETRY; |
4008 | break; | 3814 | break; |
@@ -4011,25 +3817,16 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req) | |||
4011 | switch (header->fsf_status_qual.word[0]) { | 3817 | switch (header->fsf_status_qual.word[0]) { |
4012 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: | 3818 | case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: |
4013 | /* re-establish link to port */ | 3819 | /* re-establish link to port */ |
4014 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | ||
4015 | "fsf_sq_ltest"); | ||
4016 | zfcp_test_link(unit->port); | 3820 | zfcp_test_link(unit->port); |
4017 | break; | 3821 | break; |
4018 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: | 3822 | case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: |
4019 | /* FIXME(hw) need proper specs for proper action */ | 3823 | /* FIXME(hw) need proper specs for proper action */ |
4020 | /* let scsi stack deal with retries and escalation */ | 3824 | /* let scsi stack deal with retries and escalation */ |
4021 | debug_text_event(fsf_req->adapter->erp_dbf, 1, | ||
4022 | "fsf_sq_ulp"); | ||
4023 | break; | 3825 | break; |
4024 | default: | 3826 | default: |
4025 | ZFCP_LOG_NORMAL | 3827 | ZFCP_LOG_NORMAL |
4026 | ("Unknown status qualifier 0x%x arrived.\n", | 3828 | ("Unknown status qualifier 0x%x arrived.\n", |
4027 | header->fsf_status_qual.word[0]); | 3829 | header->fsf_status_qual.word[0]); |
4028 | debug_text_event(fsf_req->adapter->erp_dbf, 0, | ||
4029 | "fsf_sq_inval:"); | ||
4030 | debug_exception(fsf_req->adapter->erp_dbf, 0, | ||
4031 | &header->fsf_status_qual.word[0], | ||
4032 | sizeof(u32)); | ||
4033 | break; | 3830 | break; |
4034 | } | 3831 | } |
4035 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 3832 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
@@ -4040,12 +3837,6 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req) | |||
4040 | 3837 | ||
4041 | case FSF_FCP_RSP_AVAILABLE: | 3838 | case FSF_FCP_RSP_AVAILABLE: |
4042 | break; | 3839 | break; |
4043 | |||
4044 | default: | ||
4045 | debug_text_event(fsf_req->adapter->erp_dbf, 0, "fsf_s_inval:"); | ||
4046 | debug_exception(fsf_req->adapter->erp_dbf, 0, | ||
4047 | &header->fsf_status, sizeof(u32)); | ||
4048 | break; | ||
4049 | } | 3840 | } |
4050 | 3841 | ||
4051 | skip_fsfstatus: | 3842 | skip_fsfstatus: |
@@ -4625,9 +4416,6 @@ zfcp_fsf_control_file_handler(struct zfcp_fsf_req *fsf_req) | |||
4625 | "was presented on the adapter %s\n", | 4416 | "was presented on the adapter %s\n", |
4626 | header->fsf_status, | 4417 | header->fsf_status, |
4627 | zfcp_get_busid_by_adapter(adapter)); | 4418 | zfcp_get_busid_by_adapter(adapter)); |
4628 | debug_text_event(fsf_req->adapter->erp_dbf, 0, "fsf_sq_inval"); | ||
4629 | debug_exception(fsf_req->adapter->erp_dbf, 0, | ||
4630 | &header->fsf_status_qual.word[0], sizeof(u32)); | ||
4631 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; | 4419 | fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; |
4632 | retval = -EINVAL; | 4420 | retval = -EINVAL; |
4633 | break; | 4421 | break; |
@@ -4817,7 +4605,6 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req) | |||
4817 | volatile struct qdio_buffer_element *sbale; | 4605 | volatile struct qdio_buffer_element *sbale; |
4818 | int inc_seq_no; | 4606 | int inc_seq_no; |
4819 | int new_distance_from_int; | 4607 | int new_distance_from_int; |
4820 | u64 dbg_tmp[2]; | ||
4821 | int retval = 0; | 4608 | int retval = 0; |
4822 | 4609 | ||
4823 | adapter = fsf_req->adapter; | 4610 | adapter = fsf_req->adapter; |
@@ -4867,10 +4654,6 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req) | |||
4867 | QDIO_FLAG_SYNC_OUTPUT, | 4654 | QDIO_FLAG_SYNC_OUTPUT, |
4868 | 0, fsf_req->sbal_first, fsf_req->sbal_number, NULL); | 4655 | 0, fsf_req->sbal_first, fsf_req->sbal_number, NULL); |
4869 | 4656 | ||
4870 | dbg_tmp[0] = (unsigned long) sbale[0].addr; | ||
4871 | dbg_tmp[1] = (u64) retval; | ||
4872 | debug_event(adapter->erp_dbf, 4, (void *) dbg_tmp, 16); | ||
4873 | |||
4874 | if (unlikely(retval)) { | 4657 | if (unlikely(retval)) { |
4875 | /* Queues are down..... */ | 4658 | /* Queues are down..... */ |
4876 | retval = -EIO; | 4659 | retval = -EIO; |
@@ -4885,7 +4668,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req) | |||
4885 | req_queue->free_index -= fsf_req->sbal_number; | 4668 | req_queue->free_index -= fsf_req->sbal_number; |
4886 | req_queue->free_index += QDIO_MAX_BUFFERS_PER_Q; | 4669 | req_queue->free_index += QDIO_MAX_BUFFERS_PER_Q; |
4887 | req_queue->free_index %= QDIO_MAX_BUFFERS_PER_Q; /* wrap */ | 4670 | req_queue->free_index %= QDIO_MAX_BUFFERS_PER_Q; /* wrap */ |
4888 | zfcp_erp_adapter_reopen(adapter, 0); | 4671 | zfcp_erp_adapter_reopen(adapter, 0, 116, fsf_req); |
4889 | } else { | 4672 | } else { |
4890 | req_queue->distance_from_int = new_distance_from_int; | 4673 | req_queue->distance_from_int = new_distance_from_int; |
4891 | /* | 4674 | /* |
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c index 22fdc17e0d0e..8ca5f074c687 100644 --- a/drivers/s390/scsi/zfcp_qdio.c +++ b/drivers/s390/scsi/zfcp_qdio.c | |||
@@ -175,8 +175,9 @@ zfcp_qdio_handler_error_check(struct zfcp_adapter *adapter, unsigned int status, | |||
175 | * which is set again in case we have missed by a mile. | 175 | * which is set again in case we have missed by a mile. |
176 | */ | 176 | */ |
177 | zfcp_erp_adapter_reopen(adapter, | 177 | zfcp_erp_adapter_reopen(adapter, |
178 | ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED | | 178 | ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED | |
179 | ZFCP_STATUS_COMMON_ERP_FAILED); | 179 | ZFCP_STATUS_COMMON_ERP_FAILED, 140, |
180 | NULL); | ||
180 | } | 181 | } |
181 | return retval; | 182 | return retval; |
182 | } | 183 | } |
@@ -239,8 +240,6 @@ static void zfcp_qdio_reqid_check(struct zfcp_adapter *adapter, | |||
239 | struct zfcp_fsf_req *fsf_req; | 240 | struct zfcp_fsf_req *fsf_req; |
240 | unsigned long flags; | 241 | unsigned long flags; |
241 | 242 | ||
242 | debug_long_event(adapter->erp_dbf, 4, req_id); | ||
243 | |||
244 | spin_lock_irqsave(&adapter->req_list_lock, flags); | 243 | spin_lock_irqsave(&adapter->req_list_lock, flags); |
245 | fsf_req = zfcp_reqlist_find(adapter, req_id); | 244 | fsf_req = zfcp_reqlist_find(adapter, req_id); |
246 | 245 | ||
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index b9daf5c05862..f81850624eed 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -31,6 +31,7 @@ static int zfcp_scsi_queuecommand(struct scsi_cmnd *, | |||
31 | void (*done) (struct scsi_cmnd *)); | 31 | void (*done) (struct scsi_cmnd *)); |
32 | static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *); | 32 | static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *); |
33 | static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *); | 33 | static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *); |
34 | static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *); | ||
34 | static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *); | 35 | static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *); |
35 | static int zfcp_task_management_function(struct zfcp_unit *, u8, | 36 | static int zfcp_task_management_function(struct zfcp_unit *, u8, |
36 | struct scsi_cmnd *); | 37 | struct scsi_cmnd *); |
@@ -51,6 +52,7 @@ struct zfcp_data zfcp_data = { | |||
51 | .queuecommand = zfcp_scsi_queuecommand, | 52 | .queuecommand = zfcp_scsi_queuecommand, |
52 | .eh_abort_handler = zfcp_scsi_eh_abort_handler, | 53 | .eh_abort_handler = zfcp_scsi_eh_abort_handler, |
53 | .eh_device_reset_handler = zfcp_scsi_eh_device_reset_handler, | 54 | .eh_device_reset_handler = zfcp_scsi_eh_device_reset_handler, |
55 | .eh_target_reset_handler = zfcp_scsi_eh_target_reset_handler, | ||
54 | .eh_host_reset_handler = zfcp_scsi_eh_host_reset_handler, | 56 | .eh_host_reset_handler = zfcp_scsi_eh_host_reset_handler, |
55 | .can_queue = 4096, | 57 | .can_queue = 4096, |
56 | .this_id = -1, | 58 | .this_id = -1, |
@@ -179,11 +181,10 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt) | |||
179 | struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata; | 181 | struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata; |
180 | 182 | ||
181 | if (unit) { | 183 | if (unit) { |
182 | zfcp_erp_wait(unit->port->adapter); | ||
183 | atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status); | 184 | atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status); |
184 | sdpnt->hostdata = NULL; | 185 | sdpnt->hostdata = NULL; |
185 | unit->device = NULL; | 186 | unit->device = NULL; |
186 | zfcp_erp_unit_failed(unit); | 187 | zfcp_erp_unit_failed(unit, 12, NULL); |
187 | zfcp_unit_put(unit); | 188 | zfcp_unit_put(unit); |
188 | } else | 189 | } else |
189 | ZFCP_LOG_NORMAL("bug: no unit associated with SCSI device at " | 190 | ZFCP_LOG_NORMAL("bug: no unit associated with SCSI device at " |
@@ -442,58 +443,32 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt) | |||
442 | return retval; | 443 | return retval; |
443 | } | 444 | } |
444 | 445 | ||
445 | static int | 446 | static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt) |
446 | zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt) | ||
447 | { | 447 | { |
448 | int retval; | 448 | int retval; |
449 | struct zfcp_unit *unit = (struct zfcp_unit *) scpnt->device->hostdata; | 449 | struct zfcp_unit *unit = scpnt->device->hostdata; |
450 | 450 | ||
451 | if (!unit) { | 451 | if (!unit) { |
452 | ZFCP_LOG_NORMAL("bug: Tried reset for nonexistent unit\n"); | 452 | WARN_ON(1); |
453 | retval = SUCCESS; | 453 | return SUCCESS; |
454 | goto out; | ||
455 | } | 454 | } |
456 | ZFCP_LOG_NORMAL("resetting unit 0x%016Lx on port 0x%016Lx, adapter %s\n", | 455 | retval = zfcp_task_management_function(unit, |
457 | unit->fcp_lun, unit->port->wwpn, | 456 | FCP_LOGICAL_UNIT_RESET, |
458 | zfcp_get_busid_by_adapter(unit->port->adapter)); | 457 | scpnt); |
458 | return retval ? FAILED : SUCCESS; | ||
459 | } | ||
459 | 460 | ||
460 | /* | 461 | static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd *scpnt) |
461 | * If we do not know whether the unit supports 'logical unit reset' | 462 | { |
462 | * then try 'logical unit reset' and proceed with 'target reset' | 463 | int retval; |
463 | * if 'logical unit reset' fails. | 464 | struct zfcp_unit *unit = scpnt->device->hostdata; |
464 | * If the unit is known not to support 'logical unit reset' then | 465 | |
465 | * skip 'logical unit reset' and try 'target reset' immediately. | 466 | if (!unit) { |
466 | */ | 467 | WARN_ON(1); |
467 | if (!atomic_test_mask(ZFCP_STATUS_UNIT_NOTSUPPUNITRESET, | 468 | return SUCCESS; |
468 | &unit->status)) { | ||
469 | retval = zfcp_task_management_function(unit, | ||
470 | FCP_LOGICAL_UNIT_RESET, | ||
471 | scpnt); | ||
472 | if (retval) { | ||
473 | ZFCP_LOG_DEBUG("unit reset failed (unit=%p)\n", unit); | ||
474 | if (retval == -ENOTSUPP) | ||
475 | atomic_set_mask | ||
476 | (ZFCP_STATUS_UNIT_NOTSUPPUNITRESET, | ||
477 | &unit->status); | ||
478 | /* fall through and try 'target reset' next */ | ||
479 | } else { | ||
480 | ZFCP_LOG_DEBUG("unit reset succeeded (unit=%p)\n", | ||
481 | unit); | ||
482 | /* avoid 'target reset' */ | ||
483 | retval = SUCCESS; | ||
484 | goto out; | ||
485 | } | ||
486 | } | 469 | } |
487 | retval = zfcp_task_management_function(unit, FCP_TARGET_RESET, scpnt); | 470 | retval = zfcp_task_management_function(unit, FCP_TARGET_RESET, scpnt); |
488 | if (retval) { | 471 | return retval ? FAILED : SUCCESS; |
489 | ZFCP_LOG_DEBUG("target reset failed (unit=%p)\n", unit); | ||
490 | retval = FAILED; | ||
491 | } else { | ||
492 | ZFCP_LOG_DEBUG("target reset succeeded (unit=%p)\n", unit); | ||
493 | retval = SUCCESS; | ||
494 | } | ||
495 | out: | ||
496 | return retval; | ||
497 | } | 472 | } |
498 | 473 | ||
499 | static int | 474 | static int |
@@ -553,7 +528,7 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt) | |||
553 | unit->fcp_lun, unit->port->wwpn, | 528 | unit->fcp_lun, unit->port->wwpn, |
554 | zfcp_get_busid_by_adapter(unit->port->adapter)); | 529 | zfcp_get_busid_by_adapter(unit->port->adapter)); |
555 | 530 | ||
556 | zfcp_erp_adapter_reopen(adapter, 0); | 531 | zfcp_erp_adapter_reopen(adapter, 0, 141, scpnt); |
557 | zfcp_erp_wait(adapter); | 532 | zfcp_erp_wait(adapter); |
558 | 533 | ||
559 | return SUCCESS; | 534 | return SUCCESS; |
diff --git a/drivers/s390/scsi/zfcp_sysfs_adapter.c b/drivers/s390/scsi/zfcp_sysfs_adapter.c index 705c6d4428f3..ccbba4dd3a77 100644 --- a/drivers/s390/scsi/zfcp_sysfs_adapter.c +++ b/drivers/s390/scsi/zfcp_sysfs_adapter.c | |||
@@ -89,7 +89,7 @@ zfcp_sysfs_port_add_store(struct device *dev, struct device_attribute *attr, con | |||
89 | 89 | ||
90 | retval = 0; | 90 | retval = 0; |
91 | 91 | ||
92 | zfcp_erp_port_reopen(port, 0); | 92 | zfcp_erp_port_reopen(port, 0, 91, NULL); |
93 | zfcp_erp_wait(port->adapter); | 93 | zfcp_erp_wait(port->adapter); |
94 | zfcp_port_put(port); | 94 | zfcp_port_put(port); |
95 | out: | 95 | out: |
@@ -147,7 +147,7 @@ zfcp_sysfs_port_remove_store(struct device *dev, struct device_attribute *attr, | |||
147 | goto out; | 147 | goto out; |
148 | } | 148 | } |
149 | 149 | ||
150 | zfcp_erp_port_shutdown(port, 0); | 150 | zfcp_erp_port_shutdown(port, 0, 92, NULL); |
151 | zfcp_erp_wait(adapter); | 151 | zfcp_erp_wait(adapter); |
152 | zfcp_port_put(port); | 152 | zfcp_port_put(port); |
153 | zfcp_port_dequeue(port); | 153 | zfcp_port_dequeue(port); |
@@ -191,9 +191,10 @@ zfcp_sysfs_adapter_failed_store(struct device *dev, struct device_attribute *att | |||
191 | goto out; | 191 | goto out; |
192 | } | 192 | } |
193 | 193 | ||
194 | zfcp_erp_modify_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING, | 194 | zfcp_erp_modify_adapter_status(adapter, 44, NULL, |
195 | ZFCP_SET); | 195 | ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); |
196 | zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED); | 196 | zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 93, |
197 | NULL); | ||
197 | zfcp_erp_wait(adapter); | 198 | zfcp_erp_wait(adapter); |
198 | out: | 199 | out: |
199 | up(&zfcp_data.config_sema); | 200 | up(&zfcp_data.config_sema); |
diff --git a/drivers/s390/scsi/zfcp_sysfs_port.c b/drivers/s390/scsi/zfcp_sysfs_port.c index 1320c0591431..703c1b5cb602 100644 --- a/drivers/s390/scsi/zfcp_sysfs_port.c +++ b/drivers/s390/scsi/zfcp_sysfs_port.c | |||
@@ -94,7 +94,7 @@ zfcp_sysfs_unit_add_store(struct device *dev, struct device_attribute *attr, con | |||
94 | 94 | ||
95 | retval = 0; | 95 | retval = 0; |
96 | 96 | ||
97 | zfcp_erp_unit_reopen(unit, 0); | 97 | zfcp_erp_unit_reopen(unit, 0, 94, NULL); |
98 | zfcp_erp_wait(unit->port->adapter); | 98 | zfcp_erp_wait(unit->port->adapter); |
99 | zfcp_unit_put(unit); | 99 | zfcp_unit_put(unit); |
100 | out: | 100 | out: |
@@ -150,7 +150,7 @@ zfcp_sysfs_unit_remove_store(struct device *dev, struct device_attribute *attr, | |||
150 | goto out; | 150 | goto out; |
151 | } | 151 | } |
152 | 152 | ||
153 | zfcp_erp_unit_shutdown(unit, 0); | 153 | zfcp_erp_unit_shutdown(unit, 0, 95, NULL); |
154 | zfcp_erp_wait(unit->port->adapter); | 154 | zfcp_erp_wait(unit->port->adapter); |
155 | zfcp_unit_put(unit); | 155 | zfcp_unit_put(unit); |
156 | zfcp_unit_dequeue(unit); | 156 | zfcp_unit_dequeue(unit); |
@@ -193,8 +193,9 @@ zfcp_sysfs_port_failed_store(struct device *dev, struct device_attribute *attr, | |||
193 | goto out; | 193 | goto out; |
194 | } | 194 | } |
195 | 195 | ||
196 | zfcp_erp_modify_port_status(port, ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); | 196 | zfcp_erp_modify_port_status(port, 45, NULL, |
197 | zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED); | 197 | ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); |
198 | zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, 96, NULL); | ||
198 | zfcp_erp_wait(port->adapter); | 199 | zfcp_erp_wait(port->adapter); |
199 | out: | 200 | out: |
200 | up(&zfcp_data.config_sema); | 201 | up(&zfcp_data.config_sema); |
diff --git a/drivers/s390/scsi/zfcp_sysfs_unit.c b/drivers/s390/scsi/zfcp_sysfs_unit.c index 63f75ee95c33..80fb2c2cf48a 100644 --- a/drivers/s390/scsi/zfcp_sysfs_unit.c +++ b/drivers/s390/scsi/zfcp_sysfs_unit.c | |||
@@ -94,8 +94,9 @@ zfcp_sysfs_unit_failed_store(struct device *dev, struct device_attribute *attr, | |||
94 | goto out; | 94 | goto out; |
95 | } | 95 | } |
96 | 96 | ||
97 | zfcp_erp_modify_unit_status(unit, ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); | 97 | zfcp_erp_modify_unit_status(unit, 46, NULL, |
98 | zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED); | 98 | ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); |
99 | zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, 97, NULL); | ||
99 | zfcp_erp_wait(unit->port->adapter); | 100 | zfcp_erp_wait(unit->port->adapter); |
100 | out: | 101 | out: |
101 | up(&zfcp_data.config_sema); | 102 | up(&zfcp_data.config_sema); |