Merge fc_attr_init() into the end of fc_lport_init() and move
fc_get_host_speed from fc_attr.c to fc_lport.c. All the occurrence
of fc_attr_init are thus removed. Then added code in fc_lport_init()
and fc_get_host_speed to reflect the speed and the supported speed
of the local port so that the /sys file system will show correct
values. This patch also serves as one of the steps to remove fc_attr.c.
Also see http://Open-FCoE.org/openfc/bugzilla/show_bug.cgi?id=74
Signed-off-by: Steve Ma <[EMAIL PROTECTED]>
---
drivers/scsi/fcoe/fcoe_if.c | 1 -
drivers/scsi/fcoe/fcoeinit.c | 1 +
drivers/scsi/libfc/fc_attr.c | 27 ---------------------------
drivers/scsi/libfc/fc_lport.c | 29 +++++++++++++++++++++++++++++
include/scsi/libfc/libfc.h | 1 -
5 files changed, 30 insertions(+), 29 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe_if.c b/drivers/scsi/fcoe/fcoe_if.c
index 7f983e2..477f6b7 100644
--- a/drivers/scsi/fcoe/fcoe_if.c
+++ b/drivers/scsi/fcoe/fcoe_if.c
@@ -389,7 +389,6 @@ static int libfc_config(struct fc_lport *lp)
fc_lport_init(lp);
fc_rport_init(lp);
fc_ns_init(lp);
- fc_attr_init(lp);
return 0;
}
diff --git a/drivers/scsi/fcoe/fcoeinit.c b/drivers/scsi/fcoe/fcoeinit.c
index ac98159..86680b8 100644
--- a/drivers/scsi/fcoe/fcoeinit.c
+++ b/drivers/scsi/fcoe/fcoeinit.c
@@ -67,6 +67,7 @@ struct fc_function_template fcoe_transport_function = {
.get_host_port_id = fc_get_host_port_id,
.show_host_port_id = 1,
+ .show_host_supported_speeds = 1,
.get_host_speed = fc_get_host_speed,
.show_host_speed = 1,
.get_host_port_type = fc_get_host_port_type,
diff --git a/drivers/scsi/libfc/fc_attr.c b/drivers/scsi/libfc/fc_attr.c
index d73f39e..6539e41 100644
--- a/drivers/scsi/libfc/fc_attr.c
+++ b/drivers/scsi/libfc/fc_attr.c
@@ -36,15 +36,6 @@ void fc_get_host_port_id(struct Scsi_Host *shost)
}
EXPORT_SYMBOL(fc_get_host_port_id);
-void fc_get_host_speed(struct Scsi_Host *shost)
-{
- /*
- * should be obtain from DEC or Enet Driver
- */
- fc_host_speed(shost) = 1; /* for now it is 1g */
-}
-EXPORT_SYMBOL(fc_get_host_speed);
-
void fc_get_host_port_type(struct Scsi_Host *shost)
{
fc_host_port_type(shost) = FC_PORTTYPE_NPORT;
@@ -59,24 +50,6 @@ void fc_get_host_fabric_name(struct Scsi_Host *shost)
}
EXPORT_SYMBOL(fc_get_host_fabric_name);
-void fc_attr_init(struct fc_lport *lp)
-{
- 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;
- /* 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;
-}
-EXPORT_SYMBOL(fc_attr_init);
-
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 b06f519..0ffdc67 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -105,6 +105,17 @@ static void fc_lport_ptp_clear(struct fc_lport *lp)
}
/*
+ * Routines to support struct fc_function_template
+ */
+void fc_get_host_speed(struct Scsi_Host *shost)
+{
+ struct fc_lport *lp = shost_priv(shost);
+
+ fc_host_speed(shost) = lp->link_speed;
+}
+EXPORT_SYMBOL(fc_get_host_speed);
+
+/*
* Fill in FLOGI command for request.
*/
static void
@@ -907,6 +918,24 @@ int fc_lport_init(struct fc_lport *lp)
if (!lp->tt.lport_logout)
lp->tt.lport_logout = fc_lport_logout;
+ 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;
+ /* 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;
return 0;
}
EXPORT_SYMBOL(fc_lport_init);
diff --git a/include/scsi/libfc/libfc.h b/include/scsi/libfc/libfc.h
index d8ec019..1eb5b8d 100644
--- a/include/scsi/libfc/libfc.h
+++ b/include/scsi/libfc/libfc.h
@@ -741,7 +741,6 @@ void fc_seq_set_rec_data(struct fc_seq *sp, u32 rec_data);
/**
* fc_functions_template
*****************************/
-void fc_attr_init(struct fc_lport *);
void fc_get_host_port_id(struct Scsi_Host *shost);
void fc_get_host_speed(struct Scsi_Host *shost);
void fc_get_host_port_type(struct Scsi_Host *shost);
_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel