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.c166
1 files changed, 146 insertions, 20 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index cf94f8636ba5..cc6ebb609e98 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -899,6 +899,10 @@ qla2x00_setup_chip(scsi_qla_host_t *ha)
899 &ha->fw_subminor_version, 899 &ha->fw_subminor_version,
900 &ha->fw_attributes, &ha->fw_memory_size); 900 &ha->fw_attributes, &ha->fw_memory_size);
901 qla2x00_resize_request_q(ha); 901 qla2x00_resize_request_q(ha);
902 ha->flags.npiv_supported = 0;
903 if (IS_QLA24XX(ha) &&
904 (ha->fw_attributes & BIT_2))
905 ha->flags.npiv_supported = 1;
902 906
903 if (ql2xallocfwdump) 907 if (ql2xallocfwdump)
904 qla2x00_alloc_fw_dump(ha); 908 qla2x00_alloc_fw_dump(ha);
@@ -1101,6 +1105,8 @@ qla2x00_init_rings(scsi_qla_host_t *ha)
1101 int rval; 1105 int rval;
1102 unsigned long flags = 0; 1106 unsigned long flags = 0;
1103 int cnt; 1107 int cnt;
1108 struct mid_init_cb_24xx *mid_init_cb =
1109 (struct mid_init_cb_24xx *) ha->init_cb;
1104 1110
1105 spin_lock_irqsave(&ha->hardware_lock, flags); 1111 spin_lock_irqsave(&ha->hardware_lock, flags);
1106 1112
@@ -1132,6 +1138,10 @@ qla2x00_init_rings(scsi_qla_host_t *ha)
1132 ha->isp_ops.update_fw_options(ha); 1138 ha->isp_ops.update_fw_options(ha);
1133 1139
1134 DEBUG(printk("scsi(%ld): Issue init firmware.\n", ha->host_no)); 1140 DEBUG(printk("scsi(%ld): Issue init firmware.\n", ha->host_no));
1141
1142 mid_init_cb->count = MAX_NUM_VPORT_FABRIC;
1143 ha->max_npiv_vports = MAX_NUM_VPORT_FABRIC;
1144
1135 rval = qla2x00_init_firmware(ha, ha->init_cb_size); 1145 rval = qla2x00_init_firmware(ha, ha->init_cb_size);
1136 if (rval) { 1146 if (rval) {
1137 DEBUG2_3(printk("scsi(%ld): Init firmware **** FAILED ****.\n", 1147 DEBUG2_3(printk("scsi(%ld): Init firmware **** FAILED ****.\n",
@@ -1263,6 +1273,7 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1263 int rval; 1273 int rval;
1264 uint16_t loop_id; 1274 uint16_t loop_id;
1265 uint16_t topo; 1275 uint16_t topo;
1276 uint16_t sw_cap;
1266 uint8_t al_pa; 1277 uint8_t al_pa;
1267 uint8_t area; 1278 uint8_t area;
1268 uint8_t domain; 1279 uint8_t domain;
@@ -1270,7 +1281,7 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1270 1281
1271 /* Get host addresses. */ 1282 /* Get host addresses. */
1272 rval = qla2x00_get_adapter_id(ha, 1283 rval = qla2x00_get_adapter_id(ha,
1273 &loop_id, &al_pa, &area, &domain, &topo); 1284 &loop_id, &al_pa, &area, &domain, &topo, &sw_cap);
1274 if (rval != QLA_SUCCESS) { 1285 if (rval != QLA_SUCCESS) {
1275 if (LOOP_TRANSITION(ha) || atomic_read(&ha->loop_down_timer) || 1286 if (LOOP_TRANSITION(ha) || atomic_read(&ha->loop_down_timer) ||
1276 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) { 1287 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) {
@@ -1295,6 +1306,7 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1295 /* initialize */ 1306 /* initialize */
1296 ha->min_external_loopid = SNS_FIRST_LOOP_ID; 1307 ha->min_external_loopid = SNS_FIRST_LOOP_ID;
1297 ha->operating_mode = LOOP; 1308 ha->operating_mode = LOOP;
1309 ha->switch_cap = 0;
1298 1310
1299 switch (topo) { 1311 switch (topo) {
1300 case 0: 1312 case 0:
@@ -1307,6 +1319,7 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1307 case 1: 1319 case 1:
1308 DEBUG3(printk("scsi(%ld): HBA in FL topology.\n", 1320 DEBUG3(printk("scsi(%ld): HBA in FL topology.\n",
1309 ha->host_no)); 1321 ha->host_no));
1322 ha->switch_cap = sw_cap;
1310 ha->current_topology = ISP_CFG_FL; 1323 ha->current_topology = ISP_CFG_FL;
1311 strcpy(connect_type, "(FL_Port)"); 1324 strcpy(connect_type, "(FL_Port)");
1312 break; 1325 break;
@@ -1322,6 +1335,7 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1322 case 3: 1335 case 3:
1323 DEBUG3(printk("scsi(%ld): HBA in F P2P topology.\n", 1336 DEBUG3(printk("scsi(%ld): HBA in F P2P topology.\n",
1324 ha->host_no)); 1337 ha->host_no));
1338 ha->switch_cap = sw_cap;
1325 ha->operating_mode = P2P; 1339 ha->operating_mode = P2P;
1326 ha->current_topology = ISP_CFG_F; 1340 ha->current_topology = ISP_CFG_F;
1327 strcpy(connect_type, "(F_Port)"); 1341 strcpy(connect_type, "(F_Port)");
@@ -1743,7 +1757,6 @@ qla2x00_rport_del(void *data)
1743 spin_unlock_irqrestore(&fcport->rport_lock, flags); 1757 spin_unlock_irqrestore(&fcport->rport_lock, flags);
1744 if (rport) 1758 if (rport)
1745 fc_remote_port_delete(rport); 1759 fc_remote_port_delete(rport);
1746
1747} 1760}
1748 1761
1749/** 1762/**
@@ -1765,6 +1778,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *ha, gfp_t flags)
1765 /* Setup fcport template structure. */ 1778 /* Setup fcport template structure. */
1766 memset(fcport, 0, sizeof (fc_port_t)); 1779 memset(fcport, 0, sizeof (fc_port_t));
1767 fcport->ha = ha; 1780 fcport->ha = ha;
1781 fcport->vp_idx = ha->vp_idx;
1768 fcport->port_type = FCT_UNKNOWN; 1782 fcport->port_type = FCT_UNKNOWN;
1769 fcport->loop_id = FC_NO_LOOP_ID; 1783 fcport->loop_id = FC_NO_LOOP_ID;
1770 atomic_set(&fcport->state, FCS_UNCONFIGURED); 1784 atomic_set(&fcport->state, FCS_UNCONFIGURED);
@@ -1911,6 +1925,7 @@ qla2x00_configure_local_loop(scsi_qla_host_t *ha)
1911 char *id_iter; 1925 char *id_iter;
1912 uint16_t loop_id; 1926 uint16_t loop_id;
1913 uint8_t domain, area, al_pa; 1927 uint8_t domain, area, al_pa;
1928 scsi_qla_host_t *pha = to_qla_parent(ha);
1914 1929
1915 found_devs = 0; 1930 found_devs = 0;
1916 new_fcport = NULL; 1931 new_fcport = NULL;
@@ -1942,7 +1957,10 @@ qla2x00_configure_local_loop(scsi_qla_host_t *ha)
1942 /* 1957 /*
1943 * Mark local devices that were present with FCF_DEVICE_LOST for now. 1958 * Mark local devices that were present with FCF_DEVICE_LOST for now.
1944 */ 1959 */
1945 list_for_each_entry(fcport, &ha->fcports, list) { 1960 list_for_each_entry(fcport, &pha->fcports, list) {
1961 if (fcport->vp_idx != ha->vp_idx)
1962 continue;
1963
1946 if (atomic_read(&fcport->state) == FCS_ONLINE && 1964 if (atomic_read(&fcport->state) == FCS_ONLINE &&
1947 fcport->port_type != FCT_BROADCAST && 1965 fcport->port_type != FCT_BROADCAST &&
1948 (fcport->flags & FCF_FABRIC_DEVICE) == 0) { 1966 (fcport->flags & FCF_FABRIC_DEVICE) == 0) {
@@ -1988,6 +2006,7 @@ qla2x00_configure_local_loop(scsi_qla_host_t *ha)
1988 new_fcport->d_id.b.area = area; 2006 new_fcport->d_id.b.area = area;
1989 new_fcport->d_id.b.al_pa = al_pa; 2007 new_fcport->d_id.b.al_pa = al_pa;
1990 new_fcport->loop_id = loop_id; 2008 new_fcport->loop_id = loop_id;
2009 new_fcport->vp_idx = ha->vp_idx;
1991 rval2 = qla2x00_get_port_database(ha, new_fcport, 0); 2010 rval2 = qla2x00_get_port_database(ha, new_fcport, 0);
1992 if (rval2 != QLA_SUCCESS) { 2011 if (rval2 != QLA_SUCCESS) {
1993 DEBUG2(printk("scsi(%ld): Failed to retrieve fcport " 2012 DEBUG2(printk("scsi(%ld): Failed to retrieve fcport "
@@ -2003,7 +2022,10 @@ qla2x00_configure_local_loop(scsi_qla_host_t *ha)
2003 /* Check for matching device in port list. */ 2022 /* Check for matching device in port list. */
2004 found = 0; 2023 found = 0;
2005 fcport = NULL; 2024 fcport = NULL;
2006 list_for_each_entry(fcport, &ha->fcports, list) { 2025 list_for_each_entry(fcport, &pha->fcports, list) {
2026 if (fcport->vp_idx != ha->vp_idx)
2027 continue;
2028
2007 if (memcmp(new_fcport->port_name, fcport->port_name, 2029 if (memcmp(new_fcport->port_name, fcport->port_name,
2008 WWN_SIZE)) 2030 WWN_SIZE))
2009 continue; 2031 continue;
@@ -2023,7 +2045,13 @@ qla2x00_configure_local_loop(scsi_qla_host_t *ha)
2023 if (!found) { 2045 if (!found) {
2024 /* New device, add to fcports list. */ 2046 /* New device, add to fcports list. */
2025 new_fcport->flags &= ~FCF_PERSISTENT_BOUND; 2047 new_fcport->flags &= ~FCF_PERSISTENT_BOUND;
2026 list_add_tail(&new_fcport->list, &ha->fcports); 2048 if (ha->parent) {
2049 new_fcport->ha = ha;
2050 new_fcport->vp_idx = ha->vp_idx;
2051 list_add_tail(&new_fcport->vp_fcport,
2052 &ha->vp_fcports);
2053 }
2054 list_add_tail(&new_fcport->list, &pha->fcports);
2027 2055
2028 /* Allocate a new replacement fcport. */ 2056 /* Allocate a new replacement fcport. */
2029 fcport = new_fcport; 2057 fcport = new_fcport;
@@ -2199,11 +2227,13 @@ qla2x00_reg_remote_port(scsi_qla_host_t *ha, fc_port_t *fcport)
2199void 2227void
2200qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport) 2228qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport)
2201{ 2229{
2230 scsi_qla_host_t *pha = to_qla_parent(ha);
2231
2202 fcport->ha = ha; 2232 fcport->ha = ha;
2203 fcport->login_retry = 0; 2233 fcport->login_retry = 0;
2204 fcport->port_login_retry_count = ha->port_down_retry_count * 2234 fcport->port_login_retry_count = pha->port_down_retry_count *
2205 PORT_RETRY_TIME; 2235 PORT_RETRY_TIME;
2206 atomic_set(&fcport->port_down_timer, ha->port_down_retry_count * 2236 atomic_set(&fcport->port_down_timer, pha->port_down_retry_count *
2207 PORT_RETRY_TIME); 2237 PORT_RETRY_TIME);
2208 fcport->flags &= ~FCF_LOGIN_NEEDED; 2238 fcport->flags &= ~FCF_LOGIN_NEEDED;
2209 2239
@@ -2234,6 +2264,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha)
2234 uint16_t mb[MAILBOX_REGISTER_COUNT]; 2264 uint16_t mb[MAILBOX_REGISTER_COUNT];
2235 uint16_t loop_id; 2265 uint16_t loop_id;
2236 LIST_HEAD(new_fcports); 2266 LIST_HEAD(new_fcports);
2267 scsi_qla_host_t *pha = to_qla_parent(ha);
2237 2268
2238 /* If FL port exists, then SNS is present */ 2269 /* If FL port exists, then SNS is present */
2239 if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) 2270 if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
@@ -2307,7 +2338,10 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha)
2307 * Logout all previous fabric devices marked lost, except 2338 * Logout all previous fabric devices marked lost, except
2308 * tape devices. 2339 * tape devices.
2309 */ 2340 */
2310 list_for_each_entry(fcport, &ha->fcports, list) { 2341 list_for_each_entry(fcport, &pha->fcports, list) {
2342 if (fcport->vp_idx !=ha->vp_idx)
2343 continue;
2344
2311 if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) 2345 if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))
2312 break; 2346 break;
2313 2347
@@ -2332,13 +2366,16 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha)
2332 } 2366 }
2333 2367
2334 /* Starting free loop ID. */ 2368 /* Starting free loop ID. */
2335 next_loopid = ha->min_external_loopid; 2369 next_loopid = pha->min_external_loopid;
2336 2370
2337 /* 2371 /*
2338 * Scan through our port list and login entries that need to be 2372 * Scan through our port list and login entries that need to be
2339 * logged in. 2373 * logged in.
2340 */ 2374 */
2341 list_for_each_entry(fcport, &ha->fcports, list) { 2375 list_for_each_entry(fcport, &pha->fcports, list) {
2376 if (fcport->vp_idx != ha->vp_idx)
2377 continue;
2378
2342 if (atomic_read(&ha->loop_down_timer) || 2379 if (atomic_read(&ha->loop_down_timer) ||
2343 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) 2380 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))
2344 break; 2381 break;
@@ -2380,11 +2417,18 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha)
2380 break; 2417 break;
2381 } 2418 }
2382 2419
2383 /* Remove device from the new list and add it to DB */
2384 list_move_tail(&fcport->list, &ha->fcports);
2385
2386 /* Login and update database */ 2420 /* Login and update database */
2387 qla2x00_fabric_dev_login(ha, fcport, &next_loopid); 2421 qla2x00_fabric_dev_login(ha, fcport, &next_loopid);
2422
2423 if (ha->parent) {
2424 fcport->ha = ha;
2425 fcport->vp_idx = ha->vp_idx;
2426 list_add_tail(&fcport->vp_fcport,
2427 &ha->vp_fcports);
2428 list_move_tail(&fcport->list,
2429 &ha->parent->fcports);
2430 } else
2431 list_move_tail(&fcport->list, &ha->fcports);
2388 } 2432 }
2389 } while (0); 2433 } while (0);
2390 2434
@@ -2428,6 +2472,11 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2428 int swl_idx; 2472 int swl_idx;
2429 int first_dev, last_dev; 2473 int first_dev, last_dev;
2430 port_id_t wrap, nxt_d_id; 2474 port_id_t wrap, nxt_d_id;
2475 int vp_index;
2476 int empty_vp_index;
2477 int found_vp;
2478 scsi_qla_host_t *vha;
2479 scsi_qla_host_t *pha = to_qla_parent(ha);
2431 2480
2432 rval = QLA_SUCCESS; 2481 rval = QLA_SUCCESS;
2433 2482
@@ -2461,13 +2510,13 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2461 return (QLA_MEMORY_ALLOC_FAILED); 2510 return (QLA_MEMORY_ALLOC_FAILED);
2462 } 2511 }
2463 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED); 2512 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED);
2464 2513 new_fcport->vp_idx = ha->vp_idx;
2465 /* Set start port ID scan at adapter ID. */ 2514 /* Set start port ID scan at adapter ID. */
2466 first_dev = 1; 2515 first_dev = 1;
2467 last_dev = 0; 2516 last_dev = 0;
2468 2517
2469 /* Starting free loop ID. */ 2518 /* Starting free loop ID. */
2470 loop_id = ha->min_external_loopid; 2519 loop_id = pha->min_external_loopid;
2471 for (; loop_id <= ha->last_loop_id; loop_id++) { 2520 for (; loop_id <= ha->last_loop_id; loop_id++) {
2472 if (qla2x00_is_reserved_id(ha, loop_id)) 2521 if (qla2x00_is_reserved_id(ha, loop_id))
2473 continue; 2522 continue;
@@ -2521,10 +2570,42 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2521 break; 2570 break;
2522 } 2571 }
2523 2572
2524 /* Bypass if host adapter. */ 2573 /* Bypass if same physical adapter. */
2525 if (new_fcport->d_id.b24 == ha->d_id.b24) 2574 if (new_fcport->d_id.b24 == pha->d_id.b24)
2526 continue; 2575 continue;
2527 2576
2577 /* Bypass virtual ports of the same host. */
2578 if (pha->num_vhosts) {
2579 vp_index = find_next_bit(
2580 (unsigned long *)pha->vp_idx_map,
2581 MAX_MULTI_ID_FABRIC + 1, 1);
2582
2583 for (;vp_index <= MAX_MULTI_ID_FABRIC;
2584 vp_index = find_next_bit(
2585 (unsigned long *)pha->vp_idx_map,
2586 MAX_MULTI_ID_FABRIC + 1, vp_index + 1)) {
2587 empty_vp_index = 1;
2588 found_vp = 0;
2589 list_for_each_entry(vha, &pha->vp_list,
2590 vp_list) {
2591 if (vp_index == vha->vp_idx) {
2592 empty_vp_index = 0;
2593 found_vp = 1;
2594 break;
2595 }
2596 }
2597
2598 if (empty_vp_index)
2599 continue;
2600
2601 if (found_vp &&
2602 new_fcport->d_id.b24 == vha->d_id.b24)
2603 break;
2604 }
2605 if (vp_index <= MAX_MULTI_ID_FABRIC)
2606 continue;
2607 }
2608
2528 /* Bypass if same domain and area of adapter. */ 2609 /* Bypass if same domain and area of adapter. */
2529 if (((new_fcport->d_id.b24 & 0xffff00) == 2610 if (((new_fcport->d_id.b24 & 0xffff00) ==
2530 (ha->d_id.b24 & 0xffff00)) && ha->current_topology == 2611 (ha->d_id.b24 & 0xffff00)) && ha->current_topology ==
@@ -2537,7 +2618,9 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2537 2618
2538 /* Locate matching device in database. */ 2619 /* Locate matching device in database. */
2539 found = 0; 2620 found = 0;
2540 list_for_each_entry(fcport, &ha->fcports, list) { 2621 list_for_each_entry(fcport, &pha->fcports, list) {
2622 if (new_fcport->vp_idx != fcport->vp_idx)
2623 continue;
2541 if (memcmp(new_fcport->port_name, fcport->port_name, 2624 if (memcmp(new_fcport->port_name, fcport->port_name,
2542 WWN_SIZE)) 2625 WWN_SIZE))
2543 continue; 2626 continue;
@@ -2605,6 +2688,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2605 } 2688 }
2606 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED); 2689 new_fcport->flags |= (FCF_FABRIC_DEVICE | FCF_LOGIN_NEEDED);
2607 new_fcport->d_id.b24 = nxt_d_id.b24; 2690 new_fcport->d_id.b24 = nxt_d_id.b24;
2691 new_fcport->vp_idx = ha->vp_idx;
2608 } 2692 }
2609 2693
2610 kfree(swl); 2694 kfree(swl);
@@ -2637,6 +2721,7 @@ qla2x00_find_new_loop_id(scsi_qla_host_t *ha, fc_port_t *dev)
2637 int found; 2721 int found;
2638 fc_port_t *fcport; 2722 fc_port_t *fcport;
2639 uint16_t first_loop_id; 2723 uint16_t first_loop_id;
2724 scsi_qla_host_t *pha = to_qla_parent(ha);
2640 2725
2641 rval = QLA_SUCCESS; 2726 rval = QLA_SUCCESS;
2642 2727
@@ -2663,7 +2748,7 @@ qla2x00_find_new_loop_id(scsi_qla_host_t *ha, fc_port_t *dev)
2663 /* Check for loop ID being already in use. */ 2748 /* Check for loop ID being already in use. */
2664 found = 0; 2749 found = 0;
2665 fcport = NULL; 2750 fcport = NULL;
2666 list_for_each_entry(fcport, &ha->fcports, list) { 2751 list_for_each_entry(fcport, &pha->fcports, list) {
2667 if (fcport->loop_id == dev->loop_id && fcport != dev) { 2752 if (fcport->loop_id == dev->loop_id && fcport != dev) {
2668 /* ID possibly in use */ 2753 /* ID possibly in use */
2669 found++; 2754 found++;
@@ -2710,6 +2795,7 @@ qla2x00_device_resync(scsi_qla_host_t *ha)
2710 uint8_t rscn_out_iter; 2795 uint8_t rscn_out_iter;
2711 uint8_t format; 2796 uint8_t format;
2712 port_id_t d_id; 2797 port_id_t d_id;
2798 scsi_qla_host_t *pha = to_qla_parent(ha);
2713 2799
2714 rval = QLA_RSCNS_HANDLED; 2800 rval = QLA_RSCNS_HANDLED;
2715 2801
@@ -2776,7 +2862,10 @@ qla2x00_device_resync(scsi_qla_host_t *ha)
2776 2862
2777 rval = QLA_SUCCESS; 2863 rval = QLA_SUCCESS;
2778 2864
2779 list_for_each_entry(fcport, &ha->fcports, list) { 2865 list_for_each_entry(fcport, &pha->fcports, list) {
2866 if (fcport->vp_idx != ha->vp_idx)
2867 continue;
2868
2780 if ((fcport->flags & FCF_FABRIC_DEVICE) == 0 || 2869 if ((fcport->flags & FCF_FABRIC_DEVICE) == 0 ||
2781 (fcport->d_id.b24 & mask) != d_id.b24 || 2870 (fcport->d_id.b24 & mask) != d_id.b24 ||
2782 fcport->port_type == FCT_BROADCAST) 2871 fcport->port_type == FCT_BROADCAST)
@@ -3940,3 +4029,40 @@ qla2x00_try_to_stop_firmware(scsi_qla_host_t *ha)
3940 ret = qla2x00_stop_firmware(ha); 4029 ret = qla2x00_stop_firmware(ha);
3941 } 4030 }
3942} 4031}
4032
4033int
4034qla24xx_configure_vhba(scsi_qla_host_t *ha)
4035{
4036 int rval = QLA_SUCCESS;
4037 uint16_t mb[MAILBOX_REGISTER_COUNT];
4038
4039 if (!ha->parent)
4040 return -EINVAL;
4041
4042 rval = qla2x00_fw_ready(ha);
4043 if (rval == QLA_SUCCESS) {
4044 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);
4045 qla2x00_marker(ha, 0, 0, MK_SYNC_ALL);
4046 }
4047
4048 ha->flags.management_server_logged_in = 0;
4049
4050 /* Login to SNS first */
4051 qla24xx_login_fabric(ha, NPH_SNS, 0xff, 0xff, 0xfc,
4052 mb, BIT_1);
4053 if (mb[0] != MBS_COMMAND_COMPLETE) {
4054 DEBUG15(qla_printk(KERN_INFO, ha,
4055 "Failed SNS login: loop_id=%x mb[0]=%x mb[1]=%x "
4056 "mb[2]=%x mb[6]=%x mb[7]=%x\n", NPH_SNS,
4057 mb[0], mb[1], mb[2], mb[6], mb[7]));
4058 return (QLA_FUNCTION_FAILED);
4059 }
4060
4061 atomic_set(&ha->loop_down_timer, 0);
4062 atomic_set(&ha->loop_state, LOOP_UP);
4063 set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags);
4064 set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags);
4065 rval = qla2x00_loop_resync(ha);
4066
4067 return rval;
4068}