diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 97 |
1 files changed, 9 insertions, 88 deletions
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 | */ |
39 | char srb_cachep_name[16]; | 39 | static kmem_cache_t *srb_cachep; |
40 | kmem_cache_t *srb_cachep; | ||
41 | |||
42 | /* | ||
43 | * Stats for all adpaters. | ||
44 | */ | ||
45 | struct _qla2x00stats qla2x00_stats; | ||
46 | 40 | ||
47 | /* | 41 | /* |
48 | * Ioctl related information. | 42 | * Ioctl related information. |
49 | */ | 43 | */ |
50 | int num_hosts; | 44 | static int num_hosts; |
51 | int apiHBAInstance; | ||
52 | |||
53 | /* | ||
54 | * Module parameter information and variables | ||
55 | */ | ||
56 | int ql2xmaxqdepth; | ||
57 | module_param(ql2xmaxqdepth, int, S_IRUGO|S_IWUSR); | ||
58 | MODULE_PARM_DESC(ql2xmaxqdepth, | ||
59 | "Maximum queue depth to report for target devices."); | ||
60 | 45 | ||
61 | int ql2xlogintimeout = 20; | 46 | int ql2xlogintimeout = 20; |
62 | module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR); | 47 | module_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 | ||
72 | int ql2xretrycount = 20; | ||
73 | module_param(ql2xretrycount, int, S_IRUGO|S_IWUSR); | ||
74 | MODULE_PARM_DESC(ql2xretrycount, | ||
75 | "Maximum number of mid-layer retries allowed for a command. " | ||
76 | "Default value is 20, "); | ||
77 | |||
78 | int ql2xplogiabsentdevice; | 57 | int ql2xplogiabsentdevice; |
79 | module_param(ql2xplogiabsentdevice, int, S_IRUGO|S_IWUSR); | 58 | module_param(ql2xplogiabsentdevice, int, S_IRUGO|S_IWUSR); |
80 | MODULE_PARM_DESC(ql2xplogiabsentdevice, | 59 | MODULE_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 | ||
98 | int ConfigRequired; | ||
99 | module_param(ConfigRequired, int, S_IRUGO|S_IRUSR); | ||
100 | MODULE_PARM_DESC(ConfigRequired, | ||
101 | "If 1, then only configured devices passed in through the" | ||
102 | "ql2xopts parameter will be presented to the OS"); | ||
103 | |||
104 | int Bind = BIND_BY_PORT_NAME; | ||
105 | module_param(Bind, int, S_IRUGO|S_IRUSR); | ||
106 | MODULE_PARM_DESC(Bind, | ||
107 | "Target persistent binding method: " | ||
108 | "0 by Portname (default); 1 by PortID; 2 by Nodename. "); | ||
109 | |||
110 | int ql2xsuspendcount = SUSPEND_COUNT; | ||
111 | module_param(ql2xsuspendcount, int, S_IRUGO|S_IWUSR); | ||
112 | MODULE_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 | |||
117 | int ql2xloginretrycount = 0; | 77 | int ql2xloginretrycount = 0; |
118 | module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR); | 78 | module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR); |
119 | MODULE_PARM_DESC(ql2xloginretrycount, | 79 | MODULE_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 | ||
716 | eh_dev_reset_done: | 668 | eh_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 | ||
903 | eh_host_reset_lock: | 847 | eh_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 | |||
2338 | qla2x00_module_init(void) | 2269 | qla2x00_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) | |||
2367 | static void __exit | 2297 | static void __exit |
2368 | qla2x00_module_exit(void) | 2298 | qla2x00_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 | ||