diff options
author | <andrew.vasquez@qlogic.com> | 2005-04-17 15:04:54 -0500 |
---|---|---|
committer | James Bottomley <jejb@titanic> | 2005-04-18 13:47:19 -0500 |
commit | 8482e118afa0cb4321ab3d30b1100d27d63130c0 (patch) | |
tree | 971714d297194e1c20e1b80b1d2e031d4517f5ad /drivers/scsi/qla2xxx/qla_init.c | |
parent | f4f051ebb40e74ad0ba02d2cb3a6c16b0393472b (diff) |
[PATCH] qla2xxx: add remote port codes...
Add initial support for FC remote port infrastructure.
o Use fc_remote_port...() registration and block/unlock
functions.
o Consolidate 'attribute' (fc-remote/sysfs) helpers into
new qla_attr.c file.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
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 00bfbd42bdb..29b301ecd2f 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -19,6 +19,7 @@ #include "qla_def.h" #include <linux/delay.h> +#include <scsi/scsi_transport_fc.h> #include "qla_devtbl.h" @@ -1927,8 +1928,35 @@ qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport) qla2x00_lun_discovery(ha, fcport); } atomic_set(&fcport->state, FCS_ONLINE); + if (ha->flags.init_done) + qla2x00_reg_remote_port(ha, fcport); } +void +qla2x00_reg_remote_port(scsi_qla_host_t *ha, fc_port_t *fcport) +{ + struct fc_rport_identifiers rport_ids; + + if (fcport->rport) { + fc_remote_port_unblock(fcport->rport); + return; + } + + rport_ids.node_name = be64_to_cpu(*(uint64_t *)fcport->node_name); + rport_ids.port_name = be64_to_cpu(*(uint64_t *)fcport->port_name); + rport_ids.port_id = fcport->d_id.b.domain << 16 | + fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; + rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; + if (fcport->port_type == FCT_INITIATOR) + rport_ids.roles |= FC_RPORT_ROLE_FCP_INITIATOR; + if (fcport->port_type == FCT_TARGET) + rport_ids.roles |= FC_RPORT_ROLE_FCP_TARGET; + + fcport->rport = fc_remote_port_add(ha->host, 0, &rport_ids); + if (!fcport->rport) + qla_printk(KERN_WARNING, ha, + "Unable to allocate fc remote port!\n"); +} /* * qla2x00_lun_discovery * Issue SCSI inquiry command for LUN discovery. @@ -2895,8 +2923,7 @@ qla2x00_device_resync(scsi_qla_host_t *ha) if (atomic_read(&fcport->state) == FCS_ONLINE) { if (format != 3 || fcport->port_type != FCT_INITIATOR) { - atomic_set(&fcport->state, - FCS_DEVICE_LOST); + qla2x00_mark_device_lost(ha, fcport, 0); } } fcport->flags &= ~FCF_FARP_DONE; |