diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_init.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 00bfbd42bdb6..29b301ecd2ff 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "qla_def.h" | 19 | #include "qla_def.h" |
20 | 20 | ||
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <scsi/scsi_transport_fc.h> | ||
22 | 23 | ||
23 | #include "qla_devtbl.h" | 24 | #include "qla_devtbl.h" |
24 | 25 | ||
@@ -1927,8 +1928,35 @@ qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport) | |||
1927 | qla2x00_lun_discovery(ha, fcport); | 1928 | qla2x00_lun_discovery(ha, fcport); |
1928 | } | 1929 | } |
1929 | atomic_set(&fcport->state, FCS_ONLINE); | 1930 | atomic_set(&fcport->state, FCS_ONLINE); |
1931 | if (ha->flags.init_done) | ||
1932 | qla2x00_reg_remote_port(ha, fcport); | ||
1930 | } | 1933 | } |
1931 | 1934 | ||
1935 | void | ||
1936 | qla2x00_reg_remote_port(scsi_qla_host_t *ha, fc_port_t *fcport) | ||
1937 | { | ||
1938 | struct fc_rport_identifiers rport_ids; | ||
1939 | |||
1940 | if (fcport->rport) { | ||
1941 | fc_remote_port_unblock(fcport->rport); | ||
1942 | return; | ||
1943 | } | ||
1944 | |||
1945 | rport_ids.node_name = be64_to_cpu(*(uint64_t *)fcport->node_name); | ||
1946 | rport_ids.port_name = be64_to_cpu(*(uint64_t *)fcport->port_name); | ||
1947 | rport_ids.port_id = fcport->d_id.b.domain << 16 | | ||
1948 | fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; | ||
1949 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; | ||
1950 | if (fcport->port_type == FCT_INITIATOR) | ||
1951 | rport_ids.roles |= FC_RPORT_ROLE_FCP_INITIATOR; | ||
1952 | if (fcport->port_type == FCT_TARGET) | ||
1953 | rport_ids.roles |= FC_RPORT_ROLE_FCP_TARGET; | ||
1954 | |||
1955 | fcport->rport = fc_remote_port_add(ha->host, 0, &rport_ids); | ||
1956 | if (!fcport->rport) | ||
1957 | qla_printk(KERN_WARNING, ha, | ||
1958 | "Unable to allocate fc remote port!\n"); | ||
1959 | } | ||
1932 | /* | 1960 | /* |
1933 | * qla2x00_lun_discovery | 1961 | * qla2x00_lun_discovery |
1934 | * Issue SCSI inquiry command for LUN discovery. | 1962 | * Issue SCSI inquiry command for LUN discovery. |
@@ -2895,8 +2923,7 @@ qla2x00_device_resync(scsi_qla_host_t *ha) | |||
2895 | if (atomic_read(&fcport->state) == FCS_ONLINE) { | 2923 | if (atomic_read(&fcport->state) == FCS_ONLINE) { |
2896 | if (format != 3 || | 2924 | if (format != 3 || |
2897 | fcport->port_type != FCT_INITIATOR) { | 2925 | fcport->port_type != FCT_INITIATOR) { |
2898 | atomic_set(&fcport->state, | 2926 | qla2x00_mark_device_lost(ha, fcport, 0); |
2899 | FCS_DEVICE_LOST); | ||
2900 | } | 2927 | } |
2901 | } | 2928 | } |
2902 | fcport->flags &= ~FCF_FARP_DONE; | 2929 | fcport->flags &= ~FCF_FARP_DONE; |