aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorJames Bottomley <jejb@titanic.(none)>2005-06-17 19:42:23 -0400
committerJames Bottomley <jejb@titanic.(none)>2005-06-17 19:42:23 -0400
commit3237ee78fc00f786d5f5aec6f9310b0e39069f15 (patch)
tree4c94e70ab846ffcb8bb5715fb3c8d8473358a323 /drivers/scsi/qla2xxx
parent9ee1c939d1cb936b1f98e8d81aeffab57bae46ab (diff)
parentdf0ae2497ddefd72a87f3a3b34ff32455d7d4ae0 (diff)
merge by hand (fix up qla_os.c merge error)
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c3
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h60
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h14
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c33
-rw-r--r--drivers/scsi/qla2xxx/qla_iocb.c3
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c18
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c97
8 files changed, 13 insertions, 221 deletions
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index c4cd4ac414c4..329d1a1fa547 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -1063,8 +1063,7 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
1063 return; 1063 return;
1064 1064
1065 printk(" sp flags=0x%x\n", sp->flags); 1065 printk(" sp flags=0x%x\n", sp->flags);
1066 printk(" r_start=0x%lx, u_start=0x%lx, f_start=0x%lx, state=%d\n", 1066 printk(" state=%d\n", sp->state);
1067 sp->r_start, sp->u_start, sp->f_start, sp->state);
1068} 1067}
1069 1068
1070#if defined(QL_DEBUG_ROUTINES) 1069#if defined(QL_DEBUG_ROUTINES)
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 7d47b8d92047..83a32e403e29 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -252,31 +252,12 @@ typedef struct srb {
252 /* Request state */ 252 /* Request state */
253 uint16_t state; 253 uint16_t state;
254 254
255 /* Timing counts. */
256 unsigned long e_start; /* Start of extend timeout */
257 unsigned long r_start; /* Start of request */
258 unsigned long u_start; /* When sent to RISC */
259 unsigned long f_start; /* When placed in FO queue*/
260
261 /* Single transfer DMA context */ 255 /* Single transfer DMA context */
262 dma_addr_t dma_handle; 256 dma_addr_t dma_handle;
263 257
264 uint32_t request_sense_length; 258 uint32_t request_sense_length;
265 uint8_t *request_sense_ptr; 259 uint8_t *request_sense_ptr;
266 260
267 int ext_history;
268
269 /* Suspend delay */
270 int delay;
271
272 /* Raw completion info for use by failover ? */
273 uint8_t fo_retry_cnt; /* Retry count this request */
274 uint8_t err_id; /* error id */
275#define SRB_ERR_PORT 1 /* Request failed -- "port down" */
276#define SRB_ERR_LOOP 2 /* Request failed -- "loop down" */
277#define SRB_ERR_DEVICE 3 /* Request failed -- "device error" */
278#define SRB_ERR_OTHER 4
279
280 /* SRB magic number */ 261 /* SRB magic number */
281 uint16_t magic; 262 uint16_t magic;
282#define SRB_MAGIC 0x10CB 263#define SRB_MAGIC 0x10CB
@@ -2082,23 +2063,8 @@ typedef struct scsi_qla_host {
2082 uint32_t current_outstanding_cmd; 2063 uint32_t current_outstanding_cmd;
2083 srb_t *status_srb; /* Status continuation entry. */ 2064 srb_t *status_srb; /* Status continuation entry. */
2084 2065
2085 unsigned long last_irq_cpu; /* cpu where we got our last irq */
2086
2087 uint16_t revision; 2066 uint16_t revision;
2088 uint8_t ports; 2067 uint8_t ports;
2089 u_long actthreads;
2090 u_long ipreq_cnt;
2091 u_long qthreads;
2092
2093 uint32_t total_isr_cnt; /* Interrupt count */
2094 uint32_t total_isp_aborts; /* controller err cnt */
2095 uint32_t total_lip_cnt; /* LIP cnt */
2096 uint32_t total_dev_errs; /* device error cnt */
2097 uint32_t total_ios; /* IO cnt */
2098 uint64_t total_bytes; /* xfr byte cnt */
2099 uint32_t total_mbx_timeout; /* mailbox timeout cnt */
2100 uint32_t total_loop_resync; /* loop resyn cnt */
2101 uint32_t dropped_frame_error_cnt;
2102 2068
2103 /* ISP configuration data. */ 2069 /* ISP configuration data. */
2104 uint16_t loop_id; /* Host adapter loop id */ 2070 uint16_t loop_id; /* Host adapter loop id */
@@ -2124,8 +2090,6 @@ typedef struct scsi_qla_host {
2124#define P2P_LOOP 3 2090#define P2P_LOOP 3
2125 2091
2126 uint8_t marker_needed; 2092 uint8_t marker_needed;
2127 uint8_t sns_retry_cnt;
2128 uint8_t mem_err;
2129 2093
2130 uint8_t interrupts_on; 2094 uint8_t interrupts_on;
2131 2095
@@ -2138,16 +2102,11 @@ typedef struct scsi_qla_host {
2138 uint16_t nvram_base; 2102 uint16_t nvram_base;
2139 2103
2140 uint16_t loop_reset_delay; 2104 uint16_t loop_reset_delay;
2141 uint16_t minimum_timeout;
2142 uint8_t retry_count; 2105 uint8_t retry_count;
2143 uint8_t login_timeout; 2106 uint8_t login_timeout;
2144 uint16_t r_a_tov; 2107 uint16_t r_a_tov;
2145 int port_down_retry_count; 2108 int port_down_retry_count;
2146 uint8_t loop_down_timeout;
2147 uint8_t mbx_count; 2109 uint8_t mbx_count;
2148 uint16_t max_probe_luns;
2149 uint16_t max_luns;
2150 uint16_t max_targets;
2151 uint16_t last_loop_id; 2110 uint16_t last_loop_id;
2152 2111
2153 uint32_t login_retry_count; 2112 uint32_t login_retry_count;
@@ -2181,7 +2140,6 @@ typedef struct scsi_qla_host {
2181 uint8_t dpc_active; /* DPC routine is active */ 2140 uint8_t dpc_active; /* DPC routine is active */
2182 2141
2183 /* Timeout timers. */ 2142 /* Timeout timers. */
2184 uint8_t queue_restart_timer;
2185 uint8_t loop_down_abort_time; /* port down timer */ 2143 uint8_t loop_down_abort_time; /* port down timer */
2186 atomic_t loop_down_timer; /* loop down timer */ 2144 atomic_t loop_down_timer; /* loop down timer */
2187 uint8_t link_down_timeout; /* link down timeout */ 2145 uint8_t link_down_timeout; /* link down timeout */
@@ -2230,18 +2188,6 @@ typedef struct scsi_qla_host {
2230 2188
2231 mbx_cmd_t mc; 2189 mbx_cmd_t mc;
2232 2190
2233 uint8_t *cmdline;
2234
2235 uint32_t failover_type;
2236 uint32_t failback_delay;
2237 unsigned long cfg_flags;
2238#define CFG_ACTIVE 0 /* CFG during a failover, event update, or ioctl */
2239#define CFG_FAILOVER 1 /* CFG during path change */
2240
2241 uint32_t binding_type;
2242#define BIND_BY_PORT_NAME 0
2243#define BIND_BY_PORT_ID 1
2244
2245 /* Basic firmware related information. */ 2191 /* Basic firmware related information. */
2246 struct qla_board_info *brd_info; 2192 struct qla_board_info *brd_info;
2247 uint16_t fw_major_version; 2193 uint16_t fw_major_version;
@@ -2274,12 +2220,6 @@ typedef struct scsi_qla_host {
2274 uint8_t nvram_version; 2220 uint8_t nvram_version;
2275 uint32_t isp_abort_cnt; 2221 uint32_t isp_abort_cnt;
2276 2222
2277 /* Adapter I/O statistics for failover */
2278 uint64_t IosRequested;
2279 uint64_t BytesRequested;
2280 uint64_t IosExecuted;
2281 uint64_t BytesExecuted;
2282
2283 /* Needed for BEACON */ 2223 /* Needed for BEACON */
2284 uint16_t beacon_blink_led; 2224 uint16_t beacon_blink_led;
2285 uint16_t beacon_green_on; 2225 uint16_t beacon_green_on;
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 2efec6c24d60..164866b199e6 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -53,27 +53,13 @@ extern void qla2x00_reg_remote_port(scsi_qla_host_t *, fc_port_t *);
53 */ 53 */
54extern char qla2x00_version_str[]; 54extern char qla2x00_version_str[];
55 55
56extern int num_hosts;
57extern int apiHBAInstance;
58
59extern struct _qla2x00stats qla2x00_stats;
60extern int ql2xretrycount;
61extern int ql2xlogintimeout; 56extern int ql2xlogintimeout;
62extern int qlport_down_retry; 57extern int qlport_down_retry;
63extern int ql2xmaxqdepth;
64extern int displayConfig;
65extern int ql2xplogiabsentdevice; 58extern int ql2xplogiabsentdevice;
66extern int ql2xenablezio; 59extern int ql2xenablezio;
67extern int ql2xintrdelaytimer; 60extern int ql2xintrdelaytimer;
68extern int ql2xloginretrycount; 61extern int ql2xloginretrycount;
69 62
70extern int ConfigRequired;
71
72extern int Bind;
73extern int ql2xsuspendcount;
74#if defined(MODULE)
75extern char *ql2xopts;
76#endif
77extern void qla2x00_sp_compl(scsi_qla_host_t *, srb_t *); 63extern void qla2x00_sp_compl(scsi_qla_host_t *, srb_t *);
78 64
79extern char *qla2x00_get_fw_version_str(struct scsi_qla_host *, char *); 65extern char *qla2x00_get_fw_version_str(struct scsi_qla_host *, char *);
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 0387005fcb6d..7629558eba25 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -85,9 +85,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *ha)
85 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); 85 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME);
86 atomic_set(&ha->loop_state, LOOP_DOWN); 86 atomic_set(&ha->loop_state, LOOP_DOWN);
87 ha->device_flags = 0; 87 ha->device_flags = 0;
88 ha->sns_retry_cnt = 0;
89 ha->dpc_flags = 0; 88 ha->dpc_flags = 0;
90 ha->failback_delay = 0;
91 ha->flags.management_server_logged_in = 0; 89 ha->flags.management_server_logged_in = 0;
92 ha->marker_needed = 0; 90 ha->marker_needed = 0;
93 ha->mbx_flags = 0; 91 ha->mbx_flags = 0;
@@ -171,8 +169,6 @@ check_fw_ready_again:
171 169
172 if (wait_time == 0) 170 if (wait_time == 0)
173 rval = QLA_FUNCTION_FAILED; 171 rval = QLA_FUNCTION_FAILED;
174 if (ha->mem_err)
175 restart_risc = 1;
176 } else if (ha->device_flags & DFLG_NO_CABLE) 172 } else if (ha->device_flags & DFLG_NO_CABLE)
177 /* If no cable, then all is good. */ 173 /* If no cable, then all is good. */
178 rval = QLA_SUCCESS; 174 rval = QLA_SUCCESS;
@@ -1410,13 +1406,8 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1410 /* Set minimum RATOV to 200 tenths of a second. */ 1406 /* Set minimum RATOV to 200 tenths of a second. */
1411 ha->r_a_tov = 200; 1407 ha->r_a_tov = 200;
1412 1408
1413 ha->minimum_timeout =
1414 (ha->login_timeout * ha->retry_count) + nv->port_down_retry_count;
1415 ha->loop_reset_delay = nv->reset_delay; 1409 ha->loop_reset_delay = nv->reset_delay;
1416 1410
1417 /* Will get the value from NVRAM. */
1418 ha->loop_down_timeout = LOOP_DOWN_TIMEOUT;
1419
1420 /* Link Down Timeout = 0: 1411 /* Link Down Timeout = 0:
1421 * 1412 *
1422 * When Port Down timer expires we will start returning 1413 * When Port Down timer expires we will start returning
@@ -1429,18 +1420,13 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1429 */ 1420 */
1430 if (nv->link_down_timeout == 0) { 1421 if (nv->link_down_timeout == 0) {
1431 ha->loop_down_abort_time = 1422 ha->loop_down_abort_time =
1432 (LOOP_DOWN_TIME - ha->loop_down_timeout); 1423 (LOOP_DOWN_TIME - LOOP_DOWN_TIMEOUT);
1433 } else { 1424 } else {
1434 ha->link_down_timeout = nv->link_down_timeout; 1425 ha->link_down_timeout = nv->link_down_timeout;
1435 ha->loop_down_abort_time = 1426 ha->loop_down_abort_time =
1436 (LOOP_DOWN_TIME - ha->link_down_timeout); 1427 (LOOP_DOWN_TIME - ha->link_down_timeout);
1437 } 1428 }
1438 1429
1439 ha->max_luns = MAX_LUNS;
1440 ha->max_probe_luns = le16_to_cpu(nv->max_luns_per_target);
1441 if (ha->max_probe_luns == 0)
1442 ha->max_probe_luns = MIN_LUNS;
1443
1444 /* 1430 /*
1445 * Need enough time to try and get the port back. 1431 * Need enough time to try and get the port back.
1446 */ 1432 */
@@ -1457,16 +1443,6 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1457 if (ql2xloginretrycount) 1443 if (ql2xloginretrycount)
1458 ha->login_retry_count = ql2xloginretrycount; 1444 ha->login_retry_count = ql2xloginretrycount;
1459 1445
1460 ha->binding_type = Bind;
1461 if (ha->binding_type != BIND_BY_PORT_NAME &&
1462 ha->binding_type != BIND_BY_PORT_ID) {
1463 qla_printk(KERN_WARNING, ha,
1464 "Invalid binding type specified (%d), "
1465 "defaulting to BIND_BY_PORT_NAME!!!\n", ha->binding_type);
1466
1467 ha->binding_type = BIND_BY_PORT_NAME;
1468 }
1469
1470 icb->lun_enables = __constant_cpu_to_le16(0); 1446 icb->lun_enables = __constant_cpu_to_le16(0);
1471 icb->command_resource_count = 0; 1447 icb->command_resource_count = 0;
1472 icb->immediate_notify_resource_count = 0; 1448 icb->immediate_notify_resource_count = 0;
@@ -1578,7 +1554,6 @@ qla2x00_configure_loop(scsi_qla_host_t *ha)
1578 */ 1554 */
1579 clear_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags); 1555 clear_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags);
1580 clear_bit(RSCN_UPDATE, &ha->dpc_flags); 1556 clear_bit(RSCN_UPDATE, &ha->dpc_flags);
1581 ha->mem_err = 0 ;
1582 1557
1583 /* Determine what we need to do */ 1558 /* Determine what we need to do */
1584 if (ha->current_topology == ISP_CFG_FL && 1559 if (ha->current_topology == ISP_CFG_FL &&
@@ -2707,7 +2682,6 @@ qla2x00_loop_resync(scsi_qla_host_t *ha)
2707 rval = QLA_SUCCESS; 2682 rval = QLA_SUCCESS;
2708 2683
2709 atomic_set(&ha->loop_state, LOOP_UPDATE); 2684 atomic_set(&ha->loop_state, LOOP_UPDATE);
2710 qla2x00_stats.loop_resync++;
2711 clear_bit(ISP_ABORT_RETRY, &ha->dpc_flags); 2685 clear_bit(ISP_ABORT_RETRY, &ha->dpc_flags);
2712 if (ha->flags.online) { 2686 if (ha->flags.online) {
2713 if (!(rval = qla2x00_fw_ready(ha))) { 2687 if (!(rval = qla2x00_fw_ready(ha))) {
@@ -2786,9 +2760,6 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
2786 if (ha->flags.online) { 2760 if (ha->flags.online) {
2787 ha->flags.online = 0; 2761 ha->flags.online = 0;
2788 clear_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); 2762 clear_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
2789 qla2x00_stats.ispAbort++;
2790 ha->total_isp_aborts++; /* used by ioctl */
2791 ha->sns_retry_cnt = 0;
2792 2763
2793 qla_printk(KERN_INFO, ha, 2764 qla_printk(KERN_INFO, ha,
2794 "Performing ISP error recovery - ha= %p.\n", ha); 2765 "Performing ISP error recovery - ha= %p.\n", ha);
@@ -2810,8 +2781,6 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
2810 sp = ha->outstanding_cmds[cnt]; 2781 sp = ha->outstanding_cmds[cnt];
2811 if (sp) { 2782 if (sp) {
2812 ha->outstanding_cmds[cnt] = NULL; 2783 ha->outstanding_cmds[cnt] = NULL;
2813 if (ha->actthreads)
2814 ha->actthreads--;
2815 sp->flags = 0; 2784 sp->flags = 0;
2816 sp->cmd->result = DID_RESET << 16; 2785 sp->cmd->result = DID_RESET << 16;
2817 sp->cmd->host_scribble = (unsigned char *)NULL; 2786 sp->cmd->host_scribble = (unsigned char *)NULL;
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index af964bb3d870..ecaf9f83b2d4 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -433,11 +433,8 @@ qla2x00_start_scsi(srb_t *sp)
433 } else 433 } else
434 ha->request_ring_ptr++; 434 ha->request_ring_ptr++;
435 435
436 ha->actthreads++;
437 ha->total_ios++;
438 sp->flags |= SRB_DMA_VALID; 436 sp->flags |= SRB_DMA_VALID;
439 sp->state = SRB_ACTIVE_STATE; 437 sp->state = SRB_ACTIVE_STATE;
440 sp->u_start = jiffies;
441 438
442 /* Set chip new ring index. */ 439 /* Set chip new ring index. */
443 WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), ha->req_ring_index); 440 WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), ha->req_ring_index);
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 6792cfae56e2..e7a8b74157a5 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -91,9 +91,6 @@ qla2100_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
91 } 91 }
92 spin_unlock_irqrestore(&ha->hardware_lock, flags); 92 spin_unlock_irqrestore(&ha->hardware_lock, flags);
93 93
94 ha->last_irq_cpu = _smp_processor_id();
95 ha->total_isr_cnt++;
96
97 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && 94 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
98 (status & MBX_INTERRUPT) && ha->flags.mbox_int) { 95 (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
99 spin_lock_irqsave(&ha->mbx_reg_lock, flags); 96 spin_lock_irqsave(&ha->mbx_reg_lock, flags);
@@ -200,9 +197,6 @@ qla2300_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
200 } 197 }
201 spin_unlock_irqrestore(&ha->hardware_lock, flags); 198 spin_unlock_irqrestore(&ha->hardware_lock, flags);
202 199
203 ha->last_irq_cpu = _smp_processor_id();
204 ha->total_isr_cnt++;
205
206 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && 200 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
207 (status & MBX_INTERRUPT) && ha->flags.mbox_int) { 201 (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
208 spin_lock_irqsave(&ha->mbx_reg_lock, flags); 202 spin_lock_irqsave(&ha->mbx_reg_lock, flags);
@@ -417,7 +411,6 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx)
417 /* Update AEN queue. */ 411 /* Update AEN queue. */
418 qla2x00_enqueue_aen(ha, MBA_LIP_OCCURRED, NULL); 412 qla2x00_enqueue_aen(ha, MBA_LIP_OCCURRED, NULL);
419 413
420 ha->total_lip_cnt++;
421 break; 414 break;
422 415
423 case MBA_LOOP_UP: /* Loop Up Event */ 416 case MBA_LOOP_UP: /* Loop Up Event */
@@ -485,7 +478,6 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint32_t mbx)
485 /* Update AEN queue. */ 478 /* Update AEN queue. */
486 qla2x00_enqueue_aen(ha, MBA_LIP_RESET, NULL); 479 qla2x00_enqueue_aen(ha, MBA_LIP_RESET, NULL);
487 480
488 ha->total_lip_cnt++;
489 break; 481 break;
490 482
491 case MBA_POINT_TO_POINT: /* Point-to-Point */ 483 case MBA_POINT_TO_POINT: /* Point-to-Point */
@@ -695,14 +687,11 @@ qla2x00_process_completed_request(struct scsi_qla_host *ha, uint32_t index)
695 /* Free outstanding command slot. */ 687 /* Free outstanding command slot. */
696 ha->outstanding_cmds[index] = NULL; 688 ha->outstanding_cmds[index] = NULL;
697 689
698 if (ha->actthreads)
699 ha->actthreads--;
700 CMD_COMPL_STATUS(sp->cmd) = 0L; 690 CMD_COMPL_STATUS(sp->cmd) = 0L;
701 CMD_SCSI_STATUS(sp->cmd) = 0L; 691 CMD_SCSI_STATUS(sp->cmd) = 0L;
702 692
703 /* Save ISP completion status */ 693 /* Save ISP completion status */
704 sp->cmd->result = DID_OK << 16; 694 sp->cmd->result = DID_OK << 16;
705 sp->fo_retry_cnt = 0;
706 qla2x00_sp_compl(ha, sp); 695 qla2x00_sp_compl(ha, sp);
707 } else { 696 } else {
708 DEBUG2(printk("scsi(%ld): Invalid ISP SCSI completion handle\n", 697 DEBUG2(printk("scsi(%ld): Invalid ISP SCSI completion handle\n",
@@ -865,9 +854,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
865 return; 854 return;
866 } 855 }
867 856
868 if (ha->actthreads)
869 ha->actthreads--;
870
871 comp_status = le16_to_cpu(pkt->comp_status); 857 comp_status = le16_to_cpu(pkt->comp_status);
872 /* Mask of reserved bits 12-15, before we examine the scsi status */ 858 /* Mask of reserved bits 12-15, before we examine the scsi status */
873 scsi_status = le16_to_cpu(pkt->scsi_status) & SS_MASK; 859 scsi_status = le16_to_cpu(pkt->scsi_status) & SS_MASK;
@@ -1026,7 +1012,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
1026 cp->request_bufflen)); 1012 cp->request_bufflen));
1027 1013
1028 cp->result = DID_BUS_BUSY << 16; 1014 cp->result = DID_BUS_BUSY << 16;
1029 ha->dropped_frame_error_cnt++;
1030 break; 1015 break;
1031 } 1016 }
1032 1017
@@ -1233,8 +1218,7 @@ qla2x00_error_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
1233 if (sp) { 1218 if (sp) {
1234 /* Free outstanding command slot. */ 1219 /* Free outstanding command slot. */
1235 ha->outstanding_cmds[pkt->handle] = NULL; 1220 ha->outstanding_cmds[pkt->handle] = NULL;
1236 if (ha->actthreads) 1221
1237 ha->actthreads--;
1238 /* Bad payload or header */ 1222 /* Bad payload or header */
1239 if (pkt->entry_status & 1223 if (pkt->entry_status &
1240 (RF_INV_E_ORDER | RF_INV_E_COUNT | 1224 (RF_INV_E_ORDER | RF_INV_E_COUNT |
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 15f6acaca305..eeaec7c50e6a 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -219,10 +219,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
219 ha->flags.mbox_int = 0; 219 ha->flags.mbox_int = 0;
220 clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); 220 clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
221 221
222 if (ha->mailbox_out[0] != MBS_COMMAND_COMPLETE) { 222 if (ha->mailbox_out[0] != MBS_COMMAND_COMPLETE)
223 qla2x00_stats.mboxerr++;
224 rval = QLA_FUNCTION_FAILED; 223 rval = QLA_FUNCTION_FAILED;
225 }
226 224
227 /* Load return mailbox registers. */ 225 /* Load return mailbox registers. */
228 iptr2 = mcp->mb; 226 iptr2 = mcp->mb;
@@ -249,8 +247,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
249 qla2x00_dump_regs(ha); 247 qla2x00_dump_regs(ha);
250#endif 248#endif
251 249
252 qla2x00_stats.mboxtout++;
253 ha->total_mbx_timeout++;
254 rval = QLA_FUNCTION_TIMEOUT; 250 rval = QLA_FUNCTION_TIMEOUT;
255 } 251 }
256 252
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 3c97aa45772d..e6831264f67c 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -36,27 +36,12 @@ char qla2x00_version_str[40];
36/* 36/*
37 * SRB allocation cache 37 * SRB allocation cache
38 */ 38 */
39char srb_cachep_name[16]; 39static kmem_cache_t *srb_cachep;
40kmem_cache_t *srb_cachep;
41
42/*
43 * Stats for all adpaters.
44 */
45struct _qla2x00stats qla2x00_stats;
46 40
47/* 41/*
48 * Ioctl related information. 42 * Ioctl related information.
49 */ 43 */
50int num_hosts; 44static int num_hosts;
51int apiHBAInstance;
52
53/*
54 * Module parameter information and variables
55 */
56int ql2xmaxqdepth;
57module_param(ql2xmaxqdepth, int, S_IRUGO|S_IWUSR);
58MODULE_PARM_DESC(ql2xmaxqdepth,
59 "Maximum queue depth to report for target devices.");
60 45
61int ql2xlogintimeout = 20; 46int ql2xlogintimeout = 20;
62module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR); 47module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR);
@@ -69,12 +54,6 @@ MODULE_PARM_DESC(qlport_down_retry,
69 "Maximum number of command retries to a port that returns" 54 "Maximum number of command retries to a port that returns"
70 "a PORT-DOWN status."); 55 "a PORT-DOWN status.");
71 56
72int ql2xretrycount = 20;
73module_param(ql2xretrycount, int, S_IRUGO|S_IWUSR);
74MODULE_PARM_DESC(ql2xretrycount,
75 "Maximum number of mid-layer retries allowed for a command. "
76 "Default value is 20, ");
77
78int ql2xplogiabsentdevice; 57int ql2xplogiabsentdevice;
79module_param(ql2xplogiabsentdevice, int, S_IRUGO|S_IWUSR); 58module_param(ql2xplogiabsentdevice, int, S_IRUGO|S_IWUSR);
80MODULE_PARM_DESC(ql2xplogiabsentdevice, 59MODULE_PARM_DESC(ql2xplogiabsentdevice,
@@ -95,25 +74,6 @@ MODULE_PARM_DESC(ql2xintrdelaytimer,
95 "ZIO: Waiting time for Firmware before it generates an " 74 "ZIO: Waiting time for Firmware before it generates an "
96 "interrupt to the host to notify completion of request."); 75 "interrupt to the host to notify completion of request.");
97 76
98int ConfigRequired;
99module_param(ConfigRequired, int, S_IRUGO|S_IRUSR);
100MODULE_PARM_DESC(ConfigRequired,
101 "If 1, then only configured devices passed in through the"
102 "ql2xopts parameter will be presented to the OS");
103
104int Bind = BIND_BY_PORT_NAME;
105module_param(Bind, int, S_IRUGO|S_IRUSR);
106MODULE_PARM_DESC(Bind,
107 "Target persistent binding method: "
108 "0 by Portname (default); 1 by PortID; 2 by Nodename. ");
109
110int ql2xsuspendcount = SUSPEND_COUNT;
111module_param(ql2xsuspendcount, int, S_IRUGO|S_IWUSR);
112MODULE_PARM_DESC(ql2xsuspendcount,
113 "Number of 6-second suspend iterations to perform while a "
114 "target returns a <NOT READY> status. Default is 10 "
115 "iterations.");
116
117int ql2xloginretrycount = 0; 77int ql2xloginretrycount = 0;
118module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR); 78module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR);
119MODULE_PARM_DESC(ql2xloginretrycount, 79MODULE_PARM_DESC(ql2xloginretrycount,
@@ -330,7 +290,6 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
330 sp->fcport = fcport; 290 sp->fcport = fcport;
331 sp->cmd = cmd; 291 sp->cmd = cmd;
332 sp->flags = 0; 292 sp->flags = 0;
333 sp->err_id = 0;
334 293
335 CMD_SP(cmd) = (void *)sp; 294 CMD_SP(cmd) = (void *)sp;
336 cmd->scsi_done = done; 295 cmd->scsi_done = done;
@@ -474,7 +433,6 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha)
474 433
475 while ((!atomic_read(&ha->loop_down_timer) && 434 while ((!atomic_read(&ha->loop_down_timer) &&
476 atomic_read(&ha->loop_state) == LOOP_DOWN) || 435 atomic_read(&ha->loop_state) == LOOP_DOWN) ||
477 test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
478 atomic_read(&ha->loop_state) != LOOP_READY) { 436 atomic_read(&ha->loop_state) != LOOP_READY) {
479 msleep(1000); 437 msleep(1000);
480 if (time_after_eq(jiffies, loop_timeout)) { 438 if (time_after_eq(jiffies, loop_timeout)) {
@@ -519,7 +477,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
519 serial = cmd->serial_number; 477 serial = cmd->serial_number;
520 478
521 /* Check active list for command command. */ 479 /* Check active list for command command. */
522 spin_unlock_irq(ha->host->host_lock);
523 spin_lock_irqsave(&ha->hardware_lock, flags); 480 spin_lock_irqsave(&ha->hardware_lock, flags);
524 for (i = 1; i < MAX_OUTSTANDING_COMMANDS; i++) { 481 for (i = 1; i < MAX_OUTSTANDING_COMMANDS; i++) {
525 sp = ha->outstanding_cmds[i]; 482 sp = ha->outstanding_cmds[i];
@@ -558,7 +515,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
558 "%x.\n", ha->host_no, id, lun, serial, ret); 515 "%x.\n", ha->host_no, id, lun, serial, ret);
559 } 516 }
560 } 517 }
561 spin_lock_irq(ha->host->host_lock);
562 518
563 qla_printk(KERN_INFO, ha, 519 qla_printk(KERN_INFO, ha,
564 "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no, 520 "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no,
@@ -658,12 +614,8 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
658 qla_printk(KERN_INFO, ha, 614 qla_printk(KERN_INFO, ha,
659 "scsi(%ld:%d:%d): DEVICE RESET ISSUED.\n", ha->host_no, id, lun); 615 "scsi(%ld:%d:%d): DEVICE RESET ISSUED.\n", ha->host_no, id, lun);
660 616
661 spin_unlock_irq(ha->host->host_lock); 617 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS)
662
663 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
664 spin_lock_irq(ha->host->host_lock);
665 goto eh_dev_reset_done; 618 goto eh_dev_reset_done;
666 }
667 619
668 if (qla2x00_wait_for_loop_ready(ha) == QLA_SUCCESS) { 620 if (qla2x00_wait_for_loop_ready(ha) == QLA_SUCCESS) {
669 if (qla2x00_device_reset(ha, fcport) == 0) 621 if (qla2x00_device_reset(ha, fcport) == 0)
@@ -714,8 +666,6 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
714 "scsi(%ld:%d:%d): DEVICE RESET SUCCEEDED.\n", ha->host_no, id, lun); 666 "scsi(%ld:%d:%d): DEVICE RESET SUCCEEDED.\n", ha->host_no, id, lun);
715 667
716eh_dev_reset_done: 668eh_dev_reset_done:
717 spin_lock_irq(ha->host->host_lock);
718
719 return ret; 669 return ret;
720} 670}
721 671
@@ -805,8 +755,6 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
805 qla_printk(KERN_INFO, ha, 755 qla_printk(KERN_INFO, ha,
806 "scsi(%ld:%d:%d): LOOP RESET ISSUED.\n", ha->host_no, id, lun); 756 "scsi(%ld:%d:%d): LOOP RESET ISSUED.\n", ha->host_no, id, lun);
807 757
808 spin_unlock_irq(ha->host->host_lock);
809
810 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) { 758 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
811 DEBUG2(printk("%s failed:board disabled\n",__func__)); 759 DEBUG2(printk("%s failed:board disabled\n",__func__));
812 goto eh_bus_reset_done; 760 goto eh_bus_reset_done;
@@ -828,8 +776,6 @@ eh_bus_reset_done:
828 qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, 776 qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__,
829 (ret == FAILED) ? "failed" : "succeded"); 777 (ret == FAILED) ? "failed" : "succeded");
830 778
831 spin_lock_irq(ha->host->host_lock);
832
833 return ret; 779 return ret;
834} 780}
835 781
@@ -871,8 +817,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
871 qla_printk(KERN_INFO, ha, 817 qla_printk(KERN_INFO, ha,
872 "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", ha->host_no, id, lun); 818 "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", ha->host_no, id, lun);
873 819
874 spin_unlock_irq(ha->host->host_lock);
875
876 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) 820 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS)
877 goto eh_host_reset_lock; 821 goto eh_host_reset_lock;
878 822
@@ -901,8 +845,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
901 ret = SUCCESS; 845 ret = SUCCESS;
902 846
903eh_host_reset_lock: 847eh_host_reset_lock:
904 spin_lock_irq(ha->host->host_lock);
905
906 qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, 848 qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__,
907 (ret == FAILED) ? "failed" : "succeded"); 849 (ret == FAILED) ? "failed" : "succeded");
908 850
@@ -1196,34 +1138,24 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1196 1138
1197 spin_lock_init(&ha->hardware_lock); 1139 spin_lock_init(&ha->hardware_lock);
1198 1140
1199 /* 4.23 Initialize /proc/scsi/qla2x00 counters */
1200 ha->actthreads = 0;
1201 ha->qthreads = 0;
1202 ha->total_isr_cnt = 0;
1203 ha->total_isp_aborts = 0;
1204 ha->total_lip_cnt = 0;
1205 ha->total_dev_errs = 0;
1206 ha->total_ios = 0;
1207 ha->total_bytes = 0;
1208
1209 ha->prev_topology = 0; 1141 ha->prev_topology = 0;
1210 ha->ports = MAX_BUSES; 1142 ha->ports = MAX_BUSES;
1211 1143
1212 if (IS_QLA2100(ha)) { 1144 if (IS_QLA2100(ha)) {
1213 ha->max_targets = MAX_TARGETS_2100; 1145 host->max_id = MAX_TARGETS_2100;
1214 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; 1146 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100;
1215 ha->request_q_length = REQUEST_ENTRY_CNT_2100; 1147 ha->request_q_length = REQUEST_ENTRY_CNT_2100;
1216 ha->response_q_length = RESPONSE_ENTRY_CNT_2100; 1148 ha->response_q_length = RESPONSE_ENTRY_CNT_2100;
1217 ha->last_loop_id = SNS_LAST_LOOP_ID_2100; 1149 ha->last_loop_id = SNS_LAST_LOOP_ID_2100;
1218 host->sg_tablesize = 32; 1150 host->sg_tablesize = 32;
1219 } else if (IS_QLA2200(ha)) { 1151 } else if (IS_QLA2200(ha)) {
1220 ha->max_targets = MAX_TARGETS_2200; 1152 host->max_id = MAX_TARGETS_2200;
1221 ha->mbx_count = MAILBOX_REGISTER_COUNT; 1153 ha->mbx_count = MAILBOX_REGISTER_COUNT;
1222 ha->request_q_length = REQUEST_ENTRY_CNT_2200; 1154 ha->request_q_length = REQUEST_ENTRY_CNT_2200;
1223 ha->response_q_length = RESPONSE_ENTRY_CNT_2100; 1155 ha->response_q_length = RESPONSE_ENTRY_CNT_2100;
1224 ha->last_loop_id = SNS_LAST_LOOP_ID_2100; 1156 ha->last_loop_id = SNS_LAST_LOOP_ID_2100;
1225 } else /*if (IS_QLA2300(ha))*/ { 1157 } else /*if (IS_QLA2300(ha))*/ {
1226 ha->max_targets = MAX_TARGETS_2200; 1158 host->max_id = MAX_TARGETS_2200;
1227 ha->mbx_count = MAILBOX_REGISTER_COUNT; 1159 ha->mbx_count = MAILBOX_REGISTER_COUNT;
1228 ha->request_q_length = REQUEST_ENTRY_CNT_2200; 1160 ha->request_q_length = REQUEST_ENTRY_CNT_2200;
1229 ha->response_q_length = RESPONSE_ENTRY_CNT_2300; 1161 ha->response_q_length = RESPONSE_ENTRY_CNT_2300;
@@ -1267,8 +1199,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1267 host->unique_id = ha->instance; 1199 host->unique_id = ha->instance;
1268 host->max_cmd_len = MAX_CMDSZ; 1200 host->max_cmd_len = MAX_CMDSZ;
1269 host->max_channel = ha->ports - 1; 1201 host->max_channel = ha->ports - 1;
1270 host->max_id = ha->max_targets; 1202 host->max_lun = MAX_LUNS;
1271 host->max_lun = ha->max_luns;
1272 host->transportt = qla2xxx_transport_template; 1203 host->transportt = qla2xxx_transport_template;
1273 if (scsi_add_host(host, &pdev->dev)) 1204 if (scsi_add_host(host, &pdev->dev))
1274 goto probe_alloc_failed; 1205 goto probe_alloc_failed;
@@ -2338,8 +2269,7 @@ static int __init
2338qla2x00_module_init(void) 2269qla2x00_module_init(void)
2339{ 2270{
2340 /* Allocate cache for SRBs. */ 2271 /* Allocate cache for SRBs. */
2341 sprintf(srb_cachep_name, "qla2xxx_srbs"); 2272 srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0,
2342 srb_cachep = kmem_cache_create(srb_cachep_name, sizeof(srb_t), 0,
2343 SLAB_HWCACHE_ALIGN, NULL, NULL); 2273 SLAB_HWCACHE_ALIGN, NULL, NULL);
2344 if (srb_cachep == NULL) { 2274 if (srb_cachep == NULL) {
2345 printk(KERN_ERR 2275 printk(KERN_ERR
@@ -2367,16 +2297,7 @@ qla2x00_module_init(void)
2367static void __exit 2297static void __exit
2368qla2x00_module_exit(void) 2298qla2x00_module_exit(void)
2369{ 2299{
2370 /* Free SRBs cache. */ 2300 kmem_cache_destroy(srb_cachep);
2371 if (srb_cachep != NULL) {
2372 if (kmem_cache_destroy(srb_cachep) != 0) {
2373 printk(KERN_ERR
2374 "qla2xxx: Unable to free SRB cache...Memory pools "
2375 "still active?\n");
2376 }
2377 srb_cachep = NULL;
2378 }
2379
2380 fc_release_transport(qla2xxx_transport_template); 2301 fc_release_transport(qla2xxx_transport_template);
2381} 2302}
2382 2303