aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_rport.c
diff options
context:
space:
mode:
authorRobert Love <robert.w.love@intel.com>2009-08-25 14:02:59 -0700
committerJames Bottomley <James.Bottomley@suse.de>2009-09-10 12:07:57 -0500
commit9737e6a7b5b8af48f983cd565df93493597c565b (patch)
tree2bb3e50171af1fbc18d0f739d760b6218031fb31 /drivers/scsi/libfc/fc_rport.c
parent[SCSI] libfc: don't do discovery before callback is set (diff)
downloadlinux-dev-9737e6a7b5b8af48f983cd565df93493597c565b.tar.xz
linux-dev-9737e6a7b5b8af48f983cd565df93493597c565b.zip
[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>
Diffstat (limited to 'drivers/scsi/libfc/fc_rport.c')
-rw-r--r--drivers/scsi/libfc/fc_rport.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 99ac056293f5..c667be879be6 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -104,18 +104,18 @@ static struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,
}
/**
- * fc_rport_create() - create remote port in INIT state.
- * @lport: local port.
- * @ids: remote port identifiers.
+ * fc_rport_create() - Create a new remote port
+ * @lport: The local port that the new remote port is for
+ * @port_id: The port ID for the new remote port
*
* Locking note: must be called with the disc_mutex held.
*/
static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
- struct fc_rport_identifiers *ids)
+ u32 port_id)
{
struct fc_rport_priv *rdata;
- rdata = lport->tt.rport_lookup(lport, ids->port_id);
+ rdata = lport->tt.rport_lookup(lport, port_id);
if (rdata)
return rdata;
@@ -123,7 +123,11 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
if (!rdata)
return NULL;
- rdata->ids = *ids;
+ rdata->ids.node_name = -1;
+ rdata->ids.port_name = -1;
+ rdata->ids.port_id = port_id;
+ rdata->ids.roles = FC_RPORT_ROLE_UNKNOWN;
+
kref_init(&rdata->kref);
mutex_init(&rdata->rp_mutex);
rdata->local_port = lport;
@@ -135,7 +139,7 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
rdata->maxframe_size = FC_MIN_MAX_PAYLOAD;
INIT_DELAYED_WORK(&rdata->retry_work, fc_rport_timeout);
INIT_WORK(&rdata->event_work, fc_rport_work);
- if (ids->port_id != FC_FID_DIR_SERV)
+ if (port_id != FC_FID_DIR_SERV)
list_add(&rdata->peers, &lport->disc.rports);
return rdata;
}