public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: James.Bottomley@HansenPartnership.com, linux-scsi@vger.kernel.org
Cc: Joe Eykholt <jeykholt@cisco.com>, Robert Love <robert.w.love@intel.com>
Subject: [PATCH 28/64] libfc: change elsct to use FC_ID instead of rdata
Date: Tue, 25 Aug 2009 14:00:55 -0700	[thread overview]
Message-ID: <20090825210055.1553.61332.stgit@localhost.localdomain> (raw)
In-Reply-To: <20090825205826.1553.94414.stgit@localhost.localdomain>

From: Joe Eykholt <jeykholt@cisco.com>

tt.elsct_send is used by both FCP and by the rport state machine.
After further patches, these two modules will use different
structures for the remote port.

So, change elsct_send to use the FC_ID instead of the fc_rport_priv
as its argument.  It currently only uses the FC_ID anyway.

For CT requests the destination FC_ID is still implicitly 0xfffffc.
After further patches the did arg on CT requests will be used to
specify the FC_ID being inquired about for GPN_ID or other queries.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---

 drivers/scsi/libfc/fc_disc.c  |    2 +-
 drivers/scsi/libfc/fc_elsct.c |   11 ++++++-----
 drivers/scsi/libfc/fc_fcp.c   |    2 +-
 drivers/scsi/libfc/fc_lport.c |   12 ++++++------
 drivers/scsi/libfc/fc_rport.c |    8 ++++----
 include/scsi/fc_encode.h      |   26 +++++---------------------
 include/scsi/libfc.h          |    2 +-
 7 files changed, 24 insertions(+), 39 deletions(-)

diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index 448ffc3..4b1f9fa 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -526,7 +526,7 @@ static void fc_disc_gpn_ft_req(struct fc_disc *disc)
 	if (!fp)
 		goto err;
 
