aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
authorMichael Reed <mdr@sgi.com>2006-07-31 13:19:30 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-08-06 16:49:15 -0400
commit5d947f2b7607c4674d104accbd3768744aaa4154 (patch)
tree4edd0cc41502ab2bebdd92c75dfd5ae1db25cf0b /drivers/message
parentdd7e2f2266acf66ec882baa6fbd79f853b5fe966 (diff)
[SCSI] mptfc: add additional fc transport attributes
Add host_supported_speeds, host_maxframe_size, host_speed, host_fabric_name, host_port_type, host_port_state, and host_symbolic_name transport attributes to fusion fibre channel. Signed-off-by: Michael Reed <mdr@sgi.com> Acked-by: Moore, Eric <Eric.Moore@lsil.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptfc.c100
1 files changed, 84 insertions, 16 deletions
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 90da7d63b08e..244a32c66f06 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -162,7 +162,13 @@ static struct fc_function_template mptfc_transport_functions = {
162 .show_starget_port_id = 1, 162 .show_starget_port_id = 1,
163 .set_rport_dev_loss_tmo = mptfc_set_rport_loss_tmo, 163 .set_rport_dev_loss_tmo = mptfc_set_rport_loss_tmo,
164 .show_rport_dev_loss_tmo = 1, 164 .show_rport_dev_loss_tmo = 1,
165 165 .show_host_supported_speeds = 1,
166 .show_host_maxframe_size = 1,
167 .show_host_speed = 1,
168 .show_host_fabric_name = 1,
169 .show_host_port_type = 1,
170 .show_host_port_state = 1,
171 .show_host_symbolic_name = 1,
166}; 172};
167 173
168static void 174static void
@@ -836,33 +842,95 @@ mptfc_SetFcPortPage1_defaults(MPT_ADAPTER *ioc)
836static void 842static void
837mptfc_init_host_attr(MPT_ADAPTER *ioc,int portnum) 843mptfc_init_host_attr(MPT_ADAPTER *ioc,int portnum)
838{ 844{
839 unsigned class = 0, cos = 0; 845 unsigned class = 0;
846 unsigned cos = 0;
847 unsigned speed;
848 unsigned port_type;
849 unsigned port_state;
850 FCPortPage0_t *pp0;
851 struct Scsi_Host *sh;
852 char *sn;
840 853
841 /* don't know what to do as only one scsi (fc) host was allocated */ 854 /* don't know what to do as only one scsi (fc) host was allocated */
842 if (portnum != 0) 855 if (portnum != 0)
843 return; 856 return;
844 857
845 class = ioc->fc_port_page0[portnum].SupportedServiceClass; 858 pp0 = &ioc->fc_port_page0[portnum];
859 sh = ioc->sh;
860
861 sn = fc_host_symbolic_name(sh);
862 snprintf(sn, FC_SYMBOLIC_NAME_SIZE, "%s %s%08xh",
863 ioc->prod_name,
864 MPT_FW_REV_MAGIC_ID_STRING,
865 ioc->facts.FWVersion.Word);
866
867 fc_host_tgtid_bind_type(sh) = FC_TGTID_BIND_BY_WWPN;
868
869 fc_host_maxframe_size(sh) = pp0->MaxFrameSize;
870
871 fc_host_node_name(sh) =
872 (u64)pp0->WWNN.High << 32 | (u64)pp0->WWNN.Low;
873
874 fc_host_port_name(sh) =
875 (u64)pp0->WWPN.High << 32 | (u64)pp0->WWPN.Low;
876
877 fc_host_port_id(sh) = pp0->PortIdentifier;
878
879 class = pp0->SupportedServiceClass;
846 if (class & MPI_FCPORTPAGE0_SUPPORT_CLASS_1) 880 if (class & MPI_FCPORTPAGE0_SUPPORT_CLASS_1)
847 cos |= FC_COS_CLASS1; 881 cos |= FC_COS_CLASS1;
848 if (class & MPI_FCPORTPAGE0_SUPPORT_CLASS_2) 882 if (class & MPI_FCPORTPAGE0_SUPPORT_CLASS_2)
849 cos |= FC_COS_CLASS2; 883 cos |= FC_COS_CLASS2;
850 if (class & MPI_FCPORTPAGE0_SUPPORT_CLASS_3) 884 if (class & MPI_FCPORTPAGE0_SUPPORT_CLASS_3)
851 cos |= FC_COS_CLASS3; 885 cos |= FC_COS_CLASS3;
886 fc_host_supported_classes(sh) = cos;
887
888 if (pp0->CurrentSpeed == MPI_FCPORTPAGE0_CURRENT_SPEED_1GBIT)
889 speed = FC_PORTSPEED_1GBIT;
890 else if (pp0->CurrentSpeed == MPI_FCPORTPAGE0_CURRENT_SPEED_2GBIT)
891 speed = FC_PORTSPEED_2GBIT;
892 else if (pp0->CurrentSpeed == MPI_FCPORTPAGE0_CURRENT_SPEED_4GBIT)
893 speed = FC_PORTSPEED_4GBIT;
894 else if (pp0->CurrentSpeed == MPI_FCPORTPAGE0_CURRENT_SPEED_10GBIT)
895 speed = FC_PORTSPEED_10GBIT;
896 else
897 speed = FC_PORTSPEED_UNKNOWN;
898 fc_host_speed(sh) = speed;
899
900 speed = 0;
901 if (pp0->SupportedSpeeds & MPI_FCPORTPAGE0_SUPPORT_1GBIT_SPEED)
902 speed |= FC_PORTSPEED_1GBIT;
903 if (pp0->SupportedSpeeds & MPI_FCPORTPAGE0_SUPPORT_2GBIT_SPEED)
904 speed |= FC_PORTSPEED_2GBIT;
905 if (pp0->SupportedSpeeds & MPI_FCPORTPAGE0_SUPPORT_4GBIT_SPEED)
906 speed |= FC_PORTSPEED_4GBIT;
907 if (pp0->SupportedSpeeds & MPI_FCPORTPAGE0_SUPPORT_10GBIT_SPEED)
908 speed |= FC_PORTSPEED_10GBIT;
909 fc_host_supported_speeds(sh) = speed;
910
911 port_state = FC_PORTSTATE_UNKNOWN;
912 if (pp0->PortState == MPI_FCPORTPAGE0_PORTSTATE_ONLINE)
913 port_state = FC_PORTSTATE_ONLINE;
914 else if (pp0->PortState == MPI_FCPORTPAGE0_PORTSTATE_OFFLINE)
915 port_state = FC_PORTSTATE_LINKDOWN;
916 fc_host_port_state(sh) = port_state;
917
918 port_type = FC_PORTTYPE_UNKNOWN;
919 if (pp0->Flags & MPI_FCPORTPAGE0_FLAGS_ATTACH_POINT_TO_POINT)
920 port_type = FC_PORTTYPE_PTP;
921 else if (pp0->Flags & MPI_FCPORTPAGE0_FLAGS_ATTACH_PRIVATE_LOOP)
922 port_type = FC_PORTTYPE_LPORT;
923 else if (pp0->Flags & MPI_FCPORTPAGE0_FLAGS_ATTACH_PUBLIC_LOOP)
924 port_type = FC_PORTTYPE_NLPORT;
925 else if (pp0->Flags & MPI_FCPORTPAGE0_FLAGS_ATTACH_FABRIC_DIRECT)
926 port_type = FC_PORTTYPE_NPORT;
927 fc_host_port_type(sh) = port_type;
928
929 fc_host_fabric_name(sh) =
930 (pp0->Flags & MPI_FCPORTPAGE0_FLAGS_FABRIC_WWN_VALID) ?
931 (u64) pp0->FabricWWNN.High << 32 | (u64) pp0->FabricWWPN.Low :
932 (u64)pp0->WWNN.High << 32 | (u64)pp0->WWNN.Low;
852 933
853 fc_host_node_name(ioc->sh) =
854 (u64)ioc->fc_port_page0[portnum].WWNN.High << 32
855 | (u64)ioc->fc_port_page0[portnum].WWNN.Low;
856
857 fc_host_port_name(ioc->sh) =
858 (u64)ioc->fc_port_page0[portnum].WWPN.High << 32
859 | (u64)ioc->fc_port_page0[portnum].WWPN.Low;
860
861 fc_host_port_id(ioc->sh) = ioc->fc_port_page0[portnum].PortIdentifier;
862
863 fc_host_supported_classes(ioc->sh) = cos;
864
865 fc_host_tgtid_bind_type(ioc->sh) = FC_TGTID_BIND_BY_WWPN;
866} 934}
867 935
868static void 936static void