aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2008-01-31 15:33:46 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-02-07 19:02:38 -0500
commitdf4bf0bb5b077545031e8ad5ef3cc0dd8a5fbe05 (patch)
treeda275b2c498c7e85fbfb634aa7a95032e8583828 /drivers/scsi/qla2xxx
parent61623fc34f9db7f01b672d2fa443d3d492049bbe (diff)
[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: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h1
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c16
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c30
3 files changed, 28 insertions, 19 deletions
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index ba35fc26ce6b..193f688ec3d7 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -66,6 +66,7 @@ extern int ql2xqfullrampup;
66extern int num_hosts; 66extern int num_hosts;
67 67
68extern int qla2x00_loop_reset(scsi_qla_host_t *); 68extern int qla2x00_loop_reset(scsi_qla_host_t *);
69extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
69 70
70/* 71/*
71 * Global Functions in qla_mid.c source file. 72 * Global Functions in qla_mid.c source file.
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index d0633ca894be..2e51fa8a70f8 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3213,9 +3213,6 @@ int
3213qla2x00_abort_isp(scsi_qla_host_t *ha) 3213qla2x00_abort_isp(scsi_qla_host_t *ha)
3214{ 3214{
3215 int rval; 3215 int rval;
3216 unsigned long flags = 0;
3217 uint16_t cnt;
3218 srb_t *sp;
3219 uint8_t status = 0; 3216 uint8_t status = 0;
3220 3217
3221 if (ha->flags.online) { 3218 if (ha->flags.online) {
@@ -3236,19 +3233,8 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
3236 LOOP_DOWN_TIME); 3233 LOOP_DOWN_TIME);
3237 } 3234 }
3238 3235
3239 spin_lock_irqsave(&ha->hardware_lock, flags);
3240 /* Requeue all commands in outstanding command list. */ 3236 /* Requeue all commands in outstanding command list. */
3241 for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) { 3237 qla2x00_abort_all_cmds(ha, DID_RESET << 16);
3242 sp = ha->outstanding_cmds[cnt];
3243 if (sp) {
3244 ha->outstanding_cmds[cnt] = NULL;
3245 sp->flags = 0;
3246 sp->cmd->result = DID_RESET << 16;
3247 sp->cmd->host_scribble = (unsigned char *)NULL;
3248 qla2x00_sp_compl(ha, sp);
3249 }
3250 }
3251 spin_unlock_irqrestore(&ha->hardware_lock, flags);
3252 3238
3253 ha->isp_ops->get_flash_version(ha, ha->request_ring); 3239 ha->isp_ops->get_flash_version(ha, ha->request_ring);
3254 3240
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 5942712799fe..3869e4d174c6 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1117,6 +1117,27 @@ qla2x00_device_reset(scsi_qla_host_t *ha, fc_port_t *reset_fcport)
1117 return ha->isp_ops->abort_target(reset_fcport); 1117 return ha->isp_ops->abort_target(reset_fcport);
1118} 1118}
1119 1119
1120void
1121qla2x00_abort_all_cmds(scsi_qla_host_t *ha, int res)
1122{
1123 int cnt;
1124 unsigned long flags;
1125 srb_t *sp;
1126
1127 spin_lock_irqsave(&ha->hardware_lock, flags);
1128 for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
1129 sp = ha->outstanding_cmds[cnt];
1130 if (sp) {
1131 ha->outstanding_cmds[cnt] = NULL;
1132 sp->flags = 0;
1133 sp->cmd->result = res;
1134 sp->cmd->host_scribble = (unsigned char *)NULL;
1135 qla2x00_sp_compl(ha, sp);
1136 }
1137 }
1138 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1139}
1140
1120static int 1141static int
1121qla2xxx_slave_alloc(struct scsi_device *sdev) 1142qla2xxx_slave_alloc(struct scsi_device *sdev)
1122{ 1143{
@@ -1608,6 +1629,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1608 ha->parent = NULL; 1629 ha->parent = NULL;
1609 ha->bars = bars; 1630 ha->bars = bars;
1610 ha->mem_only = mem_only; 1631 ha->mem_only = mem_only;
1632 spin_lock_init(&ha->hardware_lock);
1611 1633
1612 /* Set ISP-type information. */ 1634 /* Set ISP-type information. */
1613 qla2x00_set_isp_flags(ha); 1635 qla2x00_set_isp_flags(ha);
@@ -1621,8 +1643,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1621 "Found an ISP%04X, irq %d, iobase 0x%p\n", pdev->device, pdev->irq, 1643 "Found an ISP%04X, irq %d, iobase 0x%p\n", pdev->device, pdev->irq,
1622 ha->iobase); 1644 ha->iobase);
1623 1645
1624 spin_lock_init(&ha->hardware_lock);
1625
1626 ha->prev_topology = 0; 1646 ha->prev_topology = 0;
1627 ha->init_cb_size = sizeof(init_cb_t); 1647 ha->init_cb_size = sizeof(init_cb_t);
1628 ha->mgmt_svr_loop_id = MANAGEMENT_SERVER + ha->vp_idx; 1648 ha->mgmt_svr_loop_id = MANAGEMENT_SERVER + ha->vp_idx;
@@ -1848,10 +1868,14 @@ qla2x00_remove_one(struct pci_dev *pdev)
1848static void 1868static void
1849qla2x00_free_device(scsi_qla_host_t *ha) 1869qla2x00_free_device(scsi_qla_host_t *ha)
1850{ 1870{
1871 qla2x00_abort_all_cmds(ha, DID_NO_CONNECT << 16);
1872
1851 /* Disable timer */ 1873 /* Disable timer */
1852 if (ha->timer_active) 1874 if (ha->timer_active)
1853 qla2x00_stop_timer(ha); 1875 qla2x00_stop_timer(ha);
1854 1876
1877 ha->flags.online = 0;
1878
1855 /* Kill the kernel thread for this host */ 1879 /* Kill the kernel thread for this host */
1856 if (ha->dpc_thread) { 1880 if (ha->dpc_thread) {
1857 struct task_struct *t = ha->dpc_thread; 1881 struct task_struct *t = ha->dpc_thread;
@@ -1870,8 +1894,6 @@ qla2x00_free_device(scsi_qla_host_t *ha)
1870 if (ha->eft) 1894 if (ha->eft)
1871 qla2x00_disable_eft_trace(ha); 1895 qla2x00_disable_eft_trace(ha);
1872 1896
1873 ha->flags.online = 0;
1874
1875 /* Stop currently executing firmware. */ 1897 /* Stop currently executing firmware. */
1876 qla2x00_try_to_stop_firmware(ha); 1898 qla2x00_try_to_stop_firmware(ha);
1877 1899