Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360239
b: refs/heads/master
c: e452ceb
h: refs/heads/master
i:
  360237: 3d6f1ec
  360235: 292e923
  360231: 90eb219
  360223: c6d3a16
v: v3
  • Loading branch information
Joe Carnuccio authored and James Bottomley committed Feb 22, 2013
1 parent 9fc942f commit f2343dc
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f24b697ba499f971e84478f531de77ede9a2aac1
refs/heads/master: e452ceb636c416a517ec1b5d964491fd0bda503e
83 changes: 63 additions & 20 deletions trunk/drivers/scsi/qla2xxx/qla_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -3159,7 +3159,7 @@ static int
qla2x00_configure_fabric(scsi_qla_host_t *vha)
{
int rval;
fc_port_t *fcport;
fc_port_t *fcport, *fcptemp;
uint16_t next_loopid;
uint16_t mb[MAILBOX_REGISTER_COUNT];
uint16_t loop_id;
Expand Down Expand Up @@ -3197,7 +3197,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
0xfc, mb, BIT_1|BIT_0);
if (rval != QLA_SUCCESS) {
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
break;
return rval;
}
if (mb[0] != MBS_COMMAND_COMPLETE) {
ql_dbg(ql_dbg_disc, vha, 0x2042,
Expand Down Expand Up @@ -3233,20 +3233,17 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
if (rval != QLA_SUCCESS)
break;

/* Add new ports to existing port list */
list_splice_tail_init(&new_fcports, &vha->vp_fcports);

/* Starting free loop ID. */
next_loopid = ha->min_external_loopid;

/*
* Logout all previous fabric devices marked lost, except
* FCP2 devices.
*/
list_for_each_entry(fcport, &vha->vp_fcports, list) {
if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
break;

if ((fcport->flags & FCF_FABRIC_DEVICE) == 0)
continue;

/* Logout lost/gone fabric devices (non-FCP2) */
if (fcport->scan_state != QLA_FCPORT_SCAN_FOUND &&
atomic_read(&fcport->state) == FCS_ONLINE) {
qla2x00_mark_device_lost(vha, fcport,
Expand All @@ -3260,30 +3257,76 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
fcport->d_id.b.domain,
fcport->d_id.b.area,
fcport->d_id.b.al_pa);
fcport->loop_id = FC_NO_LOOP_ID;
}
continue;
}
fcport->scan_state = QLA_FCPORT_SCAN_NONE;
}

/* Login fabric devices that need a login */
if ((fcport->flags & FCF_LOGIN_NEEDED) != 0 &&
atomic_read(&vha->loop_down_timer) == 0) {
if (fcport->loop_id == FC_NO_LOOP_ID) {
fcport->loop_id = next_loopid;
rval = qla2x00_find_new_loop_id(
base_vha, fcport);
if (rval != QLA_SUCCESS) {
/* Ran out of IDs to use */
continue;
}
/* Starting free loop ID. */
next_loopid = ha->min_external_loopid;

/*
* Scan through our port list and login entries that need to be
* logged in.
*/
list_for_each_entry(fcport, &vha->vp_fcports, list) {
if (atomic_read(&vha->loop_down_timer) ||
test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
break;

if ((fcport->flags & FCF_FABRIC_DEVICE) == 0 ||
(fcport->flags & FCF_LOGIN_NEEDED) == 0)
continue;

if (fcport->loop_id == FC_NO_LOOP_ID) {
fcport->loop_id = next_loopid;
rval = qla2x00_find_new_loop_id(
base_vha, fcport);
if (rval != QLA_SUCCESS) {
/* Ran out of IDs to use */
break;
}
}
/* Login and update database */
qla2x00_fabric_dev_login(vha, fcport, &next_loopid);
}

/* Exit if out of loop IDs. */
if (rval != QLA_SUCCESS) {
break;
}

/*
* Login and add the new devices to our port list.
*/
list_for_each_entry_safe(fcport, fcptemp, &new_fcports, list) {
if (atomic_read(&vha->loop_down_timer) ||
test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
break;

/* Find a new loop ID to use. */
fcport->loop_id = next_loopid;
rval = qla2x00_find_new_loop_id(base_vha, fcport);
if (rval != QLA_SUCCESS) {
/* Ran out of IDs to use */
break;
}

/* Login and update database */
qla2x00_fabric_dev_login(vha, fcport, &next_loopid);

list_move_tail(&fcport->list, &vha->vp_fcports);
}
} while (0);

/* Free all new device structures not processed. */
list_for_each_entry_safe(fcport, fcptemp, &new_fcports, list) {
list_del(&fcport->list);
kfree(fcport);
}

if (rval) {
ql_dbg(ql_dbg_disc, vha, 0x2068,
"Configure fabric error exit rval=%d.\n", rval);
Expand Down

0 comments on commit f2343dc

Please sign in to comment.