[Open-FCoE] [PATCH 17/28] libfc: Move dns, reg_ft, reg_pn and scr into fc_lport.c

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


This is a step towards converting fc_ns.c into fc_disc.c.
It makes sense to have a discovery block, but a name server
block is overkill. This patch moves the name server
registration into the lport file.

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

 drivers/scsi/libfc/fc_lport.c |  270 ++++++++++++++++++++++++++++++-
 drivers/scsi/libfc/fc_ns.c    |  352 -----------------------------------------
 include/scsi/libfc/libfc.h    |    1 
 3 files changed, 260 insertions(+), 363 deletions(-)

diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index d810a7c..cf7be00 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -37,6 +37,10 @@
 static int fc_lport_debug;
 
 static void fc_lport_enter_flogi(struct fc_lport *);
+static void fc_lport_enter_dns(struct fc_lport *);
+static void fc_lport_enter_reg_pn(struct fc_lport *);
+static void fc_lport_enter_reg_ft(struct fc_lport *);
+static void fc_lport_enter_scr(struct fc_lport *);
 static void fc_lport_enter_logo(struct fc_lport *);
 
 static const char *fc_lport_state_names[] = {
@@ -68,7 +72,7 @@ static void fc_lport_rport_event(struct fc_lport *lport, u32 port_id,
 		case LPORT_EV_RPORT_CREATED:
 			if (rport) {
 				lport->dns_rp = rport;
-				lport->tt.dns_register(lport);
+				fc_lport_enter_dns(lport);
 			}
 			break;
 		case LPORT_EV_RPORT_LOGO:
@@ -193,6 +197,26 @@ struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *shost)
 EXPORT_SYMBOL(fc_get_host_stats);
 
 /*
+ * Test for dNS accept in response payload.
+ */
+static int fc_lport_dns_acc(struct fc_frame *fp)
+{
+	struct fc_frame_header *fh;
+	struct fc_ct_hdr *ct;
+	int rc = 0;
+
+	fh = fc_frame_header_get(fp);
+	ct = fc_frame_payload_get(fp, sizeof(*ct));
+	if (fh && ct && fh->fh_type == FC_TYPE_CT &&
+	    ct->ct_fs_type == FC_FST_DIR &&
+	    ct->ct_fs_subtype == FC_NS_SUBTYPE &&
+	    ntohs(ct->ct_cmd) == FC_FS_ACC) {
+		rc = 1;
+	}
+	return rc;
+}
+
+/*
  * Fill in FLOGI command for request.
  */
 static void
@@ -513,16 +537,24 @@ static void fc_lport_enter_retry(struct fc_lport *lp)
 	case LPORT_ST_NONE:
 	case LPORT_ST_READY:
 	case LPORT_ST_RESET:
-	case LPORT_ST_DNS:
 	case LPORT_ST_DNS_STOP:
-	case LPORT_ST_REG_PN:
-	case LPORT_ST_REG_FT:
-	case LPORT_ST_SCR:
 		WARN_ON(1);
 		break;
 	case LPORT_ST_FLOGI:
 		fc_lport_enter_flogi(lp);
 		break;
+	case LPORT_ST_DNS:
+		fc_lport_enter_dns(lp);
+		break;
+	case LPORT_ST_REG_PN:
+		fc_lport_enter_reg_pn(lp);
+		break;
+	case LPORT_ST_REG_FT:
+		fc_lport_enter_reg_ft(lp);
+		break;
+	case LPORT_ST_SCR:
+		fc_lport_enter_scr(lp);
+		break;
 	case LPORT_ST_LOGO:
 		fc_lport_enter_logo(lp);
 		break;
@@ -544,11 +576,7 @@ static void fc_lport_enter_reject(struct fc_lport *lp)
 	case LPORT_ST_SCR:
 	case LPORT_ST_DNS_STOP:
 	case LPORT_ST_DNS:
-		WARN_ON(1);
-		break;
 	case LPORT_ST_FLOGI:
-		fc_lport_enter_flogi(lp);
-		break;
 	case LPORT_ST_LOGO:
 		fc_lport_enter_reset(lp);
 		break;
@@ -790,6 +818,228 @@ static void fc_lport_error(struct fc_lport *lp, struct fc_frame *fp)
 	fc_lport_unlock(lp);
 }
 
