Pārlūkot izejas kodu

[SCSI] qla2xxx: Add port-speed FC transport attribute.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
andrew.vasquez@qlogic.com 19 gadi atpakaļ
vecāks
revīzija
04414013bb

+ 22 - 0
drivers/scsi/qla2xxx/qla_attr.c

@@ -425,6 +425,26 @@ qla2x00_get_host_port_id(struct Scsi_Host *shost)
 	    ha->d_id.b.area << 8 | ha->d_id.b.al_pa;
 	    ha->d_id.b.area << 8 | ha->d_id.b.al_pa;
 }
 }
 
 
+static void
+qla2x00_get_host_speed(struct Scsi_Host *shost)
+{
+	scsi_qla_host_t *ha = to_qla_host(shost);
+	uint32_t speed = 0;
+
+	switch (ha->link_data_rate) {
+	case LDR_1GB:
+		speed = 1;
+		break;
+	case LDR_2GB:
+		speed = 2;
+		break;
+	case LDR_4GB:
+		speed = 4;
+		break;
+	}
+	fc_host_speed(shost) = speed;
+}
+
 static void
 static void
 qla2x00_get_starget_node_name(struct scsi_target *starget)
 qla2x00_get_starget_node_name(struct scsi_target *starget)
 {
 {
@@ -520,6 +540,8 @@ struct fc_function_template qla2xxx_transport_functions = {
 
 
 	.get_host_port_id = qla2x00_get_host_port_id,
 	.get_host_port_id = qla2x00_get_host_port_id,
 	.show_host_port_id = 1,
 	.show_host_port_id = 1,
+	.get_host_speed = qla2x00_get_host_speed,
+	.show_host_speed = 1,
 
 
 	.dd_fcrport_size = sizeof(struct fc_port *),
 	.dd_fcrport_size = sizeof(struct fc_port *),
 	.show_rport_supported_classes = 1,
 	.show_rport_supported_classes = 1,

+ 4 - 0
drivers/scsi/qla2xxx/qla_def.h

@@ -2331,6 +2331,10 @@ typedef struct scsi_qla_host {
 	uint16_t	min_external_loopid;	/* First external loop Id */
 	uint16_t	min_external_loopid;	/* First external loop Id */
 
 
 	uint16_t	link_data_rate;		/* F/W operating speed */
 	uint16_t	link_data_rate;		/* F/W operating speed */
+#define LDR_1GB		0
+#define LDR_2GB		1
+#define LDR_4GB		3
+#define LDR_UNKNOWN	0xFFFF
 
 
 	uint8_t		current_topology;
 	uint8_t		current_topology;
 	uint8_t		prev_topology;
 	uint8_t		prev_topology;

+ 2 - 2
drivers/scsi/qla2xxx/qla_isr.c

@@ -402,9 +402,9 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
 		break;
 		break;
 
 
 	case MBA_LOOP_UP:		/* Loop Up Event */
 	case MBA_LOOP_UP:		/* Loop Up Event */
-		ha->link_data_rate = 0;
 		if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
 		if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
 			link_speed = link_speeds[0];
 			link_speed = link_speeds[0];
+			ha->link_data_rate = LDR_1GB;
 		} else {
 		} else {
 			link_speed = link_speeds[LS_UNKNOWN];
 			link_speed = link_speeds[LS_UNKNOWN];
 			if (mb[1] < 5)
 			if (mb[1] < 5)
@@ -436,7 +436,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb)
 		}
 		}
 
 
 		ha->flags.management_server_logged_in = 0;
 		ha->flags.management_server_logged_in = 0;
-		ha->link_data_rate = 0;
+		ha->link_data_rate = LDR_UNKNOWN;
 		if (ql2xfdmienable)
 		if (ql2xfdmienable)
 			set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags);
 			set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags);
 
 

+ 1 - 0
drivers/scsi/qla2xxx/qla_os.c

@@ -1312,6 +1312,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
 	ha->ports = MAX_BUSES;
 	ha->ports = MAX_BUSES;
 	ha->init_cb_size = sizeof(init_cb_t);
 	ha->init_cb_size = sizeof(init_cb_t);
 	ha->mgmt_svr_loop_id = MANAGEMENT_SERVER;
 	ha->mgmt_svr_loop_id = MANAGEMENT_SERVER;
+	ha->link_data_rate = LDR_UNKNOWN;
 
 
 	/* Assign ISP specific operations. */
 	/* Assign ISP specific operations. */
 	ha->isp_ops.pci_config		= qla2100_pci_config;
 	ha->isp_ops.pci_config		= qla2100_pci_config;