aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_init.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 859649160caa..270096441f3e 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2074,6 +2074,19 @@ qla2x00_configure_local_loop(scsi_qla_host_t *ha)
2074 new_fcport->flags &= ~FCF_FABRIC_DEVICE; 2074 new_fcport->flags &= ~FCF_FABRIC_DEVICE;
2075 } 2075 }
2076 2076
2077 /* Base iIDMA settings on HBA port speed. */
2078 switch (ha->link_data_rate) {
2079 case PORT_SPEED_1GB:
2080 fcport->fp_speed = cpu_to_be16(BIT_15);
2081 break;
2082 case PORT_SPEED_2GB:
2083 fcport->fp_speed = cpu_to_be16(BIT_14);
2084 break;
2085 case PORT_SPEED_4GB:
2086 fcport->fp_speed = cpu_to_be16(BIT_13);
2087 break;
2088 }
2089
2077 qla2x00_update_fcport(ha, fcport); 2090 qla2x00_update_fcport(ha, fcport);
2078 2091
2079 found_devs++; 2092 found_devs++;
@@ -2109,6 +2122,62 @@ qla2x00_probe_for_all_luns(scsi_qla_host_t *ha)
2109 } 2122 }
2110} 2123}
2111 2124
2125static void
2126qla2x00_iidma_fcport(scsi_qla_host_t *ha, fc_port_t *fcport)
2127{
2128#define LS_UNKNOWN 2
2129 static char *link_speeds[5] = { "1", "2", "?", "4" };
2130 int rval;
2131 uint16_t port_speed, mb[6];
2132
2133 if (!IS_QLA24XX(ha))
2134 return;
2135
2136 switch (be16_to_cpu(fcport->fp_speed)) {
2137 case BIT_15:
2138 port_speed = PORT_SPEED_1GB;
2139 break;
2140 case BIT_14:
2141 port_speed = PORT_SPEED_2GB;
2142 break;
2143 case BIT_13:
2144 port_speed = PORT_SPEED_4GB;
2145 break;
2146 default:
2147 DEBUG2(printk("scsi(%ld): %02x%02x%02x%02x%02x%02x%02x%02x -- "
2148 "unsupported FM port operating speed (%04x).\n",
2149 ha->host_no, fcport->port_name[0], fcport->port_name[1],
2150 fcport->port_name[2], fcport->port_name[3],
2151 fcport->port_name[4], fcport->port_name[5],
2152 fcport->port_name[6], fcport->port_name[7],
2153 be16_to_cpu(fcport->fp_speed)));
2154 port_speed = PORT_SPEED_UNKNOWN;
2155 break;
2156 }
2157 if (port_speed == PORT_SPEED_UNKNOWN)
2158 return;
2159
2160 rval = qla2x00_set_idma_speed(ha, fcport->loop_id, port_speed, mb);
2161 if (rval != QLA_SUCCESS) {
2162 DEBUG2(printk("scsi(%ld): Unable to adjust iIDMA "
2163 "%02x%02x%02x%02x%02x%02x%02x%02x -- %04x %x %04x %04x.\n",
2164 ha->host_no, fcport->port_name[0], fcport->port_name[1],
2165 fcport->port_name[2], fcport->port_name[3],
2166 fcport->port_name[4], fcport->port_name[5],
2167 fcport->port_name[6], fcport->port_name[7], rval,
2168 port_speed, mb[0], mb[1]));
2169 } else {
2170 DEBUG2(qla_printk(KERN_INFO, ha,
2171 "iIDMA adjusted to %s GB/s on "
2172 "%02x%02x%02x%02x%02x%02x%02x%02x.\n",
2173 link_speeds[port_speed], fcport->port_name[0],
2174 fcport->port_name[1], fcport->port_name[2],
2175 fcport->port_name[3], fcport->port_name[4],
2176 fcport->port_name[5], fcport->port_name[6],
2177 fcport->port_name[7]));
2178 }
2179}
2180
2112/* 2181/*
2113 * qla2x00_update_fcport 2182 * qla2x00_update_fcport
2114 * Updates device on list. 2183 * Updates device on list.
@@ -2135,6 +2204,8 @@ qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport)
2135 PORT_RETRY_TIME); 2204 PORT_RETRY_TIME);
2136 fcport->flags &= ~FCF_LOGIN_NEEDED; 2205 fcport->flags &= ~FCF_LOGIN_NEEDED;
2137 2206
2207 qla2x00_iidma_fcport(ha, fcport);
2208
2138 atomic_set(&fcport->state, FCS_ONLINE); 2209 atomic_set(&fcport->state, FCS_ONLINE);
2139 2210
2140 if (ha->flags.init_done) 2211 if (ha->flags.init_done)
@@ -2416,6 +2487,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2416 } else if (qla2x00_gnn_id(ha, swl) != QLA_SUCCESS) { 2487 } else if (qla2x00_gnn_id(ha, swl) != QLA_SUCCESS) {
2417 kfree(swl); 2488 kfree(swl);
2418 swl = NULL; 2489 swl = NULL;
2490 } else if (qla2x00_gfpn_id(ha, swl) == QLA_SUCCESS) {
2491 qla2x00_gpsc(ha, swl);
2419 } 2492 }
2420 } 2493 }
2421 swl_idx = 0; 2494 swl_idx = 0;
@@ -2450,6 +2523,9 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2450 swl[swl_idx].node_name, WWN_SIZE); 2523 swl[swl_idx].node_name, WWN_SIZE);
2451 memcpy(new_fcport->port_name, 2524 memcpy(new_fcport->port_name,
2452 swl[swl_idx].port_name, WWN_SIZE); 2525 swl[swl_idx].port_name, WWN_SIZE);
2526 memcpy(new_fcport->fabric_port_name,
2527 swl[swl_idx].fabric_port_name, WWN_SIZE);
2528 new_fcport->fp_speed = swl[swl_idx].fp_speed;
2453 2529
2454 if (swl[swl_idx].d_id.b.rsvd_1 != 0) { 2530 if (swl[swl_idx].d_id.b.rsvd_1 != 0) {
2455 last_dev = 1; 2531 last_dev = 1;
@@ -2507,6 +2583,11 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2507 2583
2508 found++; 2584 found++;
2509 2585
2586 /* Update port state. */
2587 memcpy(fcport->fabric_port_name,
2588 new_fcport->fabric_port_name, WWN_SIZE);
2589 fcport->fp_speed = new_fcport->fp_speed;
2590
2510 /* 2591 /*
2511 * If address the same and state FCS_ONLINE, nothing 2592 * If address the same and state FCS_ONLINE, nothing
2512 * changed. 2593 * changed.