aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorMartin Peschke <mp3@de.ibm.com>2008-03-27 09:22:03 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:19:04 -0400
commit9467a9b3efdd9041202f71cc270bda827a7ec777 (patch)
tree9e7b8e167da9aa5065b1f7ed1d2a1ab9c2ad47da /drivers/s390
parent698ec01635819c5ae60090bb4efcbeffc41642fb (diff)
[SCSI] zfcp: Trace all triggers of error recovery activity
This patch allows any recovery event to be traced back to an exact cause, e.g. a particular request identified by an id (address). Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c31
-rw-r--r--drivers/s390/scsi/zfcp_ccw.c12
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c134
-rw-r--r--drivers/s390/scsi/zfcp_def.h14
-rw-r--r--drivers/s390/scsi/zfcp_erp.c213
-rw-r--r--drivers/s390/scsi/zfcp_ext.h25
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c103
-rw-r--r--drivers/s390/scsi/zfcp_qdio.c4
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c2
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_adapter.c6
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_port.c6
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_unit.c2
12 files changed, 362 insertions, 190 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index f3eff7ebcb6b..d2a744200c91 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -1326,10 +1326,10 @@ zfcp_nameserver_enqueue(struct zfcp_adapter *adapter)
1326 1326
1327#define ZFCP_LOG_AREA ZFCP_LOG_AREA_FC 1327#define ZFCP_LOG_AREA ZFCP_LOG_AREA_FC
1328 1328
1329static void 1329static void zfcp_fsf_incoming_els_rscn(struct zfcp_fsf_req *fsf_req)
1330zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter,
1331 struct fsf_status_read_buffer *status_buffer)
1332{ 1330{
1331 struct fsf_status_read_buffer *status_buffer = (void*)fsf_req->data;
1332 struct zfcp_adapter *adapter = fsf_req->adapter;
1333 struct fcp_rscn_head *fcp_rscn_head; 1333 struct fcp_rscn_head *fcp_rscn_head;
1334 struct fcp_rscn_element *fcp_rscn_element; 1334 struct fcp_rscn_element *fcp_rscn_element;
1335 struct zfcp_port *port; 1335 struct zfcp_port *port;
@@ -1376,7 +1376,8 @@ zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter,
1376 ZFCP_LOG_INFO("incoming RSCN, trying to open " 1376 ZFCP_LOG_INFO("incoming RSCN, trying to open "
1377 "port 0x%016Lx\n", port->wwpn); 1377 "port 0x%016Lx\n", port->wwpn);
1378 zfcp_erp_port_reopen(port, 1378 zfcp_erp_port_reopen(port,
1379 ZFCP_STATUS_COMMON_ERP_FAILED); 1379 ZFCP_STATUS_COMMON_ERP_FAILED,
1380 82, (u64)fsf_req);
1380 continue; 1381 continue;
1381 } 1382 }
1382 1383
@@ -1407,10 +1408,10 @@ zfcp_fsf_incoming_els_rscn(struct zfcp_adapter *adapter,
1407 } 1408 }
1408} 1409}
1409 1410
1410static void 1411static void zfcp_fsf_incoming_els_plogi(struct zfcp_fsf_req *fsf_req)
1411zfcp_fsf_incoming_els_plogi(struct zfcp_adapter *adapter,
1412 struct fsf_status_read_buffer *status_buffer)
1413{ 1412{
1413 struct fsf_status_read_buffer *status_buffer = (void*)fsf_req->data;
1414 struct zfcp_adapter *adapter = fsf_req->adapter;
1414 struct fsf_plogi *els_plogi; 1415 struct fsf_plogi *els_plogi;
1415 struct zfcp_port *port; 1416 struct zfcp_port *port;
1416 unsigned long flags; 1417 unsigned long flags;
@@ -1429,14 +1430,14 @@ zfcp_fsf_incoming_els_plogi(struct zfcp_adapter *adapter,
1429 status_buffer->d_id, 1430 status_buffer->d_id,
1430 zfcp_get_busid_by_adapter(adapter)); 1431 zfcp_get_busid_by_adapter(adapter));
1431 } else { 1432 } else {
1432 zfcp_erp_port_forced_reopen(port, 0); 1433 zfcp_erp_port_forced_reopen(port, 0, 83, (u64)fsf_req);
1433 } 1434 }
1434} 1435}
1435 1436
1436static void 1437static void zfcp_fsf_incoming_els_logo(struct zfcp_fsf_req *fsf_req)
1437zfcp_fsf_incoming_els_logo(struct zfcp_adapter *adapter,
1438 struct fsf_status_read_buffer *status_buffer)
1439{ 1438{
1439 struct fsf_status_read_buffer *status_buffer = (void*)fsf_req->data;
1440 struct zfcp_adapter *adapter = fsf_req->adapter;
1440 struct fcp_logo *els_logo = (struct fcp_logo *) status_buffer->payload; 1441 struct fcp_logo *els_logo = (struct fcp_logo *) status_buffer->payload;
1441 struct zfcp_port *port; 1442 struct zfcp_port *port;
1442 unsigned long flags; 1443 unsigned long flags;
@@ -1454,7 +1455,7 @@ zfcp_fsf_incoming_els_logo(struct zfcp_adapter *adapter,
1454 status_buffer->d_id, 1455 status_buffer->d_id,
1455 zfcp_get_busid_by_adapter(adapter)); 1456 zfcp_get_busid_by_adapter(adapter));
1456 } else { 1457 } else {
1457 zfcp_erp_port_forced_reopen(port, 0); 1458 zfcp_erp_port_forced_reopen(port, 0, 84, (u64)fsf_req);
1458 } 1459 }
1459} 1460}
1460 1461
@@ -1481,12 +1482,12 @@ zfcp_fsf_incoming_els(struct zfcp_fsf_req *fsf_req)
1481 1482
1482 zfcp_san_dbf_event_incoming_els(fsf_req); 1483 zfcp_san_dbf_event_incoming_els(fsf_req);
1483 if (els_type == LS_PLOGI) 1484 if (els_type == LS_PLOGI)
1484 zfcp_fsf_incoming_els_plogi(adapter, status_buffer); 1485 zfcp_fsf_incoming_els_plogi(fsf_req);
1485 else if (els_type == LS_LOGO) 1486 else if (els_type == LS_LOGO)
1486 zfcp_fsf_incoming_els_logo(adapter, status_buffer); 1487 zfcp_fsf_incoming_els_logo(fsf_req);
1487 else if ((els_type & 0xffff0000) == LS_RSCN) 1488 else if ((els_type & 0xffff0000) == LS_RSCN)
1488 /* we are only concerned with the command, not the length */ 1489 /* we are only concerned with the command, not the length */
1489 zfcp_fsf_incoming_els_rscn(adapter, status_buffer); 1490 zfcp_fsf_incoming_els_rscn(fsf_req);
1490 else 1491 else
1491 zfcp_fsf_incoming_els_unknown(adapter, status_buffer); 1492 zfcp_fsf_incoming_els_unknown(adapter, status_buffer);
1492} 1493}
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
index dd40b1c350b9..8edd90583cd4 100644
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -172,7 +172,7 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device)
172 172
173 zfcp_erp_modify_adapter_status(adapter, 10, 0, 173 zfcp_erp_modify_adapter_status(adapter, 10, 0,
174 ZFCP_STATUS_COMMON_RUNNING, 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, 0);
176 zfcp_erp_wait(adapter); 176 zfcp_erp_wait(adapter);
177 goto out; 177 goto out;
178 178
@@ -197,7 +197,7 @@ zfcp_ccw_set_offline(struct ccw_device *ccw_device)
197 197
198 down(&zfcp_data.config_sema); 198 down(&zfcp_data.config_sema);
199 adapter = dev_get_drvdata(&ccw_device->dev); 199 adapter = dev_get_drvdata(&ccw_device->dev);
200 zfcp_erp_adapter_shutdown(adapter, 0); 200 zfcp_erp_adapter_shutdown(adapter, 0, 86, 0);
201 zfcp_erp_wait(adapter); 201 zfcp_erp_wait(adapter);
202 zfcp_erp_thread_kill(adapter); 202 zfcp_erp_thread_kill(adapter);
203 up(&zfcp_data.config_sema); 203 up(&zfcp_data.config_sema);
@@ -224,13 +224,13 @@ zfcp_ccw_notify(struct ccw_device *ccw_device, int event)
224 ZFCP_LOG_NORMAL("adapter %s: device gone\n", 224 ZFCP_LOG_NORMAL("adapter %s: device gone\n",
225 zfcp_get_busid_by_adapter(adapter)); 225 zfcp_get_busid_by_adapter(adapter));
226 debug_text_event(adapter->erp_dbf,1,"dev_gone"); 226 debug_text_event(adapter->erp_dbf,1,"dev_gone");
227 zfcp_erp_adapter_shutdown(adapter, 0); 227 zfcp_erp_adapter_shutdown(adapter, 0, 87, 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 debug_text_event(adapter->erp_dbf,1,"no_path");
233 zfcp_erp_adapter_shutdown(adapter, 0); 233 zfcp_erp_adapter_shutdown(adapter, 0, 88, 0);
234 break; 234 break;
235 case CIO_OPER: 235 case CIO_OPER:
236 ZFCP_LOG_NORMAL("adapter %s: operational again\n", 236 ZFCP_LOG_NORMAL("adapter %s: operational again\n",
@@ -240,7 +240,7 @@ zfcp_ccw_notify(struct ccw_device *ccw_device, int event)
240 ZFCP_STATUS_COMMON_RUNNING, 240 ZFCP_STATUS_COMMON_RUNNING,
241 ZFCP_SET); 241 ZFCP_SET);
242 zfcp_erp_adapter_reopen(adapter, 242 zfcp_erp_adapter_reopen(adapter,
243 ZFCP_STATUS_COMMON_ERP_FAILED); 243 ZFCP_STATUS_COMMON_ERP_FAILED, 89, 0);
244 break; 244 break;
245 } 245 }
246 zfcp_erp_wait(adapter); 246 zfcp_erp_wait(adapter);
@@ -272,7 +272,7 @@ zfcp_ccw_shutdown(struct ccw_device *cdev)
272 272
273 down(&zfcp_data.config_sema); 273 down(&zfcp_data.config_sema);
274 adapter = dev_get_drvdata(&cdev->dev); 274 adapter = dev_get_drvdata(&cdev->dev);
275 zfcp_erp_adapter_shutdown(adapter, 0); 275 zfcp_erp_adapter_shutdown(adapter, 0, 90, 0);
276 zfcp_erp_wait(adapter); 276 zfcp_erp_wait(adapter);
277 up(&zfcp_data.config_sema); 277 up(&zfcp_data.config_sema);
278} 278}
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 2fcfe9bec554..f207b0bd0cad 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -523,6 +523,7 @@ static struct debug_view zfcp_hba_dbf_view = {
523static const char *zfcp_rec_dbf_tags[] = { 523static const char *zfcp_rec_dbf_tags[] = {
524 [ZFCP_REC_DBF_ID_THREAD] = "thread", 524 [ZFCP_REC_DBF_ID_THREAD] = "thread",
525 [ZFCP_REC_DBF_ID_TARGET] = "target", 525 [ZFCP_REC_DBF_ID_TARGET] = "target",
526 [ZFCP_REC_DBF_ID_TRIGGER] = "trigger",
526}; 527};
527 528
528static const char *zfcp_rec_dbf_ids[] = { 529static const char *zfcp_rec_dbf_ids[] = {
@@ -587,6 +588,89 @@ static const char *zfcp_rec_dbf_ids[] = {
587 [59] = "unit access denied open unit", 588 [59] = "unit access denied open unit",
588 [60] = "shared unit access denied open unit", 589 [60] = "shared unit access denied open unit",
589 [61] = "unit access denied fcp", 590 [61] = "unit access denied fcp",
591 [62] = "request timeout",
592 [63] = "adisc link test reject or timeout",
593 [64] = "adisc link test d_id changed",
594 [65] = "adisc link test failed",
595 [66] = "recovery out of memory",
596 [67] = "adapter recovery repeated after state change",
597 [68] = "port recovery repeated after state change",
598 [69] = "unit recovery repeated after state change",
599 [70] = "port recovery follow-up after successful adapter recovery",
600 [71] = "adapter recovery escalation after failed adapter recovery",
601 [72] = "port recovery follow-up after successful physical port "
602 "recovery",
603 [73] = "adapter recovery escalation after failed physical port "
604 "recovery",
605 [74] = "unit recovery follow-up after successful port recovery",
606 [75] = "physical port recovery escalation after failed port "
607 "recovery",
608 [76] = "port recovery escalation after failed unit recovery",
609 [77] = "recovery opening nameserver port",
610 [78] = "duplicate request id",
611 [79] = "link down",
612 [80] = "exclusive read-only unit access unsupported",
613 [81] = "shared read-write unit access unsupported",
614 [82] = "incoming rscn",
615 [83] = "incoming plogi",
616 [84] = "incoming logo",
617 [85] = "online",
618 [86] = "offline",
619 [87] = "ccw device gone",
620 [88] = "ccw device no path",
621 [89] = "ccw device operational",
622 [90] = "ccw device shutdown",
623 [91] = "sysfs port addition",
624 [92] = "sysfs port removal",
625 [93] = "sysfs adapter recovery",
626 [94] = "sysfs unit addition",
627 [95] = "sysfs unit removal",
628 [96] = "sysfs port recovery",
629 [97] = "sysfs unit recovery",
630 [98] = "sequence number mismatch",
631 [99] = "link up",
632 [100] = "error state",
633 [101] = "status read physical port closed",
634 [102] = "link up status read",
635 [103] = "too many failed status read buffers",
636 [104] = "port handle not valid abort",
637 [105] = "lun handle not valid abort",
638 [106] = "port handle not valid ct",
639 [107] = "port handle not valid close port",
640 [108] = "port handle not valid close physical port",
641 [109] = "port handle not valid open unit",
642 [110] = "port handle not valid close unit",
643 [111] = "lun handle not valid close unit",
644 [112] = "port handle not valid fcp",
645 [113] = "lun handle not valid fcp",
646 [114] = "handle mismatch fcp",
647 [115] = "lun not valid fcp",
648 [116] = "qdio send failed",
649 [117] = "version mismatch",
650 [118] = "incompatible qtcb type",
651 [119] = "unknown protocol status",
652 [120] = "unknown fsf command",
653 [121] = "no recommendation for status qualifier",
654 [122] = "status read physical port closed in error",
655 [123] = "fc service class not supported ct",
656 [124] = "fc service class not supported els",
657 [125] = "need newer zfcp",
658 [126] = "need newer microcode",
659 [127] = "arbitrated loop not supported",
660 [128] = "unknown topology",
661 [129] = "qtcb size mismatch",
662 [130] = "unknown fsf status ecd",
663 [131] = "fcp request too big",
664 [132] = "fc service class not supported fcp",
665 [133] = "data direction not valid fcp",
666 [134] = "command length not valid fcp",
667 [135] = "status read act update",
668 [136] = "status read cfdc update",
669 [137] = "hbaapi port open",
670 [138] = "hbaapi unit open",
671 [139] = "hbaapi unit shutdown",
672 [140] = "qdio error",
673 [141] = "scsi host reset",
590}; 674};
591 675
592static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view, 676static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view,
@@ -613,6 +697,17 @@ static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view,
613 zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->u.target.wwpn); 697 zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->u.target.wwpn);
614 zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->u.target.fcp_lun); 698 zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->u.target.fcp_lun);
615 break; 699 break;
700 case ZFCP_REC_DBF_ID_TRIGGER:
701 zfcp_dbf_out(&p, "reference", "0x%016Lx", r->u.trigger.ref);
702 zfcp_dbf_out(&p, "erp_action", "0x%016Lx", r->u.trigger.action);
703 zfcp_dbf_out(&p, "requested", "%d", r->u.trigger.want);
704 zfcp_dbf_out(&p, "executed", "%d", r->u.trigger.need);
705 zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->u.trigger.wwpn);
706 zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->u.trigger.fcp_lun);
707 zfcp_dbf_out(&p, "adapter_status", "0x%08x", r->u.trigger.as);
708 zfcp_dbf_out(&p, "port_status", "0x%08x", r->u.trigger.ps);
709 zfcp_dbf_out(&p, "unit_status", "0x%08x", r->u.trigger.us);
710 break;
616 } 711 }
617 sprintf(p, "\n"); 712 sprintf(p, "\n");
618 return (p - buf) + 1; 713 return (p - buf) + 1;
@@ -727,6 +822,45 @@ void zfcp_rec_dbf_event_unit(u8 id, u64 ref, struct zfcp_unit *unit)
727 unit->fcp_lun); 822 unit->fcp_lun);
728} 823}
729 824
825/**
826 * zfcp_rec_dbf_event_trigger - trace event for triggered error recovery
827 * @id2: identifier for error recovery trigger
828 * @ref: additional reference (e.g. request)
829 * @want: originally requested error recovery action
830 * @need: error recovery action actually initiated
831 * @action: address of error recovery action struct
832 * @adapter: adapter
833 * @port: port
834 * @unit: unit
835 */
836void zfcp_rec_dbf_event_trigger(u8 id2, u64 ref, u8 want, u8 need, u64 action,
837 struct zfcp_adapter *adapter,
838 struct zfcp_port *port, struct zfcp_unit *unit)
839{
840 struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf;
841 unsigned long flags;
842
843 spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
844 memset(r, 0, sizeof(*r));
845 r->id = ZFCP_REC_DBF_ID_TRIGGER;
846 r->id2 = id2;
847 r->u.trigger.ref = ref;
848 r->u.trigger.want = want;
849 r->u.trigger.need = need;
850 r->u.trigger.action = action;
851 r->u.trigger.as = atomic_read(&adapter->status);
852 if (port) {
853 r->u.trigger.ps = atomic_read(&port->status);
854 r->u.trigger.wwpn = port->wwpn;
855 }
856 if (unit) {
857 r->u.trigger.us = atomic_read(&unit->status);
858 r->u.trigger.fcp_lun = unit->fcp_lun;
859 }
860 debug_event(adapter->rec_dbf, action ? 1 : 4, r, sizeof(*r));
861 spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
862}
863
730static void 864static void
731_zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req, 865_zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req,
732 u32 s_id, u32 d_id, void *buffer, int buflen) 866 u32 s_id, u32 d_id, void *buffer, int buflen)
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 659ec739706a..aad75cfa1c60 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -295,18 +295,32 @@ struct zfcp_rec_dbf_record_target {
295 u32 erp_count; 295 u32 erp_count;
296} __attribute__ ((packed)); 296} __attribute__ ((packed));
297 297
298struct zfcp_rec_dbf_record_trigger {
299 u8 want;
300 u8 need;
301 u32 as;
302 u32 ps;
303 u32 us;
304 u64 ref;
305 u64 action;
306 u64 wwpn;
307 u64 fcp_lun;
308} __attribute__ ((packed));
309
298struct zfcp_rec_dbf_record { 310struct zfcp_rec_dbf_record {
299 u8 id; 311 u8 id;
300 u8 id2; 312 u8 id2;
301 union { 313 union {
302 struct zfcp_rec_dbf_record_thread thread; 314 struct zfcp_rec_dbf_record_thread thread;
303 struct zfcp_rec_dbf_record_target target; 315 struct zfcp_rec_dbf_record_target target;
316 struct zfcp_rec_dbf_record_trigger trigger;
304 } u; 317 } u;
305} __attribute__ ((packed)); 318} __attribute__ ((packed));
306 319
307enum { 320enum {
308 ZFCP_REC_DBF_ID_THREAD, 321 ZFCP_REC_DBF_ID_THREAD,
309 ZFCP_REC_DBF_ID_TARGET, 322 ZFCP_REC_DBF_ID_TARGET,
323 ZFCP_REC_DBF_ID_TRIGGER,
310}; 324};
311 325
312struct zfcp_hba_dbf_record_response { 326struct zfcp_hba_dbf_record_response {
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index bee03443efd4..55e034b10ded 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -26,13 +26,16 @@
26static int zfcp_erp_adisc(struct zfcp_port *); 26static int zfcp_erp_adisc(struct zfcp_port *);
27static void zfcp_erp_adisc_handler(unsigned long); 27static void zfcp_erp_adisc_handler(unsigned long);
28 28
29static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int); 29static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int, u8,
30static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *, int); 30 u64);
31static int zfcp_erp_port_reopen_internal(struct zfcp_port *, int); 31static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *, int, u8,
32static int zfcp_erp_unit_reopen_internal(struct zfcp_unit *, int); 32 u64);
33static int zfcp_erp_port_reopen_internal(struct zfcp_port *, int, u8, u64);
34static int zfcp_erp_unit_reopen_internal(struct zfcp_unit *, int, u8, u64);
33 35
34static int zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *, int); 36static int zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *, int, u8,
35static int zfcp_erp_unit_reopen_all_internal(struct zfcp_port *, int); 37 u64);
38static int zfcp_erp_unit_reopen_all_internal(struct zfcp_port *, int, u8, u64);
36 39
37static void zfcp_erp_adapter_block(struct zfcp_adapter *, int); 40static void zfcp_erp_adapter_block(struct zfcp_adapter *, int);
38static void zfcp_erp_adapter_unblock(struct zfcp_adapter *); 41static void zfcp_erp_adapter_unblock(struct zfcp_adapter *);
@@ -97,7 +100,8 @@ static void zfcp_erp_action_dismiss_unit(struct zfcp_unit *);
97static void zfcp_erp_action_dismiss(struct zfcp_erp_action *); 100static void zfcp_erp_action_dismiss(struct zfcp_erp_action *);
98 101
99static int zfcp_erp_action_enqueue(int, struct zfcp_adapter *, 102static int zfcp_erp_action_enqueue(int, struct zfcp_adapter *,
100 struct zfcp_port *, struct zfcp_unit *); 103 struct zfcp_port *, struct zfcp_unit *,
104 u8 id, u64 ref);
101static int zfcp_erp_action_dequeue(struct zfcp_erp_action *); 105static int zfcp_erp_action_dequeue(struct zfcp_erp_action *);
102static void zfcp_erp_action_cleanup(int, struct zfcp_adapter *, 106static void zfcp_erp_action_cleanup(int, struct zfcp_adapter *,
103 struct zfcp_port *, struct zfcp_unit *, 107 struct zfcp_port *, struct zfcp_unit *,
@@ -179,7 +183,7 @@ static void zfcp_close_fsf(struct zfcp_adapter *adapter)
179static void zfcp_fsf_request_timeout_handler(unsigned long data) 183static void zfcp_fsf_request_timeout_handler(unsigned long data)
180{ 184{
181 struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; 185 struct zfcp_adapter *adapter = (struct zfcp_adapter *) data;
182 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED); 186 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 62, 0);
183} 187}
184 188
185void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout) 189void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout)
@@ -200,8 +204,8 @@ 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 */
203static int 207static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter,
204zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter, int clear_mask) 208 int clear_mask, u8 id, u64 ref)
205{ 209{
206 int retval; 210 int retval;
207 211
@@ -221,7 +225,7 @@ zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter, int clear_mask)
221 goto out; 225 goto out;
222 } 226 }
223 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, 227 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER,
224 adapter, NULL, NULL); 228 adapter, NULL, NULL, id, ref);
225 229
226 out: 230 out:
227 return retval; 231 return retval;
@@ -236,56 +240,56 @@ zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter, int clear_mask)
236 * returns: 0 - initiated action successfully 240 * returns: 0 - initiated action successfully
237 * <0 - failed to initiate action 241 * <0 - failed to initiate action
238 */ 242 */
239int 243int zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear_mask,
240zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear_mask) 244 u8 id, u64 ref)
241{ 245{
242 int retval; 246 int retval;
243 unsigned long flags; 247 unsigned long flags;
244 248
245 read_lock_irqsave(&zfcp_data.config_lock, flags); 249 read_lock_irqsave(&zfcp_data.config_lock, flags);
246 write_lock(&adapter->erp_lock); 250 write_lock(&adapter->erp_lock);
247 retval = zfcp_erp_adapter_reopen_internal(adapter, clear_mask); 251 retval = zfcp_erp_adapter_reopen_internal(adapter, clear_mask, id, ref);
248 write_unlock(&adapter->erp_lock); 252 write_unlock(&adapter->erp_lock);
249 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 253 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
250 254
251 return retval; 255 return retval;
252} 256}
253 257
254int 258int zfcp_erp_adapter_shutdown(struct zfcp_adapter *adapter, int clear_mask,
255zfcp_erp_adapter_shutdown(struct zfcp_adapter *adapter, int clear_mask) 259 u8 id, u64 ref)
256{ 260{
257 int retval; 261 int retval;
258 262
259 retval = zfcp_erp_adapter_reopen(adapter, 263 retval = zfcp_erp_adapter_reopen(adapter,
260 ZFCP_STATUS_COMMON_RUNNING | 264 ZFCP_STATUS_COMMON_RUNNING |
261 ZFCP_STATUS_COMMON_ERP_FAILED | 265 ZFCP_STATUS_COMMON_ERP_FAILED |
262 clear_mask); 266 clear_mask, id, ref);
263 267
264 return retval; 268 return retval;
265} 269}
266 270
267int 271int zfcp_erp_port_shutdown(struct zfcp_port *port, int clear_mask, u8 id,
268zfcp_erp_port_shutdown(struct zfcp_port *port, int clear_mask) 272 u64 ref)
269{ 273{
270 int retval; 274 int retval;
271 275
272 retval = zfcp_erp_port_reopen(port, 276 retval = zfcp_erp_port_reopen(port,
273 ZFCP_STATUS_COMMON_RUNNING | 277 ZFCP_STATUS_COMMON_RUNNING |
274 ZFCP_STATUS_COMMON_ERP_FAILED | 278 ZFCP_STATUS_COMMON_ERP_FAILED |
275 clear_mask); 279 clear_mask, id, ref);
276 280
277 return retval; 281 return retval;
278} 282}
279 283
280int 284int zfcp_erp_unit_shutdown(struct zfcp_unit *unit, int clear_mask, u8 id,
281zfcp_erp_unit_shutdown(struct zfcp_unit *unit, int clear_mask) 285 u64 ref)
282{ 286{
283 int retval; 287 int retval;
284 288
285 retval = zfcp_erp_unit_reopen(unit, 289 retval = zfcp_erp_unit_reopen(unit,
286 ZFCP_STATUS_COMMON_RUNNING | 290 ZFCP_STATUS_COMMON_RUNNING |
287 ZFCP_STATUS_COMMON_ERP_FAILED | 291 ZFCP_STATUS_COMMON_ERP_FAILED |
288 clear_mask); 292 clear_mask, id, ref);
289 293
290 return retval; 294 return retval;
291} 295}
@@ -400,7 +404,7 @@ zfcp_erp_adisc_handler(unsigned long data)
400 "(adapter %s, port d_id=0x%06x)\n", 404 "(adapter %s, port d_id=0x%06x)\n",
401 zfcp_get_busid_by_adapter(adapter), d_id); 405 zfcp_get_busid_by_adapter(adapter), d_id);
402 debug_text_event(adapter->erp_dbf, 3, "forcreop"); 406 debug_text_event(adapter->erp_dbf, 3, "forcreop");
403 if (zfcp_erp_port_forced_reopen(port, 0)) 407 if (zfcp_erp_port_forced_reopen(port, 0, 63, 0))
404 ZFCP_LOG_NORMAL("failed reopen of port " 408 ZFCP_LOG_NORMAL("failed reopen of port "
405 "(adapter %s, wwpn=0x%016Lx)\n", 409 "(adapter %s, wwpn=0x%016Lx)\n",
406 zfcp_get_busid_by_port(port), 410 zfcp_get_busid_by_port(port),
@@ -427,7 +431,7 @@ zfcp_erp_adisc_handler(unsigned long data)
427 "adisc_resp_wwpn=0x%016Lx)\n", 431 "adisc_resp_wwpn=0x%016Lx)\n",
428 zfcp_get_busid_by_port(port), 432 zfcp_get_busid_by_port(port),
429 port->wwpn, (wwn_t) adisc->wwpn); 433 port->wwpn, (wwn_t) adisc->wwpn);
430 if (zfcp_erp_port_reopen(port, 0)) 434 if (zfcp_erp_port_reopen(port, 0, 64, 0))
431 ZFCP_LOG_NORMAL("failed reopen of port " 435 ZFCP_LOG_NORMAL("failed reopen of port "
432 "(adapter %s, wwpn=0x%016Lx)\n", 436 "(adapter %s, wwpn=0x%016Lx)\n",
433 zfcp_get_busid_by_port(port), 437 zfcp_get_busid_by_port(port),
@@ -461,7 +465,7 @@ zfcp_test_link(struct zfcp_port *port)
461 ZFCP_LOG_NORMAL("reopen needed for port 0x%016Lx " 465 ZFCP_LOG_NORMAL("reopen needed for port 0x%016Lx "
462 "on adapter %s\n ", port->wwpn, 466 "on adapter %s\n ", port->wwpn,
463 zfcp_get_busid_by_port(port)); 467 zfcp_get_busid_by_port(port));
464 retval = zfcp_erp_port_forced_reopen(port, 0); 468 retval = zfcp_erp_port_forced_reopen(port, 0, 65, 0);
465 if (retval != 0) { 469 if (retval != 0) {
466 ZFCP_LOG_NORMAL("reopen of remote port 0x%016Lx " 470 ZFCP_LOG_NORMAL("reopen of remote port 0x%016Lx "
467 "on adapter %s failed\n", port->wwpn, 471 "on adapter %s failed\n", port->wwpn,
@@ -484,8 +488,8 @@ zfcp_test_link(struct zfcp_port *port)
484 * returns: 0 - initiated action successfully 488 * returns: 0 - initiated action successfully
485 * <0 - failed to initiate action 489 * <0 - failed to initiate action
486 */ 490 */
487static int 491static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port,
488zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port, int clear_mask) 492 int clear_mask, u8 id, u64 ref)
489{ 493{
490 int retval; 494 int retval;
491 struct zfcp_adapter *adapter = port->adapter; 495 struct zfcp_adapter *adapter = port->adapter;
@@ -509,7 +513,7 @@ zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port, int clear_mask)
509 } 513 }
510 514
511 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT_FORCED, 515 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
512 port->adapter, port, NULL); 516 port->adapter, port, NULL, id, ref);
513 517
514 out: 518 out:
515 return retval; 519 return retval;
@@ -524,8 +528,8 @@ zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port, int clear_mask)
524 * returns: 0 - initiated action successfully 528 * returns: 0 - initiated action successfully
525 * <0 - failed to initiate action 529 * <0 - failed to initiate action
526 */ 530 */
527int 531int zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear_mask, u8 id,
528zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear_mask) 532 u64 ref)
529{ 533{
530 int retval; 534 int retval;
531 unsigned long flags; 535 unsigned long flags;
@@ -534,7 +538,8 @@ zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear_mask)
534 adapter = port->adapter; 538 adapter = port->adapter;
535 read_lock_irqsave(&zfcp_data.config_lock, flags); 539 read_lock_irqsave(&zfcp_data.config_lock, flags);
536 write_lock(&adapter->erp_lock); 540 write_lock(&adapter->erp_lock);
537 retval = zfcp_erp_port_forced_reopen_internal(port, clear_mask); 541 retval = zfcp_erp_port_forced_reopen_internal(port, clear_mask, id,
542 ref);
538 write_unlock(&adapter->erp_lock); 543 write_unlock(&adapter->erp_lock);
539 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 544 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
540 545
@@ -551,8 +556,8 @@ zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear_mask)
551 * returns: 0 - initiated action successfully 556 * returns: 0 - initiated action successfully
552 * <0 - failed to initiate action 557 * <0 - failed to initiate action
553 */ 558 */
554static int 559static int zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask,
555zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask) 560 u8 id, u64 ref)
556{ 561{
557 int retval; 562 int retval;
558 struct zfcp_adapter *adapter = port->adapter; 563 struct zfcp_adapter *adapter = port->adapter;
@@ -578,7 +583,7 @@ zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask)
578 } 583 }
579 584
580 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT, 585 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT,
581 port->adapter, port, NULL); 586 port->adapter, port, NULL, id, ref);
582 587
583 out: 588 out:
584 return retval; 589 return retval;
@@ -594,8 +599,7 @@ 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. 599 * 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. 600 * To wait for the completion of the reopen zfcp_erp_wait should be used.
596 */ 601 */
597int 602int zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask, u8 id, u64 ref)
598zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask)
599{ 603{
600 int retval; 604 int retval;
601 unsigned long flags; 605 unsigned long flags;
@@ -603,7 +607,7 @@ zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask)
603 607
604 read_lock_irqsave(&zfcp_data.config_lock, flags); 608 read_lock_irqsave(&zfcp_data.config_lock, flags);
605 write_lock(&adapter->erp_lock); 609 write_lock(&adapter->erp_lock);
606 retval = zfcp_erp_port_reopen_internal(port, clear_mask); 610 retval = zfcp_erp_port_reopen_internal(port, clear_mask, id, ref);
607 write_unlock(&adapter->erp_lock); 611 write_unlock(&adapter->erp_lock);
608 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 612 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
609 613
@@ -620,8 +624,8 @@ zfcp_erp_port_reopen(struct zfcp_port *port, int clear_mask)
620 * returns: 0 - initiated action successfully 624 * returns: 0 - initiated action successfully
621 * <0 - failed to initiate action 625 * <0 - failed to initiate action
622 */ 626 */
623static int 627static int zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask,
624zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask) 628 u8 id, u64 ref)
625{ 629{
626 int retval; 630 int retval;
627 struct zfcp_adapter *adapter = unit->port->adapter; 631 struct zfcp_adapter *adapter = unit->port->adapter;
@@ -647,7 +651,7 @@ zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask)
647 } 651 }
648 652
649 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_UNIT, 653 retval = zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_UNIT,
650 unit->port->adapter, unit->port, unit); 654 adapter, unit->port, unit, id, ref);
651 out: 655 out:
652 return retval; 656 return retval;
653} 657}
@@ -662,8 +666,7 @@ zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask)
662 * locking. An error recovery task is initiated to do the reopen. 666 * 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. 667 * To wait for the completion of the reopen zfcp_erp_wait should be used.
664 */ 668 */
665int 669int zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear_mask, u8 id, u64 ref)
666zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear_mask)
667{ 670{
668 int retval; 671 int retval;
669 unsigned long flags; 672 unsigned long flags;
@@ -675,7 +678,7 @@ zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear_mask)
675 678
676 read_lock_irqsave(&zfcp_data.config_lock, flags); 679 read_lock_irqsave(&zfcp_data.config_lock, flags);
677 write_lock(&adapter->erp_lock); 680 write_lock(&adapter->erp_lock);
678 retval = zfcp_erp_unit_reopen_internal(unit, clear_mask); 681 retval = zfcp_erp_unit_reopen_internal(unit, clear_mask, id, ref);
679 write_unlock(&adapter->erp_lock); 682 write_unlock(&adapter->erp_lock);
680 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 683 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
681 684
@@ -1215,7 +1218,7 @@ zfcp_erp_strategy(struct zfcp_erp_action *erp_action)
1215 "restarting I/O on adapter %s " 1218 "restarting I/O on adapter %s "
1216 "to free mempool\n", 1219 "to free mempool\n",
1217 zfcp_get_busid_by_adapter(adapter)); 1220 zfcp_get_busid_by_adapter(adapter));
1218 zfcp_erp_adapter_reopen_internal(adapter, 0); 1221 zfcp_erp_adapter_reopen_internal(adapter, 0, 66, 0);
1219 } else { 1222 } else {
1220 debug_text_event(adapter->erp_dbf, 2, "a_st_memw"); 1223 debug_text_event(adapter->erp_dbf, 2, "a_st_memw");
1221 retval = zfcp_erp_strategy_memwait(erp_action); 1224 retval = zfcp_erp_strategy_memwait(erp_action);
@@ -1499,7 +1502,9 @@ zfcp_erp_strategy_statechange(int action,
1499 case ZFCP_ERP_ACTION_REOPEN_ADAPTER: 1502 case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
1500 if (zfcp_erp_strategy_statechange_detected(&adapter->status, 1503 if (zfcp_erp_strategy_statechange_detected(&adapter->status,
1501 status)) { 1504 status)) {
1502 zfcp_erp_adapter_reopen_internal(adapter, ZFCP_STATUS_COMMON_ERP_FAILED); 1505 zfcp_erp_adapter_reopen_internal(adapter,
1506 ZFCP_STATUS_COMMON_ERP_FAILED,
1507 67, 0);
1503 retval = ZFCP_ERP_EXIT; 1508 retval = ZFCP_ERP_EXIT;
1504 } 1509 }
1505 break; 1510 break;
@@ -1508,7 +1513,9 @@ zfcp_erp_strategy_statechange(int action,
1508 case ZFCP_ERP_ACTION_REOPEN_PORT: 1513 case ZFCP_ERP_ACTION_REOPEN_PORT:
1509 if (zfcp_erp_strategy_statechange_detected(&port->status, 1514 if (zfcp_erp_strategy_statechange_detected(&port->status,
1510 status)) { 1515 status)) {
1511 zfcp_erp_port_reopen_internal(port, ZFCP_STATUS_COMMON_ERP_FAILED); 1516 zfcp_erp_port_reopen_internal(port,
1517 ZFCP_STATUS_COMMON_ERP_FAILED,
1518 68, 0);
1512 retval = ZFCP_ERP_EXIT; 1519 retval = ZFCP_ERP_EXIT;
1513 } 1520 }
1514 break; 1521 break;
@@ -1516,7 +1523,9 @@ zfcp_erp_strategy_statechange(int action,
1516 case ZFCP_ERP_ACTION_REOPEN_UNIT: 1523 case ZFCP_ERP_ACTION_REOPEN_UNIT:
1517 if (zfcp_erp_strategy_statechange_detected(&unit->status, 1524 if (zfcp_erp_strategy_statechange_detected(&unit->status,
1518 status)) { 1525 status)) {
1519 zfcp_erp_unit_reopen_internal(unit, ZFCP_STATUS_COMMON_ERP_FAILED); 1526 zfcp_erp_unit_reopen_internal(unit,
1527 ZFCP_STATUS_COMMON_ERP_FAILED,
1528 69, 0);
1520 retval = ZFCP_ERP_EXIT; 1529 retval = ZFCP_ERP_EXIT;
1521 } 1530 }
1522 break; 1531 break;
@@ -1700,29 +1709,29 @@ zfcp_erp_strategy_followup_actions(int action,
1700 1709
1701 case ZFCP_ERP_ACTION_REOPEN_ADAPTER: 1710 case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
1702 if (status == ZFCP_ERP_SUCCEEDED) 1711 if (status == ZFCP_ERP_SUCCEEDED)
1703 zfcp_erp_port_reopen_all_internal(adapter, 0); 1712 zfcp_erp_port_reopen_all_internal(adapter, 0, 70, 0);
1704 else 1713 else
1705 zfcp_erp_adapter_reopen_internal(adapter, 0); 1714 zfcp_erp_adapter_reopen_internal(adapter, 0, 71, 0);
1706 break; 1715 break;
1707 1716
1708 case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: 1717 case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
1709 if (status == ZFCP_ERP_SUCCEEDED) 1718 if (status == ZFCP_ERP_SUCCEEDED)
1710 zfcp_erp_port_reopen_internal(port, 0); 1719 zfcp_erp_port_reopen_internal(port, 0, 72, 0);
1711 else 1720 else
1712 zfcp_erp_adapter_reopen_internal(adapter, 0); 1721 zfcp_erp_adapter_reopen_internal(adapter, 0, 73, 0);
1713 break; 1722 break;
1714 1723
1715 case ZFCP_ERP_ACTION_REOPEN_PORT: 1724 case ZFCP_ERP_ACTION_REOPEN_PORT:
1716 if (status == ZFCP_ERP_SUCCEEDED) 1725 if (status == ZFCP_ERP_SUCCEEDED)
1717 zfcp_erp_unit_reopen_all_internal(port, 0); 1726 zfcp_erp_unit_reopen_all_internal(port, 0, 74, 0);
1718 else 1727 else
1719 zfcp_erp_port_forced_reopen_internal(port, 0); 1728 zfcp_erp_port_forced_reopen_internal(port, 0, 75, 0);
1720 break; 1729 break;
1721 1730
1722 case ZFCP_ERP_ACTION_REOPEN_UNIT: 1731 case ZFCP_ERP_ACTION_REOPEN_UNIT:
1723 /* Nothing to do if status == ZFCP_ERP_SUCCEEDED */ 1732 /* Nothing to do if status == ZFCP_ERP_SUCCEEDED */
1724 if (status != ZFCP_ERP_SUCCEEDED) 1733 if (status != ZFCP_ERP_SUCCEEDED)
1725 zfcp_erp_port_reopen_internal(unit->port, 0); 1734 zfcp_erp_port_reopen_internal(unit->port, 0, 76, 0);
1726 break; 1735 break;
1727 } 1736 }
1728 1737
@@ -1863,30 +1872,32 @@ void zfcp_erp_modify_unit_status(struct zfcp_unit *unit, u8 id, u64 ref,
1863 * returns: 0 - initiated action successfully 1872 * returns: 0 - initiated action successfully
1864 * <0 - failed to initiate action 1873 * <0 - failed to initiate action
1865 */ 1874 */
1866int 1875int zfcp_erp_port_reopen_all(struct zfcp_adapter *adapter, int clear_mask,
1867zfcp_erp_port_reopen_all(struct zfcp_adapter *adapter, int clear_mask) 1876 u8 id, u64 ref)
1868{ 1877{
1869 int retval; 1878 int retval;
1870 unsigned long flags; 1879 unsigned long flags;
1871 1880
1872 read_lock_irqsave(&zfcp_data.config_lock, flags); 1881 read_lock_irqsave(&zfcp_data.config_lock, flags);
1873 write_lock(&adapter->erp_lock); 1882 write_lock(&adapter->erp_lock);
1874 retval = zfcp_erp_port_reopen_all_internal(adapter, clear_mask); 1883 retval = zfcp_erp_port_reopen_all_internal(adapter, clear_mask, id,
1884 ref);
1875 write_unlock(&adapter->erp_lock); 1885 write_unlock(&adapter->erp_lock);
1876 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 1886 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
1877 1887
1878 return retval; 1888 return retval;
1879} 1889}
1880 1890
1881static int 1891static int zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *adapter,
1882zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *adapter, int clear_mask) 1892 int clear_mask, u8 id, u64 ref)
1883{ 1893{
1884 int retval = 0; 1894 int retval = 0;
1885 struct zfcp_port *port; 1895 struct zfcp_port *port;
1886 1896
1887 list_for_each_entry(port, &adapter->port_list_head, list) 1897 list_for_each_entry(port, &adapter->port_list_head, list)
1888 if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) 1898 if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
1889 zfcp_erp_port_reopen_internal(port, clear_mask); 1899 zfcp_erp_port_reopen_internal(port, clear_mask, id,
1900 ref);
1890 1901
1891 return retval; 1902 return retval;
1892} 1903}
@@ -1898,14 +1909,14 @@ zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *adapter, int clear_mask)
1898 * 1909 *
1899 * returns: FIXME 1910 * returns: FIXME
1900 */ 1911 */
1901static int 1912static int zfcp_erp_unit_reopen_all_internal(struct zfcp_port *port,
1902zfcp_erp_unit_reopen_all_internal(struct zfcp_port *port, int clear_mask) 1913 int clear_mask, u8 id, u64 ref)
1903{ 1914{
1904 int retval = 0; 1915 int retval = 0;
1905 struct zfcp_unit *unit; 1916 struct zfcp_unit *unit;
1906 1917
1907 list_for_each_entry(unit, &port->unit_list_head, list) 1918 list_for_each_entry(unit, &port->unit_list_head, list)
1908 zfcp_erp_unit_reopen_internal(unit, clear_mask); 1919 zfcp_erp_unit_reopen_internal(unit, clear_mask, id, ref);
1909 1920
1910 return retval; 1921 return retval;
1911} 1922}
@@ -2466,8 +2477,8 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
2466 /* nameserver port may live again */ 2477 /* nameserver port may live again */
2467 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, 2478 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING,
2468 &adapter->nameserver_port->status); 2479 &adapter->nameserver_port->status);
2469 if (zfcp_erp_port_reopen(adapter->nameserver_port, 0) 2480 if (zfcp_erp_port_reopen(adapter->nameserver_port, 0,
2470 >= 0) { 2481 77, (u64)erp_action) >= 0) {
2471 erp_action->step = 2482 erp_action->step =
2472 ZFCP_ERP_STEP_NAMESERVER_OPEN; 2483 ZFCP_ERP_STEP_NAMESERVER_OPEN;
2473 retval = ZFCP_ERP_CONTINUES; 2484 retval = ZFCP_ERP_CONTINUES;
@@ -2963,14 +2974,12 @@ void zfcp_erp_start_timer(struct zfcp_fsf_req *fsf_req)
2963 * 2974 *
2964 * returns: 2975 * returns:
2965 */ 2976 */
2966static int 2977static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
2967zfcp_erp_action_enqueue(int action, 2978 struct zfcp_port *port,
2968 struct zfcp_adapter *adapter, 2979 struct zfcp_unit *unit, u8 id, u64 ref)
2969 struct zfcp_port *port, struct zfcp_unit *unit)
2970{ 2980{
2971 int retval = 1; 2981 int retval = 1, need = want;
2972 struct zfcp_erp_action *erp_action = NULL; 2982 struct zfcp_erp_action *erp_action = NULL;
2973 int stronger_action = 0;
2974 u32 status = 0; 2983 u32 status = 0;
2975 2984
2976 /* 2985 /*
@@ -2989,9 +2998,9 @@ zfcp_erp_action_enqueue(int action,
2989 &adapter->status)) 2998 &adapter->status))
2990 return -EIO; 2999 return -EIO;
2991 3000
2992 debug_event(adapter->erp_dbf, 4, &action, sizeof (int)); 3001 debug_event(adapter->erp_dbf, 4, &want, sizeof (int));
2993 /* check whether we really need this */ 3002 /* check whether we really need this */
2994 switch (action) { 3003 switch (want) {
2995 case ZFCP_ERP_ACTION_REOPEN_UNIT: 3004 case ZFCP_ERP_ACTION_REOPEN_UNIT:
2996 if (atomic_test_mask 3005 if (atomic_test_mask
2997 (ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status)) { 3006 (ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status)) {
@@ -3009,10 +3018,8 @@ zfcp_erp_action_enqueue(int action,
3009 goto out; 3018 goto out;
3010 } 3019 }
3011 if (!atomic_test_mask 3020 if (!atomic_test_mask
3012 (ZFCP_STATUS_COMMON_UNBLOCKED, &port->status)) { 3021 (ZFCP_STATUS_COMMON_UNBLOCKED, &port->status))
3013 stronger_action = ZFCP_ERP_ACTION_REOPEN_PORT; 3022 need = ZFCP_ERP_ACTION_REOPEN_PORT;
3014 unit = NULL;
3015 }
3016 /* fall through !!! */ 3023 /* fall through !!! */
3017 3024
3018 case ZFCP_ERP_ACTION_REOPEN_PORT: 3025 case ZFCP_ERP_ACTION_REOPEN_PORT:
@@ -3032,7 +3039,7 @@ zfcp_erp_action_enqueue(int action,
3032 ZFCP_ERP_ACTION_REOPEN_PORT_FORCED) { 3039 ZFCP_ERP_ACTION_REOPEN_PORT_FORCED) {
3033 ZFCP_LOG_INFO("dropped erp action %i (port " 3040 ZFCP_LOG_INFO("dropped erp action %i (port "
3034 "0x%016Lx, action in use: %i)\n", 3041 "0x%016Lx, action in use: %i)\n",
3035 action, port->wwpn, 3042 want, port->wwpn,
3036 port->erp_action.action); 3043 port->erp_action.action);
3037 debug_text_event(adapter->erp_dbf, 4, 3044 debug_text_event(adapter->erp_dbf, 4,
3038 "pf_actenq_drp"); 3045 "pf_actenq_drp");
@@ -3050,10 +3057,8 @@ zfcp_erp_action_enqueue(int action,
3050 goto out; 3057 goto out;
3051 } 3058 }
3052 if (!atomic_test_mask 3059 if (!atomic_test_mask
3053 (ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status)) { 3060 (ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status))
3054 stronger_action = ZFCP_ERP_ACTION_REOPEN_ADAPTER; 3061 need = ZFCP_ERP_ACTION_REOPEN_ADAPTER;
3055 port = NULL;
3056 }
3057 /* fall through !!! */ 3062 /* fall through !!! */
3058 3063
3059 case ZFCP_ERP_ACTION_REOPEN_ADAPTER: 3064 case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
@@ -3066,30 +3071,28 @@ zfcp_erp_action_enqueue(int action,
3066 3071
3067 default: 3072 default:
3068 debug_text_exception(adapter->erp_dbf, 1, "a_actenq_bug"); 3073 debug_text_exception(adapter->erp_dbf, 1, "a_actenq_bug");
3069 debug_event(adapter->erp_dbf, 1, &action, sizeof (int)); 3074 debug_event(adapter->erp_dbf, 1, &want, sizeof (int));
3070 ZFCP_LOG_NORMAL("bug: unknown erp action requested " 3075 ZFCP_LOG_NORMAL("bug: unknown erp action requested "
3071 "on adapter %s (action=%d)\n", 3076 "on adapter %s (action=%d)\n",
3072 zfcp_get_busid_by_adapter(adapter), action); 3077 zfcp_get_busid_by_adapter(adapter), want);
3073 goto out; 3078 goto out;
3074 } 3079 }
3075 3080
3076 /* check whether we need something stronger first */ 3081 /* check whether we need something stronger first */
3077 if (stronger_action) { 3082 if (need) {
3078 debug_text_event(adapter->erp_dbf, 4, "a_actenq_str"); 3083 debug_text_event(adapter->erp_dbf, 4, "a_actenq_str");
3079 debug_event(adapter->erp_dbf, 4, &stronger_action, 3084 debug_event(adapter->erp_dbf, 4, &need,
3080 sizeof (int)); 3085 sizeof (int));
3081 ZFCP_LOG_DEBUG("stronger erp action %d needed before " 3086 ZFCP_LOG_DEBUG("stronger erp action %d needed before "
3082 "erp action %d on adapter %s\n", 3087 "erp action %d on adapter %s\n",
3083 stronger_action, action, 3088 need, want, zfcp_get_busid_by_adapter(adapter));
3084 zfcp_get_busid_by_adapter(adapter));
3085 action = stronger_action;
3086 } 3089 }
3087 3090
3088 /* mark adapter to have some error recovery pending */ 3091 /* mark adapter to have some error recovery pending */
3089 atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status); 3092 atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status);
3090 3093
3091 /* setup error recovery action */ 3094 /* setup error recovery action */
3092 switch (action) { 3095 switch (need) {
3093 3096
3094 case ZFCP_ERP_ACTION_REOPEN_UNIT: 3097 case ZFCP_ERP_ACTION_REOPEN_UNIT:
3095 zfcp_unit_get(unit); 3098 zfcp_unit_get(unit);
@@ -3128,7 +3131,7 @@ zfcp_erp_action_enqueue(int action,
3128 erp_action->adapter = adapter; 3131 erp_action->adapter = adapter;
3129 erp_action->port = port; 3132 erp_action->port = port;
3130 erp_action->unit = unit; 3133 erp_action->unit = unit;
3131 erp_action->action = action; 3134 erp_action->action = need;
3132 erp_action->status = status; 3135 erp_action->status = status;
3133 3136
3134 ++adapter->erp_total_count; 3137 ++adapter->erp_total_count;
@@ -3139,6 +3142,8 @@ zfcp_erp_action_enqueue(int action,
3139 zfcp_rec_dbf_event_thread(1, adapter, 0); 3142 zfcp_rec_dbf_event_thread(1, adapter, 0);
3140 retval = 0; 3143 retval = 0;
3141 out: 3144 out:
3145 zfcp_rec_dbf_event_trigger(id, ref, want, need, (u64)erp_action,
3146 adapter, port, unit);
3142 return retval; 3147 return retval;
3143} 3148}
3144 3149
@@ -3322,7 +3327,7 @@ void zfcp_erp_port_boxed(struct zfcp_port *port, u8 id, u64 ref)
3322 zfcp_erp_modify_port_status(port, id, ref, 3327 zfcp_erp_modify_port_status(port, id, ref,
3323 ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET); 3328 ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET);
3324 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 3329 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
3325 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED); 3330 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
3326} 3331}
3327 3332
3328void zfcp_erp_unit_boxed(struct zfcp_unit *unit, u8 id, u64 ref) 3333void zfcp_erp_unit_boxed(struct zfcp_unit *unit, u8 id, u64 ref)
@@ -3333,7 +3338,7 @@ void zfcp_erp_unit_boxed(struct zfcp_unit *unit, u8 id, u64 ref)
3333 debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t)); 3338 debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t));
3334 zfcp_erp_modify_unit_status(unit, id, ref, 3339 zfcp_erp_modify_unit_status(unit, id, ref,
3335 ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET); 3340 ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET);
3336 zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED); 3341 zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
3337} 3342}
3338 3343
3339void zfcp_erp_port_access_denied(struct zfcp_port *port, u8 id, u64 ref) 3344void zfcp_erp_port_access_denied(struct zfcp_port *port, u8 id, u64 ref)
@@ -3361,8 +3366,8 @@ void zfcp_erp_unit_access_denied(struct zfcp_unit *unit, u8 id, u64 ref)
3361 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); 3366 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
3362} 3367}
3363 3368
3364void 3369void zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter, u8 id,
3365zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter) 3370 u64 ref)
3366{ 3371{
3367 struct zfcp_port *port; 3372 struct zfcp_port *port;
3368 unsigned long flags; 3373 unsigned long flags;
@@ -3375,15 +3380,14 @@ zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter)
3375 3380
3376 read_lock_irqsave(&zfcp_data.config_lock, flags); 3381 read_lock_irqsave(&zfcp_data.config_lock, flags);
3377 if (adapter->nameserver_port) 3382 if (adapter->nameserver_port)
3378 zfcp_erp_port_access_changed(adapter->nameserver_port); 3383 zfcp_erp_port_access_changed(adapter->nameserver_port, id, ref);
3379 list_for_each_entry(port, &adapter->port_list_head, list) 3384 list_for_each_entry(port, &adapter->port_list_head, list)
3380 if (port != adapter->nameserver_port) 3385 if (port != adapter->nameserver_port)
3381 zfcp_erp_port_access_changed(port); 3386 zfcp_erp_port_access_changed(port, id, ref);
3382 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 3387 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
3383} 3388}
3384 3389
3385void 3390void zfcp_erp_port_access_changed(struct zfcp_port *port, u8 id, u64 ref)
3386zfcp_erp_port_access_changed(struct zfcp_port *port)
3387{ 3391{
3388 struct zfcp_adapter *adapter = port->adapter; 3392 struct zfcp_adapter *adapter = port->adapter;
3389 struct zfcp_unit *unit; 3393 struct zfcp_unit *unit;
@@ -3397,21 +3401,20 @@ zfcp_erp_port_access_changed(struct zfcp_port *port)
3397 &port->status)) { 3401 &port->status)) {
3398 if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) 3402 if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
3399 list_for_each_entry(unit, &port->unit_list_head, list) 3403 list_for_each_entry(unit, &port->unit_list_head, list)
3400 zfcp_erp_unit_access_changed(unit); 3404 zfcp_erp_unit_access_changed(unit, id, ref);
3401 return; 3405 return;
3402 } 3406 }
3403 3407
3404 ZFCP_LOG_NORMAL("reopen of port 0x%016Lx on adapter %s " 3408 ZFCP_LOG_NORMAL("reopen of port 0x%016Lx on adapter %s "
3405 "(due to ACT update)\n", 3409 "(due to ACT update)\n",
3406 port->wwpn, zfcp_get_busid_by_adapter(adapter)); 3410 port->wwpn, zfcp_get_busid_by_adapter(adapter));
3407 if (zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED) != 0) 3411 if (zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref))
3408 ZFCP_LOG_NORMAL("failed reopen of port" 3412 ZFCP_LOG_NORMAL("failed reopen of port"
3409 "(adapter %s, wwpn=0x%016Lx)\n", 3413 "(adapter %s, wwpn=0x%016Lx)\n",
3410 zfcp_get_busid_by_adapter(adapter), port->wwpn); 3414 zfcp_get_busid_by_adapter(adapter), port->wwpn);
3411} 3415}
3412 3416
3413void 3417void zfcp_erp_unit_access_changed(struct zfcp_unit *unit, u8 id, u64 ref)
3414zfcp_erp_unit_access_changed(struct zfcp_unit *unit)
3415{ 3418{
3416 struct zfcp_adapter *adapter = unit->port->adapter; 3419 struct zfcp_adapter *adapter = unit->port->adapter;
3417 3420
@@ -3428,7 +3431,7 @@ zfcp_erp_unit_access_changed(struct zfcp_unit *unit)
3428 " on adapter %s (due to ACT update)\n", 3431 " on adapter %s (due to ACT update)\n",
3429 unit->fcp_lun, unit->port->wwpn, 3432 unit->fcp_lun, unit->port->wwpn,
3430 zfcp_get_busid_by_adapter(adapter)); 3433 zfcp_get_busid_by_adapter(adapter));
3431 if (zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED) != 0) 3434 if (zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref))
3432 ZFCP_LOG_NORMAL("failed reopen of unit (adapter %s, " 3435 ZFCP_LOG_NORMAL("failed reopen of unit (adapter %s, "
3433 "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n", 3436 "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n",
3434 zfcp_get_busid_by_adapter(adapter), 3437 zfcp_get_busid_by_adapter(adapter),
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 20ad6fde2e22..e10ed145baa7 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -133,20 +133,20 @@ extern struct fc_function_template zfcp_transport_functions;
133/******************************** ERP ****************************************/ 133/******************************** ERP ****************************************/
134extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, u8, u64, u32, 134extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, u8, u64, u32,
135 int); 135 int);
136extern int zfcp_erp_adapter_reopen(struct zfcp_adapter *, int); 136extern int zfcp_erp_adapter_reopen(struct zfcp_adapter *, int, u8, u64);
137extern int zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int); 137extern int zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int, u8, u64);
138extern void zfcp_erp_adapter_failed(struct zfcp_adapter *, u8, u64); 138extern void zfcp_erp_adapter_failed(struct zfcp_adapter *, u8, u64);
139 139
140extern void zfcp_erp_modify_port_status(struct zfcp_port *, u8, u64, u32, int); 140extern void zfcp_erp_modify_port_status(struct zfcp_port *, u8, u64, u32, int);
141extern int zfcp_erp_port_reopen(struct zfcp_port *, int); 141extern int zfcp_erp_port_reopen(struct zfcp_port *, int, u8, u64);
142extern int zfcp_erp_port_shutdown(struct zfcp_port *, int); 142extern int zfcp_erp_port_shutdown(struct zfcp_port *, int, u8, u64);
143extern int zfcp_erp_port_forced_reopen(struct zfcp_port *, int); 143extern int zfcp_erp_port_forced_reopen(struct zfcp_port *, int, u8, u64);
144extern void zfcp_erp_port_failed(struct zfcp_port *, u8, u64); 144extern void zfcp_erp_port_failed(struct zfcp_port *, u8, u64);
145extern int zfcp_erp_port_reopen_all(struct zfcp_adapter *, int); 145extern int zfcp_erp_port_reopen_all(struct zfcp_adapter *, int, u8, u64);
146 146
147extern void zfcp_erp_modify_unit_status(struct zfcp_unit *, u8, u64, u32, int); 147extern void zfcp_erp_modify_unit_status(struct zfcp_unit *, u8, u64, u32, int);
148extern int zfcp_erp_unit_reopen(struct zfcp_unit *, int); 148extern int zfcp_erp_unit_reopen(struct zfcp_unit *, int, u8, u64);
149extern int zfcp_erp_unit_shutdown(struct zfcp_unit *, int); 149extern int zfcp_erp_unit_shutdown(struct zfcp_unit *, int, u8, u64);
150extern void zfcp_erp_unit_failed(struct zfcp_unit *, u8, u64); 150extern void zfcp_erp_unit_failed(struct zfcp_unit *, u8, u64);
151 151
152extern int zfcp_erp_thread_setup(struct zfcp_adapter *); 152extern int zfcp_erp_thread_setup(struct zfcp_adapter *);
@@ -160,9 +160,9 @@ extern void zfcp_erp_port_boxed(struct zfcp_port *, u8 id, u64 ref);
160extern void zfcp_erp_unit_boxed(struct zfcp_unit *, u8 id, u64 ref); 160extern void zfcp_erp_unit_boxed(struct zfcp_unit *, u8 id, u64 ref);
161extern void zfcp_erp_port_access_denied(struct zfcp_port *, u8 id, u64 ref); 161extern void zfcp_erp_port_access_denied(struct zfcp_port *, u8 id, u64 ref);
162extern void zfcp_erp_unit_access_denied(struct zfcp_unit *, u8 id, u64 ref); 162extern void zfcp_erp_unit_access_denied(struct zfcp_unit *, u8 id, u64 ref);
163extern void zfcp_erp_adapter_access_changed(struct zfcp_adapter *); 163extern void zfcp_erp_adapter_access_changed(struct zfcp_adapter *, u8, u64);
164extern void zfcp_erp_port_access_changed(struct zfcp_port *); 164extern void zfcp_erp_port_access_changed(struct zfcp_port *, u8, u64);
165extern void zfcp_erp_unit_access_changed(struct zfcp_unit *); 165extern void zfcp_erp_unit_access_changed(struct zfcp_unit *, u8, u64);
166 166
167/******************************** AUX ****************************************/ 167/******************************** AUX ****************************************/
168extern void zfcp_rec_dbf_event_thread(u8 id, struct zfcp_adapter *adapter, 168extern void zfcp_rec_dbf_event_thread(u8 id, struct zfcp_adapter *adapter,
@@ -170,6 +170,9 @@ extern void zfcp_rec_dbf_event_thread(u8 id, struct zfcp_adapter *adapter,
170extern void zfcp_rec_dbf_event_adapter(u8 id, u64 ref, struct zfcp_adapter *); 170extern void zfcp_rec_dbf_event_adapter(u8 id, u64 ref, struct zfcp_adapter *);
171extern void zfcp_rec_dbf_event_port(u8 id, u64 ref, struct zfcp_port *port); 171extern void zfcp_rec_dbf_event_port(u8 id, u64 ref, struct zfcp_port *port);
172extern void zfcp_rec_dbf_event_unit(u8 id, u64 ref, struct zfcp_unit *unit); 172extern void zfcp_rec_dbf_event_unit(u8 id, u64 ref, struct zfcp_unit *unit);
173extern void zfcp_rec_dbf_event_trigger(u8 id, u64 ref, u8 want, u8 need,
174 u64 action, struct zfcp_adapter *,
175 struct zfcp_port *, struct zfcp_unit *);
173 176
174extern void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *); 177extern void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *);
175extern void zfcp_hba_dbf_event_fsf_unsol(const char *, struct zfcp_adapter *, 178extern void zfcp_hba_dbf_event_fsf_unsol(const char *, struct zfcp_adapter *,
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 2b7ddb78767c..ffdf99736a4c 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -298,7 +298,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
298 zfcp_get_busid_by_adapter(adapter), 298 zfcp_get_busid_by_adapter(adapter),
299 prot_status_qual->version_error.fsf_version, 299 prot_status_qual->version_error.fsf_version,
300 ZFCP_QTCB_VERSION); 300 ZFCP_QTCB_VERSION);
301 zfcp_erp_adapter_shutdown(adapter, 0); 301 zfcp_erp_adapter_shutdown(adapter, 0, 117, (u64)fsf_req);
302 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 302 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
303 break; 303 break;
304 304
@@ -309,7 +309,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
309 qtcb->prefix.req_seq_no, 309 qtcb->prefix.req_seq_no,
310 zfcp_get_busid_by_adapter(adapter), 310 zfcp_get_busid_by_adapter(adapter),
311 prot_status_qual->sequence_error.exp_req_seq_no); 311 prot_status_qual->sequence_error.exp_req_seq_no);
312 zfcp_erp_adapter_reopen(adapter, 0); 312 zfcp_erp_adapter_reopen(adapter, 0, 98, (u64)fsf_req);
313 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY; 313 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY;
314 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 314 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
315 break; 315 break;
@@ -320,7 +320,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
320 "that used on adapter %s. " 320 "that used on adapter %s. "
321 "Stopping all operations on this adapter.\n", 321 "Stopping all operations on this adapter.\n",
322 zfcp_get_busid_by_adapter(adapter)); 322 zfcp_get_busid_by_adapter(adapter));
323 zfcp_erp_adapter_shutdown(adapter, 0); 323 zfcp_erp_adapter_shutdown(adapter, 0, 118, (u64)fsf_req);
324 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 324 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
325 break; 325 break;
326 326
@@ -337,14 +337,15 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
337 *(unsigned long long*) 337 *(unsigned long long*)
338 (&qtcb->bottom.support.req_handle), 338 (&qtcb->bottom.support.req_handle),
339 zfcp_get_busid_by_adapter(adapter)); 339 zfcp_get_busid_by_adapter(adapter));
340 zfcp_erp_adapter_shutdown(adapter, 0); 340 zfcp_erp_adapter_shutdown(adapter, 0, 78, (u64)fsf_req);
341 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 341 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
342 break; 342 break;
343 343
344 case FSF_PROT_LINK_DOWN: 344 case FSF_PROT_LINK_DOWN:
345 zfcp_fsf_link_down_info_eval(fsf_req, 37, 345 zfcp_fsf_link_down_info_eval(fsf_req, 37,
346 &prot_status_qual->link_down_info); 346 &prot_status_qual->link_down_info);
347 zfcp_erp_adapter_reopen(adapter, 0); 347 /* FIXME: reopening adapter now? better wait for link up */
348 zfcp_erp_adapter_reopen(adapter, 0, 79, (u64)fsf_req);
348 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 349 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
349 break; 350 break;
350 351
@@ -359,7 +360,8 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
359 ZFCP_SET); 360 ZFCP_SET);
360 zfcp_erp_adapter_reopen(adapter, 361 zfcp_erp_adapter_reopen(adapter,
361 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED 362 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED
362 | ZFCP_STATUS_COMMON_ERP_FAILED); 363 | ZFCP_STATUS_COMMON_ERP_FAILED,
364 99, (u64)fsf_req);
363 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 365 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
364 break; 366 break;
365 367
@@ -369,7 +371,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
369 "Restarting all operations on this " 371 "Restarting all operations on this "
370 "adapter.\n", 372 "adapter.\n",
371 zfcp_get_busid_by_adapter(adapter)); 373 zfcp_get_busid_by_adapter(adapter));
372 zfcp_erp_adapter_reopen(adapter, 0); 374 zfcp_erp_adapter_reopen(adapter, 0, 100, (u64)fsf_req);
373 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY; 375 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY;
374 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 376 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
375 break; 377 break;
@@ -382,7 +384,7 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
382 "(debug info 0x%x).\n", 384 "(debug info 0x%x).\n",
383 zfcp_get_busid_by_adapter(adapter), 385 zfcp_get_busid_by_adapter(adapter),
384 qtcb->prefix.prot_status); 386 qtcb->prefix.prot_status);
385 zfcp_erp_adapter_shutdown(adapter, 0); 387 zfcp_erp_adapter_shutdown(adapter, 0, 119, (u64)fsf_req);
386 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 388 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
387 } 389 }
388 390
@@ -421,7 +423,8 @@ zfcp_fsf_fsfstatus_eval(struct zfcp_fsf_req *fsf_req)
421 "(debug info 0x%x).\n", 423 "(debug info 0x%x).\n",
422 zfcp_get_busid_by_adapter(fsf_req->adapter), 424 zfcp_get_busid_by_adapter(fsf_req->adapter),
423 fsf_req->qtcb->header.fsf_command); 425 fsf_req->qtcb->header.fsf_command);
424 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0); 426 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0, 120,
427 (u64)fsf_req);
425 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 428 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
426 break; 429 break;
427 430
@@ -475,7 +478,8 @@ zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *fsf_req)
475 "problem on the adapter %s " 478 "problem on the adapter %s "
476 "Stopping all operations on this adapter. ", 479 "Stopping all operations on this adapter. ",
477 zfcp_get_busid_by_adapter(fsf_req->adapter)); 480 zfcp_get_busid_by_adapter(fsf_req->adapter));
478 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0); 481 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0, 121,
482 (u64)fsf_req);
479 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 483 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
480 break; 484 break;
481 case FSF_SQ_ULP_PROGRAMMING_ERROR: 485 case FSF_SQ_ULP_PROGRAMMING_ERROR:
@@ -796,12 +800,12 @@ zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *fsf_req)
796 800
797 case FSF_STATUS_READ_SUB_CLOSE_PHYS_PORT: 801 case FSF_STATUS_READ_SUB_CLOSE_PHYS_PORT:
798 debug_text_event(adapter->erp_dbf, 3, "unsol_pc_phys:"); 802 debug_text_event(adapter->erp_dbf, 3, "unsol_pc_phys:");
799 zfcp_erp_port_reopen(port, 0); 803 zfcp_erp_port_reopen(port, 0, 101, (u64)fsf_req);
800 break; 804 break;
801 805
802 case FSF_STATUS_READ_SUB_ERROR_PORT: 806 case FSF_STATUS_READ_SUB_ERROR_PORT:
803 debug_text_event(adapter->erp_dbf, 1, "unsol_pc_err:"); 807 debug_text_event(adapter->erp_dbf, 1, "unsol_pc_err:");
804 zfcp_erp_port_shutdown(port, 0); 808 zfcp_erp_port_shutdown(port, 0, 122, (u64)fsf_req);
805 break; 809 break;
806 810
807 default: 811 default:
@@ -935,7 +939,8 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
935 ZFCP_SET); 939 ZFCP_SET);
936 zfcp_erp_adapter_reopen(adapter, 940 zfcp_erp_adapter_reopen(adapter,
937 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED 941 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED
938 | ZFCP_STATUS_COMMON_ERP_FAILED); 942 | ZFCP_STATUS_COMMON_ERP_FAILED,
943 102, (u64)fsf_req);
939 break; 944 break;
940 945
941 case FSF_STATUS_READ_NOTIFICATION_LOST: 946 case FSF_STATUS_READ_NOTIFICATION_LOST:
@@ -969,13 +974,14 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
969 974
970 if (status_buffer->status_subtype & 975 if (status_buffer->status_subtype &
971 FSF_STATUS_READ_SUB_ACT_UPDATED) 976 FSF_STATUS_READ_SUB_ACT_UPDATED)
972 zfcp_erp_adapter_access_changed(adapter); 977 zfcp_erp_adapter_access_changed(adapter, 135,
978 (u64)fsf_req);
973 break; 979 break;
974 980
975 case FSF_STATUS_READ_CFDC_UPDATED: 981 case FSF_STATUS_READ_CFDC_UPDATED:
976 ZFCP_LOG_NORMAL("CFDC has been updated on the adapter %s\n", 982 ZFCP_LOG_NORMAL("CFDC has been updated on the adapter %s\n",
977 zfcp_get_busid_by_adapter(adapter)); 983 zfcp_get_busid_by_adapter(adapter));
978 zfcp_erp_adapter_access_changed(adapter); 984 zfcp_erp_adapter_access_changed(adapter, 136, (u64)fsf_req);
979 break; 985 break;
980 986
981 case FSF_STATUS_READ_CFDC_HARDENED: 987 case FSF_STATUS_READ_CFDC_HARDENED:
@@ -1044,7 +1050,7 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
1044 ZFCP_LOG_INFO("restart adapter %s due to status read " 1050 ZFCP_LOG_INFO("restart adapter %s due to status read "
1045 "buffer shortage\n", 1051 "buffer shortage\n",
1046 zfcp_get_busid_by_adapter(adapter)); 1052 zfcp_get_busid_by_adapter(adapter));
1047 zfcp_erp_adapter_reopen(adapter, 0); 1053 zfcp_erp_adapter_reopen(adapter, 0, 103, (u64)fsf_req);
1048 } 1054 }
1049 } 1055 }
1050 out: 1056 out:
@@ -1167,7 +1173,8 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1167 /* Let's hope this sorts out the mess */ 1173 /* Let's hope this sorts out the mess */
1168 debug_text_event(new_fsf_req->adapter->erp_dbf, 1, 1174 debug_text_event(new_fsf_req->adapter->erp_dbf, 1,
1169 "fsf_s_phand_nv1"); 1175 "fsf_s_phand_nv1");
1170 zfcp_erp_adapter_reopen(unit->port->adapter, 0); 1176 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 104,
1177 (u64)new_fsf_req);
1171 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1178 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1172 } 1179 }
1173 break; 1180 break;
@@ -1199,7 +1206,8 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1199 /* Let's hope this sorts out the mess */ 1206 /* Let's hope this sorts out the mess */
1200 debug_text_event(new_fsf_req->adapter->erp_dbf, 1, 1207 debug_text_event(new_fsf_req->adapter->erp_dbf, 1,
1201 "fsf_s_lhand_nv1"); 1208 "fsf_s_lhand_nv1");
1202 zfcp_erp_port_reopen(unit->port, 0); 1209 zfcp_erp_port_reopen(unit->port, 0, 105,
1210 (u64)new_fsf_req);
1203 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1211 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1204 } 1212 }
1205 break; 1213 break;
@@ -1478,7 +1486,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
1478 ZFCP_FC_SERVICE_CLASS_DEFAULT); 1486 ZFCP_FC_SERVICE_CLASS_DEFAULT);
1479 /* stop operation for this adapter */ 1487 /* stop operation for this adapter */
1480 debug_text_exception(adapter->erp_dbf, 0, "fsf_s_class_nsup"); 1488 debug_text_exception(adapter->erp_dbf, 0, "fsf_s_class_nsup");
1481 zfcp_erp_adapter_shutdown(adapter, 0); 1489 zfcp_erp_adapter_shutdown(adapter, 0, 123, (u64)fsf_req);
1482 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1490 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1483 break; 1491 break;
1484 1492
@@ -1547,7 +1555,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
1547 (char *) &header->fsf_status_qual, 1555 (char *) &header->fsf_status_qual,
1548 sizeof (union fsf_status_qual)); 1556 sizeof (union fsf_status_qual));
1549 debug_text_event(adapter->erp_dbf, 1, "fsf_s_phandle_nv"); 1557 debug_text_event(adapter->erp_dbf, 1, "fsf_s_phandle_nv");
1550 zfcp_erp_adapter_reopen(adapter, 0); 1558 zfcp_erp_adapter_reopen(adapter, 0, 106, (u64)fsf_req);
1551 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1559 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1552 break; 1560 break;
1553 1561
@@ -1782,7 +1790,7 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
1782 ZFCP_FC_SERVICE_CLASS_DEFAULT); 1790 ZFCP_FC_SERVICE_CLASS_DEFAULT);
1783 /* stop operation for this adapter */ 1791 /* stop operation for this adapter */
1784 debug_text_exception(adapter->erp_dbf, 0, "fsf_s_class_nsup"); 1792 debug_text_exception(adapter->erp_dbf, 0, "fsf_s_class_nsup");
1785 zfcp_erp_adapter_shutdown(adapter, 0); 1793 zfcp_erp_adapter_shutdown(adapter, 0, 124, (u64)fsf_req);
1786 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1794 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1787 break; 1795 break;
1788 1796
@@ -2104,7 +2112,7 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
2104 "driver (try updated device driver)\n", 2112 "driver (try updated device driver)\n",
2105 zfcp_get_busid_by_adapter(adapter)); 2113 zfcp_get_busid_by_adapter(adapter));
2106 debug_text_event(adapter->erp_dbf, 0, "low_qtcb_ver"); 2114 debug_text_event(adapter->erp_dbf, 0, "low_qtcb_ver");
2107 zfcp_erp_adapter_shutdown(adapter, 0); 2115 zfcp_erp_adapter_shutdown(adapter, 0, 125, (u64)fsf_req);
2108 return -EIO; 2116 return -EIO;
2109 } 2117 }
2110 if (ZFCP_QTCB_VERSION > bottom->high_qtcb_version) { 2118 if (ZFCP_QTCB_VERSION > bottom->high_qtcb_version) {
@@ -2114,7 +2122,7 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
2114 "(consider a microcode upgrade)\n", 2122 "(consider a microcode upgrade)\n",
2115 zfcp_get_busid_by_adapter(adapter)); 2123 zfcp_get_busid_by_adapter(adapter));
2116 debug_text_event(adapter->erp_dbf, 0, "high_qtcb_ver"); 2124 debug_text_event(adapter->erp_dbf, 0, "high_qtcb_ver");
2117 zfcp_erp_adapter_shutdown(adapter, 0); 2125 zfcp_erp_adapter_shutdown(adapter, 0, 126, (u64)fsf_req);
2118 return -EIO; 2126 return -EIO;
2119 } 2127 }
2120 return 0; 2128 return 0;
@@ -2164,7 +2172,7 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req)
2164 zfcp_get_busid_by_adapter(adapter)); 2172 zfcp_get_busid_by_adapter(adapter));
2165 debug_text_event(fsf_req->adapter->erp_dbf, 0, 2173 debug_text_event(fsf_req->adapter->erp_dbf, 0,
2166 "top-al"); 2174 "top-al");
2167 zfcp_erp_adapter_shutdown(adapter, 0); 2175 zfcp_erp_adapter_shutdown(adapter, 0, 127, (u64)fsf_req);
2168 return -EIO; 2176 return -EIO;
2169 case FC_PORTTYPE_NPORT: 2177 case FC_PORTTYPE_NPORT:
2170 ZFCP_LOG_NORMAL("Switched fabric fibrechannel " 2178 ZFCP_LOG_NORMAL("Switched fabric fibrechannel "
@@ -2181,7 +2189,7 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req)
2181 zfcp_get_busid_by_adapter(adapter)); 2189 zfcp_get_busid_by_adapter(adapter));
2182 debug_text_exception(fsf_req->adapter->erp_dbf, 0, 2190 debug_text_exception(fsf_req->adapter->erp_dbf, 0,
2183 "unknown-topo"); 2191 "unknown-topo");
2184 zfcp_erp_adapter_shutdown(adapter, 0); 2192 zfcp_erp_adapter_shutdown(adapter, 0, 128, (u64)fsf_req);
2185 return -EIO; 2193 return -EIO;
2186 } 2194 }
2187 bottom = &qtcb->bottom.config; 2195 bottom = &qtcb->bottom.config;
@@ -2197,7 +2205,7 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req)
2197 "qtcb-size"); 2205 "qtcb-size");
2198 debug_event(fsf_req->adapter->erp_dbf, 0, 2206 debug_event(fsf_req->adapter->erp_dbf, 0,
2199 &bottom->max_qtcb_size, sizeof (u32)); 2207 &bottom->max_qtcb_size, sizeof (u32));
2200 zfcp_erp_adapter_shutdown(adapter, 0); 2208 zfcp_erp_adapter_shutdown(adapter, 0, 129, (u64)fsf_req);
2201 return -EIO; 2209 return -EIO;
2202 } 2210 }
2203 atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, 2211 atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK,
@@ -2219,7 +2227,7 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req)
2219 debug_text_event(fsf_req->adapter->erp_dbf, 0, "fsf-stat-ng"); 2227 debug_text_event(fsf_req->adapter->erp_dbf, 0, "fsf-stat-ng");
2220 debug_event(fsf_req->adapter->erp_dbf, 0, 2228 debug_event(fsf_req->adapter->erp_dbf, 0,
2221 &fsf_req->qtcb->header.fsf_status, sizeof(u32)); 2229 &fsf_req->qtcb->header.fsf_status, sizeof(u32));
2222 zfcp_erp_adapter_shutdown(adapter, 0); 2230 zfcp_erp_adapter_shutdown(adapter, 0, 130, (u64)fsf_req);
2223 return -EIO; 2231 return -EIO;
2224 } 2232 }
2225 return 0; 2233 return 0;
@@ -2760,7 +2768,7 @@ zfcp_fsf_close_port_handler(struct zfcp_fsf_req *fsf_req)
2760 sizeof (union fsf_status_qual)); 2768 sizeof (union fsf_status_qual));
2761 debug_text_event(fsf_req->adapter->erp_dbf, 1, 2769 debug_text_event(fsf_req->adapter->erp_dbf, 1,
2762 "fsf_s_phand_nv"); 2770 "fsf_s_phand_nv");
2763 zfcp_erp_adapter_reopen(port->adapter, 0); 2771 zfcp_erp_adapter_reopen(port->adapter, 0, 107, (u64)fsf_req);
2764 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2772 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2765 break; 2773 break;
2766 2774
@@ -2903,7 +2911,7 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req)
2903 sizeof (union fsf_status_qual)); 2911 sizeof (union fsf_status_qual));
2904 debug_text_event(fsf_req->adapter->erp_dbf, 1, 2912 debug_text_event(fsf_req->adapter->erp_dbf, 1,
2905 "fsf_s_phand_nv"); 2913 "fsf_s_phand_nv");
2906 zfcp_erp_adapter_reopen(port->adapter, 0); 2914 zfcp_erp_adapter_reopen(port->adapter, 0, 108, (u64)fsf_req);
2907 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2915 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2908 break; 2916 break;
2909 2917
@@ -3128,7 +3136,8 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3128 (char *) &header->fsf_status_qual, 3136 (char *) &header->fsf_status_qual,
3129 sizeof (union fsf_status_qual)); 3137 sizeof (union fsf_status_qual));
3130 debug_text_event(adapter->erp_dbf, 1, "fsf_s_ph_nv"); 3138 debug_text_event(adapter->erp_dbf, 1, "fsf_s_ph_nv");
3131 zfcp_erp_adapter_reopen(unit->port->adapter, 0); 3139 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 109,
3140 (u64)fsf_req);
3132 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3141 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3133 break; 3142 break;
3134 3143
@@ -3311,13 +3320,15 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3311 "unit not supported\n"); 3320 "unit not supported\n");
3312 zfcp_erp_unit_failed(unit, 35, (u64)fsf_req); 3321 zfcp_erp_unit_failed(unit, 35, (u64)fsf_req);
3313 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3322 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3314 zfcp_erp_unit_shutdown(unit, 0); 3323 zfcp_erp_unit_shutdown(unit, 0, 80,
3324 (u64)fsf_req);
3315 } else if (!exclusive && readwrite) { 3325 } else if (!exclusive && readwrite) {
3316 ZFCP_LOG_NORMAL("shared access of read-write " 3326 ZFCP_LOG_NORMAL("shared access of read-write "
3317 "unit not supported\n"); 3327 "unit not supported\n");
3318 zfcp_erp_unit_failed(unit, 36, (u64)fsf_req); 3328 zfcp_erp_unit_failed(unit, 36, (u64)fsf_req);
3319 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3329 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3320 zfcp_erp_unit_shutdown(unit, 0); 3330 zfcp_erp_unit_shutdown(unit, 0, 81,
3331 (u64)fsf_req);
3321 } 3332 }
3322 } 3333 }
3323 3334
@@ -3445,7 +3456,8 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req)
3445 sizeof (union fsf_status_qual)); 3456 sizeof (union fsf_status_qual));
3446 debug_text_event(fsf_req->adapter->erp_dbf, 1, 3457 debug_text_event(fsf_req->adapter->erp_dbf, 1,
3447 "fsf_s_phand_nv"); 3458 "fsf_s_phand_nv");
3448 zfcp_erp_adapter_reopen(unit->port->adapter, 0); 3459 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 110,
3460 (u64)fsf_req);
3449 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3461 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3450 break; 3462 break;
3451 3463
@@ -3463,7 +3475,7 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req)
3463 sizeof (union fsf_status_qual)); 3475 sizeof (union fsf_status_qual));
3464 debug_text_event(fsf_req->adapter->erp_dbf, 1, 3476 debug_text_event(fsf_req->adapter->erp_dbf, 1,
3465 "fsf_s_lhand_nv"); 3477 "fsf_s_lhand_nv");
3466 zfcp_erp_port_reopen(unit->port, 0); 3478 zfcp_erp_port_reopen(unit->port, 0, 111, (u64)fsf_req);
3467 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3479 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3468 break; 3480 break;
3469 3481
@@ -3681,7 +3693,7 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
3681 zfcp_get_busid_by_unit(unit), 3693 zfcp_get_busid_by_unit(unit),
3682 unit->port->wwpn, 3694 unit->port->wwpn,
3683 unit->fcp_lun); 3695 unit->fcp_lun);
3684 zfcp_erp_unit_shutdown(unit, 0); 3696 zfcp_erp_unit_shutdown(unit, 0, 131, (u64)fsf_req);
3685 retval = -EINVAL; 3697 retval = -EINVAL;
3686 } 3698 }
3687 goto no_fit; 3699 goto no_fit;
@@ -3841,7 +3853,8 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3841 sizeof (union fsf_status_qual)); 3853 sizeof (union fsf_status_qual));
3842 debug_text_event(fsf_req->adapter->erp_dbf, 1, 3854 debug_text_event(fsf_req->adapter->erp_dbf, 1,
3843 "fsf_s_phand_nv"); 3855 "fsf_s_phand_nv");
3844 zfcp_erp_adapter_reopen(unit->port->adapter, 0); 3856 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 112,
3857 (u64)fsf_req);
3845 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3858 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3846 break; 3859 break;
3847 3860
@@ -3859,7 +3872,7 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3859 sizeof (union fsf_status_qual)); 3872 sizeof (union fsf_status_qual));
3860 debug_text_event(fsf_req->adapter->erp_dbf, 1, 3873 debug_text_event(fsf_req->adapter->erp_dbf, 1,
3861 "fsf_s_uhand_nv"); 3874 "fsf_s_uhand_nv");
3862 zfcp_erp_port_reopen(unit->port, 0); 3875 zfcp_erp_port_reopen(unit->port, 0, 113, (u64)fsf_req);
3863 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3876 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3864 break; 3877 break;
3865 3878
@@ -3877,7 +3890,8 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3877 sizeof (union fsf_status_qual)); 3890 sizeof (union fsf_status_qual));
3878 debug_text_event(fsf_req->adapter->erp_dbf, 1, 3891 debug_text_event(fsf_req->adapter->erp_dbf, 1,
3879 "fsf_s_hand_mis"); 3892 "fsf_s_hand_mis");
3880 zfcp_erp_adapter_reopen(unit->port->adapter, 0); 3893 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 114,
3894 (u64)fsf_req);
3881 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3895 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3882 break; 3896 break;
3883 3897
@@ -3889,7 +3903,8 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3889 /* stop operation for this adapter */ 3903 /* stop operation for this adapter */
3890 debug_text_exception(fsf_req->adapter->erp_dbf, 0, 3904 debug_text_exception(fsf_req->adapter->erp_dbf, 0,
3891 "fsf_s_class_nsup"); 3905 "fsf_s_class_nsup");
3892 zfcp_erp_adapter_shutdown(unit->port->adapter, 0); 3906 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 132,
3907 (u64)fsf_req);
3893 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3908 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3894 break; 3909 break;
3895 3910
@@ -3907,7 +3922,7 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3907 sizeof (union fsf_status_qual)); 3922 sizeof (union fsf_status_qual));
3908 debug_text_event(fsf_req->adapter->erp_dbf, 1, 3923 debug_text_event(fsf_req->adapter->erp_dbf, 1,
3909 "fsf_s_fcp_lun_nv"); 3924 "fsf_s_fcp_lun_nv");
3910 zfcp_erp_port_reopen(unit->port, 0); 3925 zfcp_erp_port_reopen(unit->port, 0, 115, (u64)fsf_req);
3911 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3926 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3912 break; 3927 break;
3913 3928
@@ -3945,7 +3960,8 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3945 /* stop operation for this adapter */ 3960 /* stop operation for this adapter */
3946 debug_text_event(fsf_req->adapter->erp_dbf, 0, 3961 debug_text_event(fsf_req->adapter->erp_dbf, 0,
3947 "fsf_s_dir_ind_nv"); 3962 "fsf_s_dir_ind_nv");
3948 zfcp_erp_adapter_shutdown(unit->port->adapter, 0); 3963 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 133,
3964 (u64)fsf_req);
3949 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3965 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3950 break; 3966 break;
3951 3967
@@ -3960,7 +3976,8 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3960 /* stop operation for this adapter */ 3976 /* stop operation for this adapter */
3961 debug_text_event(fsf_req->adapter->erp_dbf, 0, 3977 debug_text_event(fsf_req->adapter->erp_dbf, 0,
3962 "fsf_s_cmd_len_nv"); 3978 "fsf_s_cmd_len_nv");
3963 zfcp_erp_adapter_shutdown(unit->port->adapter, 0); 3979 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 134,
3980 (u64)fsf_req);
3964 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 3981 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3965 break; 3982 break;
3966 3983
@@ -4863,7 +4880,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req)
4863 req_queue->free_index -= fsf_req->sbal_number; 4880 req_queue->free_index -= fsf_req->sbal_number;
4864 req_queue->free_index += QDIO_MAX_BUFFERS_PER_Q; 4881 req_queue->free_index += QDIO_MAX_BUFFERS_PER_Q;
4865 req_queue->free_index %= QDIO_MAX_BUFFERS_PER_Q; /* wrap */ 4882 req_queue->free_index %= QDIO_MAX_BUFFERS_PER_Q; /* wrap */
4866 zfcp_erp_adapter_reopen(adapter, 0); 4883 zfcp_erp_adapter_reopen(adapter, 0, 116, (u64)fsf_req);
4867 } else { 4884 } else {
4868 req_queue->distance_from_int = new_distance_from_int; 4885 req_queue->distance_from_int = new_distance_from_int;
4869 /* 4886 /*
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c
index 22fdc17e0d0e..d742d0a9df77 100644
--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -175,8 +175,8 @@ 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, 0);
180 } 180 }
181 return retval; 181 return retval;
182} 182}
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 1198f0b27e3a..cd844b2ad7a1 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -529,7 +529,7 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
529 unit->fcp_lun, unit->port->wwpn, 529 unit->fcp_lun, unit->port->wwpn,
530 zfcp_get_busid_by_adapter(unit->port->adapter)); 530 zfcp_get_busid_by_adapter(unit->port->adapter));
531 531
532 zfcp_erp_adapter_reopen(adapter, 0); 532 zfcp_erp_adapter_reopen(adapter, 0, 141, (u64)scpnt);
533 zfcp_erp_wait(adapter); 533 zfcp_erp_wait(adapter);
534 534
535 return SUCCESS; 535 return SUCCESS;
diff --git a/drivers/s390/scsi/zfcp_sysfs_adapter.c b/drivers/s390/scsi/zfcp_sysfs_adapter.c
index ec340530c824..e0bbcc440a52 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, 0);
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, 0);
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);
@@ -193,7 +193,7 @@ zfcp_sysfs_adapter_failed_store(struct device *dev, struct device_attribute *att
193 193
194 zfcp_erp_modify_adapter_status(adapter, 44, 0, 194 zfcp_erp_modify_adapter_status(adapter, 44, 0,
195 ZFCP_STATUS_COMMON_RUNNING, 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, 0);
197 zfcp_erp_wait(adapter); 197 zfcp_erp_wait(adapter);
198 out: 198 out:
199 up(&zfcp_data.config_sema); 199 up(&zfcp_data.config_sema);
diff --git a/drivers/s390/scsi/zfcp_sysfs_port.c b/drivers/s390/scsi/zfcp_sysfs_port.c
index 9cc2bc5be724..538195034c68 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, 0);
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, 0);
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);
@@ -195,7 +195,7 @@ zfcp_sysfs_port_failed_store(struct device *dev, struct device_attribute *attr,
195 195
196 zfcp_erp_modify_port_status(port, 45, 0, 196 zfcp_erp_modify_port_status(port, 45, 0,
197 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); 197 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
198 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED); 198 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, 96, 0);
199 zfcp_erp_wait(port->adapter); 199 zfcp_erp_wait(port->adapter);
200 out: 200 out:
201 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 52a5f6a25ff9..fd73568b44b4 100644
--- a/drivers/s390/scsi/zfcp_sysfs_unit.c
+++ b/drivers/s390/scsi/zfcp_sysfs_unit.c
@@ -96,7 +96,7 @@ zfcp_sysfs_unit_failed_store(struct device *dev, struct device_attribute *attr,
96 96
97 zfcp_erp_modify_unit_status(unit, 46, 0, 97 zfcp_erp_modify_unit_status(unit, 46, 0,
98 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); 98 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
99 zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED); 99 zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, 97, 0);
100 zfcp_erp_wait(unit->port->adapter); 100 zfcp_erp_wait(unit->port->adapter);
101 out: 101 out:
102 up(&zfcp_data.config_sema); 102 up(&zfcp_data.config_sema);