aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Chaudhary <vikas.chaudhary@qlogic.com>2011-03-21 06:34:33 -0400
committerJames Bottomley <James.Bottomley@suse.de>2011-03-23 13:53:04 -0400
commit2d7924e6be8b994f718429001457e677a2159445 (patch)
tree85fe600f18f8453276be24b30687e7803ed40029
parent3038727c8391ab1f3e5f5cf764f9f74164e6b47a (diff)
[SCSI] qla4xxx: added new function qla4xxx_relogin_all_devices
Move relogin to all devices code from do_dpc to new fuction qla4xxx_relogin_all_devices() Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c54
1 files changed, 23 insertions, 31 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index b7bc69900de8..a4acb0dd7beb 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1218,6 +1218,27 @@ recover_ha_init_adapter:
1218 return status; 1218 return status;
1219} 1219}
1220 1220
1221static void qla4xxx_relogin_all_devices(struct scsi_qla_host *ha)
1222{
1223 struct ddb_entry *ddb_entry, *dtemp;
1224
1225 list_for_each_entry_safe(ddb_entry, dtemp, &ha->ddb_list, list) {
1226 if ((atomic_read(&ddb_entry->state) == DDB_STATE_MISSING) ||
1227 (atomic_read(&ddb_entry->state) == DDB_STATE_DEAD)) {
1228 if (ddb_entry->fw_ddb_device_state ==
1229 DDB_DS_SESSION_ACTIVE) {
1230 atomic_set(&ddb_entry->state, DDB_STATE_ONLINE);
1231 ql4_printk(KERN_INFO, ha, "scsi%ld: %s: ddb[%d]"
1232 " marked ONLINE\n", ha->host_no, __func__,
1233 ddb_entry->fw_ddb_index);
1234
1235 iscsi_unblock_session(ddb_entry->sess);
1236 } else
1237 qla4xxx_relogin_device(ha, ddb_entry);
1238 }
1239 }
1240}
1241
1221void qla4xxx_wake_dpc(struct scsi_qla_host *ha) 1242void qla4xxx_wake_dpc(struct scsi_qla_host *ha)
1222{ 1243{
1223 if (ha->dpc_thread && 1244 if (ha->dpc_thread &&
@@ -1326,13 +1347,7 @@ dpc_post_reset_ha:
1326 if (test_and_clear_bit(DPC_LINK_CHANGED, &ha->dpc_flags)) { 1347 if (test_and_clear_bit(DPC_LINK_CHANGED, &ha->dpc_flags)) {
1327 if (!test_bit(AF_LINK_UP, &ha->flags)) { 1348 if (!test_bit(AF_LINK_UP, &ha->flags)) {
1328 /* ---- link down? --- */ 1349 /* ---- link down? --- */
1329 list_for_each_entry_safe(ddb_entry, dtemp, 1350 qla4xxx_mark_all_devices_missing(ha);
1330 &ha->ddb_list, list) {
1331 if (atomic_read(&ddb_entry->state) ==
1332 DDB_STATE_ONLINE)
1333 qla4xxx_mark_device_missing(ha,
1334 ddb_entry);
1335 }
1336 } else { 1351 } else {
1337 /* ---- link up? --- * 1352 /* ---- link up? --- *
1338 * F/W will auto login to all devices ONLY ONCE after 1353 * F/W will auto login to all devices ONLY ONCE after
@@ -1341,30 +1356,7 @@ dpc_post_reset_ha:
1341 * manually relogin to devices when recovering from 1356 * manually relogin to devices when recovering from
1342 * connection failures, logouts, expired KATO, etc. */ 1357 * connection failures, logouts, expired KATO, etc. */
1343 1358
1344 list_for_each_entry_safe(ddb_entry, dtemp, 1359 qla4xxx_relogin_all_devices(ha);
1345 &ha->ddb_list, list) {
1346 if ((atomic_read(&ddb_entry->state) ==
1347 DDB_STATE_MISSING) ||
1348 (atomic_read(&ddb_entry->state) ==
1349 DDB_STATE_DEAD)) {
1350 if (ddb_entry->fw_ddb_device_state ==
1351 DDB_DS_SESSION_ACTIVE) {
1352 atomic_set(&ddb_entry->state,
1353 DDB_STATE_ONLINE);
1354 ql4_printk(KERN_INFO, ha,
1355 "scsi%ld: %s: ddb[%d]"
1356 " marked ONLINE\n",
1357 ha->host_no, __func__,
1358 ddb_entry->fw_ddb_index);
1359
1360 iscsi_unblock_session(
1361 ddb_entry->sess);
1362 } else
1363 qla4xxx_relogin_device(
1364 ha, ddb_entry);
1365 }
1366
1367 }
1368 } 1360 }
1369 } 1361 }
1370 1362