[SCSI] libfc: Initialize fc_rport_identifiers inside fc_rport_create
Currently these values are initialized by the callers. This was exposed
by a later patch that adds PLOGI request support. The patch failed to
initialize the new remote port's roles and it caused problems. This patch
has the rport_create routine initialize the identifiers and then the
callers can override them with real values.
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index 1a699f4..4242894 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -137,10 +137,7 @@
break;
}
dp->lp = lport;
- dp->ids.port_id = ntoh24(pp->rscn_fid);
- dp->ids.port_name = -1;
- dp->ids.node_name = -1;
- dp->ids.roles = FC_RPORT_ROLE_UNKNOWN;
+ dp->port_id = ntoh24(pp->rscn_fid);
list_add_tail(&dp->peers, &disc_ports);
break;
case ELS_ADDR_FMT_AREA:
@@ -162,7 +159,7 @@
redisc, lport->state, disc->pending);
list_for_each_entry_safe(dp, next, &disc_ports, peers) {
list_del(&dp->peers);
- rdata = lport->tt.rport_lookup(lport, dp->ids.port_id);
+ rdata = lport->tt.rport_lookup(lport, dp->port_id);
if (rdata) {
lport->tt.rport_logoff(rdata);
}
@@ -435,15 +432,14 @@
while (plen >= sizeof(*np)) {
ids.port_id = ntoh24(np->fp_fid);
ids.port_name = ntohll(np->fp_wwpn);
- ids.node_name = -1;
- ids.roles = FC_RPORT_ROLE_UNKNOWN;
if (ids.port_id != fc_host_port_id(lport->host) &&
ids.port_name != lport->wwpn) {
- rdata = lport->tt.rport_create(lport, &ids);
- if (rdata)
+ rdata = lport->tt.rport_create(lport, ids.port_id);
+ if (rdata) {
+ rdata->ids.port_name = ids.port_name;
rdata->disc_id = disc->disc_id;
- else {
+ } else {
printk(KERN_WARNING "libfc: Failed to allocate "
"memory for the newly discovered port "
"(%6x)\n", ids.port_id);
@@ -580,10 +576,10 @@
lport = disc->lport;
- if (dp->ids.port_id == fc_host_port_id(lport->host))
+ if (dp->port_id == fc_host_port_id(lport->host))
goto out;
- rdata = lport->tt.rport_create(lport, &dp->ids);
+ rdata = lport->tt.rport_create(lport, dp->port_id);
if (rdata) {
rdata->disc_id = disc->disc_id;
kfree(dp);