[Open-FCoE] [PATCH 22/28] libfc: rename LP variables

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


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

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

 drivers/scsi/libfc/fc_lport.c |  480 +++++++++++++++++++++--------------------
 1 files changed, 243 insertions(+), 237 deletions(-)

diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 85a0131..632bb00 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -56,7 +56,7 @@ static const char *fc_lport_state_names[] = {
 	[LPORT_ST_RESET] =    "reset",
 };
 
-static int fc_frame_drop(struct fc_lport *lp, struct fc_frame *fp)
+static int fc_frame_drop(struct fc_lport *lport, struct fc_frame *fp)
 {
 	fc_frame_free(fp);
 	return 0;
@@ -78,7 +78,9 @@ static void fc_lport_rport_event(struct fc_lport *lport, u32 port_id,
 		case LPORT_EV_RPORT_LOGO:
 		case LPORT_EV_RPORT_FAILED:
 			lport->dns_rp = NULL;
+			fc_lport_lock(lport);
 			fc_lport_enter_reset(lport);
+			fc_lport_unlock(lport);
 			break;
 		case LPORT_EV_RPORT_NONE:
 			break;
@@ -87,17 +89,17 @@ static void fc_lport_rport_event(struct fc_lport *lport, u32 port_id,
 	fc_lport_unlock(lport);
 }
 
-static const char *fc_lport_state(struct fc_lport *lp)
+static const char *fc_lport_state(struct fc_lport *lport)
 {
 	const char *cp;
 
-	cp = fc_lport_state_names[lp->state];
+	cp = fc_lport_state_names[lport->state];
 	if (!cp)
 		cp = "unknown";
 	return cp;
 }
 
-static void fc_lport_ptp_setup(struct fc_lport *lp,
+static void fc_lport_ptp_setup(struct fc_lport *lport,
 			       u32 remote_fid, u64 remote_wwpn,
 			       u64 remote_wwnn)
 {
@@ -112,24 +114,24 @@ static void fc_lport_ptp_setup(struct fc_lport *lp,
 	 * if we have to create a rport the fc class can sleep so we must
 	 * drop the lock here
 	 */
-	fc_lport_unlock(lp);
-	rport = lp->tt.rport_lookup(lp, ids.port_id); /* lookup and hold */
-	if (rport == NULL)
-		rport = lp->tt.rport_create(lp, &ids); /* create and hold */
-	fc_lport_lock(lp);
+	fc_lport_unlock(lport);
+	rport = lport->tt.rport_lookup(lport, ids.port_id);
+	if (!rport)
+		rport = lport->tt.rport_create(lport, &ids);
+	fc_lport_lock(lport);
 	if (rport) {
-		if (lp->ptp_rp)
-			fc_remote_port_delete(lp->ptp_rp);
-		lp->ptp_rp = rport;
-		fc_lport_enter_ready(lp);
+		if (lport->ptp_rp)
+			fc_remote_port_delete(lport->ptp_rp);
+		lport->ptp_rp = rport;
+		fc_lport_enter_ready(lport);
 	}
 }
 
-static void fc_lport_ptp_clear(struct fc_lport *lp)
+static void fc_lport_ptp_clear(struct fc_lport *lport)
 {
-	if (lp->ptp_rp) {
-		fc_remote_port_delete(lp->ptp_rp);
-		lp->ptp_rp = NULL;
+	if (lport->ptp_rp) {
+		fc_remote_port_delete(lport->ptp_rp);
+		lport->ptp_rp = NULL;
 	}
 }
 
@@ -220,30 +222,30 @@ static int fc_lport_dns_acc(struct fc_frame *fp)
  * Fill in FLOGI command for request.
  */
 static void
-fc_lport_flogi_fill(struct fc_lport *lp,
-		    struct fc_els_flogi *flogi, unsigned int op)
+fc_lport_flogi_fill(struct fc_lport *lport, struct fc_els_flogi *flogi,
+		    unsigned int op)
 {
 	struct fc_els_csp *sp;
 	struct fc_els_cssp *cp;
 
 	memset(flogi, 0, sizeof(*flogi));
 	flogi->fl_cmd = (u8) op;
-	put_unaligned_be64(lp->wwpn, &flogi->fl_wwpn);
-	put_unaligned_be64(lp->wwnn, &flogi->fl_wwnn);
+	put_unaligned_be64(lport->wwpn, &flogi->fl_wwpn);
+	put_unaligned_be64(lport->wwnn, &flogi->fl_wwnn);
 	sp = &flogi->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 = &flogi->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;
 	}
@@ -254,27 +256,27 @@ fc_lport_flogi_fill(struct fc_lport *lp,
  * fabric so we should reset our list of fc_rports. Passing a fid of
  * 0 will also reset the rport list regardless of the previous fid.
  */
-static void fc_lport_set_fid(struct fc_lport *lp, u32 fid)
+static void fc_lport_set_fid(struct fc_lport *lport, u32 fid)
 {
-	if (fid != 0 && lp->fid == fid)
+	if (fid != 0 && lport->fid == fid)
 		return;
 
 	if (fc_lport_debug)
 		FC_DBG("changing local port fid from %x to %x\n",
-		       lp->fid, fid);
-	lp->fid = fid;
-	fc_host_port_id(lp->host) = fid;
-	lp->tt.rport_reset_list(lp);
+		       lport->fid, fid);
+	lport->fid = fid;
+	fc_host_port_id(lport->host) = fid;
+	lport->tt.rport_reset_list(lport);
 }
 
 /*
  * Add a supported FC-4 type.
  */
-static void fc_lport_add_fc4_type(struct fc_lport *lp, enum fc_fh_type type)
+static void fc_lport_add_fc4_type(struct fc_lport *lport, enum fc_fh_type type)
 {
 	__be32 *mp;
 
-	mp = &lp->fcts.ff_type_map[type / FC_NS_BPW];
+	mp = &lport->fcts.ff_type_map[type / FC_NS_BPW];
 	*mp = htonl(ntohl(*mp) | 1UL << (type % FC_NS_BPW));
 }
 
@@ -282,9 +284,9 @@ static void fc_lport_add_fc4_type(struct fc_lport *lp, enum fc_fh_type type)
  * Handle received RLIR - registered link incident report.
  */
 static void fc_lport_rlir_req(struct fc_seq *sp, struct fc_frame *fp,
-			      struct fc_lport *lp)
+			      struct fc_lport *lport)
 {
-	lp->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL);
+	lport->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL);
 	fc_frame_free(fp);
 }
 
@@ -292,7 +294,7 @@ static void fc_lport_rlir_req(struct fc_seq *sp, struct fc_frame *fp,
  * Handle received ECHO.
  */
 static void fc_lport_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
-			      struct fc_lport *lp)
+			      struct fc_lport *lport)
 {
 	struct fc_frame *fp;
 	unsigned int len;
@@ -305,15 +307,15 @@ static void fc_lport_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
 
 	if (len < sizeof(__be32))
 		len = sizeof(__be32);
-	fp = fc_frame_alloc(lp, len);
+	fp = fc_frame_alloc(lport, len);
 	if (fp) {
 		dp = fc_frame_payload_get(fp, len);
 		memcpy(dp, pp, len);
 		*((u32 *)dp) = htonl(ELS_LS_ACC << 24);
-		sp = lp->tt.seq_start_next(sp);
+		sp = lport->tt.seq_start_next(sp);
 		f_ctl = 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);
 	}
 	fc_frame_free(in_fp);
 }
@@ -322,7 +324,7 @@ static void fc_lport_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
  * Handle received RNID.
  */
 static void fc_lport_rnid_req(struct fc_seq *sp, struct fc_frame *in_fp,
-			      struct fc_lport *lp)
+			      struct fc_lport *lport)
 {
 	struct fc_frame *fp;
 	struct fc_els_rnid *req;
@@ -341,33 +343,33 @@ static void fc_lport_rnid_req(struct fc_seq *sp, struct fc_frame *in_fp,
 		rjt_data.fp = NULL;
 		rjt_data.reason = ELS_RJT_LOGIC;
 		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);
 	} else {
 		fmt = req->rnid_fmt;
 		len = sizeof(*rp);
 		if (fmt != ELS_RNIDF_GEN ||
-		    ntohl(lp->rnid_gen.rnid_atype) == 0) {
+		    ntohl(lport->rnid_gen.rnid_atype) == 0) {
 			fmt = ELS_RNIDF_NONE;	/* nothing to provide */
 			len -= sizeof(rp->gen);
 		}
-		fp = fc_frame_alloc(lp, len);
+		fp = fc_frame_alloc(lport, len);
 		if (fp) {
 			rp = fc_frame_payload_get(fp, len);
 			memset(rp, 0, len);
 			rp->rnid.rnid_cmd = ELS_LS_ACC;
 			rp->rnid.rnid_fmt = fmt;
 			rp->rnid.rnid_cid_len = sizeof(rp->cid);
-			rp->cid.rnid_wwpn = htonll(lp->wwpn);
-			rp->cid.rnid_wwnn = htonll(lp->wwnn);
+			rp->cid.rnid_wwpn = htonll(lport->wwpn);
+			rp->cid.rnid_wwnn = htonll(lport->wwnn);
 			if (fmt == ELS_RNIDF_GEN) {
 				rp->rnid.rnid_sid_len = sizeof(rp->gen);
-				memcpy(&rp->gen, &lp->rnid_gen,
+				memcpy(&rp->gen, &lport->rnid_gen,
 				       sizeof(rp->gen));
 			}
-			sp = lp->tt.seq_start_next(sp);
+			sp = lport->tt.seq_start_next(sp);
 			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);
 		}
 	}
 	fc_frame_free(in_fp);