+/*
+ * Handle response from name server.
+ */
+static void fc_lport_ns_resp(struct fc_seq *sp, struct fc_frame *fp,
+			     void *lp_arg)
+{
+	struct fc_lport *lport = lp_arg;
+
+	if (!IS_ERR(fp)) {
+		fc_lport_lock(lport);
+		cancel_delayed_work_sync(&lport->retry_work);
+		if (fc_lport_dns_acc(fp)) {
+			if (lport->state == LPORT_ST_REG_PN)
+				fc_lport_enter_reg_ft(lport);
+			else
+				fc_lport_enter_scr(lport);
+
+		} else {
+			fc_lport_retry(lport);
+		}
+		fc_lport_unlock(lport);
+		fc_frame_free(fp);
+	} else
+		fc_lport_error(lport, fp);
+}
+
+/**
+ * fc_lport_scr_resp - Handle response to State Change Register (SCR) request
+ * @sp: current sequence in SCR exchange
+ * @fp: response frame
+ * @lp_arg: Fibre Channel host port instance
+ */
+static void fc_lport_scr_resp(struct fc_seq *sp, struct fc_frame *fp,
+			      void *lp_arg)
+{
+	struct fc_lport *lport = lp_arg;
+	int err;
+
+	if (IS_ERR(fp))
+		fc_lport_error(lport, fp);
+	else {
+		fc_lport_lock(lport);
+		fc_lport_state_enter(lport, LPORT_ST_READY);
+		fc_lport_unlock(lport);
+		err = lport->tt.disc_start(lport);
+		if (err)
+			FC_DBG("target discovery start error\n");
+		fc_frame_free(fp);
+	}
+}
+
+/**
+ * fc_lport_enter scr - Send a State Change Register (SCR) request
+ * @lp: Fibre Channel host port instance
+ */
+static void fc_lport_enter_scr(struct fc_lport *lport)
+{
+	struct fc_frame *fp;
+	struct fc_els_scr *scr;
+
+	if (fc_lport_debug)
+		FC_DBG("Processing SCR state\n");
+
+	fc_lport_state_enter(lport, LPORT_ST_SCR);
+
+	fp = fc_frame_alloc(lport, sizeof(*scr));
+	if (fp) {
+		scr = fc_frame_payload_get(fp, sizeof(*scr));
+		memset(scr, 0, sizeof(*scr));
+		scr->scr_cmd = ELS_SCR;
+		scr->scr_reg_func = ELS_SCRF_FULL;
+	}
+	fc_frame_setup(fp, FC_RCTL_ELS_REQ, FC_TYPE_ELS);
+	fc_frame_set_offset(fp, 0);
+
+	lport->tt.exch_seq_send(lport, fp,
+				fc_lport_scr_resp, NULL,
+				lport, lport->e_d_tov,
+				lport->fid, FC_FID_FCTRL,
+				FC_FC_SEQ_INIT | FC_FC_END_SEQ);
+}
+
+/**
+ * fc_lport_enter_reg_ft - Register FC4-types with the name server
+ * @lp: Fibre Channel host port instance
+ */
+static void fc_lport_enter_reg_ft(struct fc_lport *lport)
+{
+	struct fc_frame *fp;
+	struct req {
+		struct fc_ct_hdr ct;
+		struct fc_ns_fid fid;	/* port ID object */
+		struct fc_ns_fts fts;	/* FC4-types object */
+	} *req;
+	struct fc_ns_fts *lps;
+	int i;
+
+	if (fc_lport_debug)
+		FC_DBG("Processing REG_FT state\n");
+
+	fc_lport_state_enter(lport, LPORT_ST_REG_FT);
+
+	lps = &lport->fcts;
+	i = sizeof(lps->ff_type_map) / sizeof(lps->ff_type_map[0]);
+	while (--i >= 0)
+		if (ntohl(lps->ff_type_map[i]) != 0)
+			break;
+	if (i >= 0) {
+		fp = fc_frame_alloc(lport, sizeof(*req));
+		if (fp) {
+			req = fc_frame_payload_get(fp, sizeof(*req));
+			fc_fill_dns_hdr(lport, &req->ct,
+					FC_NS_RFT_ID,
+					sizeof(*req) -
+					sizeof(struct fc_ct_hdr));
+			hton24(req->fid.fp_fid, lport->fid);
+			req->fts = *lps;
+			fc_frame_setup(fp, FC_RCTL_DD_UNSOL_CTL, FC_TYPE_CT);
+
+			if (!lport->tt.exch_seq_send(lport, fp,
+						     fc_lport_ns_resp, NULL,
+						     lport, lport->e_d_tov,
+						     lport->fid,
+						     FC_FID_DIR_SERV,
+						     FC_FC_SEQ_INIT |
+						     FC_FC_END_SEQ))
+				fc_lport_retry(lport);
+		} else {
+			fc_lport_retry(lport);
+		}
+	} else {
+		fc_lport_enter_scr(lport);
+	}
+}
+
+/*
+ * Register port name with name server.
+ */
+static void fc_lport_enter_reg_pn(struct fc_lport *lport)
+{
+	struct fc_frame *fp;
+	struct req {
+		struct fc_ct_hdr ct;
+		struct fc_ns_rn_id rn;
+	} *req;
+
+	if (fc_lport_debug)
+		FC_DBG("Processing REG_PN state\n");
+
+	fc_lport_state_enter(lport, LPORT_ST_REG_PN);
+	fp = fc_frame_alloc(lport, sizeof(*req));
+	if (!fp) {
+		fc_lport_retry(lport);
+		return;
+	}
+	req = fc_frame_payload_get(fp, sizeof(*req));
+	memset(req, 0, sizeof(*req));
+	fc_fill_dns_hdr(lport, &req->ct, FC_NS_RPN_ID, sizeof(req->rn));
+	hton24(req->rn.fr_fid.fp_fid, lport->fid);
+	put_unaligned_be64(lport->wwpn, &req->rn.fr_wwn);
+	fc_frame_setup(fp, FC_RCTL_DD_UNSOL_CTL, FC_TYPE_CT);
+	if (!lport->tt.exch_seq_send(lport, fp,
+				     fc_lport_ns_resp, NULL,
+				     lport, lport->e_d_tov,
+				     lport->fid,
+				     FC_FID_DIR_SERV,
+				     FC_FC_SEQ_INIT | FC_FC_END_SEQ))
+		fc_lport_retry(lport);
+}
+
+/*
+ * Setup session to dNS if not already set up.
+ */
+static void fc_lport_enter_dns(struct fc_lport *lport)
+{
+	struct fc_rport *rport;
+	struct fc_rport_libfc_priv *rdata;
+	struct fc_ns_port dp;
+
+	dp.ids.port_id = FC_FID_DIR_SERV;
+	dp.ids.port_name = -1;
+	dp.ids.node_name = -1;
+	dp.ids.roles = FC_RPORT_ROLE_UNKNOWN;
+
+	if (fc_lport_debug)
+		FC_DBG("Processing DNS state\n");
+
+	fc_lport_state_enter(lport, LPORT_ST_DNS);
+
+	if (!lport->dns_rp) {
+		/* Set up a dummy rport to directory server */
+		fc_lport_unlock(lport);
+		rport = fc_rport_dummy_create(&dp);
+		fc_lport_lock(lport);
+		if (!rport)
+			goto err;
+		lport->dns_rp = rport;
+	}
+
+	rport = lport->dns_rp;
+	rdata = rport->dd_data;
+	rdata->local_port = lport;
+
+	/*
+	 * If dNS session isn't ready, start its logon.
+	 */
+	if (rdata->rp_state != RPORT_ST_READY) {
+		rdata->event_callback = fc_lport_rport_event;
+		lport->tt.rport_login(rport);
+	} else {
+		cancel_delayed_work_sync(&lport->retry_work);
+		fc_lport_enter_reg_pn(lport);
+	}
+	return;
+
+	/*
+	 * Resource allocation problem (malloc).  Try again in 500 mS.
+	 */
+err:
+	fc_lport_retry(lport);
+}
+
 static void fc_lport_timeout(struct work_struct *work)
 {
 	struct fc_lport *lport =
@@ -919,7 +1169,7 @@ fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg)
 				lp->r_a_tov = r_a_tov;
 				fc_host_fabric_name(lp->host) =
 					get_unaligned_be64(&flp->fl_wwnn);
