linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: vikas.chaudhary@qlogic.com
To: James.Bottomley@suse.de
Cc: linux-scsi@vger.kernel.org, ravi.anand@qlogic.com,
	lalit.chandivade@qlogic.com, vikas.chaudhary@qlogic.com
Subject: [PATCH 10/13] qla4xxx: added new function qla4xxx_relogin_all_devices
Date: Mon, 21 Mar 2011 03:34:33 -0700	[thread overview]
Message-ID: <1300703676-27398-10-git-send-email-vikas.chaudhary@qlogic.com> (raw)
In-Reply-To: <1300703676-27398-1-git-send-email-vikas.chaudhary@qlogic.com>

From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>

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>
---
 drivers/scsi/qla4xxx/ql4_os.c |   54 +++++++++++++++++-----------------------
 1 files changed, 23 insertions(+), 31 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 4a599d3..e70b6bf 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1218,6 +1218,27 @@ recover_ha_init_adapter:
 	return status;
 }
 
+static void qla4xxx_relogin_all_devices(struct scsi_qla_host *ha)
+{
+	struct ddb_entry *ddb_entry, *dtemp;
+
+	list_for_each_entry_safe(ddb_entry, dtemp, &ha->ddb_list, list) {
+		if ((atomic_read(&ddb_entry->state) == DDB_STATE_MISSING) ||
+		    (atomic_read(&ddb_entry->state) == DDB_STATE_DEAD)) {
+			if (ddb_entry->fw_ddb_device_state ==
+			    DDB_DS_SESSION_ACTIVE) {
+				atomic_set(&ddb_entry->state, DDB_STATE_ONLINE);
+				ql4_printk(KERN_INFO, ha, "scsi%ld: %s: ddb[%d]"
+				    " marked ONLINE\n",	ha->host_no, __func__,
+				    ddb_entry->fw_ddb_index);
+
+				iscsi_unblock_session(ddb_entry->sess);
+			} else
+				qla4xxx_relogin_device(ha, ddb_entry);
+		}
+	}
+}
+
 void qla4xxx_wake_dpc(struct scsi_qla_host *ha)
 {
 	if (ha->dpc_thread &&
@@ -1326,13 +1347,7 @@ dpc_post_reset_ha:
 	if (test_and_clear_bit(DPC_LINK_CHANGED, &ha->dpc_flags)) {
 		if (!test_bit(AF_LINK_UP, &ha->flags)) {
 			/* ---- link down? --- */
-			list_for_each_entry_safe(ddb_entry, dtemp,
-						 &ha->ddb_list, list) {
-				if (atomic_read(&ddb_entry->state) ==
-						DDB_STATE_ONLINE)
-					qla4xxx_mark_device_missing(ha,
-							ddb_entry);
-			}
+			qla4xxx_mark_all_devices_missing(ha);
 		} else {
 			/* ---- link up? --- *
 			 * F/W will auto login to all devices ONLY ONCE after
@@ -1341,30 +1356,7 @@ dpc_post_reset_ha:
 			 * manually relogin to devices when recovering from
 			 * connection failures, logouts, expired KATO, etc. */
 
-			list_for_each_entry_safe(ddb_entry, dtemp,
-							&ha->ddb_list, list) {
-				if ((atomic_read(&ddb_entry->state) ==
-						 DDB_STATE_MISSING) ||
-				    (atomic_read(&ddb_entry->state) ==
-						 DDB_STATE_DEAD)) {
-					if (ddb_entry->fw_ddb_device_state ==
-					    DDB_DS_SESSION_ACTIVE) {
-						atomic_set(&ddb_entry->state,
-							   DDB_STATE_ONLINE);
-						ql4_printk(KERN_INFO, ha,
-						    "scsi%ld: %s: ddb[%d]"
-						    " marked ONLINE\n",
-						    ha->host_no, __func__,
-						    ddb_entry->fw_ddb_index);
-
-						iscsi_unblock_session(
-						    ddb_entry->sess);
-					} else
-						qla4xxx_relogin_device(
-						    ha, ddb_entry);
-				}
-
-			}
+			qla4xxx_relogin_all_devices(ha);
 		}
 	}
 
-- 
1.7.3.2


  parent reply	other threads:[~2011-03-21 10:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-21 10:34 [PATCH 01/13] qla4xxx: cleanup qla4xxx_initialize_ddb_list() vikas.chaudhary
2011-03-21 10:34 ` [PATCH 02/13] qla4xxx: Do not send mbox command if FW is in failed state vikas.chaudhary
2011-03-21 10:34 ` [PATCH 03/13] qla4xxx: Do not retry ISP82XX initialization if H/W state is failed vikas.chaudhary
2011-03-21 10:34 ` [PATCH 04/13] qla4xxx: cleanup DDB relogin logic during initialization vikas.chaudhary
2011-03-21 10:34 ` [PATCH 05/13] qla4xxx: remove unused ddb flag DF_NO_RELOGIN vikas.chaudhary
2011-03-21 10:34 ` [PATCH 06/13] qla4xxx: Prevent other port reinitialization during remove_adapter vikas.chaudhary
2011-03-21 10:34 ` [PATCH 07/13] qla4xxx: cleanup function qla4xxx_process_ddb_changed vikas.chaudhary
2011-03-21 10:34 ` [PATCH 08/13] qla4xxx: Add support for ql4xmaxqdepth command line parameter vikas.chaudhary
2011-03-21 10:34 ` [PATCH 09/13] qla4xxx: add support for ql4xsess_recovery_tmo cmd line param vikas.chaudhary
2011-03-21 10:34 ` vikas.chaudhary [this message]
2011-03-21 10:34 ` [PATCH 12/13] qla4xxx: masking required bits of add_fw_options during initialization vikas.chaudhary
2011-03-21 10:34 ` [PATCH 13/13] qla4xxx: Update driver version to 5.02.00-k6 vikas.chaudhary
2011-03-23 14:44 ` [PATCH 01/13] qla4xxx: cleanup qla4xxx_initialize_ddb_list() James Bottomley
2011-03-23 15:10   ` Vikas Chaudhary
  -- strict thread matches above, loose matches on Subject: below --
2011-03-14  5:25 [PATCH 10/13] qla4xxx: added new function qla4xxx_relogin_all_devices Vikas Chaudhary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300703676-27398-10-git-send-email-vikas.chaudhary@qlogic.com \
    --to=vikas.chaudhary@qlogic.com \
    --cc=James.Bottomley@suse.de \
    --cc=lalit.chandivade@qlogic.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ravi.anand@qlogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).