diff options
author | Joe Eykholt <jeykholt@cisco.com> | 2009-08-25 14:01:01 -0700 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-09-10 12:07:42 -0500 |
commit | f211fa514a07326c0f9364c0e6ed17e38860172f (patch) | |
tree | 9c2c54fee556816f36211185b6d6df0812b9acec /drivers/scsi/libfc/fc_lport.c | |
parent | a46f327aa5caf2cce138e98ddd863b6cca0e71e2 (diff) |
[SCSI] libfc: make rport structure optional
Allow a struct fc_rport_priv to have no fc_rport associated with it.
This sets up to remove the need for "rogue" rports.
Add a few fields to fc_rport_priv that are needed before the fc_rport
is created. These are the ids, maxframe_size, classes, and rport pointer.
Remove the macro PRIV_TO_RPORT(). Just use rdata->rport where appropriate.
To take the place of the get_device()/put_device ops that were used to
hold both the rport and rdata, add a reference count to rdata structures
using kref. When kref_get decrements the refcount to zero, a new template
function releasing the rdata should be called. This will take care of
freeing the rdata and releasing the hold on the rport (for now). After
subsequent patches make the rport truly optional, this release function
will simply free the rdata.
Remove the simple inline function fc_rport_set_name(), which becomes
semanticly ambiguous otherwise. The caller will set the port_name and
node_name in the rdata->Ids, which will later be copied to the rport
when it its created.
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_lport.c')
-rw-r--r-- | drivers/scsi/libfc/fc_lport.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index aa605d2012e0..a7fe6b8d38b8 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c @@ -143,14 +143,12 @@ static void fc_lport_rport_callback(struct fc_lport *lport, struct fc_rport_priv *rdata, enum fc_rport_event event) { - struct fc_rport *rport = PRIV_TO_RPORT(rdata); - FC_LPORT_DBG(lport, "Received a %d event for port (%6x)\n", event, - rport->port_id); + rdata->ids.port_id); switch (event) { case RPORT_EV_CREATED: - if (rport->port_id == FC_FID_DIR_SERV) { + if (rdata->ids.port_id == FC_FID_DIR_SERV) { mutex_lock(&lport->lp_mutex); if (lport->state == LPORT_ST_DNS) { lport->dns_rp = rdata; @@ -160,7 +158,7 @@ static void fc_lport_rport_callback(struct fc_lport *lport, "on port (%6x) for the directory " "server, but the lport is not " "in the DNS state, it's in the " - "%d state", rport->port_id, + "%d state", rdata->ids.port_id, lport->state); lport->tt.rport_logoff(rdata); } @@ -168,12 +166,12 @@ static void fc_lport_rport_callback(struct fc_lport *lport, } else FC_LPORT_DBG(lport, "Received an event for port (%6x) " "which is not the directory server\n", - rport->port_id); + rdata->ids.port_id); break; case RPORT_EV_LOGO: case RPORT_EV_FAILED: case RPORT_EV_STOP: - if (rport->port_id == FC_FID_DIR_SERV) { + if (rdata->ids.port_id == FC_FID_DIR_SERV) { mutex_lock(&lport->lp_mutex); lport->dns_rp = NULL; mutex_unlock(&lport->lp_mutex); @@ -181,7 +179,7 @@ static void fc_lport_rport_callback(struct fc_lport *lport, } else FC_LPORT_DBG(lport, "Received an event for port (%6x) " "which is not the directory server\n", - rport->port_id); + rdata->ids.port_id); break; case RPORT_EV_NONE: break; |