-				lp->tt.dns_register(lp);
+				fc_lport_enter_dns(lp);
 			}
 		}
 		fc_lport_unlock(lp);
diff --git a/drivers/scsi/libfc/fc_ns.c b/drivers/scsi/libfc/fc_ns.c
index aa846dc..39948cc 100644
--- a/drivers/scsi/libfc/fc_ns.c
+++ b/drivers/scsi/libfc/fc_ns.c
@@ -43,11 +43,6 @@ static void fc_ns_del_target(struct fc_lport *, struct fc_rport *);
 static void fc_ns_disc_done(struct fc_lport *);
 static void fcdt_ns_error(struct fc_lport *, struct fc_frame *);
 static void fc_ns_timeout(struct work_struct *);
-static void fc_ns_enter_reg_pn(struct fc_lport *lp);
-static void fc_ns_error(struct fc_lport *lp, struct fc_frame *fp);
-static void fc_ns_resp(struct fc_seq *sp, struct fc_frame *fp,
-		       void *lp_arg);
-static void fc_ns_retry(struct fc_lport *lp);
 static void fc_ns_single(struct fc_lport *, struct fc_ns_port *);
 static int fc_ns_restart(struct fc_lport *);
 
@@ -153,172 +148,6 @@ static void fc_ns_recv_req(struct fc_seq *sp, struct fc_frame *fp,
 	}
 }
 
