[SCSI] qla2xxx: Avoid losing any fc ports when loop id's are exhausted.
Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com> Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
parent
daae62a33e
commit
4dc77c36f8
|
@ -2910,7 +2910,7 @@ static int
|
||||||
qla2x00_configure_fabric(scsi_qla_host_t *vha)
|
qla2x00_configure_fabric(scsi_qla_host_t *vha)
|
||||||
{
|
{
|
||||||
int rval;
|
int rval;
|
||||||
fc_port_t *fcport, *fcptemp;
|
fc_port_t *fcport;
|
||||||
uint16_t next_loopid;
|
uint16_t next_loopid;
|
||||||
uint16_t mb[MAILBOX_REGISTER_COUNT];
|
uint16_t mb[MAILBOX_REGISTER_COUNT];
|
||||||
uint16_t loop_id;
|
uint16_t loop_id;
|
||||||
|
@ -2948,7 +2948,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
|
||||||
0xfc, mb, BIT_1|BIT_0);
|
0xfc, mb, BIT_1|BIT_0);
|
||||||
if (rval != QLA_SUCCESS) {
|
if (rval != QLA_SUCCESS) {
|
||||||
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
|
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
|
||||||
return rval;
|
break;
|
||||||
}
|
}
|
||||||
if (mb[0] != MBS_COMMAND_COMPLETE) {
|
if (mb[0] != MBS_COMMAND_COMPLETE) {
|
||||||
ql_dbg(ql_dbg_disc, vha, 0x2042,
|
ql_dbg(ql_dbg_disc, vha, 0x2042,
|
||||||
|
@ -2984,10 +2984,12 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
|
||||||
if (rval != QLA_SUCCESS)
|
if (rval != QLA_SUCCESS)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/* Add new ports to existing port list */
|
||||||
* Logout all previous fabric devices marked lost, except
|
list_splice_tail_init(&new_fcports, &vha->vp_fcports);
|
||||||
* FCP2 devices.
|
|
||||||
*/
|
/* Starting free loop ID. */
|
||||||
|
next_loopid = ha->min_external_loopid;
|
||||||
|
|
||||||
list_for_each_entry(fcport, &vha->vp_fcports, list) {
|
list_for_each_entry(fcport, &vha->vp_fcports, list) {
|
||||||
if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
|
if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
|
||||||
break;
|
break;
|
||||||
|
@ -2995,6 +2997,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
|
||||||
if ((fcport->flags & FCF_FABRIC_DEVICE) == 0)
|
if ((fcport->flags & FCF_FABRIC_DEVICE) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* Logout lost/gone fabric devices (non-FCP2) */
|
||||||
if (fcport->scan_state != QLA_FCPORT_SCAN_FOUND &&
|
if (fcport->scan_state != QLA_FCPORT_SCAN_FOUND &&
|
||||||
atomic_read(&fcport->state) == FCS_ONLINE) {
|
atomic_read(&fcport->state) == FCS_ONLINE) {
|
||||||
qla2x00_mark_device_lost(vha, fcport,
|
qla2x00_mark_device_lost(vha, fcport,
|
||||||
|
@ -3008,76 +3011,30 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
|
||||||
fcport->d_id.b.domain,
|
fcport->d_id.b.domain,
|
||||||
fcport->d_id.b.area,
|
fcport->d_id.b.area,
|
||||||
fcport->d_id.b.al_pa);
|
fcport->d_id.b.al_pa);
|
||||||
fcport->loop_id = FC_NO_LOOP_ID;
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fcport->scan_state = QLA_FCPORT_SCAN_NONE;
|
fcport->scan_state = QLA_FCPORT_SCAN_NONE;
|
||||||
}
|
|
||||||
|
|
||||||
/* Starting free loop ID. */
|
/* Login fabric devices that need a login */
|
||||||
next_loopid = ha->min_external_loopid;
|
if ((fcport->flags & FCF_LOGIN_NEEDED) != 0 &&
|
||||||
|
atomic_read(&vha->loop_down_timer) == 0) {
|
||||||
/*
|
if (fcport->loop_id == FC_NO_LOOP_ID) {
|
||||||
* Scan through our port list and login entries that need to be
|
fcport->loop_id = next_loopid;
|
||||||
* logged in.
|
rval = qla2x00_find_new_loop_id(
|
||||||
*/
|
base_vha, fcport);
|
||||||
list_for_each_entry(fcport, &vha->vp_fcports, list) {
|
if (rval != QLA_SUCCESS) {
|
||||||
if (atomic_read(&vha->loop_down_timer) ||
|
/* Ran out of IDs to use */
|
||||||
test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
|
continue;
|
||||||
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 */
|
/* Login and update database */
|
||||||
qla2x00_fabric_dev_login(vha, fcport, &next_loopid);
|
qla2x00_fabric_dev_login(vha, fcport, &next_loopid);
|
||||||
|
|
||||||
list_move_tail(&fcport->list, &vha->vp_fcports);
|
|
||||||
}
|
}
|
||||||
} while (0);
|
} 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) {
|
if (rval) {
|
||||||
ql_dbg(ql_dbg_disc, vha, 0x2068,
|
ql_dbg(ql_dbg_disc, vha, 0x2068,
|
||||||
"Configure fabric error exit rval=%d.\n", rval);
|
"Configure fabric error exit rval=%d.\n", rval);
|
||||||
|
|
Loading…
Reference in New Issue