aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_rport.c
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2009-08-25 14:02:06 -0700
committerJames Bottomley <James.Bottomley@suse.de>2009-09-10 12:07:47 -0500
commit8025b5db7e10cd90cadec940cc766be3bbda65e8 (patch)
tree79d509309c67529db93e071aa51a63947d869fe2 /drivers/scsi/libfc/fc_rport.c
parent[SCSI] libfc: change to make remote port callback optional (diff)
downloadlinux-dev-8025b5db7e10cd90cadec940cc766be3bbda65e8.tar.xz
linux-dev-8025b5db7e10cd90cadec940cc766be3bbda65e8.zip
[SCSI] libfc: move rport_lookup into fc_rport.c
Move the libfc remote port lookup function into fc_rport.c. This seems like the best place for it. Signed-off-by: Joe Eykholt <jeykholt@cisco.com> 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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 406049c13a0e..99ac056293f5 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -87,6 +87,23 @@ static const char *fc_rport_state_names[] = {
};
/**
+ * fc_rport_lookup() - lookup a remote port by port_id
+ * @lport: Fibre Channel host port instance
+ * @port_id: remote port port_id to match
+ */
+static struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,
+ u32 port_id)
+{
+ struct fc_rport_priv *rdata;
+
+ list_for_each_entry(rdata, &lport->disc.rports, peers)
+ if (rdata->ids.port_id == port_id &&
+ rdata->rp_state != RPORT_ST_DELETE)
+ return rdata;
+ return NULL;
+}
+
+/**
* fc_rport_create() - create remote port in INIT state.
* @lport: local port.
* @ids: remote port identifiers.
@@ -1292,6 +1309,9 @@ static void fc_rport_flush_queue(void)
int fc_rport_init(struct fc_lport *lport)
{
+ if (!lport->tt.rport_lookup)
+ lport->tt.rport_lookup = fc_rport_lookup;
+
if (!lport->tt.rport_create)
lport->tt.rport_create = fc_rport_create;