-/**
- * fc_ns_scr_resp - Handle response to State Change Register (SCR) request
- * @sp: current sequence in SCR exchange
- * @fp: response frame
- * @lp_arg: Fibre Channel host port instance
- */
-static void fc_ns_scr_resp(struct fc_seq *sp, struct fc_frame *fp,
-			   void *lp_arg)
-{
-	struct fc_lport *lp = lp_arg;
-	int err;
-
-	if (IS_ERR(fp))
-		fc_ns_error(lp, fp);
-	else {
-		fc_lport_lock(lp);
-		fc_lport_state_enter(lp, LPORT_ST_READY);
-		fc_lport_unlock(lp);
-		err = lp->tt.disc_start(lp);
-		if (err)
-			FC_DBG("target discovery start error\n");
-		fc_frame_free(fp);
-	}
-}
-
-/**
- * fc_ns_enter scr - Send a State Change Register (SCR) request
- * @lp: Fibre Channel host port instance
- */
-static void fc_ns_enter_scr(struct fc_lport *lp)
-{
-	struct fc_frame *fp;
-	struct fc_els_scr *scr;
-
-	if (fc_ns_debug)
-		FC_DBG("Processing SCR state\n");
-
-	fc_lport_state_enter(lp, LPORT_ST_SCR);
-
-	fp = fc_frame_alloc(lp, sizeof(*scr));
-	if (fp) {
-		scr = fc_frame_payload_get(fp, sizeof(*scr));
-		memset(scr, 0, sizeof(*scr));
-		scr->scr_cmd = ELS_SCR;
-		scr->scr_reg_func = ELS_SCRF_FULL;
-	}
-	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_ns_scr_resp, NULL,
-			     lp, lp->e_d_tov,
-			     lp->fid, FC_FID_FCTRL,
-			     FC_FC_SEQ_INIT | FC_FC_END_SEQ);
-}
-
-/**
- * fc_ns_enter_reg_ft - Register FC4-types with the name server
- * @lp: Fibre Channel host port instance
- */
-static void fc_ns_enter_reg_ft(struct fc_lport *lp)
-{
-	struct fc_frame *fp;
-	struct req {
-		struct fc_ct_hdr ct;
-		struct fc_ns_fid fid;	/* port ID object */
-		struct fc_ns_fts fts;	/* FC4-types object */
-	} *req;
-	struct fc_ns_fts *lps;
-	int i;
-
-	if (fc_ns_debug)
-		FC_DBG("Processing REG_FT state\n");
-
-	fc_lport_state_enter(lp, LPORT_ST_REG_FT);
-
-	lps = &lp->fcts;
-	i = sizeof(lps->ff_type_map) / sizeof(lps->ff_type_map[0]);
-	while (--i >= 0)
-		if (ntohl(lps->ff_type_map[i]) != 0)
-			break;
-	if (i >= 0) {
-		fp = fc_frame_alloc(lp, sizeof(*req));
-		if (fp) {
-			req = fc_frame_payload_get(fp, sizeof(*req));
-			fc_fill_dns_hdr(lp, &req->ct,
-					FC_NS_RFT_ID,
-					sizeof(*req) -
-					sizeof(struct fc_ct_hdr));
-			hton24(req->fid.fp_fid, lp->fid);
-			req->fts = *lps;
-			fc_frame_setup(fp, FC_RCTL_DD_UNSOL_CTL, FC_TYPE_CT);
-			if (!lp->tt.exch_seq_send(lp, fp,
-						  fc_ns_resp, NULL, lp,
-						  lp->e_d_tov,
-						  lp->fid,
-						  FC_FID_DIR_SERV,
-						  FC_FC_SEQ_INIT |
-						  FC_FC_END_SEQ))
-				fc_ns_retry(lp);
-		} else {
-			fc_ns_retry(lp);
-		}
-	} else {
-		fc_ns_enter_scr(lp);
-	}
-}
-
-/*
- * enter next state for handling an exchange reject or retry exhaustion
- * in the current state.
- */
-static void fc_ns_enter_reject(struct fc_lport *lp)
-{
-	switch (lp->state) {
-	case LPORT_ST_NONE:
-	case LPORT_ST_READY:
-	case LPORT_ST_RESET:
-	case LPORT_ST_FLOGI:
-	case LPORT_ST_LOGO:
-		WARN_ON(1);
-		break;
-	case LPORT_ST_REG_PN:
-		fc_ns_enter_reg_ft(lp);
-		break;
-	case LPORT_ST_REG_FT:
-		fc_ns_enter_scr(lp);
-		break;
-	case LPORT_ST_SCR:
-	case LPORT_ST_DNS_STOP:
-		lp->tt.disc_stop(lp);
-		break;
-	case LPORT_ST_DNS:
-		lp->tt.lport_reset(lp);
-		break;
-	}
-}
-
-static void fc_ns_enter_retry(struct fc_lport *lp)
-{
-	switch (lp->state) {
-	case LPORT_ST_NONE:
-	case LPORT_ST_RESET:
-	case LPORT_ST_READY:
-	case LPORT_ST_FLOGI:
-	case LPORT_ST_LOGO:
-		WARN_ON(1);
-		break;
-	case LPORT_ST_DNS:
-		lp->tt.dns_register(lp);
-		break;
-	case LPORT_ST_DNS_STOP:
-		lp->tt.disc_stop(lp);
-		break;
-	case LPORT_ST_REG_PN:
-		fc_ns_enter_reg_pn(lp);
-		break;
-	case LPORT_ST_REG_FT:
-		fc_ns_enter_reg_ft(lp);
-		break;
-	case LPORT_ST_SCR:
-		fc_ns_enter_scr(lp);
-		break;
-	}
-}
-
 /*
  * Refresh target discovery, perhaps due to an RSCN.
  * A configurable delay is introduced to collect any subsequent RSCNs.
@@ -391,51 +220,6 @@ int fc_ns_disc_start(struct fc_lport *lp)
 }
 
 /*
- * Handle resource allocation problem by retrying in a bit.
- */
-static void fc_ns_retry(struct fc_lport *lp)
-{
-	if (lp->retry_count == 0)
-		FC_DBG("local port %6x alloc failure "
-		       "- will retry\n", lp->fid);
-	if (lp->retry_count < lp->max_retry_count) {
-		lp->retry_count++;
-		schedule_delayed_work(&lp->retry_work,
-				      jiffies +
-				      msecs_to_jiffies(lp->e_d_tov));
-	} else {
-		FC_DBG("local port %6x alloc failure "
-		       "- retries exhausted\n", lp->fid);
-		fc_ns_enter_reject(lp);
-	}
-}
-
-/*
- * Handle errors on local port requests.
- * Don't get locks if in RESET state.
- * The only possible errors so far are exchange TIMEOUT and CLOSED (reset).
- */
-static void fc_ns_error(struct fc_lport *lp, struct fc_frame *fp)
-{
-	if (lp->state == LPORT_ST_RESET)
-		return;
-
-	fc_lport_lock(lp);
-	if (PTR_ERR(fp) == -FC_EX_TIMEOUT) {
-		if (lp->retry_count < lp->max_retry_count) {
-			lp->retry_count++;
-			fc_ns_enter_retry(lp);
-		} else {
-			fc_ns_enter_reject(lp);
-		}
-	}
-	if (fc_ns_debug)
-		FC_DBG("error %ld retries %d limit %d\n",
-		       PTR_ERR(fp), lp->retry_count, lp->max_retry_count);
-	fc_lport_unlock(lp);
-}
-
-/*
  * Restart discovery after a delay due to resource shortages.
  * If the error persists, the discovery will be abandoned.
  */
