[Open-FCoE] [PATCH] libfc: Setting the correct lport fabric_name in /sys filesystem

Steve Ma steve.ma at intel.com
Wed Sep 10 21:58:36 UTC 2008


Added a new item, fabric_name, into struct fc_lport. The patch
is to save the wwnn obtained from the common service parameters
of the LS_ACC of FLOGI as fabric_name in struct fc_lport if the
LS_ACC is sent from a fabric port (otherwise, the fabric_name
should remain zero), and set fc_host_fabric_name(shost) to
the saved fabric_name in fc_get_host_fabric_name(). The routine
fc_get_host_fabric_name() of fc_attr.c is moved into fc_lport.c
as one of the steps to remove the file fc_attr.c.

Signed-off-by: Steve Ma <steve.ma at intel.com>
---

 drivers/scsi/libfc/fc_attr.c  |    8 --------
 drivers/scsi/libfc/fc_lport.c |   10 ++++++++++
 include/scsi/libfc/libfc.h    |    1 +
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/libfc/fc_attr.c b/drivers/scsi/libfc/fc_attr.c
index 6539e41..0a99f83 100644
--- a/drivers/scsi/libfc/fc_attr.c
+++ b/drivers/scsi/libfc/fc_attr.c
@@ -42,14 +42,6 @@ void fc_get_host_port_type(struct Scsi_Host *shost)
 }
 EXPORT_SYMBOL(fc_get_host_port_type);
 
-void fc_get_host_fabric_name(struct Scsi_Host *shost)
-{
-	struct fc_lport *lp = shost_priv(shost);
-
-	fc_host_fabric_name(shost) = lp->wwnn;
-}
-EXPORT_SYMBOL(fc_get_host_fabric_name);
-
 void fc_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout)
 {
 	if (timeout)
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 0ffdc67..28ddc24 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -107,6 +107,14 @@ static void fc_lport_ptp_clear(struct fc_lport *lp)
 /*
  * Routines to support struct fc_function_template
  */
+void fc_get_host_fabric_name(struct Scsi_Host *shost)
+{
+	struct fc_lport *lp = shost_priv(shost);
+
+	fc_host_fabric_name(shost) = lp->fabric_name;
+}
+EXPORT_SYMBOL(fc_get_host_fabric_name);
+
 void fc_get_host_speed(struct Scsi_Host *shost)
 {
 	struct fc_lport *lp = shost_priv(shost);
@@ -831,6 +839,8 @@ fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg)
 			} else {
 				lp->e_d_tov = e_d_tov;
 				lp->r_a_tov = r_a_tov;
+				lp->fabric_name = get_unaligned_be64(
+							&flp->fl_wwnn);
 				lp->tt.dns_register(lp);
 			}
 		}
diff --git a/include/scsi/libfc/libfc.h b/include/scsi/libfc/libfc.h
index 1eb5b8d..96eb0dd 100644
--- a/include/scsi/libfc/libfc.h
+++ b/include/scsi/libfc/libfc.h
@@ -403,6 +403,7 @@ struct fc_lport {
 	struct fc_host_statistics host_stats;
 	struct fcoe_dev_stats	*dev_stats[NR_CPUS];
 
+	u64			fabric_name;
 	u64			wwpn;
 	u64			wwnn;
 	u32			fid;




More information about the devel mailing list