[SCSI] qla2xxx: Correct 8GB iIDMA support.

Original implementation manipulated the FC_GS values for
port-speed.  Transition the codes to use the driver's own
internal representations as this makes for a reduction in
duplicate 'conversion' codes throughout the driver.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
Andrew Vasquez 2007-08-13 10:13:18 -07:00 committed by James Bottomley
parent 02d638b4b7
commit a3cbdfad15
3 changed files with 30 additions and 44 deletions

View File

@ -1502,7 +1502,6 @@ typedef struct {
uint8_t node_name[WWN_SIZE];
uint8_t port_name[WWN_SIZE];
uint8_t fabric_port_name[WWN_SIZE];
uint16_t fp_speeds;
uint16_t fp_speed;
} sw_info_t;

View File

@ -295,6 +295,8 @@ qla2x00_gid_pt(scsi_qla_host_t *ha, sw_info_t *list)
list[i].d_id.b.domain = gid_data->port_id[0];
list[i].d_id.b.area = gid_data->port_id[1];
list[i].d_id.b.al_pa = gid_data->port_id[2];
memset(list[i].fabric_port_name, 0, WWN_SIZE);
list[i].fp_speed = PORT_SPEED_UNKNOWN;
/* Last one exit. */
if (gid_data->control_byte & BIT_7) {
@ -1707,8 +1709,6 @@ qla2x00_gfpn_id(scsi_qla_host_t *ha, sw_info_t *list)
for (i = 0; i < MAX_FIBRE_DEVICES; i++) {
/* Issue GFPN_ID */
memset(list[i].fabric_port_name, 0, WWN_SIZE);
/* Prepare common MS IOCB */
ms_pkt = ha->isp_ops->prep_ms_iocb(ha, GFPN_ID_REQ_SIZE,
GFPN_ID_RSP_SIZE);
@ -1821,8 +1821,6 @@ qla2x00_gpsc(scsi_qla_host_t *ha, sw_info_t *list)
for (i = 0; i < MAX_FIBRE_DEVICES; i++) {
/* Issue GFPN_ID */
list[i].fp_speeds = list[i].fp_speed = 0;
/* Prepare common MS IOCB */
ms_pkt = qla24xx_prep_ms_fm_iocb(ha, GPSC_REQ_SIZE,
GPSC_RSP_SIZE);
@ -1858,9 +1856,21 @@ qla2x00_gpsc(scsi_qla_host_t *ha, sw_info_t *list)
}
rval = QLA_FUNCTION_FAILED;
} else {
/* Save portname */
list[i].fp_speeds = ct_rsp->rsp.gpsc.speeds;
list[i].fp_speed = ct_rsp->rsp.gpsc.speed;
/* Save port-speed */
switch (be16_to_cpu(ct_rsp->rsp.gpsc.speed)) {
case BIT_15:
list[i].fp_speed = PORT_SPEED_1GB;
break;
case BIT_14:
list[i].fp_speed = PORT_SPEED_2GB;
break;
case BIT_13:
list[i].fp_speed = PORT_SPEED_4GB;
break;
case BIT_11:
list[i].fp_speed = PORT_SPEED_8GB;
break;
}
DEBUG2_3(printk("scsi(%ld): GPSC ext entry - "
"fpn %02x%02x%02x%02x%02x%02x%02x%02x speeds=%04x "
@ -1873,8 +1883,8 @@ qla2x00_gpsc(scsi_qla_host_t *ha, sw_info_t *list)
list[i].fabric_port_name[5],
list[i].fabric_port_name[6],
list[i].fabric_port_name[7],
be16_to_cpu(list[i].fp_speeds),
be16_to_cpu(list[i].fp_speed)));
be16_to_cpu(ct_rsp->rsp.gpsc.speeds),
be16_to_cpu(ct_rsp->rsp.gpsc.speed)));
}
/* Last device exit. */

View File

@ -2079,17 +2079,7 @@ qla2x00_configure_local_loop(scsi_qla_host_t *ha)
}
/* Base iIDMA settings on HBA port speed. */
switch (ha->link_data_rate) {
case PORT_SPEED_1GB:
fcport->fp_speed = cpu_to_be16(BIT_15);
break;
case PORT_SPEED_2GB:
fcport->fp_speed = cpu_to_be16(BIT_14);
break;
case PORT_SPEED_4GB:
fcport->fp_speed = cpu_to_be16(BIT_13);
break;
}
fcport->fp_speed = ha->link_data_rate;
qla2x00_update_fcport(ha, fcport);
@ -2130,38 +2120,25 @@ static void
qla2x00_iidma_fcport(scsi_qla_host_t *ha, fc_port_t *fcport)
{
#define LS_UNKNOWN 2
static char *link_speeds[5] = { "1", "2", "?", "4" };
static char *link_speeds[5] = { "1", "2", "?", "4", "8" };
int rval;
uint16_t port_speed, mb[6];
uint16_t mb[6];
if (!IS_IIDMA_CAPABLE(ha))
return;
switch (be16_to_cpu(fcport->fp_speed)) {
case BIT_15:
port_speed = PORT_SPEED_1GB;
break;
case BIT_14:
port_speed = PORT_SPEED_2GB;
break;
case BIT_13:
port_speed = PORT_SPEED_4GB;
break;
default:
if (fcport->fp_speed == PORT_SPEED_UNKNOWN) {
DEBUG2(printk("scsi(%ld): %02x%02x%02x%02x%02x%02x%02x%02x -- "
"unsupported FM port operating speed (%04x).\n",
"unsupported FM port operating speed.\n",
ha->host_no, fcport->port_name[0], fcport->port_name[1],
fcport->port_name[2], fcport->port_name[3],
fcport->port_name[4], fcport->port_name[5],
fcport->port_name[6], fcport->port_name[7],
be16_to_cpu(fcport->fp_speed)));
port_speed = PORT_SPEED_UNKNOWN;
break;
}
if (port_speed == PORT_SPEED_UNKNOWN)
fcport->port_name[6], fcport->port_name[7]));
return;
}
rval = qla2x00_set_idma_speed(ha, fcport->loop_id, port_speed, mb);
rval = qla2x00_set_idma_speed(ha, fcport->loop_id, fcport->fp_speed,
mb);
if (rval != QLA_SUCCESS) {
DEBUG2(printk("scsi(%ld): Unable to adjust iIDMA "
"%02x%02x%02x%02x%02x%02x%02x%02x -- %04x %x %04x %04x.\n",
@ -2169,12 +2146,12 @@ qla2x00_iidma_fcport(scsi_qla_host_t *ha, fc_port_t *fcport)
fcport->port_name[2], fcport->port_name[3],
fcport->port_name[4], fcport->port_name[5],
fcport->port_name[6], fcport->port_name[7], rval,
port_speed, mb[0], mb[1]));
fcport->fp_speed, mb[0], mb[1]));
} else {
DEBUG2(qla_printk(KERN_INFO, ha,
"iIDMA adjusted to %s GB/s on "
"%02x%02x%02x%02x%02x%02x%02x%02x.\n",
link_speeds[port_speed], fcport->port_name[0],
link_speeds[fcport->fp_speed], fcport->port_name[0],
fcport->port_name[1], fcport->port_name[2],
fcport->port_name[3], fcport->port_name[4],
fcport->port_name[5], fcport->port_name[6],