@@ -453,52 +237,6 @@ static void fcdt_ns_retry(struct fc_lport *lp)
 }
 
 /*
- * Test for dNS accept in response payload.
- */
-static int fc_lport_dns_acc(struct fc_frame *fp)
-{
-	struct fc_frame_header *fh;
-	struct fc_ct_hdr *ct;
-	int rc = 0;
-
-	fh = fc_frame_header_get(fp);
-	ct = fc_frame_payload_get(fp, sizeof(*ct));
-	if (fh && ct && fh->fh_type == FC_TYPE_CT &&
-	    ct->ct_fs_type == FC_FST_DIR &&
-	    ct->ct_fs_subtype == FC_NS_SUBTYPE &&
-	    ntohs(ct->ct_cmd) == FC_FS_ACC) {
-		rc = 1;
-	}
-	return rc;
-}
-
-/*
- * Handle response from name server.
- */
-static void
-fc_ns_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg)
-{
-	struct fc_lport *lp = lp_arg;
-
-	if (!IS_ERR(fp)) {
-		fc_lport_lock(lp);
-		cancel_delayed_work_sync(&lp->retry_work);
-		if (fc_lport_dns_acc(fp)) {
-			if (lp->state == LPORT_ST_REG_PN)
-				fc_ns_enter_reg_ft(lp);
-			else
-				fc_ns_enter_scr(lp);
-
-		} else {
-			fc_ns_retry(lp);
-		}
-		fc_lport_unlock(lp);
-		fc_frame_free(fp);
-	} else
-		fc_ns_error(lp, fp);
-}
-
-/*
  * Handle new target found by discovery.
  * Create remote port and session if needed.
  * Ignore returns of our own FID & WWPN.
@@ -845,58 +583,6 @@ out:
 }
 
 /*
- * Setup session to dNS if not already set up.
- */
-static void fc_ns_enter_dns(struct fc_lport *lp)
-{
-	struct fc_rport *rport;
-	struct fc_rport_libfc_priv *rp;
-	struct fc_ns_port dp;
-
-	dp.ids.port_id = FC_FID_DIR_SERV;
-	dp.ids.port_name = -1;
-	dp.ids.node_name = -1;
-	dp.ids.roles = FC_RPORT_ROLE_UNKNOWN;
-
-	if (fc_ns_debug)
-		FC_DBG("Processing DNS state\n");
-
-	fc_lport_state_enter(lp, LPORT_ST_DNS);
-
-	if (!lp->dns_rp) {
-		/* Set up a dummy rport to directory server */
-		fc_lport_unlock(lp);
-		rport = fc_rport_dummy_create(&dp);
-		fc_lport_lock(lp);
-		if (!rport)
-			goto err;
-		lp->dns_rp = rport;
-	}
-
-	rport = lp->dns_rp;
-	rp = rport->dd_data;
-	rp->local_port = lp;
-
-	/*
-	 * If dNS session isn't ready, start its logon.
-	 */
-	if (rp->rp_state != RPORT_ST_READY) {
-		rp->event_callback = lp->tt.event_callback;
-		lp->tt.rport_login(rport);
-	} else {
-		cancel_delayed_work_sync(&lp->retry_work);
-		fc_ns_enter_reg_pn(lp);
-	}
-	return;
-
-	/*
-	 * Resource allocation problem (malloc).  Try again in 500 mS.
-	 */
-err:
-	fc_ns_retry(lp);
-}
-
-/*
  * Logoff DNS session.
  * We should get an event call when the session has been logged out.
  */
