aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_os.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c94
1 files changed, 8 insertions, 86 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index d960637fd56a..0b12498b7672 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
@@ -1195,34 +1137,24 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1195 1137
1196 spin_lock_init(&ha->hardware_lock); 1138 spin_lock_init(&ha->hardware_lock);
1197 1139
1198 /* 4.23 Initialize /proc/scsi/qla2x00 counters */
1199 ha->actthreads = 0;
1200 ha->qthreads = 0;
1201 ha->total_isr_cnt = 0;
1202 ha->total_isp_aborts = 0;
1203 ha->total_lip_cnt = 0;
1204 ha->total_dev_errs = 0;
1205 ha->total_ios = 0;
1206 ha->total_bytes = 0;
1207
1208 ha->prev_topology = 0; 1140 ha->prev_topology = 0;
1209 ha->ports = MAX_BUSES; 1141 ha->ports = MAX_BUSES;
1210 1142
1211 if (IS_QLA2100(ha)) { 1143 if (IS_QLA2100(ha)) {
1212 ha->max_targets = MAX_TARGETS_2100; 1144 host->max_id = MAX_TARGETS_2100;
1213 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; 1145 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100;
1214 ha->request_q_length = REQUEST_ENTRY_CNT_2100; 1146 ha->request_q_length = REQUEST_ENTRY_CNT_2100;
1215 ha->response_q_length = RESPONSE_ENTRY_CNT_2100; 1147 ha->response_q_length = RESPONSE_ENTRY_CNT_2100;
1216 ha->last_loop_id = SNS_LAST_LOOP_ID_2100; 1148 ha->last_loop_id = SNS_LAST_LOOP_ID_2100;
1217 host->sg_tablesize = 32; 1149 host->sg_tablesize = 32;
1218 } else if (IS_QLA2200(ha)) { 1150 } else if (IS_QLA2200(ha)) {
1219 ha->max_targets = MAX_TARGETS_2200; 1151 host->max_id = MAX_TARGETS_2200;
1220 ha->mbx_count = MAILBOX_REGISTER_COUNT; 1152 ha->mbx_count = MAILBOX_REGISTER_COUNT;
1221 ha->request_q_length = REQUEST_ENTRY_CNT_2200; 1153 ha->request_q_length = REQUEST_ENTRY_CNT_2200;
1222 ha->response_q_length = RESPONSE_ENTRY_CNT_2100; 1154 ha->response_q_length = RESPONSE_ENTRY_CNT_2100;
1223 ha->last_loop_id = SNS_LAST_LOOP_ID_2100; 1155 ha->last_loop_id = SNS_LAST_LOOP_ID_2100;
1224 } else /*if (IS_QLA2300(ha))*/ { 1156 } else /*if (IS_QLA2300(ha))*/ {
1225 ha->max_targets = MAX_TARGETS_2200; 1157 host->max_id = MAX_TARGETS_2200;
1226 ha->mbx_count = MAILBOX_REGISTER_COUNT; 1158 ha->mbx_count = MAILBOX_REGISTER_COUNT;
1227 ha->request_q_length = REQUEST_ENTRY_CNT_2200; 1159 ha->request_q_length = REQUEST_ENTRY_CNT_2200;
1228 ha->response_q_length = RESPONSE_ENTRY_CNT_2300; 1160 ha->response_q_length = RESPONSE_ENTRY_CNT_2300;
@@ -2339,8 +2271,7 @@ static int __init
2339qla2x00_module_init(void) 2271qla2x00_module_init(void)
2340{ 2272{
2341 /* Allocate cache for SRBs. */ 2273 /* Allocate cache for SRBs. */
2342 sprintf(srb_cachep_name, "qla2xxx_srbs"); 2274 srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0,
2343 srb_cachep = kmem_cache_create(srb_cachep_name, sizeof(srb_t), 0,
2344 SLAB_HWCACHE_ALIGN, NULL, NULL); 2275 SLAB_HWCACHE_ALIGN, NULL, NULL);
2345 if (srb_cachep == NULL) { 2276 if (srb_cachep == NULL) {
2346 printk(KERN_ERR 2277 printk(KERN_ERR
@@ -2368,16 +2299,7 @@ qla2x00_module_init(void)
2368static void __exit 2299static void __exit
2369qla2x00_module_exit(void) 2300qla2x00_module_exit(void)
2370{ 2301{
2371 /* Free SRBs cache. */ 2302 kmem_cache_destroy(srb_cachep);
2372 if (srb_cachep != NULL) {
2373 if (kmem_cache_destroy(srb_cachep) != 0) {
2374 printk(KERN_ERR
2375 "qla2xxx: Unable to free SRB cache...Memory pools "
2376 "still active?\n");
2377 }
2378 srb_cachep = NULL;
2379 }
2380
2381 fc_release_transport(qla2xxx_transport_template); 2303 fc_release_transport(qla2xxx_transport_template);
2382} 2304}
2383 2305