[Open-FCoE] [PATCH 07/28] libfc: move rolechg function call to enter_ready()

Robert Love robert.w.love at intel.com
Tue Sep 30 18:25:24 UTC 2008


This also adds a roles member to the rport private data
so that we can store the role and then later in enter_ready
we change the role.

Signed-off-by: Robert Love <robert.w.love at intel.com>
---

 drivers/scsi/libfc/fc_rport.c |    7 +++++--
 include/scsi/libfc/libfc.h    |    1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 5451bf9..22ecd29 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -354,6 +354,8 @@ static void fc_rport_enter_ready(struct fc_rport *rport)
 	if (fc_rp_debug)
 		FC_DBG("remote %6x ready\n", rport->port_id);
 
+	fc_remote_port_rolechg(rport, rdata->roles);
+
 	if (rdata->event_callback)
 		rdata->event_callback(lport, rport, LPORT_EV_RPORT_CREATED);
 }
@@ -625,9 +627,9 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp,
 		if (fcp_parm & FCP_SPPF_TARG_FCN)
 			roles |= FC_RPORT_ROLE_FCP_TARGET;
 
+		rp->roles = roles;
 		fc_rport_enter_rtv(rport);
 		fc_rport_unlock(rport);
-		fc_remote_port_rolechg(rport, roles);
 	} else {
 		FC_DBG("bad ELS response\n");
 		fc_rport_state_enter(rport, RPORT_ST_ERROR);
@@ -1135,7 +1137,8 @@ static void fc_rport_recv_prli_req(struct fc_rport *rport,
 					roles |= FC_RPORT_ROLE_FCP_INITIATOR;
 				if (fcp_parm & FCP_SPPF_TARG_FCN)
 					roles |= FC_RPORT_ROLE_FCP_TARGET;
-				fc_remote_port_rolechg(rport, roles);
+				rp->roles = roles;
+
 				spp->spp_params =
 					htonl(rp->local_port->service_params);
 				break;
diff --git a/include/scsi/libfc/libfc.h b/include/scsi/libfc/libfc.h
index ea6293f..6b5da5f 100644
--- a/include/scsi/libfc/libfc.h
+++ b/include/scsi/libfc/libfc.h
@@ -160,6 +160,7 @@ struct fc_rport_libfc_priv {
 	void (*event_callback)(struct fc_lport *,
 			       struct fc_rport *,
 			       enum fc_lport_event);
+	u32 roles;
 };
 
 struct fc_rport *fc_ns_create_dummy_rport(struct fc_ns_port *);




More information about the devel mailing list