Commit df4bf0bb authored by Andrew Vasquez's avatar Andrew Vasquez Committed by James Bottomley

[SCSI] qla2xxx: Cleanup any outstanding SRB resources during shutdown.

Refactor SRB-failure completion codes in the process.  Also,
signal the DPC routine to complete sooner as backend processing
at shutdown-time is superflous.

[jejb: resolve conflicts with pci_enable_device_bars removal]
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 61623fc3
...@@ -66,6 +66,7 @@ extern int ql2xqfullrampup; ...@@ -66,6 +66,7 @@ extern int ql2xqfullrampup;
extern int num_hosts; extern int num_hosts;
extern int qla2x00_loop_reset(scsi_qla_host_t *); extern int qla2x00_loop_reset(scsi_qla_host_t *);
extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
/* /*
* Global Functions in qla_mid.c source file. * Global Functions in qla_mid.c source file.
......
...@@ -3213,9 +3213,6 @@ int ...@@ -3213,9 +3213,6 @@ int
qla2x00_abort_isp(scsi_qla_host_t *ha) qla2x00_abort_isp(scsi_qla_host_t *ha)
{ {
int rval; int rval;
unsigned long flags = 0;
uint16_t cnt;
srb_t *sp;
uint8_t status = 0; uint8_t status = 0;
if (ha->flags.online) { if (ha->flags.online) {
...@@ -3236,19 +3233,8 @@ qla2x00_abort_isp(scsi_qla_host_t *ha) ...@@ -3236,19 +3233,8 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
LOOP_DOWN_TIME); LOOP_DOWN_TIME);
} }
spin_lock_irqsave(&ha->hardware_lock, flags);
/* Requeue all commands in outstanding command list. */ /* Requeue all commands in outstanding command list. */
for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { qla2x00_abort_all_cmds(ha, DID_RESET << 16);
sp = ha->outstanding_cmds[cnt];
if (sp) {
ha->outstanding_cmds[cnt] = NULL;
sp->flags = 0;
sp->cmd->result = DID_RESET << 16;
sp->cmd->host_scribble = (unsigned char *)NULL;
qla2x00_sp_compl(ha, sp);
}
}
spin_unlock_irqrestore(&ha->hardware_lock, flags);
ha->isp_ops->get_flash_version(ha, ha->request_ring); ha->isp_ops->get_flash_version(ha, ha->request_ring);
......
...@@ -1117,6 +1117,27 @@ qla2x00_device_reset(scsi_qla_host_t *ha, fc_port_t *reset_fcport) ...@@ -1117,6 +1117,27 @@ qla2x00_device_reset(scsi_qla_host_t *ha, fc_port_t *reset_fcport)
return ha->isp_ops->abort_target(reset_fcport); return ha->isp_ops->abort_target(reset_fcport);
} }
void
qla2x00_abort_all_cmds(scsi_qla_host_t *ha, int res)
{
int cnt;
unsigned long flags;
srb_t *sp;
spin_lock_irqsave(&ha->hardware_lock, flags);
for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
sp = ha->outstanding_cmds[cnt];
if (sp) {
ha->outstanding_cmds[cnt] = NULL;
sp->flags = 0;
sp->cmd->result = res;
sp->cmd->host_scribble = (unsigned char *)NULL;
qla2x00_sp_compl(ha, sp);
}
}
spin_unlock_irqrestore(&ha->hardware_lock, flags);
}
static int static int
qla2xxx_slave_alloc(struct scsi_device *sdev) qla2xxx_slave_alloc(struct scsi_device *sdev)
{ {
...@@ -1608,6 +1629,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1608,6 +1629,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
ha->parent = NULL; ha->parent = NULL;
ha->bars = bars; ha->bars = bars;
ha->mem_only = mem_only; ha->mem_only = mem_only;
spin_lock_init(&ha->hardware_lock);
/* Set ISP-type information. */ /* Set ISP-type information. */
qla2x00_set_isp_flags(ha); qla2x00_set_isp_flags(ha);
...@@ -1621,8 +1643,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1621,8 +1643,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
"Found an ISP%04X, irq %d, iobase 0x%p\n", pdev->device, pdev->irq, "Found an ISP%04X, irq %d, iobase 0x%p\n", pdev->device, pdev->irq,
ha->iobase); ha->iobase);
spin_lock_init(&ha->hardware_lock);
ha->prev_topology = 0; ha->prev_topology = 0;
ha->init_cb_size = sizeof(init_cb_t); ha->init_cb_size = sizeof(init_cb_t);
ha->mgmt_svr_loop_id = MANAGEMENT_SERVER + ha->vp_idx; ha->mgmt_svr_loop_id = MANAGEMENT_SERVER + ha->vp_idx;
...@@ -1848,10 +1868,14 @@ qla2x00_remove_one(struct pci_dev *pdev) ...@@ -1848,10 +1868,14 @@ qla2x00_remove_one(struct pci_dev *pdev)
static void static void
qla2x00_free_device(scsi_qla_host_t *ha) qla2x00_free_device(scsi_qla_host_t *ha)
{ {
qla2x00_abort_all_cmds(ha, DID_NO_CONNECT << 16);
/* Disable timer */ /* Disable timer */
if (ha->timer_active) if (ha->timer_active)
qla2x00_stop_timer(ha); qla2x00_stop_timer(ha);
ha->flags.online = 0;
/* Kill the kernel thread for this host */ /* Kill the kernel thread for this host */
if (ha->dpc_thread) { if (ha->dpc_thread) {
struct task_struct *t = ha->dpc_thread; struct task_struct *t = ha->dpc_thread;
...@@ -1870,8 +1894,6 @@ qla2x00_free_device(scsi_qla_host_t *ha) ...@@ -1870,8 +1894,6 @@ qla2x00_free_device(scsi_qla_host_t *ha)
if (ha->eft) if (ha->eft)
qla2x00_disable_eft_trace(ha); qla2x00_disable_eft_trace(ha);
ha->flags.online = 0;
/* Stop currently executing firmware. */ /* Stop currently executing firmware. */
qla2x00_try_to_stop_firmware(ha); qla2x00_try_to_stop_firmware(ha);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment