diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2006-02-07 01:47:12 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-02-07 01:47:12 -0500 |
commit | 3c9b3a8575b4f2551e3b5b74ffa1c3559c6338eb (patch) | |
tree | 7f8d84353852401ec74e005f6f0b1eb958b9a70d /drivers/scsi/qla2xxx/qla_init.c | |
parent | c0d3c0c0ce94d3db893577ae98e64414d92e49d8 (diff) | |
parent | c03296a868ae7c91aa2d8b372184763b18f16d7a (diff) |
Merge branch 'master'
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_init.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 83 |
1 files changed, 39 insertions, 44 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index a91fea69ad63..e67bb0997818 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -32,7 +32,6 @@ static int qla2x00_fw_ready(scsi_qla_host_t *); | |||
32 | static int qla2x00_configure_hba(scsi_qla_host_t *); | 32 | static int qla2x00_configure_hba(scsi_qla_host_t *); |
33 | static int qla2x00_configure_loop(scsi_qla_host_t *); | 33 | static int qla2x00_configure_loop(scsi_qla_host_t *); |
34 | static int qla2x00_configure_local_loop(scsi_qla_host_t *); | 34 | static int qla2x00_configure_local_loop(scsi_qla_host_t *); |
35 | static void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *); | ||
36 | static int qla2x00_configure_fabric(scsi_qla_host_t *); | 35 | static int qla2x00_configure_fabric(scsi_qla_host_t *); |
37 | static int qla2x00_find_all_fabric_devs(scsi_qla_host_t *, struct list_head *); | 36 | static int qla2x00_find_all_fabric_devs(scsi_qla_host_t *, struct list_head *); |
38 | static int qla2x00_device_resync(scsi_qla_host_t *); | 37 | static int qla2x00_device_resync(scsi_qla_host_t *); |
@@ -1688,10 +1687,16 @@ static void | |||
1688 | qla2x00_rport_del(void *data) | 1687 | qla2x00_rport_del(void *data) |
1689 | { | 1688 | { |
1690 | fc_port_t *fcport = data; | 1689 | fc_port_t *fcport = data; |
1690 | struct fc_rport *rport; | ||
1691 | unsigned long flags; | ||
1692 | |||
1693 | spin_lock_irqsave(&fcport->rport_lock, flags); | ||
1694 | rport = fcport->drport; | ||
1695 | fcport->drport = NULL; | ||
1696 | spin_unlock_irqrestore(&fcport->rport_lock, flags); | ||
1697 | if (rport) | ||
1698 | fc_remote_port_delete(rport); | ||
1691 | 1699 | ||
1692 | if (fcport->rport) | ||
1693 | fc_remote_port_delete(fcport->rport); | ||
1694 | fcport->rport = NULL; | ||
1695 | } | 1700 | } |
1696 | 1701 | ||
1697 | /** | 1702 | /** |
@@ -1719,6 +1724,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *ha, gfp_t flags) | |||
1719 | atomic_set(&fcport->state, FCS_UNCONFIGURED); | 1724 | atomic_set(&fcport->state, FCS_UNCONFIGURED); |
1720 | fcport->flags = FCF_RLC_SUPPORT; | 1725 | fcport->flags = FCF_RLC_SUPPORT; |
1721 | fcport->supported_classes = FC_COS_UNSPECIFIED; | 1726 | fcport->supported_classes = FC_COS_UNSPECIFIED; |
1727 | spin_lock_init(&fcport->rport_lock); | ||
1722 | INIT_WORK(&fcport->rport_add_work, qla2x00_rport_add, fcport); | 1728 | INIT_WORK(&fcport->rport_add_work, qla2x00_rport_add, fcport); |
1723 | INIT_WORK(&fcport->rport_del_work, qla2x00_rport_del, fcport); | 1729 | INIT_WORK(&fcport->rport_del_work, qla2x00_rport_del, fcport); |
1724 | 1730 | ||
@@ -2008,7 +2014,7 @@ qla2x00_probe_for_all_luns(scsi_qla_host_t *ha) | |||
2008 | { | 2014 | { |
2009 | fc_port_t *fcport; | 2015 | fc_port_t *fcport; |
2010 | 2016 | ||
2011 | qla2x00_mark_all_devices_lost(ha); | 2017 | qla2x00_mark_all_devices_lost(ha, 0); |
2012 | list_for_each_entry(fcport, &ha->fcports, list) { | 2018 | list_for_each_entry(fcport, &ha->fcports, list) { |
2013 | if (fcport->port_type != FCT_TARGET) | 2019 | if (fcport->port_type != FCT_TARGET) |
2014 | continue; | 2020 | continue; |
@@ -2032,13 +2038,9 @@ qla2x00_probe_for_all_luns(scsi_qla_host_t *ha) | |||
2032 | * Context: | 2038 | * Context: |
2033 | * Kernel context. | 2039 | * Kernel context. |
2034 | */ | 2040 | */ |
2035 | static void | 2041 | void |
2036 | qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport) | 2042 | qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport) |
2037 | { | 2043 | { |
2038 | uint16_t index; | ||
2039 | unsigned long flags; | ||
2040 | srb_t *sp; | ||
2041 | |||
2042 | fcport->ha = ha; | 2044 | fcport->ha = ha; |
2043 | fcport->login_retry = 0; | 2045 | fcport->login_retry = 0; |
2044 | fcport->port_login_retry_count = ha->port_down_retry_count * | 2046 | fcport->port_login_retry_count = ha->port_down_retry_count * |
@@ -2047,28 +2049,6 @@ qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport) | |||
2047 | PORT_RETRY_TIME); | 2049 | PORT_RETRY_TIME); |
2048 | fcport->flags &= ~FCF_LOGIN_NEEDED; | 2050 | fcport->flags &= ~FCF_LOGIN_NEEDED; |
2049 | 2051 | ||
2050 | /* | ||
2051 | * Check for outstanding cmd on tape Bypass LUN discovery if active | ||
2052 | * command on tape. | ||
2053 | */ | ||
2054 | if (fcport->flags & FCF_TAPE_PRESENT) { | ||
2055 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
2056 | for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) { | ||
2057 | fc_port_t *sfcp; | ||
2058 | |||
2059 | if ((sp = ha->outstanding_cmds[index]) != 0) { | ||
2060 | sfcp = sp->fcport; | ||
2061 | if (sfcp == fcport) { | ||
2062 | atomic_set(&fcport->state, FCS_ONLINE); | ||
2063 | spin_unlock_irqrestore( | ||
2064 | &ha->hardware_lock, flags); | ||
2065 | return; | ||
2066 | } | ||
2067 | } | ||
2068 | } | ||
2069 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
2070 | } | ||
2071 | |||
2072 | if (fcport->port_type == FCT_INITIATOR || | 2052 | if (fcport->port_type == FCT_INITIATOR || |
2073 | fcport->port_type == FCT_BROADCAST) | 2053 | fcport->port_type == FCT_BROADCAST) |
2074 | fcport->device_type = TYPE_PROCESSOR; | 2054 | fcport->device_type = TYPE_PROCESSOR; |
@@ -2084,24 +2064,29 @@ qla2x00_reg_remote_port(scsi_qla_host_t *ha, fc_port_t *fcport) | |||
2084 | { | 2064 | { |
2085 | struct fc_rport_identifiers rport_ids; | 2065 | struct fc_rport_identifiers rport_ids; |
2086 | struct fc_rport *rport; | 2066 | struct fc_rport *rport; |
2067 | unsigned long flags; | ||
2087 | 2068 | ||
2088 | if (fcport->rport) { | 2069 | if (fcport->drport) |
2089 | fc_remote_port_delete(fcport->rport); | 2070 | qla2x00_rport_del(fcport); |
2090 | fcport->rport = NULL; | 2071 | if (fcport->rport) |
2091 | } | 2072 | return; |
2092 | 2073 | ||
2093 | rport_ids.node_name = wwn_to_u64(fcport->node_name); | 2074 | rport_ids.node_name = wwn_to_u64(fcport->node_name); |
2094 | rport_ids.port_name = wwn_to_u64(fcport->port_name); | 2075 | rport_ids.port_name = wwn_to_u64(fcport->port_name); |
2095 | rport_ids.port_id = fcport->d_id.b.domain << 16 | | 2076 | rport_ids.port_id = fcport->d_id.b.domain << 16 | |
2096 | fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; | 2077 | fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; |
2097 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; | 2078 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; |
2098 | fcport->rport = rport = fc_remote_port_add(ha->host, 0, &rport_ids); | 2079 | rport = fc_remote_port_add(ha->host, 0, &rport_ids); |
2099 | if (!rport) { | 2080 | if (!rport) { |
2100 | qla_printk(KERN_WARNING, ha, | 2081 | qla_printk(KERN_WARNING, ha, |
2101 | "Unable to allocate fc remote port!\n"); | 2082 | "Unable to allocate fc remote port!\n"); |
2102 | return; | 2083 | return; |
2103 | } | 2084 | } |
2085 | spin_lock_irqsave(&fcport->rport_lock, flags); | ||
2086 | fcport->rport = rport; | ||
2104 | *((fc_port_t **)rport->dd_data) = fcport; | 2087 | *((fc_port_t **)rport->dd_data) = fcport; |
2088 | spin_unlock_irqrestore(&fcport->rport_lock, flags); | ||
2089 | |||
2105 | rport->supported_classes = fcport->supported_classes; | 2090 | rport->supported_classes = fcport->supported_classes; |
2106 | 2091 | ||
2107 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; | 2092 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; |
@@ -2217,12 +2202,11 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha) | |||
2217 | 2202 | ||
2218 | if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) { | 2203 | if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) { |
2219 | qla2x00_mark_device_lost(ha, fcport, | 2204 | qla2x00_mark_device_lost(ha, fcport, |
2220 | ql2xplogiabsentdevice); | 2205 | ql2xplogiabsentdevice, 0); |
2221 | if (fcport->loop_id != FC_NO_LOOP_ID && | 2206 | if (fcport->loop_id != FC_NO_LOOP_ID && |
2222 | (fcport->flags & FCF_TAPE_PRESENT) == 0 && | 2207 | (fcport->flags & FCF_TAPE_PRESENT) == 0 && |
2223 | fcport->port_type != FCT_INITIATOR && | 2208 | fcport->port_type != FCT_INITIATOR && |
2224 | fcport->port_type != FCT_BROADCAST) { | 2209 | fcport->port_type != FCT_BROADCAST) { |
2225 | |||
2226 | ha->isp_ops.fabric_logout(ha, | 2210 | ha->isp_ops.fabric_logout(ha, |
2227 | fcport->loop_id, | 2211 | fcport->loop_id, |
2228 | fcport->d_id.b.domain, | 2212 | fcport->d_id.b.domain, |
@@ -2694,7 +2678,8 @@ qla2x00_device_resync(scsi_qla_host_t *ha) | |||
2694 | if (atomic_read(&fcport->state) == FCS_ONLINE) { | 2678 | if (atomic_read(&fcport->state) == FCS_ONLINE) { |
2695 | if (format != 3 || | 2679 | if (format != 3 || |
2696 | fcport->port_type != FCT_INITIATOR) { | 2680 | fcport->port_type != FCT_INITIATOR) { |
2697 | qla2x00_mark_device_lost(ha, fcport, 0); | 2681 | qla2x00_mark_device_lost(ha, fcport, |
2682 | 0, 0); | ||
2698 | } | 2683 | } |
2699 | } | 2684 | } |
2700 | fcport->flags &= ~FCF_FARP_DONE; | 2685 | fcport->flags &= ~FCF_FARP_DONE; |
@@ -2741,8 +2726,7 @@ qla2x00_fabric_dev_login(scsi_qla_host_t *ha, fc_port_t *fcport, | |||
2741 | ha->isp_ops.fabric_logout(ha, fcport->loop_id, | 2726 | ha->isp_ops.fabric_logout(ha, fcport->loop_id, |
2742 | fcport->d_id.b.domain, fcport->d_id.b.area, | 2727 | fcport->d_id.b.domain, fcport->d_id.b.area, |
2743 | fcport->d_id.b.al_pa); | 2728 | fcport->d_id.b.al_pa); |
2744 | qla2x00_mark_device_lost(ha, fcport, 1); | 2729 | qla2x00_mark_device_lost(ha, fcport, 1, 0); |
2745 | |||
2746 | } else { | 2730 | } else { |
2747 | qla2x00_update_fcport(ha, fcport); | 2731 | qla2x00_update_fcport(ha, fcport); |
2748 | } | 2732 | } |
@@ -2855,7 +2839,7 @@ qla2x00_fabric_login(scsi_qla_host_t *ha, fc_port_t *fcport, | |||
2855 | ha->isp_ops.fabric_logout(ha, fcport->loop_id, | 2839 | ha->isp_ops.fabric_logout(ha, fcport->loop_id, |
2856 | fcport->d_id.b.domain, fcport->d_id.b.area, | 2840 | fcport->d_id.b.domain, fcport->d_id.b.area, |
2857 | fcport->d_id.b.al_pa); | 2841 | fcport->d_id.b.al_pa); |
2858 | qla2x00_mark_device_lost(ha, fcport, 1); | 2842 | qla2x00_mark_device_lost(ha, fcport, 1, 0); |
2859 | 2843 | ||
2860 | rval = 1; | 2844 | rval = 1; |
2861 | break; | 2845 | break; |
@@ -2990,6 +2974,17 @@ qla2x00_rescan_fcports(scsi_qla_host_t *ha) | |||
2990 | qla2x00_probe_for_all_luns(ha); | 2974 | qla2x00_probe_for_all_luns(ha); |
2991 | } | 2975 | } |
2992 | 2976 | ||
2977 | void | ||
2978 | qla2x00_update_fcports(scsi_qla_host_t *ha) | ||
2979 | { | ||
2980 | fc_port_t *fcport; | ||
2981 | |||
2982 | /* Go with deferred removal of rport references. */ | ||
2983 | list_for_each_entry(fcport, &ha->fcports, list) | ||
2984 | if (fcport->drport) | ||
2985 | qla2x00_rport_del(fcport); | ||
2986 | } | ||
2987 | |||
2993 | /* | 2988 | /* |
2994 | * qla2x00_abort_isp | 2989 | * qla2x00_abort_isp |
2995 | * Resets ISP and aborts all outstanding commands. | 2990 | * Resets ISP and aborts all outstanding commands. |
@@ -3019,7 +3014,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha) | |||
3019 | atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); | 3014 | atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); |
3020 | if (atomic_read(&ha->loop_state) != LOOP_DOWN) { | 3015 | if (atomic_read(&ha->loop_state) != LOOP_DOWN) { |
3021 | atomic_set(&ha->loop_state, LOOP_DOWN); | 3016 | atomic_set(&ha->loop_state, LOOP_DOWN); |
3022 | qla2x00_mark_all_devices_lost(ha); | 3017 | qla2x00_mark_all_devices_lost(ha, 0); |
3023 | } else { | 3018 | } else { |
3024 | if (!atomic_read(&ha->loop_down_timer)) | 3019 | if (!atomic_read(&ha->loop_down_timer)) |
3025 | atomic_set(&ha->loop_down_timer, | 3020 | atomic_set(&ha->loop_down_timer, |