-	if (lport->tt.elsct_send(lport, NULL, fp,
+	if (lport->tt.elsct_send(lport, 0, fp,
 				 FC_NS_GPN_FT,
 				 fc_disc_gpn_ft_resp,
 				 disc, lport->e_d_tov))
diff --git a/drivers/scsi/libfc/fc_elsct.c b/drivers/scsi/libfc/fc_elsct.c
index 2b8a3bb..5e8b011 100644
--- a/drivers/scsi/libfc/fc_elsct.c
+++ b/drivers/scsi/libfc/fc_elsct.c
@@ -32,7 +32,7 @@
  * fc_elsct_send - sends ELS/CT frame
  */
 static struct fc_seq *fc_elsct_send(struct fc_lport *lport,
-				    struct fc_rport_priv *rdata,
+				    u32 did,
 				    struct fc_frame *fp,
 				    unsigned int op,
 				    void (*resp)(struct fc_seq *,
@@ -41,16 +41,17 @@ static struct fc_seq *fc_elsct_send(struct fc_lport *lport,
 				    void *arg, u32 timer_msec)
 {
 	enum fc_rctl r_ctl;
-	u32 did = FC_FID_NONE;
 	enum fc_fh_type fh_type;
 	int rc;
 
 	/* ELS requests */
 	if ((op >= ELS_LS_RJT) && (op <= ELS_AUTH_ELS))
-		rc = fc_els_fill(lport, rdata, fp, op, &r_ctl, &did, &fh_type);
-	else
+		rc = fc_els_fill(lport, did, fp, op, &r_ctl, &fh_type);
+	else {
 		/* CT requests */
-		rc = fc_ct_fill(lport, fp, op, &r_ctl, &did, &fh_type);
+		rc = fc_ct_fill(lport, fp, op, &r_ctl, &fh_type);
+		did = FC_FID_DIR_SERV;
+	}
 
 	if (rc)
 		return NULL;
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index a622096..59a4408 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -1308,7 +1308,7 @@ static void fc_fcp_rec(struct fc_fcp_pkt *fsp)
 	fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, rport->port_id,
 		       fc_host_port_id(rp->local_port->host), FC_TYPE_ELS,
 		       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);
-	if (lp->tt.elsct_send(lp, rport->dd_data, fp, ELS_REC, fc_fcp_rec_resp,
+	if (lp->tt.elsct_send(lp, rport->port_id, fp, ELS_REC, fc_fcp_rec_resp,
 			      fsp, jiffies_to_msecs(FC_SCSI_REC_TOV))) {
 		fc_fcp_pkt_hold(fsp);		/* hold while REC outstanding */
 		return;
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 3c15abd..aa605d2 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1217,7 +1217,7 @@ static void fc_lport_enter_scr(struct fc_lport *lport)
 		return;
 	}
 
-	if (!lport->tt.elsct_send(lport, NULL, fp, ELS_SCR,
+	if (!lport->tt.elsct_send(lport, FC_FID_FCTRL, fp, ELS_SCR,
 				  fc_lport_scr_resp, lport, lport->e_d_tov))
 		fc_lport_error(lport, fp);
 }
@@ -1258,7 +1258,7 @@ static void fc_lport_enter_rft_id(struct fc_lport *lport)
 		return;
 	}
 
-	if (!lport->tt.elsct_send(lport, NULL, fp, FC_NS_RFT_ID,
+	if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RFT_ID,
 				  fc_lport_rft_id_resp,
 				  lport, lport->e_d_tov))
 		fc_lport_error(lport, fp);
@@ -1287,7 +1287,7 @@ static void fc_lport_enter_rpn_id(struct fc_lport *lport)
 		return;
 	}
 
-	if (!lport->tt.elsct_send(lport, NULL, fp, FC_NS_RPN_ID,
+	if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RPN_ID,
 				  fc_lport_rpn_id_resp,
 				  lport, lport->e_d_tov))
 		fc_lport_error(lport, fp);
@@ -1443,8 +1443,8 @@ static void fc_lport_enter_logo(struct fc_lport *lport)
 		return;
 	}
 
-	if (!lport->tt.elsct_send(lport, NULL, fp, ELS_LOGO, fc_lport_logo_resp,
-				  lport, lport->e_d_tov))
+	if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, ELS_LOGO,
+				  fc_lport_logo_resp, lport, lport->e_d_tov))
 		fc_lport_error(lport, fp);
 }
 
@@ -1567,7 +1567,7 @@ void fc_lport_enter_flogi(struct fc_lport *lport)
 	if (!fp)
 		return fc_lport_error(lport, fp);
 
-	if (!lport->tt.elsct_send(lport, NULL, fp, ELS_FLOGI,
+	if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, ELS_FLOGI,
 				  fc_lport_flogi_resp, lport, lport->e_d_tov))
 		fc_lport_error(lport, fp);
 }
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 13d3d75..20371b4 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -593,7 +593,7 @@ static void fc_rport_enter_plogi(struct fc_rport_priv *rdata)
 	}
 	rdata->e_d_tov = lport->e_d_tov;
 
-	if (!lport->tt.elsct_send(lport, rdata, fp, ELS_PLOGI,
+	if (!lport->tt.elsct_send(lport, rport->port_id, fp, ELS_PLOGI,
 				  fc_rport_plogi_resp, rdata, lport->e_d_tov))
 		fc_rport_error_retry(rdata, fp);
 	else
@@ -747,7 +747,7 @@ static void fc_rport_enter_prli(struct fc_rport_priv *rdata)
 		return;
 	}
 
-	if (!lport->tt.elsct_send(lport, rdata, fp, ELS_PRLI,
+	if (!lport->tt.elsct_send(lport, rport->port_id, fp, ELS_PRLI,
 				  fc_rport_prli_resp, rdata, lport->e_d_tov))
 		fc_rport_error_retry(rdata, fp);
 	else
@@ -845,7 +845,7 @@ static void fc_rport_enter_rtv(struct fc_rport_priv *rdata)
 		return;
 	}
 
-	if (!lport->tt.elsct_send(lport, rdata, fp, ELS_RTV,
+	if (!lport->tt.elsct_send(lport, rport->port_id, fp, ELS_RTV,
 				     fc_rport_rtv_resp, rdata, lport->e_d_tov))
 		fc_rport_error_retry(rdata, fp);
 	else
@@ -876,7 +876,7 @@ static void fc_rport_enter_logo(struct fc_rport_priv *rdata)
 		return;
 	}
 
-	if (!lport->tt.elsct_send(lport, rdata, fp, ELS_LOGO,
+	if (!lport->tt.elsct_send(lport, rport->port_id, fp, ELS_LOGO,
 				  fc_rport_logo_resp, rdata, lport->e_d_tov))
 		fc_rport_error_retry(rdata, fp);
 	else
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 3ede1ab..24bf764 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -79,8 +79,9 @@ static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp,
 /**
  * fc_ct_fill - Fill in a name service request frame
  */
-static inline int fc_ct_fill(struct fc_lport *lport, struct fc_frame *fp,
-		      unsigned int op, enum fc_rctl *r_ctl, u32 *did,
+static inline int fc_ct_fill(struct fc_lport *lport,
+		      struct fc_frame *fp,
+		      unsigned int op, enum fc_rctl *r_ctl,
 		      enum fc_fh_type *fh_type)
 {
 	struct fc_ct_req *ct;
@@ -110,7 +111,6 @@ static inline int fc_ct_fill(struct fc_lport *lport, struct fc_frame *fp,
 		return -EINVAL;
 	}
 	*r_ctl = FC_RCTL_DD_UNSOL_CTL;
-	*did = FC_FID_DIR_SERV;
 	*fh_type = FC_TYPE_CT;
 	return 0;
 }
@@ -250,53 +250,37 @@ static inline void fc_scr_fill(struct fc_lport *lport, struct fc_frame *fp)
  * fc_els_fill - Fill in an ELS  request frame
  */
 static inline int fc_els_fill(struct fc_lport *lport,
-		       struct fc_rport_priv *rdata,
+		       u32 did,
 		       struct fc_frame *fp, unsigned int op,
-		       enum fc_rctl *r_ctl, u32 *did, enum fc_fh_type *fh_type)
+		       enum fc_rctl *r_ctl, enum fc_fh_type *fh_type)
 {
-	struct fc_rport *rport = PRIV_TO_RPORT(rdata);
-
 	switch (op) {
 	case ELS_PLOGI:
 		fc_plogi_fill(lport, fp, ELS_PLOGI);
-		*did = rport->port_id;
 		break;
 
 	case ELS_FLOGI:
 		fc_flogi_fill(lport, fp);
-		*did = FC_FID_FLOGI;
 		break;
 
 	case ELS_LOGO:
 		fc_logo_fill(lport, fp);
-		*did = FC_FID_FLOGI;
-		/*
-		 * if rport is valid then it
-		 * is port logo, therefore
-		 * set did to rport id.
-		 */
-		if (rdata)
-			*did = rport->port_id;
 		break;
 
 	case ELS_RTV:
 		fc_rtv_fill(lport, fp);
-		*did = rport->port_id;
 		break;
 
 	case ELS_REC:
 		fc_rec_fill(lport, fp);
-		*did = rport->port_id;
 		break;
 
 	case ELS_PRLI:
 		fc_prli_fill(lport, fp);
-		*did = rport->port_id;
 		break;
 
 	case ELS_SCR:
 		fc_scr_fill(lport, fp);
-		*did = FC_FID_FCTRL;
 		break;
 
 	default:
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index df57cb7..2473167 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -424,7 +424,7 @@ struct libfc_function_template {
 	 * STATUS: OPTIONAL
 	 */
 	struct fc_seq *(*elsct_send)(struct fc_lport *lport,
-				     struct fc_rport_priv *,
+				     u32 did,
 				     struct fc_frame *fp,
 				     unsigned int op,
 				     void (*resp)(struct fc_seq *,


  parent reply	other threads:[~2009-08-25 21:00 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-25 20:58 [PATCH 00/64] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
2009-08-25 20:58 ` [PATCH 01/64] fcoe: Add format spacing to FCOE_NETDEV_DBG debug macro Robert Love
2009-08-25 20:58 ` [PATCH 02/64] libfc: Fix misleading debug statement Robert Love
2009-08-25 20:58 ` [PATCH 03/64] fcoe: libfcoe: extra semicolon in CHECK_LOGGING macros causes compile error Robert Love
2009-08-25 20:58 ` [PATCH 04/64] fcoe, libfc: adds per cpu exch pool within exchange manager(EM) Robert Love
2009-08-25 20:58 ` [PATCH 05/64] fcoe, libfc: fully makes use of per cpu exch pool and then removes em_lock Robert Love
2009-08-25 20:58 ` [PATCH 06/64] libfc: Export FC headers Robert Love
2009-08-27 10:27   ` Christof Schmitt
2009-08-27 17:42     ` Robert Love
2009-08-28  8:32       ` Swen Schillig
2009-08-28 16:58         ` Robert Love
2009-08-25 20:59 ` [PATCH 07/64] fcoe: Add sysfs parameter to fcoe for minimum DDP read I/O size Robert Love
2009-08-25 20:59 ` [PATCH 08/64] libfcoe: fcoe_ctlr_destroy use cancel_work_sync instead of flush_work Robert Love
2009-08-25 20:59 ` [PATCH 09/64] fcoe: fix missing error check in call to fcoe_if_init Robert Love
2009-08-25 20:59 ` [PATCH 10/64] fcoe: remove unnecessary list and lock initializations Robert Love
2009-08-25 20:59 ` [PATCH 11/64] fcoe: interface changes to fcoe_if_create and fcoe_if_destroy Robert Love
2009-08-25 20:59 ` [PATCH 12/64] fcoe: Introduce and allocate fcoe_interface structure, 1:1 with net_device Robert Love
2009-08-25 20:59 ` [PATCH 13/64] fcoe: move netdev to fcoe_interface Robert Love
2009-08-25 20:59 ` [PATCH 14/64] fcoe: move packet handlers from fcoe_port " Robert Love
2009-08-25 20:59 ` [PATCH 15/64] fcoe: move FIP controller " Robert Love
2009-08-25 20:59 ` [PATCH 16/64] fcoe: move offload exchange manager pointer " Robert Love
2009-08-25 20:59 ` [PATCH 17/64] fcoe: remove fcoe_interface->priv pointer Robert Love
2009-08-25 21:00 ` [PATCH 18/64] fcoe: fcoe_interface create, destroy and refcounting Robert Love
2009-08-25 21:00 ` [PATCH 19/64] fcoe: split out per interface setup Robert Love
2009-08-25 21:00 ` [PATCH 20/64] fcoe: add mutex to protect create and destroy Robert Love
2009-08-25 21:00 ` [PATCH 21/64] fcoe: move the host-list add/remove to keep out VN_Ports Robert Love
2009-08-25 21:00 ` [PATCH 22/64] fcoe: Fix module ref count bug by adding NETDEV UNREGISTER handling Robert Love
2009-08-25 21:00 ` [PATCH 23/64] fcoe: use rtnl mutex in place of hostlist lock Robert Love
2009-08-25 21:00 ` [PATCH 24/64] libfc: prepare to split off struct fc_rport_priv from fc_rport_libfc_priv Robert Love
2009-08-25 21:00 ` [PATCH 25/64] libfc: change interface for rport_create Robert Love
2009-08-25 21:00 ` [PATCH 26/64] libfc: fix RPORT_TO_PRIV and PRIV_TO_RPORT() macros Robert Love
2009-08-25 21:00 ` [PATCH 27/64] libfc: make fc_rport_priv the primary rport interface Robert Love
2009-08-25 21:00 ` Robert Love [this message]
2009-08-25 21:01 ` [PATCH 29/64] libfc: make rport structure optional Robert Love
2009-08-25 21:01 ` [PATCH 30/64] libfc: rearrange code in fc_rport_work Robert Love
2009-08-25 21:01 ` [PATCH 31/64] libfc: rename rport event CREATED to READY Robert Love
2009-08-25 21:01 ` [PATCH 32/64] libfc: don't create dummy (rogue) remote ports Robert Love
2009-08-25 21:01 ` [PATCH 33/64] libfc: fix rport event race between READY and LOGO Robert Love
2009-08-25 21:01 ` [PATCH 34/64] libfc: eliminate disc->event Robert Love
2009-08-25 21:01 ` [PATCH 35/64] libfc: remove unused disc->delay element Robert Love
2009-08-25 21:01 ` [PATCH 36/64] libfc: rport debug messages were printing pointer values Robert Love
2009-08-25 21:01 ` [PATCH 37/64] libfc: simplify fc_lport_rport_callback Robert Love
2009-08-25 21:01 ` [PATCH 38/64] libfc: make rport module maintain the rport list Robert Love
2009-08-25 21:01 ` [PATCH 39/64] libfc: have rport_create do a lookup for pre-existing rports first Robert Love
2009-08-25 21:02 ` [PATCH 40/64] libfc: change to make remote port callback optional Robert Love
2009-08-25 21:02 ` [PATCH 41/64] libfc: move rport_lookup into fc_rport.c Robert Love
2009-08-25 21:02 ` [PATCH 42/64] libfc: do not log off rports before or after discovery Robert Love
2009-08-25 21:02 ` [PATCH 43/64] libfc: discovery restart sequence error fix Robert Love
2009-08-25 21:02 ` [PATCH 44/64] libfc: rearrange code in fc_disc_gpn_ft_resp() Robert Love
2009-08-25 21:02 ` [PATCH 45/64] libfc: handle discovery failure more correctly Robert Love
2009-08-25 21:02 ` [PATCH 46/64] libfc: fix: empty zone causes endless discovery retries Robert Love
2009-08-25 21:02 ` [PATCH 47/64] libfc: discovery retry should clear pending first Robert Love
2009-08-25 21:02 ` [PATCH 48/64] libfc: discovery gpn_ft parse bug Robert Love
2009-08-25 21:02 ` [PATCH 49/64] libfc: clean up point-to-point discovery code Robert Love
2009-08-25 21:02 ` [PATCH 50/64] libfc: don't do discovery before callback is set Robert Love
2009-08-25 21:02 ` [PATCH 51/64] libfc: Initialize fc_rport_identifiers inside fc_rport_create Robert Love
2009-08-25 21:03 ` [PATCH 52/64] libfc: Always reset remote port roles when receiving PRLI Robert Love
2009-08-25 21:03 ` [PATCH 53/64] libfc: move remote port lookup for ELS requests into fc_rport.c Robert Love
2009-08-25 21:03 ` [PATCH 54/64] libfc: fix: rport_recv_req needs disc_mutex when calling rport_lookup Robert Love
2009-08-25 21:03 ` [PATCH 55/64] libfc: improve debug messages for ELS response handlers Robert Love
2009-08-25 21:03 ` [PATCH 56/64] libfc: correctly handle incoming PLOGI request Robert Love
2009-08-25 21:03 ` [PATCH 57/64] libfc: fix rport error handling for login-required and invalid ops Robert Love
2009-08-25 21:03 ` [PATCH 58/64] libfc: re-login to remote ports that send us LOGO Robert Love
2009-08-25 21:03 ` [PATCH 59/64] libfc: LOGO response code had extraeous enter_rtv Robert Love
2009-08-25 21:03 ` [PATCH 60/64] libfc: use ADISC to verify rport login state Robert Love
2009-08-25 21:03 ` [PATCH 61/64] libfc: fix handling of incoming Discover Address (ADISC) requests Robert Love
2009-08-25 21:03 ` [PATCH 62/64] libfc: send GPN_ID in reaction to single-port RSCNs Robert Love
2009-08-25 21:04 ` [PATCH 63/64] libfc: don't swap OX_ID and RX_ID when sending BA_RJT Robert Love
2009-08-25 21:04 ` [PATCH 64/64] fcoe: flush per-cpu thread work when destroying interface Robert Love

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090825210055.1553.61332.stgit@localhost.localdomain \
    --to=robert.w.love@intel.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=jeykholt@cisco.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox