aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2005-07-08 21:00:36 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-07-14 11:15:55 -0400
commit77d74143612c1dab6c055dac21f965929ba0a7e6 (patch)
tree07a06f60be57487294bdc19df81b66e56ae3ccec /drivers/scsi
parent88c2666351f41a7d4459e79594f687a356f5e57c (diff)
[SCSI] qla2xxx: Cleanup FC remote port registration.
Cleanup FC remote port registration. Due to the inherent behaviour (an immediate scan) of adding a 'target'-role-capable rport via fc_remote_port_add(), split the registration into two steps -- addition as unknown-type role, then use fc_remote_port_rolchg() with appropriate role (based on PLOGI/PRLI bits). This allows for a more cleaner rport->dd_data management as can be seen with the simplified qla2xxx_slave_alloc() function. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c17
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c16
2 files changed, 11 insertions, 22 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 1a25714e85c6..a6d2559217cd 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2068,21 +2068,24 @@ qla2x00_reg_remote_port(scsi_qla_host_t *ha, fc_port_t *fcport)
2068 rport_ids.port_id = fcport->d_id.b.domain << 16 | 2068 rport_ids.port_id = fcport->d_id.b.domain << 16 |
2069 fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; 2069 fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa;
2070 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; 2070 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;
2071 fcport->rport = rport = fc_remote_port_add(ha->host, 0, &rport_ids);
2072 if (!rport) {
2073 qla_printk(KERN_WARNING, ha,
2074 "Unable to allocate fc remote port!\n");
2075 return;
2076 }
2077 rport->dd_data = fcport;
2078
2079 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;
2071 if (fcport->port_type == FCT_INITIATOR) 2080 if (fcport->port_type == FCT_INITIATOR)
2072 rport_ids.roles |= FC_RPORT_ROLE_FCP_INITIATOR; 2081 rport_ids.roles |= FC_RPORT_ROLE_FCP_INITIATOR;
2073 if (fcport->port_type == FCT_TARGET) 2082 if (fcport->port_type == FCT_TARGET)
2074 rport_ids.roles |= FC_RPORT_ROLE_FCP_TARGET; 2083 rport_ids.roles |= FC_RPORT_ROLE_FCP_TARGET;
2075 2084 fc_remote_port_rolechg(rport, rport_ids.roles);
2076 fcport->rport = rport = fc_remote_port_add(ha->host, 0, &rport_ids);
2077 if (!rport)
2078 qla_printk(KERN_WARNING, ha,
2079 "Unable to allocate fc remote port!\n");
2080 2085
2081 if (rport->scsi_target_id != -1 && 2086 if (rport->scsi_target_id != -1 &&
2082 rport->scsi_target_id < ha->host->max_id) 2087 rport->scsi_target_id < ha->host->max_id)
2083 fcport->os_target_id = rport->scsi_target_id; 2088 fcport->os_target_id = rport->scsi_target_id;
2084
2085 rport->dd_data = fcport;
2086} 2089}
2087 2090
2088/* 2091/*
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index d726f48728ec..9000659bfbcf 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1071,26 +1071,12 @@ qla2x00_device_reset(scsi_qla_host_t *ha, fc_port_t *reset_fcport)
1071static int 1071static int
1072qla2xxx_slave_alloc(struct scsi_device *sdev) 1072qla2xxx_slave_alloc(struct scsi_device *sdev)
1073{ 1073{
1074 scsi_qla_host_t *ha = to_qla_host(sdev->host);
1075 struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); 1074 struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
1076 fc_port_t *fcport;
1077 int found;
1078 1075
1079 if (!rport) 1076 if (!rport)
1080 return -ENXIO; 1077 return -ENXIO;
1081 1078
1082 found = 0; 1079 sdev->hostdata = rport->dd_data;
1083 list_for_each_entry(fcport, &ha->fcports, list) {
1084 if (rport->port_name ==
1085 be64_to_cpu(*(uint64_t *)fcport->port_name)) {
1086 found++;
1087 break;
1088 }
1089 }
1090 if (!found)
1091 return -ENXIO;
1092
1093 sdev->hostdata = fcport;
1094 1080
1095 return 0; 1081 return 0;
1096} 1082}