[Open-FCoE] [PATCH 10/28] libfc: Make rport variable naming common

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


rport = fc_rport pointer
rdata = fc_rport_libfc_priv pointer
lport = fc_lport pointer

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

 drivers/scsi/libfc/fc_rport.c |  293 +++++++++++++++++++++--------------------
 1 files changed, 148 insertions(+), 145 deletions(-)

diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index ad0d83b..7d1416a 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -65,20 +65,21 @@ static const char *fc_rport_state_names[] = {
 	[RPORT_ST_LOGO] = "LOGO",
 };
 
-static const char *fc_rport_state(struct fc_rport *rp)
+/**
+ * fc_rport_state - return a string for the state the rport is in
+ * @rport: The rport whose state we want to get a string for
+ */
+static const char *fc_rport_state(struct fc_rport *rport)
 {
 	const char *cp;
-	struct fc_rport_libfc_priv *rpp = rp->dd_data;
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
 
-	cp = fc_rport_state_names[rpp->rp_state];
+	cp = fc_rport_state_names[rdata->rp_state];
 	if (!cp)
 		cp = "Unknown";
 	return cp;
 }
 
-static struct fc_rport *fc_remote_port_create(struct fc_lport *,
-					      struct fc_rport_identifiers *);
-
 /**
  * fc_rport_lookup - lookup a remote port by port_id
  * @lp: Fibre Channel host port instance
@@ -108,29 +109,29 @@ struct fc_rport *fc_rport_lookup(const struct fc_lport *lp, u32 fid)
  * @lp: Fibre Channel host port instance
  * @ids: remote port identifiers (port_id, port_name, and node_name must be set)
  */
