diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 282 |
1 files changed, 40 insertions, 242 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index d0aa18831544..2b6104daacb0 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -75,11 +75,6 @@ MODULE_PARM_DESC(ql2xretrycount, | |||
75 | "Maximum number of mid-layer retries allowed for a command. " | 75 | "Maximum number of mid-layer retries allowed for a command. " |
76 | "Default value is 20, "); | 76 | "Default value is 20, "); |
77 | 77 | ||
78 | int displayConfig; | ||
79 | module_param(displayConfig, int, S_IRUGO|S_IWUSR); | ||
80 | MODULE_PARM_DESC(displayConfig, | ||
81 | "If 1 then display the configuration used in /etc/modprobe.conf."); | ||
82 | |||
83 | int ql2xplogiabsentdevice; | 78 | int ql2xplogiabsentdevice; |
84 | module_param(ql2xplogiabsentdevice, int, S_IRUGO|S_IWUSR); | 79 | module_param(ql2xplogiabsentdevice, int, S_IRUGO|S_IWUSR); |
85 | MODULE_PARM_DESC(ql2xplogiabsentdevice, | 80 | MODULE_PARM_DESC(ql2xplogiabsentdevice, |
@@ -119,12 +114,6 @@ MODULE_PARM_DESC(ql2xsuspendcount, | |||
119 | "target returns a <NOT READY> status. Default is 10 " | 114 | "target returns a <NOT READY> status. Default is 10 " |
120 | "iterations."); | 115 | "iterations."); |
121 | 116 | ||
122 | int ql2xdoinitscan = 1; | ||
123 | module_param(ql2xdoinitscan, int, S_IRUGO|S_IWUSR); | ||
124 | MODULE_PARM_DESC(ql2xdoinitscan, | ||
125 | "Signal mid-layer to perform scan after driver load: 0 -- no " | ||
126 | "signal sent to mid-layer."); | ||
127 | |||
128 | int ql2xloginretrycount = 0; | 117 | int ql2xloginretrycount = 0; |
129 | module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR); | 118 | module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR); |
130 | MODULE_PARM_DESC(ql2xloginretrycount, | 119 | MODULE_PARM_DESC(ql2xloginretrycount, |
@@ -195,8 +184,6 @@ static struct scsi_host_template qla2x00_driver_template = { | |||
195 | 184 | ||
196 | static struct scsi_transport_template *qla2xxx_transport_template = NULL; | 185 | static struct scsi_transport_template *qla2xxx_transport_template = NULL; |
197 | 186 | ||
198 | static void qla2x00_display_fc_names(scsi_qla_host_t *); | ||
199 | |||
200 | /* TODO Convert to inlines | 187 | /* TODO Convert to inlines |
201 | * | 188 | * |
202 | * Timer routines | 189 | * Timer routines |
@@ -332,14 +319,11 @@ static int | |||
332 | qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 319 | qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
333 | { | 320 | { |
334 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); | 321 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); |
335 | os_tgt_t *tq = (os_tgt_t *) cmd->device->hostdata; | 322 | fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; |
336 | fc_port_t *fcport = tq->fcport; | ||
337 | os_lun_t *lq; | ||
338 | srb_t *sp; | 323 | srb_t *sp; |
339 | int rval; | 324 | int rval; |
340 | 325 | ||
341 | lq = GET_LU_Q(ha, cmd->device->id, cmd->device->lun); | 326 | if (!fcport) { |
342 | if (!fcport || !lq) { | ||
343 | cmd->result = DID_NO_CONNECT << 16; | 327 | cmd->result = DID_NO_CONNECT << 16; |
344 | goto qc_fail_command; | 328 | goto qc_fail_command; |
345 | } | 329 | } |
@@ -361,13 +345,8 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
361 | } | 345 | } |
362 | 346 | ||
363 | sp->ha = ha; | 347 | sp->ha = ha; |
348 | sp->fcport = fcport; | ||
364 | sp->cmd = cmd; | 349 | sp->cmd = cmd; |
365 | sp->tgt_queue = tq; | ||
366 | |||
367 | sp->lun_queue = lq; | ||
368 | lq->io_cnt++; | ||
369 | sp->fclun = lq->fclun; | ||
370 | |||
371 | sp->flags = 0; | 350 | sp->flags = 0; |
372 | sp->err_id = 0; | 351 | sp->err_id = 0; |
373 | 352 | ||
@@ -677,9 +656,7 @@ int | |||
677 | qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) | 656 | qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) |
678 | { | 657 | { |
679 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); | 658 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); |
680 | os_tgt_t *tq = (os_tgt_t *) cmd->device->hostdata; | 659 | fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; |
681 | fc_port_t *fcport = tq->fcport; | ||
682 | os_lun_t *lq; | ||
683 | srb_t *sp; | 660 | srb_t *sp; |
684 | int ret; | 661 | int ret; |
685 | unsigned int id, lun; | 662 | unsigned int id, lun; |
@@ -692,8 +669,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) | |||
692 | serial = cmd->serial_number; | 669 | serial = cmd->serial_number; |
693 | 670 | ||
694 | sp = (srb_t *) CMD_SP(cmd); | 671 | sp = (srb_t *) CMD_SP(cmd); |
695 | lq = GET_LU_Q(ha, id, lun); | 672 | if (!sp || !fcport) |
696 | if (!sp || !fcport || !lq) | ||
697 | return ret; | 673 | return ret; |
698 | 674 | ||
699 | qla_printk(KERN_INFO, ha, | 675 | qla_printk(KERN_INFO, ha, |
@@ -826,9 +802,7 @@ int | |||
826 | qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) | 802 | qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) |
827 | { | 803 | { |
828 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); | 804 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); |
829 | os_tgt_t *tq = (os_tgt_t *) cmd->device->hostdata; | 805 | fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; |
830 | fc_port_t *fcport = tq->fcport; | ||
831 | os_lun_t *lq; | ||
832 | srb_t *sp; | 806 | srb_t *sp; |
833 | int ret; | 807 | int ret; |
834 | unsigned int id, lun; | 808 | unsigned int id, lun; |
@@ -841,8 +815,7 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) | |||
841 | serial = cmd->serial_number; | 815 | serial = cmd->serial_number; |
842 | 816 | ||
843 | sp = (srb_t *) CMD_SP(cmd); | 817 | sp = (srb_t *) CMD_SP(cmd); |
844 | lq = GET_LU_Q(ha, id, lun); | 818 | if (!sp || !fcport) |
845 | if (!sp || !fcport || !lq) | ||
846 | return ret; | 819 | return ret; |
847 | 820 | ||
848 | qla_printk(KERN_INFO, ha, | 821 | qla_printk(KERN_INFO, ha, |
@@ -895,9 +868,7 @@ int | |||
895 | qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | 868 | qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) |
896 | { | 869 | { |
897 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); | 870 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); |
898 | os_tgt_t *tq = (os_tgt_t *) cmd->device->hostdata; | 871 | fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; |
899 | fc_port_t *fcport = tq->fcport; | ||
900 | os_lun_t *lq; | ||
901 | srb_t *sp; | 872 | srb_t *sp; |
902 | int ret; | 873 | int ret; |
903 | unsigned int id, lun; | 874 | unsigned int id, lun; |
@@ -910,8 +881,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
910 | serial = cmd->serial_number; | 881 | serial = cmd->serial_number; |
911 | 882 | ||
912 | sp = (srb_t *) CMD_SP(cmd); | 883 | sp = (srb_t *) CMD_SP(cmd); |
913 | lq = GET_LU_Q(ha, id, lun); | 884 | if (!sp || !fcport) |
914 | if (!sp || !fcport || !lq) | ||
915 | return ret; | 885 | return ret; |
916 | 886 | ||
917 | qla_printk(KERN_INFO, ha, | 887 | qla_printk(KERN_INFO, ha, |
@@ -969,25 +939,20 @@ static int | |||
969 | qla2x00_loop_reset(scsi_qla_host_t *ha) | 939 | qla2x00_loop_reset(scsi_qla_host_t *ha) |
970 | { | 940 | { |
971 | int status = QLA_SUCCESS; | 941 | int status = QLA_SUCCESS; |
972 | uint16_t t; | 942 | struct fc_port *fcport; |
973 | os_tgt_t *tq; | ||
974 | 943 | ||
975 | if (ha->flags.enable_lip_reset) { | 944 | if (ha->flags.enable_lip_reset) { |
976 | status = qla2x00_lip_reset(ha); | 945 | status = qla2x00_lip_reset(ha); |
977 | } | 946 | } |
978 | 947 | ||
979 | if (status == QLA_SUCCESS && ha->flags.enable_target_reset) { | 948 | if (status == QLA_SUCCESS && ha->flags.enable_target_reset) { |
980 | for (t = 0; t < MAX_FIBRE_DEVICES; t++) { | 949 | list_for_each_entry(fcport, &ha->fcports, list) { |
981 | if ((tq = TGT_Q(ha, t)) == NULL) | 950 | if (fcport->port_type != FCT_TARGET) |
982 | continue; | ||
983 | |||
984 | if (tq->fcport == NULL) | ||
985 | continue; | 951 | continue; |
986 | 952 | ||
987 | status = qla2x00_target_reset(ha, 0, t); | 953 | status = qla2x00_target_reset(ha, fcport); |
988 | if (status != QLA_SUCCESS) { | 954 | if (status != QLA_SUCCESS) |
989 | break; | 955 | break; |
990 | } | ||
991 | } | 956 | } |
992 | } | 957 | } |
993 | 958 | ||
@@ -1041,15 +1006,26 @@ static int | |||
1041 | qla2xxx_slave_alloc(struct scsi_device *sdev) | 1006 | qla2xxx_slave_alloc(struct scsi_device *sdev) |
1042 | { | 1007 | { |
1043 | scsi_qla_host_t *ha = to_qla_host(sdev->host); | 1008 | scsi_qla_host_t *ha = to_qla_host(sdev->host); |
1044 | os_tgt_t *tq; | 1009 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); |
1010 | fc_port_t *fcport; | ||
1011 | int found; | ||
1045 | 1012 | ||
1046 | tq = (os_tgt_t *) TGT_Q(ha, sdev->id); | 1013 | if (!rport) |
1047 | if (!tq) | ||
1048 | return -ENXIO; | 1014 | return -ENXIO; |
1049 | if (!tq->fcport) | 1015 | |
1016 | found = 0; | ||
1017 | list_for_each_entry(fcport, &ha->fcports, list) { | ||
1018 | if (rport->port_name == | ||
1019 | be64_to_cpu(*(uint64_t *)fcport->port_name)) { | ||
1020 | found++; | ||
1021 | break; | ||
1022 | } | ||
1023 | |||
1024 | } | ||
1025 | if (!found) | ||
1050 | return -ENXIO; | 1026 | return -ENXIO; |
1051 | 1027 | ||
1052 | sdev->hostdata = tq; | 1028 | sdev->hostdata = fcport; |
1053 | 1029 | ||
1054 | return 0; | 1030 | return 0; |
1055 | } | 1031 | } |
@@ -1330,6 +1306,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1330 | } | 1306 | } |
1331 | 1307 | ||
1332 | qla2x00_init_host_attr(ha); | 1308 | qla2x00_init_host_attr(ha); |
1309 | |||
1333 | /* | 1310 | /* |
1334 | * Startup the kernel thread for this host adapter | 1311 | * Startup the kernel thread for this host adapter |
1335 | */ | 1312 | */ |
@@ -1406,11 +1383,6 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1406 | ha->flags.init_done = 1; | 1383 | ha->flags.init_done = 1; |
1407 | num_hosts++; | 1384 | num_hosts++; |
1408 | 1385 | ||
1409 | /* List the target we have found */ | ||
1410 | if (displayConfig) { | ||
1411 | qla2x00_display_fc_names(ha); | ||
1412 | } | ||
1413 | |||
1414 | qla_printk(KERN_INFO, ha, "\n" | 1386 | qla_printk(KERN_INFO, ha, "\n" |
1415 | " QLogic Fibre Channel HBA Driver: %s\n" | 1387 | " QLogic Fibre Channel HBA Driver: %s\n" |
1416 | " QLogic %s - %s\n" | 1388 | " QLogic %s - %s\n" |
@@ -1427,6 +1399,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1427 | return 0; | 1399 | return 0; |
1428 | 1400 | ||
1429 | probe_failed: | 1401 | probe_failed: |
1402 | fc_remove_host(ha->host); | ||
1403 | |||
1430 | scsi_remove_host(host); | 1404 | scsi_remove_host(host); |
1431 | 1405 | ||
1432 | probe_alloc_failed: | 1406 | probe_alloc_failed: |
@@ -1449,6 +1423,8 @@ void qla2x00_remove_one(struct pci_dev *pdev) | |||
1449 | 1423 | ||
1450 | qla2x00_free_sysfs_attr(ha); | 1424 | qla2x00_free_sysfs_attr(ha); |
1451 | 1425 | ||
1426 | fc_remove_host(ha->host); | ||
1427 | |||
1452 | scsi_remove_host(ha->host); | 1428 | scsi_remove_host(ha->host); |
1453 | 1429 | ||
1454 | qla2x00_free_device(ha); | 1430 | qla2x00_free_device(ha); |
@@ -1581,9 +1557,6 @@ qla2x00_proc_info(struct Scsi_Host *shost, char *buffer, | |||
1581 | { | 1557 | { |
1582 | struct info_str info; | 1558 | struct info_str info; |
1583 | int retval = -EINVAL; | 1559 | int retval = -EINVAL; |
1584 | os_lun_t *up; | ||
1585 | os_tgt_t *tq; | ||
1586 | unsigned int t, l; | ||
1587 | uint32_t tmp_sn; | 1560 | uint32_t tmp_sn; |
1588 | uint32_t *flags; | 1561 | uint32_t *flags; |
1589 | uint8_t *loop_state; | 1562 | uint8_t *loop_state; |
@@ -1737,79 +1710,6 @@ qla2x00_proc_info(struct Scsi_Host *shost, char *buffer, | |||
1737 | ha->init_cb->port_name[6], | 1710 | ha->init_cb->port_name[6], |
1738 | ha->init_cb->port_name[7]); | 1711 | ha->init_cb->port_name[7]); |
1739 | 1712 | ||
1740 | /* Print out device port names */ | ||
1741 | for (t = 0; t < MAX_FIBRE_DEVICES; t++) { | ||
1742 | if ((tq = TGT_Q(ha, t)) == NULL) | ||
1743 | continue; | ||
1744 | |||
1745 | copy_info(&info, | ||
1746 | "scsi-qla%d-target-%d=" | ||
1747 | "%02x%02x%02x%02x%02x%02x%02x%02x;\n", | ||
1748 | (int)ha->instance, t, | ||
1749 | tq->port_name[0], tq->port_name[1], | ||
1750 | tq->port_name[2], tq->port_name[3], | ||
1751 | tq->port_name[4], tq->port_name[5], | ||
1752 | tq->port_name[6], tq->port_name[7]); | ||
1753 | } | ||
1754 | |||
1755 | copy_info(&info, "\nSCSI LUN Information:\n"); | ||
1756 | copy_info(&info, | ||
1757 | "(Id:Lun) * - indicates lun is not registered with the OS.\n"); | ||
1758 | |||
1759 | /* scan for all equipment stats */ | ||
1760 | for (t = 0; t < MAX_FIBRE_DEVICES; t++) { | ||
1761 | /* scan all luns */ | ||
1762 | for (l = 0; l < ha->max_luns; l++) { | ||
1763 | up = (os_lun_t *) GET_LU_Q(ha, t, l); | ||
1764 | |||
1765 | if (up == NULL) { | ||
1766 | continue; | ||
1767 | } | ||
1768 | if (up->fclun == NULL) { | ||
1769 | continue; | ||
1770 | } | ||
1771 | |||
1772 | copy_info(&info, | ||
1773 | "(%2d:%2d): Total reqs %ld,", | ||
1774 | t,l,up->io_cnt); | ||
1775 | |||
1776 | copy_info(&info, | ||
1777 | " Pending reqs %ld,", | ||
1778 | up->out_cnt); | ||
1779 | |||
1780 | if (up->io_cnt < 4) { | ||
1781 | copy_info(&info, | ||
1782 | " flags 0x%x*,", | ||
1783 | (int)up->q_flag); | ||
1784 | } else { | ||
1785 | copy_info(&info, | ||
1786 | " flags 0x%x,", | ||
1787 | (int)up->q_flag); | ||
1788 | } | ||
1789 | |||
1790 | copy_info(&info, | ||
1791 | " %ld:%d:%02x %02x", | ||
1792 | up->fclun->fcport->ha->instance, | ||
1793 | up->fclun->fcport->cur_path, | ||
1794 | up->fclun->fcport->loop_id, | ||
1795 | up->fclun->device_type); | ||
1796 | |||
1797 | copy_info(&info, "\n"); | ||
1798 | |||
1799 | if (info.pos >= info.offset + info.length) { | ||
1800 | /* No need to continue */ | ||
1801 | goto profile_stop; | ||
1802 | } | ||
1803 | } | ||
1804 | |||
1805 | if (info.pos >= info.offset + info.length) { | ||
1806 | /* No need to continue */ | ||
1807 | break; | ||
1808 | } | ||
1809 | } | ||
1810 | |||
1811 | profile_stop: | ||
1812 | |||
1813 | retval = info.pos > info.offset ? info.pos - info.offset : 0; | 1713 | retval = info.pos > info.offset ? info.pos - info.offset : 0; |
1814 | 1714 | ||
1815 | DEBUG3(printk(KERN_INFO | 1715 | DEBUG3(printk(KERN_INFO |
@@ -1820,95 +1720,6 @@ profile_stop: | |||
1820 | } | 1720 | } |
1821 | 1721 | ||
1822 | /* | 1722 | /* |
1823 | * qla2x00_display_fc_names | ||
1824 | * This routine will the node names of the different devices found | ||
1825 | * after port inquiry. | ||
1826 | * | ||
1827 | * Input: | ||
1828 | * cmd = SCSI command structure | ||
1829 | * | ||
1830 | * Returns: | ||
1831 | * None. | ||
1832 | */ | ||
1833 | static void | ||
1834 | qla2x00_display_fc_names(scsi_qla_host_t *ha) | ||
1835 | { | ||
1836 | uint16_t tgt; | ||
1837 | os_tgt_t *tq; | ||
1838 | |||
1839 | /* Display the node name for adapter */ | ||
1840 | qla_printk(KERN_INFO, ha, | ||
1841 | "scsi-qla%d-adapter-node=%02x%02x%02x%02x%02x%02x%02x%02x\\;\n", | ||
1842 | (int)ha->instance, | ||
1843 | ha->init_cb->node_name[0], | ||
1844 | ha->init_cb->node_name[1], | ||
1845 | ha->init_cb->node_name[2], | ||
1846 | ha->init_cb->node_name[3], | ||
1847 | ha->init_cb->node_name[4], | ||
1848 | ha->init_cb->node_name[5], | ||
1849 | ha->init_cb->node_name[6], | ||
1850 | ha->init_cb->node_name[7]); | ||
1851 | |||
1852 | /* display the port name for adapter */ | ||
1853 | qla_printk(KERN_INFO, ha, | ||
1854 | "scsi-qla%d-adapter-port=%02x%02x%02x%02x%02x%02x%02x%02x\\;\n", | ||
1855 | (int)ha->instance, | ||
1856 | ha->init_cb->port_name[0], | ||
1857 | ha->init_cb->port_name[1], | ||
1858 | ha->init_cb->port_name[2], | ||
1859 | ha->init_cb->port_name[3], | ||
1860 | ha->init_cb->port_name[4], | ||
1861 | ha->init_cb->port_name[5], | ||
1862 | ha->init_cb->port_name[6], | ||
1863 | ha->init_cb->port_name[7]); | ||
1864 | |||
1865 | /* Print out device port names */ | ||
1866 | for (tgt = 0; tgt < MAX_TARGETS; tgt++) { | ||
1867 | if ((tq = ha->otgt[tgt]) == NULL) | ||
1868 | continue; | ||
1869 | |||
1870 | if (tq->fcport == NULL) | ||
1871 | continue; | ||
1872 | |||
1873 | switch (ha->binding_type) { | ||
1874 | case BIND_BY_PORT_NAME: | ||
1875 | qla_printk(KERN_INFO, ha, | ||
1876 | "scsi-qla%d-tgt-%d-di-0-port=" | ||
1877 | "%02x%02x%02x%02x%02x%02x%02x%02x\\;\n", | ||
1878 | (int)ha->instance, | ||
1879 | tgt, | ||
1880 | tq->port_name[0], | ||
1881 | tq->port_name[1], | ||
1882 | tq->port_name[2], | ||
1883 | tq->port_name[3], | ||
1884 | tq->port_name[4], | ||
1885 | tq->port_name[5], | ||
1886 | tq->port_name[6], | ||
1887 | tq->port_name[7]); | ||
1888 | |||
1889 | break; | ||
1890 | |||
1891 | case BIND_BY_PORT_ID: | ||
1892 | qla_printk(KERN_INFO, ha, | ||
1893 | "scsi-qla%d-tgt-%d-di-0-pid=" | ||
1894 | "%02x%02x%02x\\;\n", | ||
1895 | (int)ha->instance, | ||
1896 | tgt, | ||
1897 | tq->d_id.b.domain, | ||
1898 | tq->d_id.b.area, | ||
1899 | tq->d_id.b.al_pa); | ||
1900 | break; | ||
1901 | } | ||
1902 | |||
1903 | #if VSA | ||
1904 | qla_printk(KERN_INFO, ha, | ||
1905 | "scsi-qla%d-target-%d-vsa=01;\n", (int)ha->instance, tgt); | ||
1906 | #endif | ||
1907 | } | ||
1908 | } | ||
1909 | |||
1910 | |||
1911 | /* | ||
1912 | * qla2x00_mark_device_lost Updates fcport state when device goes offline. | 1723 | * qla2x00_mark_device_lost Updates fcport state when device goes offline. |
1913 | * | 1724 | * |
1914 | * Input: ha = adapter block pointer. fcport = port structure pointer. | 1725 | * Input: ha = adapter block pointer. fcport = port structure pointer. |
@@ -2199,11 +2010,8 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha) | |||
2199 | static void | 2010 | static void |
2200 | qla2x00_mem_free(scsi_qla_host_t *ha) | 2011 | qla2x00_mem_free(scsi_qla_host_t *ha) |
2201 | { | 2012 | { |
2202 | uint32_t t; | ||
2203 | struct list_head *fcpl, *fcptemp; | 2013 | struct list_head *fcpl, *fcptemp; |
2204 | fc_port_t *fcport; | 2014 | fc_port_t *fcport; |
2205 | struct list_head *fcll, *fcltemp; | ||
2206 | fc_lun_t *fclun; | ||
2207 | unsigned long wtime;/* max wait time if mbx cmd is busy. */ | 2015 | unsigned long wtime;/* max wait time if mbx cmd is busy. */ |
2208 | 2016 | ||
2209 | if (ha == NULL) { | 2017 | if (ha == NULL) { |
@@ -2212,11 +2020,6 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
2212 | return; | 2020 | return; |
2213 | } | 2021 | } |
2214 | 2022 | ||
2215 | /* Free the target queues */ | ||
2216 | for (t = 0; t < MAX_TARGETS; t++) { | ||
2217 | qla2x00_tgt_free(ha, t); | ||
2218 | } | ||
2219 | |||
2220 | /* Make sure all other threads are stopped. */ | 2023 | /* Make sure all other threads are stopped. */ |
2221 | wtime = 60 * HZ; | 2024 | wtime = 60 * HZ; |
2222 | while (ha->dpc_wait && wtime) { | 2025 | while (ha->dpc_wait && wtime) { |
@@ -2295,14 +2098,6 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
2295 | list_for_each_safe(fcpl, fcptemp, &ha->fcports) { | 2098 | list_for_each_safe(fcpl, fcptemp, &ha->fcports) { |
2296 | fcport = list_entry(fcpl, fc_port_t, list); | 2099 | fcport = list_entry(fcpl, fc_port_t, list); |
2297 | 2100 | ||
2298 | /* fc luns */ | ||
2299 | list_for_each_safe(fcll, fcltemp, &fcport->fcluns) { | ||
2300 | fclun = list_entry(fcll, fc_lun_t, list); | ||
2301 | |||
2302 | list_del_init(&fclun->list); | ||
2303 | kfree(fclun); | ||
2304 | } | ||
2305 | |||
2306 | /* fc ports */ | 2101 | /* fc ports */ |
2307 | list_del_init(&fcport->list); | 2102 | list_del_init(&fcport->list); |
2308 | kfree(fcport); | 2103 | kfree(fcport); |
@@ -2648,6 +2443,7 @@ qla2x00_sp_compl(scsi_qla_host_t *ha, srb_t *sp) | |||
2648 | 2443 | ||
2649 | cmd->scsi_done(cmd); | 2444 | cmd->scsi_done(cmd); |
2650 | } | 2445 | } |
2446 | |||
2651 | /************************************************************************** | 2447 | /************************************************************************** |
2652 | * qla2x00_timer | 2448 | * qla2x00_timer |
2653 | * | 2449 | * |
@@ -2713,11 +2509,13 @@ qla2x00_timer(scsi_qla_host_t *ha) | |||
2713 | spin_lock_irqsave(&ha->hardware_lock, cpu_flags); | 2509 | spin_lock_irqsave(&ha->hardware_lock, cpu_flags); |
2714 | for (index = 1; index < MAX_OUTSTANDING_COMMANDS; | 2510 | for (index = 1; index < MAX_OUTSTANDING_COMMANDS; |
2715 | index++) { | 2511 | index++) { |
2512 | fc_port_t *sfcp; | ||
2513 | |||
2716 | sp = ha->outstanding_cmds[index]; | 2514 | sp = ha->outstanding_cmds[index]; |
2717 | if (!sp) | 2515 | if (!sp) |
2718 | continue; | 2516 | continue; |
2719 | if (!(sp->fclun->fcport->flags & | 2517 | sfcp = sp->fcport; |
2720 | FCF_TAPE_PRESENT)) | 2518 | if (!(sfcp->flags & FCF_TAPE_PRESENT)) |
2721 | continue; | 2519 | continue; |
2722 | 2520 | ||
2723 | set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); | 2521 | set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags); |