hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/scsi/qla2xxx/qla_init.c
....@@ -483,6 +483,7 @@
483483 void qla24xx_handle_adisc_event(scsi_qla_host_t *vha, struct event_arg *ea)
484484 {
485485 struct fc_port *fcport = ea->fcport;
486
+ unsigned long flags;
486487
487488 ql_dbg(ql_dbg_disc, vha, 0x20d2,
488489 "%s %8phC DS %d LS %d rc %d login %d|%d rscn %d|%d lid %d\n",
....@@ -497,9 +498,15 @@
497498 ql_dbg(ql_dbg_disc, vha, 0x2066,
498499 "%s %8phC: adisc fail: post delete\n",
499500 __func__, ea->fcport->port_name);
501
+
502
+ spin_lock_irqsave(&vha->work_lock, flags);
500503 /* deleted = 0 & logout_on_delete = force fw cleanup */
501
- fcport->deleted = 0;
504
+ if (fcport->deleted == QLA_SESS_DELETED)
505
+ fcport->deleted = 0;
506
+
502507 fcport->logout_on_delete = 1;
508
+ spin_unlock_irqrestore(&vha->work_lock, flags);
509
+
503510 qlt_schedule_sess_for_deletion(ea->fcport);
504511 return;
505512 }
....@@ -1405,7 +1412,6 @@
14051412
14061413 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
14071414 ea->fcport->login_gen++;
1408
- ea->fcport->deleted = 0;
14091415 ea->fcport->logout_on_delete = 1;
14101416
14111417 if (!ea->fcport->login_succ && !IS_SW_RESV_ADDR(ea->fcport->d_id)) {
....@@ -4336,15 +4342,16 @@
43364342 memcpy(ha->port_name, ha->init_cb->port_name, WWN_SIZE);
43374343 }
43384344
4345
+ QLA_FW_STARTED(ha);
43394346 rval = qla2x00_init_firmware(vha, ha->init_cb_size);
43404347 next_check:
43414348 if (rval) {
4349
+ QLA_FW_STOPPED(ha);
43424350 ql_log(ql_log_fatal, vha, 0x00d2,
43434351 "Init Firmware **** FAILED ****.\n");
43444352 } else {
43454353 ql_dbg(ql_dbg_init, vha, 0x00d3,
43464354 "Init Firmware -- success.\n");
4347
- QLA_FW_STARTED(ha);
43484355 vha->u_ql2xexchoffld = vha->u_ql2xiniexchg = 0;
43494356 }
43504357
....@@ -5639,6 +5646,8 @@
56395646 void
56405647 qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
56415648 {
5649
+ unsigned long flags;
5650
+
56425651 if (IS_SW_RESV_ADDR(fcport->d_id))
56435652 return;
56445653
....@@ -5648,7 +5657,11 @@
56485657 qla2x00_set_fcport_disc_state(fcport, DSC_UPD_FCPORT);
56495658 fcport->login_retry = vha->hw->login_retry_count;
56505659 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT);
5660
+
5661
+ spin_lock_irqsave(&vha->work_lock, flags);
56515662 fcport->deleted = 0;
5663
+ spin_unlock_irqrestore(&vha->work_lock, flags);
5664
+
56525665 if (vha->hw->current_topology == ISP_CFG_NL)
56535666 fcport->logout_on_delete = 0;
56545667 else
....@@ -6913,14 +6926,15 @@
69136926 }
69146927
69156928 /* purge MBox commands */
6916
- if (atomic_read(&ha->num_pend_mbx_stage3)) {
6929
+ spin_lock_irqsave(&ha->hardware_lock, flags);
6930
+ if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags)) {
69176931 clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
69186932 complete(&ha->mbx_intr_comp);
69196933 }
6934
+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
69206935
69216936 i = 0;
6922
- while (atomic_read(&ha->num_pend_mbx_stage3) ||
6923
- atomic_read(&ha->num_pend_mbx_stage2) ||
6937
+ while (atomic_read(&ha->num_pend_mbx_stage2) ||
69246938 atomic_read(&ha->num_pend_mbx_stage1)) {
69256939 msleep(20);
69266940 i++;
....@@ -6969,22 +6983,18 @@
69696983 }
69706984 spin_unlock_irqrestore(&ha->vport_slock, flags);
69716985
6972
- if (!ha->flags.eeh_busy) {
6973
- /* Make sure for ISP 82XX IO DMA is complete */
6974
- if (IS_P3P_TYPE(ha)) {
6975
- qla82xx_chip_reset_cleanup(vha);
6976
- ql_log(ql_log_info, vha, 0x00b4,
6977
- "Done chip reset cleanup.\n");
6986
+ /* Make sure for ISP 82XX IO DMA is complete */
6987
+ if (IS_P3P_TYPE(ha)) {
6988
+ qla82xx_chip_reset_cleanup(vha);
6989
+ ql_log(ql_log_info, vha, 0x00b4,
6990
+ "Done chip reset cleanup.\n");
69786991
6979
- /* Done waiting for pending commands.
6980
- * Reset the online flag.
6981
- */
6982
- vha->flags.online = 0;
6983
- }
6984
-
6985
- /* Requeue all commands in outstanding command list. */
6986
- qla2x00_abort_all_cmds(vha, DID_RESET << 16);
6992
+ /* Done waiting for pending commands. Reset online flag */
6993
+ vha->flags.online = 0;
69876994 }
6995
+
6996
+ /* Requeue all commands in outstanding command list. */
6997
+ qla2x00_abort_all_cmds(vha, DID_RESET << 16);
69886998 /* memory barrier */
69896999 wmb();
69907000 }
....@@ -7011,6 +7021,12 @@
70117021
70127022 if (vha->flags.online) {
70137023 qla2x00_abort_isp_cleanup(vha);
7024
+
7025
+ if (qla2x00_isp_reg_stat(ha)) {
7026
+ ql_log(ql_log_info, vha, 0x803f,
7027
+ "ISP Abort - ISP reg disconnect, exiting.\n");
7028
+ return status;
7029
+ }
70147030
70157031 if (test_and_clear_bit(ISP_ABORT_TO_ROM, &vha->dpc_flags)) {
70167032 ha->flags.chip_reset_done = 1;
....@@ -7052,8 +7068,18 @@
70527068
70537069 ha->isp_ops->get_flash_version(vha, req->ring);
70547070
7071
+ if (qla2x00_isp_reg_stat(ha)) {
7072
+ ql_log(ql_log_info, vha, 0x803f,
7073
+ "ISP Abort - ISP reg disconnect pre nvram config, exiting.\n");
7074
+ return status;
7075
+ }
70557076 ha->isp_ops->nvram_config(vha);
70567077
7078
+ if (qla2x00_isp_reg_stat(ha)) {
7079
+ ql_log(ql_log_info, vha, 0x803f,
7080
+ "ISP Abort - ISP reg disconnect post nvmram config, exiting.\n");
7081
+ return status;
7082
+ }
70577083 if (!qla2x00_restart_isp(vha)) {
70587084 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags);
70597085