-static struct fc_rport *fc_remote_port_create(struct fc_lport *lp,
+static struct fc_rport *fc_remote_port_create(struct fc_lport *lport,
 					      struct fc_rport_identifiers *ids)
 {
-	struct fc_rport_libfc_priv *rp;
+	struct fc_rport_libfc_priv *rdata;
 	struct fc_rport *rport;
 
-	rport = fc_remote_port_add(lp->host, 0, ids);
+	rport = fc_remote_port_add(lport->host, 0, ids);
 	if (!rport)
 		return NULL;
 
-	rp = rport->dd_data;
-	rp->local_port = lp;
+	rdata = rport->dd_data;
+	rdata->local_port = lport;
 
 	/* default value until service parameters are exchanged in PLOGI */
 	rport->maxframe_size = FC_MIN_MAX_PAYLOAD;
 
-	spin_lock_init(&rp->rp_lock);
-	rp->rp_state = RPORT_ST_INIT;
-	rp->local_port = lp;
-	rp->e_d_tov = lp->e_d_tov;
-	rp->r_a_tov = lp->r_a_tov;
-	rp->flags = FC_RP_FLAGS_REC_SUPPORTED;
-	INIT_DELAYED_WORK(&rp->retry_work, fc_rport_timeout);
+	spin_lock_init(&rdata->rp_lock);
+	rdata->rp_state = RPORT_ST_INIT;
+	rdata->local_port = lport;
+	rdata->e_d_tov = lport->e_d_tov;
+	rdata->r_a_tov = lport->r_a_tov;
+	rdata->flags = FC_RP_FLAGS_REC_SUPPORTED;
+	INIT_DELAYED_WORK(&rdata->retry_work, fc_rport_timeout);
 
 	return rport;
 }
@@ -151,14 +152,14 @@ EXPORT_SYMBOL(fc_set_rport_loss_tmo);
 
 static inline void fc_rport_lock(struct fc_rport *rport)
 {
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
-	spin_lock_bh(&rp->rp_lock);
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
+	spin_lock_bh(&rdata->rp_lock);
 }
 
 static inline void fc_rport_unlock(struct fc_rport *rport)
 {
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
-	spin_unlock_bh(&rp->rp_lock);
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
+	spin_unlock_bh(&rdata->rp_lock);
 }
 
 /**
@@ -186,12 +187,12 @@ fc_plogi_get_maxframe(struct fc_els_flogi *flp, unsigned int maxval)
 
 /**
  * fc_lport_plogi_fill - Fill in PLOGI command for request
- * @lp: Fibre Channel host port instance
+ * @lport: Fibre Channel host port instance
  * @plogi: PLOGI command structure to fill (same structure as FLOGI)
  * @op: either ELS_PLOGI for a localy generated request, or ELS_LS_ACC
  */
 static void
-fc_lport_plogi_fill(struct fc_lport *lp,
+fc_lport_plogi_fill(struct fc_lport *lport,
 		    struct fc_els_flogi *plogi, unsigned int op)
 {
 	struct fc_els_csp *sp;
@@ -199,23 +200,23 @@ fc_lport_plogi_fill(struct fc_lport *lp,
 
 	memset(plogi, 0, sizeof(*plogi));
 	plogi->fl_cmd = (u8) op;
-	put_unaligned_be64(lp->wwpn, &plogi->fl_wwpn);
-	put_unaligned_be64(lp->wwnn, &plogi->fl_wwnn);
+	put_unaligned_be64(lport->wwpn, &plogi->fl_wwpn);
+	put_unaligned_be64(lport->wwnn, &plogi->fl_wwnn);
 
 	sp = &plogi->fl_csp;
 	sp->sp_hi_ver = 0x20;
 	sp->sp_lo_ver = 0x20;
 	sp->sp_bb_cred = htons(10);	/* this gets set by gateway */
-	sp->sp_bb_data = htons((u16) lp->mfs);
+	sp->sp_bb_data = htons((u16) lport->mfs);
 	cp = &plogi->fl_cssp[3 - 1];	/* class 3 parameters */
 	cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ);
 	if (op != ELS_FLOGI) {
 		sp->sp_features = htons(FC_SP_FT_CIRO);
 		sp->sp_tot_seq = htons(255);	/* seq. we accept */
 		sp->sp_rel_off = htons(0x1f);
-		sp->sp_e_d_tov = htonl(lp->e_d_tov);
+		sp->sp_e_d_tov = htonl(lport->e_d_tov);
 
-		cp->cp_rdfs = htons((u16) lp->mfs);
+		cp->cp_rdfs = htons((u16) lport->mfs);
 		cp->cp_con_seq = htons(255);
 		cp->cp_open_seq = 1;
 	}
@@ -224,10 +225,10 @@ fc_lport_plogi_fill(struct fc_lport *lp,
 static void fc_rport_state_enter(struct fc_rport *rport,
 				 enum fc_rport_state new)
 {
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
-	if (rp->rp_state != new)
-		rp->retries = 0;
-	rp->rp_state = new;
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
+	if (rdata->rp_state != new)
+		rdata->retries = 0;
+	rdata->rp_state = new;
 }
 
 /**
@@ -321,16 +322,16 @@ void fc_rport_reset(struct fc_rport *rport)
 /*
  * Reset all sessions for a local port session list.
  */
-void fc_rport_reset_list(struct fc_lport *lp)
+void fc_rport_reset_list(struct fc_lport *lport)
 {
-	struct Scsi_Host *shost = lp->host;
+	struct Scsi_Host *shost = lport->host;
 	struct fc_rport *rport;
 	struct fc_rport *next;
 	unsigned long flags;
 
 	spin_lock_irqsave(shost->host_lock, flags);
 	list_for_each_entry_safe(rport, next, &fc_host_rports(shost), peers) {
-		lp->tt.rport_reset(rport);
+		lport->tt.rport_reset(rport);
 	}
 	spin_unlock_irqrestore(shost->host_lock, flags);
 }
@@ -361,11 +362,11 @@ static void fc_rport_enter_ready(struct fc_rport *rport)
  */
 static void fc_rport_timeout(struct work_struct *work)
 {
-	struct fc_rport_libfc_priv *rp =
+	struct fc_rport_libfc_priv *rdata =
 		container_of(work, struct fc_rport_libfc_priv, retry_work.work);
-	struct fc_rport *rport = (((void *)rp) - sizeof(struct fc_rport));
+	struct fc_rport *rport = (((void *)rdata) - sizeof(struct fc_rport));
 
-	switch (rp->rp_state) {
+	switch (rdata->rp_state) {
 	case RPORT_ST_PLOGI:
 		fc_rport_enter_plogi(rport);
 		break;
@@ -392,7 +393,7 @@ static void fc_rport_timeout(struct work_struct *work)
 
 /**
  * fc_rport_error - Handler for any errors
- * @rp: The fc_rport object
+ * @rport: The fc_rport object
  * @fp: The frame pointer
  *
  * If the error was caused by a resource allocation failure
@@ -463,7 +464,7 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp,
 	u16 cssp_seq;
 	u8 op;
 	struct fc_rport *rport = rp_arg;
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
 
 	if (!IS_ERR(fp)) {
 		op = fc_frame_payload_op(fp);
@@ -477,16 +478,17 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp,
 			tov = ntohl(plp->fl_csp.sp_e_d_tov);
 			if (ntohs(plp->fl_csp.sp_features) & FC_SP_FT_EDTR)
 				tov /= 1000;
-			if (tov > rp->e_d_tov)
-				rp->e_d_tov = tov;
+			if (tov > rdata->e_d_tov)
+				rdata->e_d_tov = tov;
 			csp_seq = ntohs(plp->fl_csp.sp_tot_seq);
 			cssp_seq = ntohs(plp->fl_cssp[3 - 1].cp_con_seq);
 			if (cssp_seq < csp_seq)
 				csp_seq = cssp_seq;
-			rp->max_seq = csp_seq;
+			rdata->max_seq = csp_seq;
 			rport->maxframe_size =
-				fc_plogi_get_maxframe(plp, rp->local_port->mfs);
-			if (rp->rp_state == RPORT_ST_PLOGI)
+				fc_plogi_get_maxframe(plp,
+						      rdata->local_port->mfs);
+			if (rdata->rp_state == RPORT_ST_PLOGI)
 				fc_rport_enter_prli(rport);
 		} else {
 			if (fc_rp_debug)
@@ -509,26 +511,26 @@ static void fc_rport_enter_plogi(struct fc_rport *rport)
 {
 	struct fc_frame *fp;
 	struct fc_els_flogi *plogi;
-	struct fc_lport *lp;
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
+	struct fc_lport *lport = rdata->local_port;
 
-	lp = rp->local_port;
 	fc_rport_state_enter(rport, RPORT_ST_PLOGI);
 	rport->maxframe_size = FC_MIN_MAX_PAYLOAD;
-	fp = fc_frame_alloc(lp, sizeof(*plogi));
+	fp = fc_frame_alloc(lport, sizeof(*plogi));
 	if (!fp)
 		return fc_rport_error(rport, fp);
 	plogi = fc_frame_payload_get(fp, sizeof(*plogi));
 	WARN_ON(!plogi);
-	fc_lport_plogi_fill(rp->local_port, plogi, ELS_PLOGI);
-	rp->e_d_tov = lp->e_d_tov;
+	fc_lport_plogi_fill(rdata->local_port, plogi, ELS_PLOGI);
+	rdata->e_d_tov = lport->e_d_tov;
 	fc_frame_setup(fp, FC_RCTL_ELS_REQ, FC_TYPE_ELS);
-	if (!lp->tt.exch_seq_send(lp, fp,
-				  fc_rport_plogi_resp, NULL,
-				  rport, lp->e_d_tov,
-				  rp->local_port->fid,
-				  rport->port_id,
-				  FC_FC_SEQ_INIT | FC_FC_END_SEQ))
+
+	if (!lport->tt.exch_seq_send(lport, fp,
+				     fc_rport_plogi_resp, NULL,
+				     rport, lport->e_d_tov,
+				     rdata->local_port->fid,
+				     rport->port_id,
+				     FC_FC_SEQ_INIT | FC_FC_END_SEQ))
 		fc_rport_error(rport, fp);
 }
 
@@ -641,8 +643,8 @@ static void fc_rport_enter_prli(struct fc_rport *rport)
 		struct fc_els_spp spp;
 	} *pp;
 	struct fc_frame *fp;
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
-	struct fc_lport *lp = rp->local_port;
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
+	struct fc_lport *lport = rdata->local_port;
 
 	fc_rport_state_enter(rport, RPORT_ST_PRLI);
 
@@ -655,7 +657,7 @@ static void fc_rport_enter_prli(struct fc_rport *rport)
 		fc_rport_enter_ready(rport);
 		return;
 	}
-	fp = fc_frame_alloc(lp, sizeof(*pp));
+	fp = fc_frame_alloc(lport, sizeof(*pp));
 	if (!fp)
 		return fc_rport_error(rport, fp);
 	pp = fc_frame_payload_get(fp, sizeof(*pp));
@@ -666,14 +668,14 @@ static void fc_rport_enter_prli(struct fc_rport *rport)
 	pp->prli.prli_len = htons(sizeof(*pp));
 	pp->spp.spp_type = FC_TYPE_FCP;
 	pp->spp.spp_flags = FC_SPP_EST_IMG_PAIR;
-	pp->spp.spp_params = htonl(rp->local_port->service_params);
+	pp->spp.spp_params = htonl(lport->service_params);
 	fc_frame_setup(fp, FC_RCTL_ELS_REQ, FC_TYPE_ELS);
-	if (!lp->tt.exch_seq_send(lp, fp,
-				  fc_rport_prli_resp, NULL,
-				  rport, lp->e_d_tov,
-				  rp->local_port->fid,
-				  rport->port_id,
-				  FC_FC_SEQ_INIT | FC_FC_END_SEQ))
+
+	if (!lport->tt.exch_seq_send(lport, fp,
+				     fc_rport_prli_resp, NULL,
+				     rport, lport->e_d_tov,
+				     lport->fid, rport->port_id,
+				     FC_FC_SEQ_INIT | FC_FC_END_SEQ))
 		fc_rport_error(rport, fp);
 }
 
@@ -689,7 +691,7 @@ static void fc_rport_rtv_resp(struct fc_seq *sp, struct fc_frame *fp,
 			      void *rp_arg)
 {
 	struct fc_rport *rport = rp_arg;
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
 	u8 op;
 
 	if (IS_ERR(fp)) {
@@ -710,13 +712,13 @@ static void fc_rport_rtv_resp(struct fc_seq *sp, struct fc_frame *fp,
 			tov = ntohl(rtv->rtv_r_a_tov);
 			if (tov == 0)
 				tov = 1;
-			rp->r_a_tov = tov;
+			rdata->r_a_tov = tov;
 			tov = ntohl(rtv->rtv_e_d_tov);
 			if (toq & FC_ELS_RTV_EDRES)
 				tov /= 1000000;
 			if (tov == 0)
 				tov = 1;
-			rp->e_d_tov = tov;
+			rdata->e_d_tov = tov;
 		}
 	}
 
@@ -733,13 +735,12 @@ static void fc_rport_enter_rtv(struct fc_rport *rport)
 {
 	struct fc_els_rtv *rtv;
 	struct fc_frame *fp;
-	struct fc_lport *lp;
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
+	struct fc_lport *lport = rdata->local_port;
 
-	lp = rp->local_port;
 	fc_rport_state_enter(rport, RPORT_ST_RTV);
 
-	fp = fc_frame_alloc(lp, sizeof(*rtv));
+	fp = fc_frame_alloc(lport, sizeof(*rtv));
 	if (!fp)
 		return fc_rport_error(rport, fp);
 	rtv = fc_frame_payload_get(fp, sizeof(*rtv));
@@ -747,12 +748,12 @@ static void fc_rport_enter_rtv(struct fc_rport *rport)
 	memset(rtv, 0, sizeof(*rtv));
 	rtv->rtv_cmd = ELS_RTV;
 	fc_frame_setup(fp, FC_RCTL_ELS_REQ, FC_TYPE_ELS);
-	if (!lp->tt.exch_seq_send(lp, fp,
-				  fc_rport_rtv_resp, NULL,
-				  rport, lp->e_d_tov,
-				  rp->local_port->fid,
-				  rport->port_id,
-				  FC_FC_SEQ_INIT | FC_FC_END_SEQ))
+
+	if (!lport->tt.exch_seq_send(lport, fp,
+				     fc_rport_rtv_resp, NULL,
+				     rport, lport->e_d_tov,
+				     lport->fid, rport->port_id,
+				     FC_FC_SEQ_INIT | FC_FC_END_SEQ))
 		fc_rport_error(rport, fp);
 }
 
@@ -764,28 +765,27 @@ static void fc_rport_enter_logo(struct fc_rport *rport)
 {
 	struct fc_frame *fp;
 	struct fc_els_logo *logo;
-	struct fc_lport *lp;
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
+	struct fc_lport *lport = rdata->local_port;
 
 	fc_rport_state_enter(rport, RPORT_ST_LOGO);
 
-	lp = rp->local_port;
-	fp = fc_frame_alloc(lp, sizeof(*logo));
+	fp = fc_frame_alloc(lport, sizeof(*logo));
 	if (!fp)
 		return fc_rport_error(rport, fp);
 	logo = fc_frame_payload_get(fp, sizeof(*logo));
 	memset(logo, 0, sizeof(*logo));
 	logo->fl_cmd = ELS_LOGO;
-	hton24(logo->fl_n_port_id, lp->fid);
-	logo->fl_n_port_wwn = htonll(lp->wwpn);
+	hton24(logo->fl_n_port_id, lport->fid);
+	logo->fl_n_port_wwn = htonll(lport->wwpn);
 
 	fc_frame_setup(fp, FC_RCTL_ELS_REQ, FC_TYPE_ELS);
-	if (!lp->tt.exch_seq_send(lp, fp,
-				  fc_rport_logo_resp, NULL,
-				  rport, lp->e_d_tov,
-				  rp->local_port->fid,
-				  rport->port_id,
-				  FC_FC_SEQ_INIT | FC_FC_END_SEQ))
+
+	if (!lport->tt.exch_seq_send(lport, fp,
+				     fc_rport_logo_resp, NULL,
+				     rport, lport->e_d_tov,
+				     lport->fid, rport->port_id,
+				     FC_FC_SEQ_INIT | FC_FC_END_SEQ))
 		fc_rport_error(rport, fp);
 }
 
@@ -797,9 +797,10 @@ static void fc_rport_enter_logo(struct fc_rport *rport)
 void fc_rport_recv_req(struct fc_seq *sp, struct fc_frame *fp,
 		       struct fc_rport *rport)
 {
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
+	struct fc_lport *lport = rdata->local_port;
+
 	struct fc_frame_header *fh;
-	struct fc_lport *lp = rp->local_port;
 	struct fc_seq_els_data els_data;
 	u8 op;
 
@@ -826,15 +827,15 @@ void fc_rport_recv_req(struct fc_seq *sp, struct fc_frame *fp,
 			break;
 		case ELS_RRQ:
 			els_data.fp = fp;
-			lp->tt.seq_els_rsp_send(sp, ELS_RRQ, &els_data);
+			lport->tt.seq_els_rsp_send(sp, ELS_RRQ, &els_data);
 			break;
 		case ELS_REC:
 			els_data.fp = fp;
-			lp->tt.seq_els_rsp_send(sp, ELS_REC, &els_data);
+			lport->tt.seq_els_rsp_send(sp, ELS_REC, &els_data);
 			break;
 		default:
 			els_data.reason = ELS_RJT_UNSUP;
-			lp->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &els_data);
+			lport->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &els_data);
 			fc_frame_free(fp);
 			break;
 		}
@@ -852,10 +853,11 @@ void fc_rport_recv_req(struct fc_seq *sp, struct fc_frame *fp,
 static void fc_rport_recv_plogi_req(struct fc_rport *rport,
 				    struct fc_seq *sp, struct fc_frame *rx_fp)
 {
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
+	struct fc_lport *lport = rdata->local_port;
 	struct fc_frame *fp = rx_fp;
+
 	struct fc_frame_header *fh;
-	struct fc_lport *lp;
 	struct fc_els_flogi *pl;
 	struct fc_seq_els_data rjt_data;
 	u32 sid;
@@ -878,7 +880,6 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
 	wwpn = get_unaligned_be64(&pl->fl_wwpn);
 	wwnn = get_unaligned_be64(&pl->fl_wwnn);
 	fc_rport_lock(rport);
-	lp = rp->local_port;
 
 	/*
 	 * If the session was just created, possibly due to the incoming PLOGI,
@@ -891,7 +892,7 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
 	 * XXX TBD: If the session was ready before, the PLOGI should result in
 	 * all outstanding exchanges being reset.
 	 */
-	switch (rp->rp_state) {
+	switch (rdata->rp_state) {
 	case RPORT_ST_INIT:
 		if (fc_rp_debug)
 			FC_DBG("incoming PLOGI from %6x wwpn %llx state INIT "
@@ -901,8 +902,8 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
 	case RPORT_ST_PLOGI:
 		if (fc_rp_debug)
 			FC_DBG("incoming PLOGI from %x in PLOGI state %d\n",
-			       sid, rp->rp_state);
-		if (wwpn < lp->wwpn)
+			       sid, rdata->rp_state);
+		if (wwpn < lport->wwpn)
 			reject = ELS_RJT_INPROG;
 		break;
 	case RPORT_ST_PRLI:
@@ -910,32 +911,32 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
 	case RPORT_ST_READY:
 		if (fc_rp_debug)
 			FC_DBG("incoming PLOGI from %x in logged-in state %d "
-			       "- ignored for now\n", sid, rp->rp_state);
+			       "- ignored for now\n", sid, rdata->rp_state);
 		/* XXX TBD - should reset */
 		break;
 	case RPORT_ST_NONE:
 	default:
 		if (fc_rp_debug)
 			FC_DBG("incoming PLOGI from %x in unexpected "
-			       "state %d\n", sid, rp->rp_state);
+			       "state %d\n", sid, rdata->rp_state);
 		break;
 	}
 
 	if (reject) {
 		rjt_data.reason = reject;
 		rjt_data.explan = ELS_EXPL_NONE;
-		lp->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &rjt_data);
+		lport->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &rjt_data);
 		fc_frame_free(fp);
 	} else {
-		fp = fc_frame_alloc(lp, sizeof(*pl));
+		fp = fc_frame_alloc(lport, sizeof(*pl));
 		if (fp == NULL) {
 			fp = rx_fp;
 			rjt_data.reason = ELS_RJT_UNAB;
 			rjt_data.explan = ELS_EXPL_NONE;
-			lp->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &rjt_data);
+			lport->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &rjt_data);
 			fc_frame_free(fp);
 		} else {
-			sp = lp->tt.seq_start_next(sp);
+			sp = lport->tt.seq_start_next(sp);
 			WARN_ON(!sp);
 			fc_rport_set_name(rport, wwpn, wwnn);
 
@@ -943,11 +944,11 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
 			 * Get session payload size from incoming PLOGI.
 			 */
 			rport->maxframe_size =
-				fc_plogi_get_maxframe(pl, lp->mfs);
+				fc_plogi_get_maxframe(pl, lport->mfs);
 			fc_frame_free(rx_fp);
 			pl = fc_frame_payload_get(fp, sizeof(*pl));
 			WARN_ON(!pl);
-			fc_lport_plogi_fill(lp, pl, ELS_LS_ACC);
+			fc_lport_plogi_fill(lport, pl, ELS_LS_ACC);
 
 			/*
 			 * Send LS_ACC.	 If this fails,
@@ -955,8 +956,8 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
 			 */
 			f_ctl = FC_FC_SEQ_INIT | FC_FC_LAST_SEQ | FC_FC_END_SEQ;
 			fc_frame_setup(fp, FC_RCTL_ELS_REP, FC_TYPE_ELS);
-			lp->tt.seq_send(lp, sp, fp, f_ctl);
-			if (rp->rp_state == RPORT_ST_PLOGI)
+			lport->tt.seq_send(lport, sp, fp, f_ctl);
+			if (rdata->rp_state == RPORT_ST_PLOGI)
 				fc_rport_enter_prli(rport);
 			else
 				fc_rport_state_enter(rport,
@@ -975,10 +976,11 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
 static void fc_rport_recv_prli_req(struct fc_rport *rport,
 				   struct fc_seq *sp, struct fc_frame *rx_fp)
 {
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
+	struct fc_lport *lport = rdata->local_port;
+
 	struct fc_frame *fp;
 	struct fc_frame_header *fh;
-	struct fc_lport *lp;
 	struct {
 		struct fc_els_prli prli;
 		struct fc_els_spp spp;
@@ -997,8 +999,8 @@ static void fc_rport_recv_prli_req(struct fc_rport *rport,
 
 	rjt_data.fp = NULL;
 	fh = fc_frame_header_get(rx_fp);
-	lp = rp->local_port;
-	switch (rp->rp_state) {
+
+	switch (rdata->rp_state) {
 	case RPORT_ST_PLOGI_RECV:
 	case RPORT_ST_PRLI:
 	case RPORT_ST_READY:
@@ -1029,12 +1031,12 @@ static void fc_rport_recv_prli_req(struct fc_rport *rport,
 		rspp = &pp->spp;
 	}
 	if (reason != ELS_RJT_NONE ||
-	    (fp = fc_frame_alloc(lp, len)) == NULL) {
+	    (fp = fc_frame_alloc(lport, len)) == NULL) {
 		rjt_data.reason = reason;
 		rjt_data.explan = explan;
-		lp->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &rjt_data);
+		lport->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &rjt_data);
 	} else {
-		sp = lp->tt.seq_start_next(sp);
+		sp = lport->tt.seq_start_next(sp);
 		WARN_ON(!sp);
 		pp = fc_frame_payload_get(fp, len);
 		WARN_ON(!pp);
@@ -1063,16 +1065,16 @@ static void fc_rport_recv_prli_req(struct fc_rport *rport,
 			case FC_TYPE_FCP:
 				fcp_parm = ntohl(rspp->spp_params);
 				if (fcp_parm * FCP_SPPF_RETRY)
-					rp->flags |= FC_RP_FLAGS_RETRY;
+					rdata->flags |= FC_RP_FLAGS_RETRY;
 				rport->supported_classes = FC_COS_CLASS3;
 				if (fcp_parm & FCP_SPPF_INIT_FCN)
 					roles |= FC_RPORT_ROLE_FCP_INITIATOR;
 				if (fcp_parm & FCP_SPPF_TARG_FCN)
 					roles |= FC_RPORT_ROLE_FCP_TARGET;
-				rp->roles = roles;
+				rdata->roles = roles;
 
 				spp->spp_params =
-					htonl(rp->local_port->service_params);
+					htonl(lport->service_params);
 				break;
 			default:
 				resp = FC_SPP_RESP_INVL;
@@ -1089,13 +1091,13 @@ static void fc_rport_recv_prli_req(struct fc_rport *rport,
 		 */
 		f_ctl = FC_FC_SEQ_INIT | FC_FC_LAST_SEQ | FC_FC_END_SEQ;
 		fc_frame_setup(fp, FC_RCTL_ELS_REP, FC_TYPE_ELS);
-		lp->tt.seq_send(lp, sp, fp, f_ctl);
+		lport->tt.seq_send(lport, sp, fp, f_ctl);
 
 		/*
 		 * Get lock and re-check state.
 		 */
 		fc_rport_lock(rport);
-		switch (rp->rp_state) {
+		switch (rdata->rp_state) {
 		case RPORT_ST_PLOGI_RECV:
 		case RPORT_ST_PRLI:
 			fc_rport_enter_ready(rport);
@@ -1119,18 +1121,19 @@ static void fc_rport_recv_prli_req(struct fc_rport *rport,
 static void fc_rport_recv_prlo_req(struct fc_rport *rport, struct fc_seq *sp,
 				   struct fc_frame *fp)
 {
-	struct fc_rport_libfc_priv *rp = rport->dd_data;
+	struct fc_rport_libfc_priv *rdata = rport->dd_data;
+	struct fc_lport *lport = rdata->local_port;
+
 	struct fc_frame_header *fh;
-	struct fc_lport *lp = rp->local_port;
 	struct fc_seq_els_data rjt_data;
 
 	fh = fc_frame_header_get(fp);
 	FC_DBG("incoming PRLO from %x state %d\n",
-	       ntoh24(fh->fh_s_id), rp->rp_state);
+	       ntoh24(fh->fh_s_id), rdata->rp_state);
 	rjt_data.fp = NULL;
 	rjt_data.reason = ELS_RJT_UNAB;
 	rjt_data.explan = ELS_EXPL_NONE;
-	lp->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &rjt_data);
+	lport->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &rjt_data);
 	fc_frame_free(fp);
 }
 
@@ -1163,28 +1166,28 @@ static void fc_rport_recv_logo_req(struct fc_rport *rport, struct fc_seq *sp,
 	fc_frame_free(fp);
 }
 
-int fc_rport_init(struct fc_lport *lp)
+int fc_rport_init(struct fc_lport *lport)
 {
-	if (!lp->tt.rport_login)
-		lp->tt.rport_login = fc_rport_login;
+	if (!lport->tt.rport_login)
+		lport->tt.rport_login = fc_rport_login;
 
-	if (!lp->tt.rport_logout)
-		lp->tt.rport_logout = fc_rport_logout;
+	if (!lport->tt.rport_logout)
+		lport->tt.rport_logout = fc_rport_logout;
 
-	if (!lp->tt.rport_recv_req)
-		lp->tt.rport_recv_req = fc_rport_recv_req;
+	if (!lport->tt.rport_recv_req)
+		lport->tt.rport_recv_req = fc_rport_recv_req;
 
-	if (!lp->tt.rport_create)
-		lp->tt.rport_create = fc_remote_port_create;
+	if (!lport->tt.rport_create)
+		lport->tt.rport_create = fc_remote_port_create;
 
-	if (!lp->tt.rport_lookup)
-		lp->tt.rport_lookup = fc_rport_lookup;
+	if (!lport->tt.rport_lookup)
+		lport->tt.rport_lookup = fc_rport_lookup;
 
-	if (!lp->tt.rport_reset)
-		lp->tt.rport_reset = fc_rport_reset;
+	if (!lport->tt.rport_reset)
+		lport->tt.rport_reset = fc_rport_reset;
 
-	if (!lp->tt.rport_reset_list)
-		lp->tt.rport_reset_list = fc_rport_reset_list;
+	if (!lport->tt.rport_reset_list)
+		lport->tt.rport_reset_list = fc_rport_reset_list;
 
 	return 0;
 }




More information about the devel mailing list