diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_attr.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 4894dc886b62..413d8cd6a324 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * QLogic Fibre Channel HBA Driver | 2 | * QLogic Fibre Channel HBA Driver |
3 | * Copyright (c) 2003-2005 QLogic Corporation | 3 | * Copyright (c) 2003-2008 QLogic Corporation |
4 | * | 4 | * |
5 | * See LICENSE.qla2xxx for copyright and licensing details. | 5 | * See LICENSE.qla2xxx for copyright and licensing details. |
6 | */ | 6 | */ |
@@ -849,20 +849,20 @@ static void | |||
849 | qla2x00_get_host_speed(struct Scsi_Host *shost) | 849 | qla2x00_get_host_speed(struct Scsi_Host *shost) |
850 | { | 850 | { |
851 | scsi_qla_host_t *ha = to_qla_parent(shost_priv(shost)); | 851 | scsi_qla_host_t *ha = to_qla_parent(shost_priv(shost)); |
852 | uint32_t speed = 0; | 852 | u32 speed = FC_PORTSPEED_UNKNOWN; |
853 | 853 | ||
854 | switch (ha->link_data_rate) { | 854 | switch (ha->link_data_rate) { |
855 | case PORT_SPEED_1GB: | 855 | case PORT_SPEED_1GB: |
856 | speed = 1; | 856 | speed = FC_PORTSPEED_1GBIT; |
857 | break; | 857 | break; |
858 | case PORT_SPEED_2GB: | 858 | case PORT_SPEED_2GB: |
859 | speed = 2; | 859 | speed = FC_PORTSPEED_2GBIT; |
860 | break; | 860 | break; |
861 | case PORT_SPEED_4GB: | 861 | case PORT_SPEED_4GB: |
862 | speed = 4; | 862 | speed = FC_PORTSPEED_4GBIT; |
863 | break; | 863 | break; |
864 | case PORT_SPEED_8GB: | 864 | case PORT_SPEED_8GB: |
865 | speed = 8; | 865 | speed = FC_PORTSPEED_8GBIT; |
866 | break; | 866 | break; |
867 | } | 867 | } |
868 | fc_host_speed(shost) = speed; | 868 | fc_host_speed(shost) = speed; |
@@ -900,7 +900,8 @@ qla2x00_get_starget_node_name(struct scsi_target *starget) | |||
900 | u64 node_name = 0; | 900 | u64 node_name = 0; |
901 | 901 | ||
902 | list_for_each_entry(fcport, &ha->fcports, list) { | 902 | list_for_each_entry(fcport, &ha->fcports, list) { |
903 | if (starget->id == fcport->os_target_id) { | 903 | if (fcport->rport && |
904 | starget->id == fcport->rport->scsi_target_id) { | ||
904 | node_name = wwn_to_u64(fcport->node_name); | 905 | node_name = wwn_to_u64(fcport->node_name); |
905 | break; | 906 | break; |
906 | } | 907 | } |
@@ -918,7 +919,8 @@ qla2x00_get_starget_port_name(struct scsi_target *starget) | |||
918 | u64 port_name = 0; | 919 | u64 port_name = 0; |
919 | 920 | ||
920 | list_for_each_entry(fcport, &ha->fcports, list) { | 921 | list_for_each_entry(fcport, &ha->fcports, list) { |
921 | if (starget->id == fcport->os_target_id) { | 922 | if (fcport->rport && |
923 | starget->id == fcport->rport->scsi_target_id) { | ||
922 | port_name = wwn_to_u64(fcport->port_name); | 924 | port_name = wwn_to_u64(fcport->port_name); |
923 | break; | 925 | break; |
924 | } | 926 | } |
@@ -936,7 +938,8 @@ qla2x00_get_starget_port_id(struct scsi_target *starget) | |||
936 | uint32_t port_id = ~0U; | 938 | uint32_t port_id = ~0U; |
937 | 939 | ||
938 | list_for_each_entry(fcport, &ha->fcports, list) { | 940 | list_for_each_entry(fcport, &ha->fcports, list) { |
939 | if (starget->id == fcport->os_target_id) { | 941 | if (fcport->rport && |
942 | starget->id == fcport->rport->scsi_target_id) { | ||
940 | port_id = fcport->d_id.b.domain << 16 | | 943 | port_id = fcport->d_id.b.domain << 16 | |
941 | fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; | 944 | fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; |
942 | break; | 945 | break; |
@@ -1196,6 +1199,7 @@ struct fc_function_template qla2xxx_transport_functions = { | |||
1196 | .show_host_node_name = 1, | 1199 | .show_host_node_name = 1, |
1197 | .show_host_port_name = 1, | 1200 | .show_host_port_name = 1, |
1198 | .show_host_supported_classes = 1, | 1201 | .show_host_supported_classes = 1, |
1202 | .show_host_supported_speeds = 1, | ||
1199 | 1203 | ||
1200 | .get_host_port_id = qla2x00_get_host_port_id, | 1204 | .get_host_port_id = qla2x00_get_host_port_id, |
1201 | .show_host_port_id = 1, | 1205 | .show_host_port_id = 1, |
@@ -1276,9 +1280,23 @@ struct fc_function_template qla2xxx_transport_vport_functions = { | |||
1276 | void | 1280 | void |
1277 | qla2x00_init_host_attr(scsi_qla_host_t *ha) | 1281 | qla2x00_init_host_attr(scsi_qla_host_t *ha) |
1278 | { | 1282 | { |
1283 | u32 speed = FC_PORTSPEED_UNKNOWN; | ||
1284 | |||
1279 | fc_host_node_name(ha->host) = wwn_to_u64(ha->node_name); | 1285 | fc_host_node_name(ha->host) = wwn_to_u64(ha->node_name); |
1280 | fc_host_port_name(ha->host) = wwn_to_u64(ha->port_name); | 1286 | fc_host_port_name(ha->host) = wwn_to_u64(ha->port_name); |
1281 | fc_host_supported_classes(ha->host) = FC_COS_CLASS3; | 1287 | fc_host_supported_classes(ha->host) = FC_COS_CLASS3; |
1282 | fc_host_max_npiv_vports(ha->host) = ha->max_npiv_vports;; | 1288 | fc_host_max_npiv_vports(ha->host) = ha->max_npiv_vports;; |
1283 | fc_host_npiv_vports_inuse(ha->host) = ha->cur_vport_count; | 1289 | fc_host_npiv_vports_inuse(ha->host) = ha->cur_vport_count; |
1290 | |||
1291 | if (IS_QLA25XX(ha)) | ||
1292 | speed = FC_PORTSPEED_8GBIT | FC_PORTSPEED_4GBIT | | ||
1293 | FC_PORTSPEED_2GBIT | FC_PORTSPEED_1GBIT; | ||
1294 | else if (IS_QLA24XX_TYPE(ha)) | ||
1295 | speed = FC_PORTSPEED_4GBIT | FC_PORTSPEED_2GBIT | | ||
1296 | FC_PORTSPEED_1GBIT; | ||
1297 | else if (IS_QLA23XX(ha)) | ||
1298 | speed = FC_PORTSPEED_2GBIT | FC_PORTSPEED_1GBIT; | ||
1299 | else | ||
1300 | speed = FC_PORTSPEED_1GBIT; | ||
1301 | fc_host_supported_speeds(ha->host) = speed; | ||
1284 | } | 1302 | } |