[Open-FCoE] [RFC PATCH 07/15] libfc: add newlins to debug statements

Robert Love robert.w.love at intel.com
Tue Sep 2 22:37:29 UTC 2008


Also ensure that all lport states have good debug statements

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

 drivers/scsi/libfc/fc_lport.c |   26 ++++++++++++++++---------
 drivers/scsi/libfc/fc_ns.c    |   33 ++++++++++++++++++++------------
 drivers/scsi/libfc/fc_rport.c |   42 +++++++++++++++++++++--------------------
 3 files changed, 57 insertions(+), 44 deletions(-)

diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 2d90b86..df1d18b 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -157,7 +157,7 @@ static void fc_lport_set_fid(struct fc_lport *lp, u32 fid)
 		return;
 
 	if (fc_lport_debug)
-		FC_DBG("changing local port fid from %x to %x",
+		FC_DBG("changing local port fid from %x to %x\n",
 		       lp->fid, fid);
 	lp->fid = fid;
 	lp->tt.rport_reset_list(lp);
@@ -429,6 +429,9 @@ EXPORT_SYMBOL(fc_set_mfs);
  */
 static void fc_lport_enter_retry(struct fc_lport *lp)
 {
+	if (fc_lport_debug)
+		FC_DBG("Entered retry\n");
+
 	switch (lp->state) {
 	case LPORT_ST_NONE:
 	case LPORT_ST_READY:
@@ -455,6 +458,9 @@ static void fc_lport_enter_retry(struct fc_lport *lp)
  */
 static void fc_lport_enter_reject(struct fc_lport *lp)
 {
+	if (fc_lport_debug)
+		FC_DBG("Entered reject\n");
+
 	switch (lp->state) {
 	case LPORT_ST_NONE:
 	case LPORT_ST_READY:
@@ -522,10 +528,10 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
 	remote_wwpn = get_unaligned_be64(&flp->fl_wwpn);
 	if (remote_wwpn == lp->wwpn) {
 		FC_DBG("FLOGI from port with same WWPN %llx "
-		       "possible configuration error.", remote_wwpn);
+		       "possible configuration error.\n", remote_wwpn);
 		goto out;
 	}
-	FC_DBG("FLOGI from port WWPN %llx ", remote_wwpn);
+	FC_DBG("FLOGI from port WWPN %llx\n", remote_wwpn);
 	fc_lport_lock(lp);
 
 	/*
@@ -640,7 +646,7 @@ static void fc_lport_recv(struct fc_lport *lp, struct fc_seq *sp,
 			}
 		}
 	} else {
-		FC_DBG("dropping invalid frame (eof %x)", fr_eof(fp));
+		FC_DBG("dropping invalid frame (eof %x)\n", fr_eof(fp));
 		fc_frame_free(fp);
 	}
 
@@ -659,7 +665,7 @@ static void fc_lport_recv(struct fc_lport *lp, struct fc_seq *sp,
 int fc_lport_enter_reset(struct fc_lport *lp)
 {
 	if (fc_lport_debug)
-		FC_DBG("Processing RESET state");
+		FC_DBG("Entered reset\n");
 
 	if (lp->dns_rp) {
 		fc_remote_port_delete(lp->dns_rp);
@@ -703,7 +709,7 @@ static void fc_lport_error(struct fc_lport *lp, struct fc_frame *fp)
 		}
 	}
 	if (fc_lport_debug)
-		FC_DBG("error %ld retries %d limit %d",
+		FC_DBG("error %ld retries %d limit %d\n",
 		       PTR_ERR(fp), lp->retry_count, lp->max_retry_count);
 	fc_lport_unlock(lp);
 }
@@ -739,7 +745,7 @@ static void fc_lport_enter_logo(struct fc_lport *lp)
 	struct fc_els_logo *logo;
 
 	if (fc_lport_debug)
-		FC_DBG("Processing LOGO state");
+		FC_DBG("Entered logo\n");
 
 	fc_lport_state_enter(lp, LPORT_ST_LOGO);
 
@@ -805,7 +811,7 @@ fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg)
 	did = ntoh24(fh->fh_d_id);
 	if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) {
 		if (fc_lport_debug)
-			FC_DBG("assigned fid %x", did);
+			FC_DBG("assigned fid %x\n", did);
 		fc_lport_lock(lp);
 		fc_lport_set_fid(lp, did);
 		flp = fc_frame_payload_get(fp, sizeof(*flp));
@@ -824,7 +830,7 @@ fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg)
 				if (e_d_tov > lp->e_d_tov)
 					lp->e_d_tov = e_d_tov;
 				lp->r_a_tov = 2 * e_d_tov;
-				FC_DBG("point-to-point mode");
+				FC_DBG("point-to-point mode\n");
 				fc_lport_ptp_setup(lp, ntoh24(fh->fh_s_id),
 						   get_unaligned_be64(
 							   &flp->fl_wwpn),
@@ -880,7 +886,7 @@ static void fc_lport_flogi_send(struct fc_lport *lp)
 void fc_lport_enter_flogi(struct fc_lport *lp)
 {
 	if (fc_lport_debug)
-		FC_DBG("Processing FLOGI state");
+		FC_DBG("Entered FLOGI\n");
 	fc_lport_state_enter(lp, LPORT_ST_FLOGI);
 	fc_lport_flogi_send(lp);
 }
diff --git a/drivers/scsi/libfc/fc_ns.c b/drivers/scsi/libfc/fc_ns.c
index 7541354..dd49188 100644
--- a/drivers/scsi/libfc/fc_ns.c
+++ b/drivers/scsi/libfc/fc_ns.c
@@ -115,7 +115,7 @@ static void fc_ns_rscn_req(struct fc_seq *sp, struct fc_frame *fp,
 	lp->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL);
 	if (redisc) {
 		if (fc_ns_debug)
-			FC_DBG("RSCN received: rediscovering");
+			FC_DBG("RSCN received: rediscovering\n");
 		list_for_each_entry_safe(dp, next, &disc_list, peers) {
 			list_del(&dp->peers);
 			kfree(dp);
@@ -124,7 +124,7 @@ static void fc_ns_rscn_req(struct fc_seq *sp, struct fc_frame *fp,
 	} else {
 		if (fc_ns_debug)
 			FC_DBG("RSCN received: not rediscovering. "
-				"redisc %d state %d in_prog %d",
+				"redisc %d state %d in_prog %d\n",
 				redisc, lp->state, lp->ns_disc_pending);
 		list_for_each_entry_safe(dp, next, &disc_list, peers) {
 			list_del(&dp->peers);
@@ -189,7 +189,7 @@ static void fc_ns_enter_scr(struct fc_lport *lp)
 	struct fc_els_scr *scr;
 
 	if (fc_ns_debug)
-		FC_DBG("Processing SCR state");
+		FC_DBG("Entered SCR\n");
 
 	fc_lport_state_enter(lp, LPORT_ST_SCR);
 
@@ -226,7 +226,7 @@ static void fc_ns_enter_reg_ft(struct fc_lport *lp)
 	int i;
 
 	if (fc_ns_debug)
-		FC_DBG("Processing REG_FT state");
+		FC_DBG("Entered REG_FT\n");
 
 	fc_lport_state_enter(lp, LPORT_ST_REG_FT);
 
@@ -268,6 +268,9 @@ static void fc_ns_enter_reg_ft(struct fc_lport *lp)
  */
 static void fc_ns_enter_reject(struct fc_lport *lp)
 {
+	if (fc_ns_debug)
+		FC_DBG("Entered reject\n");
+
 	switch (lp->state) {
 	case LPORT_ST_NONE:
 	case LPORT_ST_READY:
@@ -294,6 +297,9 @@ static void fc_ns_enter_reject(struct fc_lport *lp)
 
 static void fc_ns_enter_retry(struct fc_lport *lp)
 {
+	if (fc_ns_debug)
+		FC_DBG("Entered retry\n");
+
 	switch (lp->state) {
 	case LPORT_ST_NONE:
 	case LPORT_ST_RESET:
@@ -475,7 +481,7 @@ static void fc_ns_error(struct fc_lport *lp, struct fc_frame *fp)
 		}
 	}
 	if (fc_ns_debug)
-		FC_DBG("error %ld retries %d limit %d",
+		FC_DBG("error %ld retries %d limit %d\n",
 		       PTR_ERR(fp), lp->retry_count, lp->max_retry_count);
 	fc_lport_unlock(lp);
 }
@@ -670,12 +676,12 @@ static void fcdt_ns_error(struct fc_lport *lp, struct fc_frame *fp)
 		if (lp->ns_disc_retry_count++ < FC_NS_RETRY_LIMIT) {
 			fc_ns_gpn_ft_req(lp);
 		} else {
-			FC_DBG("err %d - ending", err);
+			FC_DBG("err %d - ending\n", err);
 			fc_ns_disc_done(lp);
 		}
 		break;
 	default:
-		FC_DBG("err %d - ending", err);
+		FC_DBG("err %d - ending\n", err);
 		fc_ns_disc_done(lp);
 		break;
 	}
@@ -823,7 +829,7 @@ static void fc_ns_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
 	    lp->ns_disc_seq_count == 0) {
 		cp = fc_frame_payload_get(fp, sizeof(*cp));
 		if (cp == NULL) {
-			FC_DBG("GPN_FT response too short.  len %d",
+			FC_DBG("GPN_FT response too short,  len %d\n",
 			       fr_len(fp));
 		} else if (ntohs(cp->ct_cmd) == FC_FS_ACC) {
 
@@ -834,7 +840,8 @@ static void fc_ns_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
 			len -= sizeof(*cp);
 		} else if (ntohs(cp->ct_cmd) == FC_FS_RJT) {
 			FC_DBG("GPN_FT rejected reason %x exp %x "
-			       "(check zoning)", cp->ct_reason, cp->ct_explan);
+			       "(check zoning)\n", cp->ct_reason,
+			       cp->ct_explan);
 			fc_ns_disc_done(lp);
 		} else {
 			FC_DBG("GPN_FT unexpected response code %x\n",
@@ -845,7 +852,7 @@ static void fc_ns_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
 		buf = fh + 1;
 	} else {
 		FC_DBG("GPN_FT unexpected frame - out of sequence? "
-		       "seq_cnt %x expected %x sof %x eof %x",
+		       "seq_cnt %x expected %x sof %x eof %x\n",
 		       seq_cnt, lp->ns_disc_seq_count, fr_sof(fp), fr_eof(fp));
 	}
 	if (buf) {
@@ -903,7 +910,7 @@ static void fc_ns_enter_dns(struct fc_lport *lp)
 	};
 
 	if (fc_ns_debug)
-		FC_DBG("Processing DNS state");
+		FC_DBG("Entered DNS\n");
 
 	fc_lport_state_enter(lp, LPORT_ST_DNS);
 
@@ -958,7 +965,7 @@ static void fc_ns_enter_dns_stop(struct fc_lport *lp)
 	struct fc_rport *rport = lp->dns_rp;
 
 	if (fc_ns_debug)
-		FC_DBG("Processing DNS_STOP state");
+		FC_DBG("Entered DNS STOP\n");
 
 	fc_lport_state_enter(lp, LPORT_ST_DNS_STOP);
 
@@ -980,7 +987,7 @@ static void fc_ns_enter_reg_pn(struct fc_lport *lp)
 	} *req;
 
 	if (fc_ns_debug)
-		FC_DBG("Processing REG_PN state");
+		FC_DBG("Entered REG_PN\n");
 
 	fc_lport_state_enter(lp, LPORT_ST_REG_PN);
 	fp = fc_frame_alloc(lp, sizeof(*req));
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 2e7eff7..df826e5 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -241,7 +241,7 @@ static void fc_rport_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
 
 	cp = fc_frame_payload_get(fp, sizeof(cp->ct));
 	if (cp == NULL) {
-		FC_DBG("GPN_ID response too short.  len %d", fr_len(fp));
+		FC_DBG("GPN_ID response too short, len %d\n", fr_len(fp));
 		return;
 	}
 	cmd = ntohs(cp->ct.ct_cmd);
@@ -249,7 +249,7 @@ static void fc_rport_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
 	case FC_FS_ACC:
 		cp = fc_frame_payload_get(fp, sizeof(*cp));
 		if (cp == NULL) {
-			FC_DBG("GPN_ID response payload too short.  len %d",
+			FC_DBG("GPN_ID response payload too short, len %d\n",
 			       fr_len(fp));
 			break;
 		}
@@ -366,7 +366,7 @@ static void fc_rport_gnn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
 
 	cp = fc_frame_payload_get(fp, sizeof(cp->ct));
 	if (cp == NULL) {
-		FC_DBG("GNN_ID response too short.  len %d", fr_len(fp));
+		FC_DBG("GNN_ID response too short,  len %d\n", fr_len(fp));
 		return;
 	}
 
@@ -375,7 +375,7 @@ static void fc_rport_gnn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
 	case FC_FS_ACC:
 		cp = fc_frame_payload_get(fp, sizeof(*cp));
 		if (cp == NULL) {
-			FC_DBG("GNN_ID response payload too short.  len %d",
+			FC_DBG("GNN_ID response payload too short, len %d\n",
 			       fr_len(fp));
 			break;
 		}
@@ -555,7 +555,7 @@ int fc_rport_logout(struct fc_rport *rport)
 		fc_rport_state_enter(rport, RPORT_ST_INIT);
 		fc_rport_unlock(rport);
 		if (fc_rp_debug)
-			FC_DBG("remote %6x closed", rport->port_id);
+			FC_DBG("remote %6x closed\n", rport->port_id);
 		if (rport == lp->dns_rp &&
 		    lp->state != LPORT_ST_RESET) {
 			fc_lport_lock(lp);
@@ -588,7 +588,7 @@ void fc_rport_reset(struct fc_rport *rport)
 	struct fc_lport *lp;
 
 	if (fc_rp_debug)
-		FC_DBG("sess to %6x reset", rport->port_id);
+		FC_DBG("sess to %6x reset\n", rport->port_id);
 	fc_rport_lock(rport);
 
 	lp = rp->local_port;
@@ -596,7 +596,7 @@ void fc_rport_reset(struct fc_rport *rport)
 	fc_rport_unlock(rport);
 
 	if (fc_rp_debug)
-		FC_DBG("remote %6x closed", rport->port_id);
+		FC_DBG("remote %6x closed\n", rport->port_id);
 	if (rport == lp->dns_rp &&
 	    lp->state != LPORT_ST_RESET) {
 		fc_lport_lock(lp);
@@ -661,12 +661,12 @@ static void fc_rport_reject(struct fc_rport *rport)
 	case RPORT_ST_RTV:
 		fc_rport_state_enter(rport, RPORT_ST_READY);
 		if (fc_rp_debug)
-			FC_DBG("remote %6x ready", rport->port_id);
+			FC_DBG("remote %6x ready\n", rport->port_id);
 		break;
 	case RPORT_ST_LOGO:
 		fc_rport_state_enter(rport, RPORT_ST_INIT);
 		if (fc_rp_debug)
-			FC_DBG("remote %6x closed", rport->port_id);
+			FC_DBG("remote %6x closed\n", rport->port_id);
 		if (rport == lp->dns_rp &&
 		    lp->state != LPORT_ST_RESET) {
 			fc_lport_lock(lp);
@@ -819,7 +819,7 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp,
 				fc_rport_enter_prli(rport);
 		} else {
 			if (fc_rp_debug)
-				FC_DBG("bad PLOGI response");
+				FC_DBG("bad PLOGI response\n");
 
 			rjp = fc_frame_payload_get(fp, sizeof(*rjp));
 			if (op == ELS_LS_RJT && rjp != NULL &&
@@ -1009,7 +1009,7 @@ static void fc_rport_enter_prli(struct fc_rport *rport)
 	if (rport->port_id >= FC_FID_DOM_MGR) {
 		fc_rport_state_enter(rport, RPORT_ST_READY);
 		if (fc_rp_debug)
-			FC_DBG("remote %6x ready", rport->port_id);
+			FC_DBG("remote %6x ready\n", rport->port_id);
 
 		fc_lport_lock(lp);
 		del_timer(&lp->state_timer);
@@ -1084,7 +1084,7 @@ static void fc_rport_rtv_resp(struct fc_seq *sp, struct fc_frame *fp,
 	fc_rport_state_enter(rport, RPORT_ST_READY);
 	fc_rport_unlock(rport);
 	if (fc_rp_debug)
-		FC_DBG("remote %6x ready", rport->port_id);
+		FC_DBG("remote %6x ready\n", rport->port_id);
 	fc_frame_free(fp);
 }
 
@@ -1239,7 +1239,7 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
 	sid = ntoh24(fh->fh_s_id);
 	pl = fc_frame_payload_get(fp, sizeof(*pl));
 	if (!pl) {
-		FC_DBG("incoming PLOGI from %x too short", sid);
+		FC_DBG("incoming PLOGI from %x too short\n", sid);
 		WARN_ON(1);
 		/* XXX TBD: send reject? */
 		fc_frame_free(fp);
@@ -1270,7 +1270,7 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
 		break;
 	case RPORT_ST_PLOGI:
 		if (fc_rp_debug)
-			FC_DBG("incoming PLOGI from %x in PLOGI state %d",
+			FC_DBG("incoming PLOGI from %x in PLOGI state %d\n",
 			       sid, rp->rp_state);
 		if (wwpn < lp->wwpn)
 			reject = ELS_RJT_INPROG;
@@ -1279,15 +1279,15 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
 	case RPORT_ST_ERROR:
 	case RPORT_ST_READY:
 		if (fc_rp_debug)
-			FC_DBG("incoming PLOGI from %x in logged-in state %d "
-			       "- ignored for now", sid, rp->rp_state);
+			FC_DBG("incoming PLOGI from %x in logged - in state %d "
+			       "- ignored for now\n", sid, rp->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",
-			       sid, rp->rp_state);
+			FC_DBG("incoming PLOGI from %x in unexpected "
+			       "state %d\n", sid, rp->rp_state);
 		break;
 	}
 
@@ -1470,7 +1470,7 @@ static void fc_rport_recv_prli_req(struct fc_rport *rport,
 		case RPORT_ST_PRLI:
 			fc_rport_state_enter(rport, RPORT_ST_READY);
 			if (fc_rp_debug)
-				FC_DBG("remote %6x ready", rport->port_id);
+				FC_DBG("remote %6x ready\n", rport->port_id);
 			if (rport == lp->dns_rp &&
 			    lp->state == LPORT_ST_DNS) {
 				fc_lport_lock(lp);
@@ -1504,7 +1504,7 @@ static void fc_rport_recv_prlo_req(struct fc_rport *rport, struct fc_seq *sp,
 	struct fc_seq_els_data rjt_data;
 
 	fh = fc_frame_header_get(fp);
-	FC_DBG("incoming PRLO from %x state %d",
+	FC_DBG("incoming PRLO from %x state %d\n",
 	       ntoh24(fh->fh_s_id), rp->rp_state);
 	rjt_data.fp = NULL;
 	rjt_data.reason = ELS_RJT_UNAB;
@@ -1531,7 +1531,7 @@ static void fc_rport_recv_logo_req(struct fc_rport *rport, struct fc_seq *sp,
 	fc_rport_state_enter(rport, RPORT_ST_INIT);
 	fc_rport_unlock(rport);
 	if (fc_rp_debug)
-		FC_DBG("remote %6x closed", rport->port_id);
+		FC_DBG("remote %6x closed\n", rport->port_id);
 	if (rport == lp->dns_rp &&
 	    lp->state != LPORT_ST_RESET) {
 		fc_lport_lock(lp);




More information about the devel mailing list