Skip to content

Commit cdb9d2a

Browse files
Quinn Tranjfvogel
authored andcommitted
qla2xxx: Fix driver unload by shutting down chip
Use chip shutdown at the start of unload to stop all DMA + traffics and bring down the laser. This prevents any link activities from triggering the driver to be re-engaged. Fixes: 4b60c82 ("scsi: qla2xxx: Add fw_started flags to qpair") Cc: <stable@vger.kernel.org> #4.16 Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Orabug: 29411891 Signed-off-by: John Donnelly <John.P.Donnelly@oracle.com> Reviewed-by: Allen Pais <allen.pais@oracle.com>
1 parent 897e7d1 commit cdb9d2a

5 files changed

Lines changed: 34 additions & 28 deletions

File tree

‎drivers/scsi/qla2xxx/qla_isr.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,9 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)
631631
unsigned long flags;
632632
fc_port_t *fcport = NULL;
633633

634+
if (!vha->hw->flags.fw_started)
635+
return;
636+
634637
/* Setup to process RIO completion. */
635638
handle_cnt = 0;
636639
if (IS_CNA_CAPABLE(ha))

‎drivers/scsi/qla2xxx/qla_mbx.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4217,6 +4217,9 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req)
42174217
mbx_cmd_t *mcp = &mc;
42184218
struct qla_hw_data *ha = vha->hw;
42194219

4220+
if (!ha->flags.fw_started)
4221+
return QLA_SUCCESS;
4222+
42204223
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10d3,
42214224
"Entered %s.\n", __func__);
42224225

@@ -4286,6 +4289,9 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
42864289
mbx_cmd_t *mcp = &mc;
42874290
struct qla_hw_data *ha = vha->hw;
42884291

4292+
if (!ha->flags.fw_started)
4293+
return QLA_SUCCESS;
4294+
42894295
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10d6,
42904296
"Entered %s.\n", __func__);
42914297

‎drivers/scsi/qla2xxx/qla_mid.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,12 @@ int
152152
qla24xx_disable_vp(scsi_qla_host_t *vha)
153153
{
154154
unsigned long flags;
155-
int ret;
155+
int ret = QLA_SUCCESS;
156156
fc_port_t *fcport;
157157

158-
ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL);
158+
if (vha->hw->flags.fw_started)
159+
ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL);
160+
159161
atomic_set(&vha->loop_state, LOOP_DOWN);
160162
atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
161163
list_for_each_entry(fcport, &vha->vp_fcports, list)

‎drivers/scsi/qla2xxx/qla_os.c‎

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ static void qla2x00_free_device(scsi_qla_host_t *);
310310
static int qla2xxx_map_queues(struct Scsi_Host *shost);
311311
static void qla2x00_destroy_deferred_work(struct qla_hw_data *);
312312

313+
313314
struct scsi_host_template qla2xxx_driver_template = {
314315
.module = THIS_MODULE,
315316
.name = QLA2XXX_DRIVER_NAME,
@@ -3644,6 +3645,8 @@ qla2x00_remove_one(struct pci_dev *pdev)
36443645

36453646
base_vha = pci_get_drvdata(pdev);
36463647
ha = base_vha->hw;
3648+
ql_log(ql_log_info, base_vha, 0xb079,
3649+
"Removing driver\n");
36473650

36483651
/* Indicate device removal to prevent future board_disable and wait
36493652
* until any pending board_disable has completed. */
@@ -3666,6 +3669,21 @@ qla2x00_remove_one(struct pci_dev *pdev)
36663669
}
36673670
qla2x00_wait_for_hba_ready(base_vha);
36683671

3672+
if (IS_QLA25XX(ha) || IS_QLA2031(ha) || IS_QLA27XX(ha)) {
3673+
if (ha->flags.fw_started)
3674+
qla2x00_abort_isp_cleanup(base_vha);
3675+
} else if (!IS_QLAFX00(ha)) {
3676+
if (IS_QLA8031(ha)) {
3677+
ql_dbg(ql_dbg_p3p, base_vha, 0xb07e,
3678+
"Clearing fcoe driver presence.\n");
3679+
if (qla83xx_clear_drv_presence(base_vha) != QLA_SUCCESS)
3680+
ql_dbg(ql_dbg_p3p, base_vha, 0xb079,
3681+
"Error while clearing DRV-Presence.\n");
3682+
}
3683+
3684+
qla2x00_try_to_stop_firmware(base_vha);
3685+
}
3686+
36693687
qla2x00_wait_for_sess_deletion(base_vha);
36703688

36713689
/*
@@ -3689,14 +3707,6 @@ qla2x00_remove_one(struct pci_dev *pdev)
36893707

36903708
qla2x00_delete_all_vps(ha, base_vha);
36913709

3692-
if (IS_QLA8031(ha)) {
3693-
ql_dbg(ql_dbg_p3p, base_vha, 0xb07e,
3694-
"Clearing fcoe driver presence.\n");
3695-
if (qla83xx_clear_drv_presence(base_vha) != QLA_SUCCESS)
3696-
ql_dbg(ql_dbg_p3p, base_vha, 0xb079,
3697-
"Error while clearing DRV-Presence.\n");
3698-
}
3699-
37003710
qla2x00_abort_all_cmds(base_vha, DID_NO_CONNECT << 16);
37013711

37023712
qla2x00_dfs_remove(base_vha);
@@ -3756,24 +3766,6 @@ qla2x00_free_device(scsi_qla_host_t *vha)
37563766
qla2x00_stop_timer(vha);
37573767

37583768
qla25xx_delete_queues(vha);
3759-
3760-
if (ha->flags.fce_enabled)
3761-
qla2x00_disable_fce_trace(vha, NULL, NULL);
3762-
3763-
if (ha->eft)
3764-
qla2x00_disable_eft_trace(vha);
3765-
3766-
if (IS_QLA25XX(ha) || IS_QLA2031(ha) || IS_QLA27XX(ha)) {
3767-
if (ha->flags.fw_started)
3768-
qla2x00_abort_isp_cleanup(vha);
3769-
} else {
3770-
if (ha->flags.fw_started) {
3771-
/* Stop currently executing firmware. */
3772-
qla2x00_try_to_stop_firmware(vha);
3773-
ha->flags.fw_started = 0;
3774-
}
3775-
}
3776-
37773769
vha->flags.online = 0;
37783770

37793771
/* turn-off interrupts on the card */

‎drivers/scsi/qla2xxx/qla_sup.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,6 +1880,9 @@ qla24xx_beacon_off(struct scsi_qla_host *vha)
18801880
if (IS_P3P_TYPE(ha))
18811881
return QLA_SUCCESS;
18821882

1883+
if (!ha->flags.fw_started)
1884+
return QLA_SUCCESS;
1885+
18831886
ha->beacon_blink_led = 0;
18841887

18851888
if (IS_QLA2031(ha) || IS_QLA27XX(ha))

0 commit comments

Comments
 (0)