aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJoe Carnuccio <joe.carnuccio@qlogic.com>2013-02-08 01:57:56 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-02-22 07:55:45 -0500
commite452ceb636c416a517ec1b5d964491fd0bda503e (patch)
tree33d9b01abfe20cc725cca3f04af93226c88f7138 /drivers/scsi
parentf24b697ba499f971e84478f531de77ede9a2aac1 (diff)
[SCSI] Revert "[SCSI] qla2xxx: Avoid losing any fc ports when loop id's are exhausted."
This reverts commit 4dc77c36f86c2dc4e3f483146d33b64d12c0da3f. Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com> Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c83
1 files changed, 63 insertions, 20 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 8888d9b8473c..51f007f27fd8 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3159,7 +3159,7 @@ static int
3159qla2x00_configure_fabric(scsi_qla_host_t *vha) 3159qla2x00_configure_fabric(scsi_qla_host_t *vha)
3160{ 3160{
3161 int rval; 3161 int rval;
3162 fc_port_t *fcport; 3162 fc_port_t *fcport, *fcptemp;
3163 uint16_t next_loopid; 3163 uint16_t next_loopid;
3164 uint16_t mb[MAILBOX_REGISTER_COUNT]; 3164 uint16_t mb[MAILBOX_REGISTER_COUNT];
3165 uint16_t loop_id; 3165 uint16_t loop_id;
@@ -3197,7 +3197,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
3197 0xfc, mb, BIT_1|BIT_0); 3197 0xfc, mb, BIT_1|BIT_0);
3198 if (rval != QLA_SUCCESS) { 3198 if (rval != QLA_SUCCESS) {
3199 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); 3199 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
3200 break; 3200 return rval;
3201 } 3201 }
3202 if (mb[0] != MBS_COMMAND_COMPLETE) { 3202 if (mb[0] != MBS_COMMAND_COMPLETE) {
3203 ql_dbg(ql_dbg_disc, vha, 0x2042, 3203 ql_dbg(ql_dbg_disc, vha, 0x2042,
@@ -3233,12 +3233,10 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
3233 if (rval != QLA_SUCCESS) 3233 if (rval != QLA_SUCCESS)
3234 break; 3234 break;
3235 3235
3236 /* Add new ports to existing port list */ 3236 /*
3237 list_splice_tail_init(&new_fcports, &vha->vp_fcports); 3237 * Logout all previous fabric devices marked lost, except
3238 3238 * FCP2 devices.
3239 /* Starting free loop ID. */ 3239 */
3240 next_loopid = ha->min_external_loopid;
3241
3242 list_for_each_entry(fcport, &vha->vp_fcports, list) { 3240 list_for_each_entry(fcport, &vha->vp_fcports, list) {
3243 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) 3241 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
3244 break; 3242 break;
@@ -3246,7 +3244,6 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
3246 if ((fcport->flags & FCF_FABRIC_DEVICE) == 0) 3244 if ((fcport->flags & FCF_FABRIC_DEVICE) == 0)
3247 continue; 3245 continue;
3248 3246
3249 /* Logout lost/gone fabric devices (non-FCP2) */
3250 if (fcport->scan_state != QLA_FCPORT_SCAN_FOUND && 3247 if (fcport->scan_state != QLA_FCPORT_SCAN_FOUND &&
3251 atomic_read(&fcport->state) == FCS_ONLINE) { 3248 atomic_read(&fcport->state) == FCS_ONLINE) {
3252 qla2x00_mark_device_lost(vha, fcport, 3249 qla2x00_mark_device_lost(vha, fcport,
@@ -3260,30 +3257,76 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
3260 fcport->d_id.b.domain, 3257 fcport->d_id.b.domain,
3261 fcport->d_id.b.area, 3258 fcport->d_id.b.area,
3262 fcport->d_id.b.al_pa); 3259 fcport->d_id.b.al_pa);
3260 fcport->loop_id = FC_NO_LOOP_ID;
3263 } 3261 }
3264 continue; 3262 continue;
3265 } 3263 }
3266 fcport->scan_state = QLA_FCPORT_SCAN_NONE; 3264 fcport->scan_state = QLA_FCPORT_SCAN_NONE;
3265 }
3267 3266
3268 /* Login fabric devices that need a login */ 3267 /* Starting free loop ID. */
3269 if ((fcport->flags & FCF_LOGIN_NEEDED) != 0 && 3268 next_loopid = ha->min_external_loopid;
3270 atomic_read(&vha->loop_down_timer) == 0) { 3269
3271 if (fcport->loop_id == FC_NO_LOOP_ID) { 3270 /*
3272 fcport->loop_id = next_loopid; 3271 * Scan through our port list and login entries that need to be
3273 rval = qla2x00_find_new_loop_id( 3272 * logged in.
3274 base_vha, fcport); 3273 */
3275 if (rval != QLA_SUCCESS) { 3274 list_for_each_entry(fcport, &vha->vp_fcports, list) {
3276 /* Ran out of IDs to use */ 3275 if (atomic_read(&vha->loop_down_timer) ||
3277 continue; 3276 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
3278 } 3277 break;
3278
3279 if ((fcport->flags & FCF_FABRIC_DEVICE) == 0 ||
3280 (fcport->flags & FCF_LOGIN_NEEDED) == 0)
3281 continue;
3282
3283 if (fcport->loop_id == FC_NO_LOOP_ID) {
3284 fcport->loop_id = next_loopid;
3285 rval = qla2x00_find_new_loop_id(
3286 base_vha, fcport);
3287 if (rval != QLA_SUCCESS) {
3288 /* Ran out of IDs to use */
3289 break;
3279 } 3290 }
3280 } 3291 }
3292 /* Login and update database */
3293 qla2x00_fabric_dev_login(vha, fcport, &next_loopid);
3294 }
3295
3296 /* Exit if out of loop IDs. */
3297 if (rval != QLA_SUCCESS) {
3298 break;
3299 }
3300
3301 /*
3302 * Login and add the new devices to our port list.
3303 */
3304 list_for_each_entry_safe(fcport, fcptemp, &new_fcports, list) {
3305 if (atomic_read(&vha->loop_down_timer) ||
3306 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
3307 break;
3308
3309 /* Find a new loop ID to use. */
3310 fcport->loop_id = next_loopid;
3311 rval = qla2x00_find_new_loop_id(base_vha, fcport);
3312 if (rval != QLA_SUCCESS) {
3313 /* Ran out of IDs to use */
3314 break;
3315 }
3281 3316
3282 /* Login and update database */ 3317 /* Login and update database */
3283 qla2x00_fabric_dev_login(vha, fcport, &next_loopid); 3318 qla2x00_fabric_dev_login(vha, fcport, &next_loopid);
3319
3320 list_move_tail(&fcport->list, &vha->vp_fcports);
3284 } 3321 }
3285 } while (0); 3322 } while (0);
3286 3323
3324 /* Free all new device structures not processed. */
3325 list_for_each_entry_safe(fcport, fcptemp, &new_fcports, list) {
3326 list_del(&fcport->list);
3327 kfree(fcport);
3328 }
3329
3287 if (rval) { 3330 if (rval) {
3288 ql_dbg(ql_dbg_disc, vha, 0x2068, 3331 ql_dbg(ql_dbg_disc, vha, 0x2068,
3289 "Configure fabric error exit rval=%d.\n", rval); 3332 "Configure fabric error exit rval=%d.\n", rval);