@@ -915,41 +601,6 @@ static void fc_ns_enter_dns_stop(struct fc_lport *lp)
 		lp->tt.lport_logout(lp);
 }
 
-/*
- * Register port name with name server.
- */
-static void fc_ns_enter_reg_pn(struct fc_lport *lp)
-{
-	struct fc_frame *fp;
-	struct req {
-		struct fc_ct_hdr ct;
-		struct fc_ns_rn_id rn;
-	} *req;
-
-	if (fc_ns_debug)
-		FC_DBG("Processing REG_PN state\n");
-
-	fc_lport_state_enter(lp, LPORT_ST_REG_PN);
-	fp = fc_frame_alloc(lp, sizeof(*req));
-	if (!fp) {
-		fc_ns_retry(lp);
-		return;
-	}
-	req = fc_frame_payload_get(fp, sizeof(*req));
-	memset(req, 0, sizeof(*req));
-	fc_fill_dns_hdr(lp, &req->ct, FC_NS_RPN_ID, sizeof(req->rn));
-	hton24(req->rn.fr_fid.fp_fid, lp->fid);
-	put_unaligned_be64(lp->wwpn, &req->rn.fr_wwn);
-	fc_frame_setup(fp, FC_RCTL_DD_UNSOL_CTL, FC_TYPE_CT);
-	if (!lp->tt.exch_seq_send(lp, fp,
-				  fc_ns_resp, NULL, lp,
-				  lp->e_d_tov,
-				  lp->fid,
-				  FC_FID_DIR_SERV,
-				  FC_FC_SEQ_INIT | FC_FC_END_SEQ))
-		fc_ns_retry(lp);
-}
-
 int fc_ns_init(struct fc_lport *lp)
 {
 	INIT_DELAYED_WORK(&lp->ns_disc_work, fc_ns_timeout);
@@ -960,9 +611,6 @@ int fc_ns_init(struct fc_lport *lp)
 	if (!lp->tt.disc_recv_req)
 		lp->tt.disc_recv_req = fc_ns_recv_req;
 
-	if (!lp->tt.dns_register)
-		lp->tt.dns_register = fc_ns_enter_dns;
-
 	if (!lp->tt.disc_stop)
 		lp->tt.disc_stop = fc_ns_enter_dns_stop;
 
diff --git a/include/scsi/libfc/libfc.h b/include/scsi/libfc/libfc.h
index 8af4c2a..c26396b 100644
--- a/include/scsi/libfc/libfc.h
+++ b/include/scsi/libfc/libfc.h
@@ -414,7 +414,6 @@ struct libfc_function_template {
 	 */
 	int (*disc_start)(struct fc_lport *);
 
-	void (*dns_register)(struct fc_lport *);
 	void (*disc_stop)(struct fc_lport *);
 };
 




More information about the devel mailing list