@@ -388,14 +390,14 @@ static void fc_lport_recv_logo_req(struct fc_seq *sp, struct fc_frame *fp,
  * Receive request frame
  */
 
-int fc_fabric_login(struct fc_lport *lp)
+int fc_fabric_login(struct fc_lport *lport)
 {
 	int rc = -1;
 
-	if (lp->state == LPORT_ST_NONE) {
-		fc_lport_lock(lp);
-		fc_lport_enter_reset(lp);
-		fc_lport_unlock(lp);
+	if (lport->state == LPORT_ST_NONE) {
+		fc_lport_lock(lport);
+		fc_lport_enter_reset(lport);
+		fc_lport_unlock(lport);
 		rc = 0;
 	}
 	return rc;
@@ -404,16 +406,16 @@ EXPORT_SYMBOL(fc_fabric_login);
 
 /**
  * fc_linkup -	link up notification
- * @dev:      Pointer to fc_lport .
+ * @lport:      Pointer to fc_lport
  **/
-void fc_linkup(struct fc_lport *lp)
+void fc_linkup(struct fc_lport *lport)
 {
-	if ((lp->link_status & FC_LINK_UP) != FC_LINK_UP) {
-		lp->link_status |= FC_LINK_UP;
-		fc_lport_lock(lp);
-		if (lp->state == LPORT_ST_RESET)
-			fc_lport_enter_flogi(lp);
-		fc_lport_unlock(lp);
+	if ((lport->link_status & FC_LINK_UP) != FC_LINK_UP) {
+		lport->link_status |= FC_LINK_UP;
+		fc_lport_lock(lport);
+		if (lport->state == LPORT_ST_RESET)
+			fc_lport_enter_flogi(lport);
+		fc_lport_unlock(lport);
 	}
 }
 EXPORT_SYMBOL(fc_linkup);
@@ -422,41 +424,41 @@ EXPORT_SYMBOL(fc_linkup);
  * fc_linkdown -  link down notification
  * @dev:      Pointer to fc_lport .
  **/
-void fc_linkdown(struct fc_lport *lp)
+void fc_linkdown(struct fc_lport *lport)
 {
-	if ((lp->link_status & FC_LINK_UP) == FC_LINK_UP) {
-		lp->link_status &= ~(FC_LINK_UP);
-		fc_lport_enter_reset(lp);
-		lp->tt.scsi_cleanup(lp);
+	if ((lport->link_status & FC_LINK_UP) == FC_LINK_UP) {
+		lport->link_status &= ~(FC_LINK_UP);
+		fc_lport_enter_reset(lport);
+		lport->tt.scsi_cleanup(lport);
 	}
 }
 EXPORT_SYMBOL(fc_linkdown);
 
-void fc_pause(struct fc_lport *lp)
+void fc_pause(struct fc_lport *lport)
 {
-	lp->link_status |= FC_PAUSE;
+	lport->link_status |= FC_PAUSE;
 }
 EXPORT_SYMBOL(fc_pause);
 
-void fc_unpause(struct fc_lport *lp)
+void fc_unpause(struct fc_lport *lport)
 {
-	lp->link_status &= ~(FC_PAUSE);
+	lport->link_status &= ~(FC_PAUSE);
 }
 EXPORT_SYMBOL(fc_unpause);
 
-int fc_fabric_logoff(struct fc_lport *lp)
+int fc_fabric_logoff(struct fc_lport *lport)
 {
-	fc_lport_lock(lp);
-	fc_lport_enter_logo(lp);
-	fc_lport_unlock(lp);
-	lp->tt.scsi_cleanup(lp);
+	fc_lport_lock(lport);
+	fc_lport_enter_logo(lport);
+	fc_lport_unlock(lport);
+	lport->tt.scsi_cleanup(lport);
 	return 0;
 }
 EXPORT_SYMBOL(fc_fabric_logoff);
 
 /**
  * fc_lport_destroy - unregister a fc_lport
- * @lp:	   fc_lport pointer to unregister
+ * @lport:	   fc_lport pointer to unregister
  *
  * Return value:
  *	None
@@ -466,30 +468,30 @@ EXPORT_SYMBOL(fc_fabric_logoff);
  * and free up other system resources.
  *
  **/
-int fc_lport_destroy(struct fc_lport *lp)
+int fc_lport_destroy(struct fc_lport *lport)
 {
-	fc_lport_lock(lp);
-	fc_lport_state_enter(lp, LPORT_ST_LOGO);
-	fc_lport_unlock(lp);
+	fc_lport_lock(lport);
+	fc_lport_state_enter(lport, LPORT_ST_LOGO);
+	fc_lport_unlock(lport);
 
-	cancel_delayed_work_sync(&lp->ns_disc_work);
+	cancel_delayed_work_sync(&lport->ns_disc_work);
 
-	lp->tt.scsi_abort_io(lp);
+	lport->tt.scsi_abort_io(lport);
 
-	lp->tt.frame_send = fc_frame_drop;
+	lport->tt.frame_send = fc_frame_drop;
 
-	lp->tt.exch_mgr_reset(lp->emp, 0, 0);
+	lport->tt.exch_mgr_reset(lport->emp, 0, 0);
 
 	return 0;
 }
 EXPORT_SYMBOL(fc_lport_destroy);
 
-int fc_set_mfs(struct fc_lport *lp, u32 mfs)
+int fc_set_mfs(struct fc_lport *lport, u32 mfs)
 {
 	unsigned int old_mfs;
 	int rc = -1;
 
-	old_mfs = lp->mfs;
+	old_mfs = lport->mfs;
 
 	if (mfs >= FC_MIN_MAX_FRAME) {
 		mfs &= ~3;
@@ -497,13 +499,13 @@ int fc_set_mfs(struct fc_lport *lp, u32 mfs)
 		if (mfs > FC_MAX_FRAME)
 			mfs = FC_MAX_FRAME;
 		mfs -= sizeof(struct fc_frame_header);
-		lp->mfs = mfs;
+		lport->mfs = mfs;
 		rc = 0;
 	}
 
 	if (!rc && mfs < old_mfs) {
-		lp->ns_disc_done = 0;
-		fc_lport_enter_reset(lp);
+		lport->ns_disc_done = 0;
+		fc_lport_enter_reset(lport);
 	}
 	return rc;
 }
@@ -521,31 +523,31 @@ static void fc_lport_enter_ready(struct fc_lport *lport)
 /*
  * re-enter state for retrying a request after a timeout or alloc failure.
  */
-static void fc_lport_enter_retry(struct fc_lport *lp)
+static void fc_lport_enter_retry(struct fc_lport *lport)
 {
-	switch (lp->state) {
+	switch (lport->state) {
 	case LPORT_ST_NONE:
 	case LPORT_ST_READY:
 	case LPORT_ST_RESET:
 		WARN_ON(1);
 		break;
 	case LPORT_ST_FLOGI:
-		fc_lport_enter_flogi(lp);
+		fc_lport_enter_flogi(lport);
 		break;
 	case LPORT_ST_DNS:
-		fc_lport_enter_dns(lp);
+		fc_lport_enter_dns(lport);
 		break;
 	case LPORT_ST_REG_PN:
-		fc_lport_enter_reg_pn(lp);
+		fc_lport_enter_reg_pn(lport);
 		break;
 	case LPORT_ST_REG_FT:
-		fc_lport_enter_reg_ft(lp);
+		fc_lport_enter_reg_ft(lport);
 		break;
 	case LPORT_ST_SCR:
-		fc_lport_enter_scr(lp);
+		fc_lport_enter_scr(lport);
 		break;
 	case LPORT_ST_LOGO:
-		fc_lport_enter_logo(lp);
+		fc_lport_enter_logo(lport);
 		break;
 	}
 }
@@ -554,9 +556,9 @@ static void fc_lport_enter_retry(struct fc_lport *lp)
  * enter next state for handling an exchange reject or retry exhaustion
  * in the current state.
  */
-static void fc_lport_enter_reject(struct fc_lport *lp)
+static void fc_lport_enter_reject(struct fc_lport *lport)
 {
-	switch (lp->state) {
+	switch (lport->state) {
 	case LPORT_ST_NONE:
 	case LPORT_ST_READY:
 	case LPORT_ST_RESET:
@@ -566,7 +568,7 @@ static void fc_lport_enter_reject(struct fc_lport *lp)
 	case LPORT_ST_DNS:
 	case LPORT_ST_FLOGI:
 	case LPORT_ST_LOGO:
-		fc_lport_enter_reset(lp);
+		fc_lport_enter_reset(lport);
 		break;
 	}
 }
@@ -574,21 +576,22 @@ static void fc_lport_enter_reject(struct fc_lport *lp)
 /*
  * Handle resource allocation problem by retrying in a bit.
  */
-static void fc_lport_retry(struct fc_lport *lp)
+static void fc_lport_retry(struct fc_lport *lport)
 {
-	if (lp->retry_count == 0)
+	if (lport->retry_count == 0)
 		FC_DBG("local port %6x alloc failure in state %s "
-		       "- will retry\n", lp->fid, fc_lport_state(lp));
-	if (lp->retry_count < lp->max_retry_count) {
-		lp->retry_count++;
-		schedule_delayed_work(&lp->retry_work,
+		       "- will retry\n", lport->fid, fc_lport_state(lport));
+
+	if (lport->retry_count < lport->max_retry_count) {
+		lport->retry_count++;
+		schedule_delayed_work(&lport->retry_work,
 				      jiffies +
-				      msecs_to_jiffies(lp->e_d_tov));
+				      msecs_to_jiffies(lport->e_d_tov));
 	} else {
 		FC_DBG("local port %6x alloc failure in state %s "
-		       "- retries exhausted\n", lp->fid,
-		       fc_lport_state(lp));
-		fc_lport_enter_reject(lp);
+		       "- retries exhausted\n", lport->fid,
+		       fc_lport_state(lport));
+		fc_lport_enter_reject(lport);
 	}
 }
 
@@ -599,7 +602,7 @@ static void fc_lport_retry(struct fc_lport *lp)
  */
 static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
 				    struct fc_frame *rx_fp,
-				    struct fc_lport *lp)
+				    struct fc_lport *lport)
 {
 	struct fc_frame *fp;
 	struct fc_frame_header *fh;
@@ -617,13 +620,13 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
 	if (!flp)
 		goto out;
 	remote_wwpn = get_unaligned_be64(&flp->fl_wwpn);
-	if (remote_wwpn == lp->wwpn) {
+	if (remote_wwpn == lport->wwpn) {
 		FC_DBG("FLOGI from port with same WWPN %llx "
 		       "possible configuration error\n", remote_wwpn);
 		goto out;
 	}
 	FC_DBG("FLOGI from port WWPN %llx\n", remote_wwpn);
-	fc_lport_lock(lp);
+	fc_lport_lock(lport);
 
 	/*
 	 * XXX what is the right thing to do for FIDs?
@@ -631,20 +634,20 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
 	 * But if so, both of us could end up with the same FID.
 	 */
 	local_fid = FC_LOCAL_PTP_FID_LO;
-	if (remote_wwpn < lp->wwpn) {
+	if (remote_wwpn < lport->wwpn) {
 		local_fid = FC_LOCAL_PTP_FID_HI;
 		if (!remote_fid || remote_fid == local_fid)
 			remote_fid = FC_LOCAL_PTP_FID_LO;
 	} else if (!remote_fid) {
 		remote_fid = FC_LOCAL_PTP_FID_HI;
 	}
-	fc_lport_set_fid(lp, local_fid);
+	fc_lport_set_fid(lport, local_fid);
 
-	fp = fc_frame_alloc(lp, sizeof(*flp));
+	fp = fc_frame_alloc(lport, sizeof(*flp));
 	if (fp) {
-		sp = lp->tt.seq_start_next(fr_seq(rx_fp));
+		sp = lport->tt.seq_start_next(fr_seq(rx_fp));
 		new_flp = fc_frame_payload_get(fp, sizeof(*flp));
-		fc_lport_flogi_fill(lp, new_flp, ELS_FLOGI);
+		fc_lport_flogi_fill(lport, new_flp, ELS_FLOGI);
 		new_flp->fl_cmd = (u8) ELS_LS_ACC;
 
 		/*
@@ -653,22 +656,22 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
 		 */
 		f_ctl = 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);
 
 	} else {
-		fc_lport_retry(lp);
+		fc_lport_retry(lport);
 	}
-	fc_lport_ptp_setup(lp, remote_fid, remote_wwpn,
+	fc_lport_ptp_setup(lport, remote_fid, remote_wwpn,
 			   get_unaligned_be64(&flp->fl_wwnn));
-	fc_lport_unlock(lp);
-	if (lp->tt.disc_start(lp))
+	fc_lport_unlock(lport);
+	if (lport->tt.disc_start(lport))
 		FC_DBG("target discovery start error\n");
 out:
 	sp = fr_seq(rx_fp);
 	fc_frame_free(rx_fp);
 }
 
-static void fc_lport_recv(struct fc_lport *lp, struct fc_seq *sp,
+static void fc_lport_recv(struct fc_lport *lport, struct fc_seq *sp,
 			  struct fc_frame *fp)
 {
 	struct fc_frame_header *fh = fc_frame_header_get(fp);
@@ -698,7 +701,7 @@ static void fc_lport_recv(struct fc_lport *lp, struct fc_seq *sp,
 				recv = fc_lport_recv_logo_req;
 			break;
 		case ELS_RSCN:
-			recv = lp->tt.disc_recv_req;
+			recv = lport->tt.disc_recv_req;
 			break;
 		case ELS_ECHO:
 			recv = fc_lport_echo_req;
@@ -712,7 +715,7 @@ static void fc_lport_recv(struct fc_lport *lp, struct fc_seq *sp,
 		}
 
 		if (recv)
-			recv(sp, fp, lp);
+			recv(sp, fp, lport);
 		else {
 			/*
 			 * Find session.
@@ -721,16 +724,17 @@ static void fc_lport_recv(struct fc_lport *lp, struct fc_seq *sp,
 			s_id = ntoh24(fh->fh_s_id);
 			d_id = ntoh24(fh->fh_d_id);
 
-			rport = lp->tt.rport_lookup(lp, s_id);
+			rport = lport->tt.rport_lookup(lport, s_id);
 			if (rport) {
-				lp->tt.rport_recv_req(sp, fp, rport);
+				lport->tt.rport_recv_req(sp, fp, rport);
 				put_device(&rport->dev); /* hold from lookup */
 			} else {
 				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);
 			}
 		}
@@ -743,7 +747,7 @@ static void fc_lport_recv(struct fc_lport *lp, struct fc_seq *sp,
 	 *  The common exch_done for all request may not be good
 	 *  if any request requires longer hold on exhange. XXX
 	 */
-	lp->tt.exch_done(sp);
+	lport->tt.exch_done(sp);
 }
 
 /*
@@ -751,18 +755,18 @@ static void fc_lport_recv(struct fc_lport *lp, struct fc_seq *sp,
  * This is called after a SCSI reset or the driver is unloading
  * or the program is exiting.
  */
-int fc_lport_enter_reset(struct fc_lport *lp)
+int fc_lport_enter_reset(struct fc_lport *lport)
 {
 	if (fc_lport_debug)
 		FC_DBG("Processing RESET state\n");
 
-	if (lp->dns_rp) {
-		fc_remote_port_delete(lp->dns_rp);
-		lp->dns_rp = NULL;
+	if (lport->dns_rp) {
+		fc_remote_port_delete(lport->dns_rp);
+		lport->dns_rp = NULL;
 	}
-	fc_lport_ptp_clear(lp);
+	fc_lport_ptp_clear(lport);
 
-	fc_block_rports(lp);
+	fc_block_rports(lport);
 
 	/*
 	 * Setting state RESET keeps fc_lport_error() callbacks
@@ -770,12 +774,13 @@ int fc_lport_enter_reset(struct fc_lport *lp)
 	 * It also causes fc_lport_sess_event() to ignore events.
 	 * The lock is held for the duration of the time in RESET state.
 	 */
-	fc_lport_state_enter(lp, LPORT_ST_RESET);
-	lp->tt.exch_mgr_reset(lp->emp, 0, 0);
-	fc_lport_set_fid(lp, 0);
-	fc_host_fabric_name(lp->host) = 0;
-	if ((lp->link_status & FC_LINK_UP) == FC_LINK_UP)
-		fc_lport_enter_flogi(lp);
+	fc_lport_state_enter(lport, LPORT_ST_RESET);
+	lport->tt.exch_mgr_reset(lport->emp, 0, 0);
+	fc_host_fabric_name(lport->host) = 0;
+	fc_lport_set_fid(lport, 0);
+	if ((lport->link_status & FC_LINK_UP) == FC_LINK_UP)
+		fc_lport_enter_flogi(lport);
+
 	return 0;
 }
 EXPORT_SYMBOL(fc_lport_enter_reset);
@@ -785,25 +790,25 @@ EXPORT_SYMBOL(fc_lport_enter_reset);
  * Don't get locks if in RESET state.
  * The only possible errors so far are exchange TIMEOUT and CLOSED (reset).
  */
-static void fc_lport_error(struct fc_lport *lp, struct fc_frame *fp)
+static void fc_lport_error(struct fc_lport *lport, struct fc_frame *fp)
 {
-	if (lp->state == LPORT_ST_RESET)
+	if (lport->state == LPORT_ST_RESET)
 		return;
 
-	fc_lport_lock(lp);
+	fc_lport_lock(lport);
 	if (PTR_ERR(fp) == -FC_EX_TIMEOUT) {
-		if (lp->retry_count < lp->max_retry_count) {
-			lp->retry_count++;
-			fc_lport_enter_retry(lp);
+		if (lport->retry_count < lport->max_retry_count) {
+			lport->retry_count++;
+			fc_lport_enter_retry(lport);
 		} else {
-			fc_lport_enter_reject(lp);
+			fc_lport_enter_reject(lport);
 
 		}
 	}
 	if (fc_lport_debug)
 		FC_DBG("error %ld retries %d limit %d\n",
-		       PTR_ERR(fp), lp->retry_count, lp->max_retry_count);
-	fc_lport_unlock(lp);
+		       PTR_ERR(fp), lport->retry_count, lport->max_retry_count);
+	fc_lport_unlock(lport);
 }
 
 /*
@@ -1042,20 +1047,20 @@ static void fc_lport_timeout(struct work_struct *work)
 static void fc_lport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
 			       void *lp_arg)
 {
-	struct fc_lport *lp = lp_arg;
+	struct fc_lport *lport = lp_arg;
 
 	if (IS_ERR(fp))
-		fc_lport_error(lp, fp);
+		fc_lport_error(lport, fp);
 	else {
 		fc_frame_free(fp);
-		fc_lport_lock(lp);
-		fc_lport_enter_reset(lp);
-		fc_lport_unlock(lp);
+		fc_lport_lock(lport);
+		fc_lport_enter_reset(lport);
+		fc_lport_unlock(lport);
 	}
 }
 
 /* Logout of the FC fabric */
-static void fc_lport_enter_logo(struct fc_lport *lp)
+static void fc_lport_enter_logo(struct fc_lport *lport)
 {
 	struct fc_frame *fp;
 	struct fc_els_logo *logo;
@@ -1063,15 +1068,15 @@ static void fc_lport_enter_logo(struct fc_lport *lp)
 	if (fc_lport_debug)
 		FC_DBG("Processing LOGO state\n");
 
-	fc_lport_state_enter(lp, LPORT_ST_LOGO);
+	fc_lport_state_enter(lport, LPORT_ST_LOGO);
 
 	/* DNS session should be closed so we can release it here */
-	if (lp->dns_rp) {
-		fc_remote_port_delete(lp->dns_rp);
-		lp->dns_rp = NULL;
+	if (lport->dns_rp) {
+		fc_remote_port_delete(lport->dns_rp);
+		lport->dns_rp = NULL;
 	}
 
-	fp = fc_frame_alloc(lp, sizeof(*logo));
+	fp = fc_frame_alloc(lport, sizeof(*logo));
 	if (!fp) {
 		FC_DBG("failed to allocate frame\n");
 		return;
@@ -1080,27 +1085,27 @@ static void fc_lport_enter_logo(struct fc_lport *lp)
 	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);
 	fc_frame_set_offset(fp, 0);
 
-	lp->tt.exch_seq_send(lp, fp,
-			      fc_lport_logo_resp, NULL,
-			      lp, lp->e_d_tov,
-			      lp->fid, FC_FID_FLOGI,
-			      FC_FC_SEQ_INIT | FC_FC_END_SEQ);
+	lport->tt.exch_seq_send(lport, fp,
+				fc_lport_logo_resp, NULL,
+				lport, lport->e_d_tov,
+				lport->fid, FC_FID_FLOGI,
+				FC_FC_SEQ_INIT | FC_FC_END_SEQ);
 }
 
 /*
  * Handle incoming ELS FLOGI response.
  * Save parameters of remote switch.  Finish exchange.
  */
-static void
-fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg)
+static void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
+				void *lp_arg)
 {
-	struct fc_lport *lp = lp_arg;
+	struct fc_lport *lport = lp_arg;
 	struct fc_frame_header *fh;
 	struct fc_els_flogi *flp;
 	u32 did;
@@ -1110,7 +1115,7 @@ fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg)
 	u16 mfs;
 
 	if (IS_ERR(fp)) {
-		fc_lport_error(lp, fp);
+		fc_lport_error(lport, fp);
 		return;
 	}
 
@@ -1119,43 +1124,43 @@ fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg)
 	if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) {
 		if (fc_lport_debug)
 			FC_DBG("assigned fid %x\n", did);
-		fc_lport_lock(lp);
-		fc_lport_set_fid(lp, did);
+		fc_lport_lock(lport);
+		fc_lport_set_fid(lport, did);
 		flp = fc_frame_payload_get(fp, sizeof(*flp));
 		if (flp) {
 			mfs = ntohs(flp->fl_csp.sp_bb_data) &
 				FC_SP_BB_DATA_MASK;
 			if (mfs >= FC_SP_MIN_MAX_PAYLOAD &&
-			    mfs < lp->mfs)
-				lp->mfs = mfs;
+			    mfs < lport->mfs)
+				lport->mfs = mfs;
 			csp_flags = ntohs(flp->fl_csp.sp_features);
 			r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov);
 			e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov);
 			if (csp_flags & FC_SP_FT_EDTR)
 				e_d_tov /= 1000000;
 			if ((csp_flags & FC_SP_FT_FPORT) == 0) {
-				if (e_d_tov > lp->e_d_tov)
-					lp->e_d_tov = e_d_tov;
-				lp->r_a_tov = 2 * e_d_tov;
+				if (e_d_tov > lport->e_d_tov)
+					lport->e_d_tov = e_d_tov;
+				lport->r_a_tov = 2 * e_d_tov;
 				FC_DBG("point-to-point mode\n");
-				fc_lport_ptp_setup(lp, ntoh24(fh->fh_s_id),
+				fc_lport_ptp_setup(lport, ntoh24(fh->fh_s_id),
 						   get_unaligned_be64(
 							   &flp->fl_wwpn),
 						   get_unaligned_be64(
 							   &flp->fl_wwnn));
 			} else {
-				lp->e_d_tov = e_d_tov;
-				lp->r_a_tov = r_a_tov;
-				fc_host_fabric_name(lp->host) =
+				lport->e_d_tov = e_d_tov;
+				lport->r_a_tov = r_a_tov;
+				fc_host_fabric_name(lport->host) =
 					get_unaligned_be64(&flp->fl_wwnn);
-				fc_lport_enter_dns(lp);
+				fc_lport_enter_dns(lport);
 			}
 		}
-		fc_lport_unlock(lp);
+		fc_lport_unlock(lport);
 		if (flp) {
 			csp_flags = ntohs(flp->fl_csp.sp_features);
 			if ((csp_flags & FC_SP_FT_FPORT) == 0) {
-				if (lp->tt.disc_start(lp))
+				if (lport->tt.disc_start(lport))
 					FC_DBG("target disc start error\n");
 			}
 		}
@@ -1168,87 +1173,88 @@ fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg)
 /*
  * Send ELS (extended link service) FLOGI request to peer.
  */
-static void fc_lport_flogi_send(struct fc_lport *lp)
+static void fc_lport_flogi_send(struct fc_lport *lport)
 {
 	struct fc_frame *fp;
 	struct fc_els_flogi *flp;
 
-	fp = fc_frame_alloc(lp, sizeof(*flp));
+	fp = fc_frame_alloc(lport, sizeof(*flp));
 	if (!fp)
-		return fc_lport_retry(lp);
+		return fc_lport_retry(lport);
 
 	flp = fc_frame_payload_get(fp, sizeof(*flp));
-	fc_lport_flogi_fill(lp, flp, ELS_FLOGI);
+	fc_lport_flogi_fill(lport, flp, ELS_FLOGI);
 
 	fc_frame_setup(fp, FC_RCTL_ELS_REQ, FC_TYPE_ELS);
 	fc_frame_set_offset(fp, 0);
 
-	if (!lp->tt.exch_seq_send(lp, fp,
-				   fc_lport_flogi_resp, NULL,
-				   lp, lp->e_d_tov,
-				   0, FC_FID_FLOGI,
-				   FC_FC_SEQ_INIT | FC_FC_END_SEQ))
-		fc_lport_retry(lp);
+	if (!lport->tt.exch_seq_send(lport, fp,
+				     fc_lport_flogi_resp, NULL,
+				     lport, lport->e_d_tov,
+				     0, FC_FID_FLOGI,
+				     FC_FC_SEQ_INIT | FC_FC_END_SEQ))
+		fc_lport_retry(lport);
 
 }
 
-void fc_lport_enter_flogi(struct fc_lport *lp)
+void fc_lport_enter_flogi(struct fc_lport *lport)
 {
 	if (fc_lport_debug)
 		FC_DBG("Processing FLOGI state\n");
-	fc_lport_state_enter(lp, LPORT_ST_FLOGI);
-	fc_lport_flogi_send(lp);
+	fc_lport_state_enter(lport, LPORT_ST_FLOGI);
+	fc_lport_flogi_send(lport);
 }
 
 /* Configure a fc_lport */
-int fc_lport_config(struct fc_lport *lp)
+int fc_lport_config(struct fc_lport *lport)
 {
-	INIT_DELAYED_WORK(&lp->retry_work, fc_lport_timeout);
-	spin_lock_init(&lp->state_lock);
+	INIT_DELAYED_WORK(&lport->retry_work, fc_lport_timeout);
+	spin_lock_init(&lport->state_lock);
 
-	fc_lport_lock(lp);
-	fc_lport_state_enter(lp, LPORT_ST_NONE);
-	fc_lport_unlock(lp);
+	fc_lport_lock(lport);
+	fc_lport_state_enter(lport, LPORT_ST_NONE);
+	fc_lport_unlock(lport);
 
-	lp->ns_disc_delay = DNS_DELAY;
+	lport->ns_disc_delay = DNS_DELAY;
 
-	fc_lport_add_fc4_type(lp, FC_TYPE_FCP);
-	fc_lport_add_fc4_type(lp, FC_TYPE_CT);
+	fc_lport_add_fc4_type(lport, FC_TYPE_FCP);
+	fc_lport_add_fc4_type(lport, FC_TYPE_CT);
 
 	return 0;
 }
 EXPORT_SYMBOL(fc_lport_config);
 
-int fc_lport_init(struct fc_lport *lp)
+int fc_lport_init(struct fc_lport *lport)
 {
-	if (!lp->tt.lport_recv)
-		lp->tt.lport_recv = fc_lport_recv;
-
-	if (!lp->tt.lport_reset)
-		lp->tt.lport_reset = fc_lport_enter_reset;
-
-	if (!lp->tt.event_callback)
-		lp->tt.event_callback = fc_lport_rport_event;
-
-	fc_host_port_type(lp->host) = FC_PORTTYPE_NPORT;
-	fc_host_node_name(lp->host) = lp->wwnn;
-	fc_host_port_name(lp->host) = lp->wwpn;
-	fc_host_supported_classes(lp->host) = FC_COS_CLASS3;
-	memset(fc_host_supported_fc4s(lp->host), 0,
-	       sizeof(fc_host_supported_fc4s(lp->host)));
-	fc_host_supported_fc4s(lp->host)[2] = 1;
-	fc_host_supported_fc4s(lp->host)[7] = 1;
+	if (!lport->tt.lport_recv)
+		lport->tt.lport_recv = fc_lport_recv;
+
+	if (!lport->tt.lport_reset)
+		lport->tt.lport_reset = fc_lport_enter_reset;
+
+	if (!lport->tt.event_callback)
+		lport->tt.event_callback = fc_lport_rport_event;
+
+	fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT;
+	fc_host_node_name(lport->host) = lport->wwnn;
+	fc_host_port_name(lport->host) = lport->wwpn;
+	fc_host_supported_classes(lport->host) = FC_COS_CLASS3;
+	memset(fc_host_supported_fc4s(lport->host), 0,
+	       sizeof(fc_host_supported_fc4s(lport->host)));
+	fc_host_supported_fc4s(lport->host)[2] = 1;
+	fc_host_supported_fc4s(lport->host)[7] = 1;
+
 	/* This value is also unchanging */
-	memset(fc_host_active_fc4s(lp->host), 0,
-	       sizeof(fc_host_active_fc4s(lp->host)));
-	fc_host_active_fc4s(lp->host)[2] = 1;
-	fc_host_active_fc4s(lp->host)[7] = 1;
-	fc_host_maxframe_size(lp->host) = lp->mfs;
-	fc_host_supported_speeds(lp->host) = 0;
-	if (lp->link_supported_speeds & FC_PORTSPEED_1GBIT)
-		fc_host_supported_speeds(lp->host) |= FC_PORTSPEED_1GBIT;
-	if (lp->link_supported_speeds & FC_PORTSPEED_10GBIT)
-		fc_host_supported_speeds(lp->host) |= FC_PORTSPEED_10GBIT;
+	memset(fc_host_active_fc4s(lport->host), 0,
+	       sizeof(fc_host_active_fc4s(lport->host)));
+	fc_host_active_fc4s(lport->host)[2] = 1;
+	fc_host_active_fc4s(lport->host)[7] = 1;
+	fc_host_maxframe_size(lport->host) = lport->mfs;
+	fc_host_supported_speeds(lport->host) = 0;
+	if (lport->link_supported_speeds & FC_PORTSPEED_1GBIT)
+		fc_host_supported_speeds(lport->host) |= FC_PORTSPEED_1GBIT;
+	if (lport->link_supported_speeds & FC_PORTSPEED_10GBIT)
+		fc_host_supported_speeds(lport->host) |= FC_PORTSPEED_10GBIT;
 
 	return 0;
 }




More information about the devel mailing list